33 #define HIST_SIZE (3*256)
53 int n = sscanf(args,
"%d", &thumb->
n_frames);
57 "Invalid number of frames specified (minimum is 2).\n");
64 "Allocation failure, try to lower the number of frames\n");
80 double err, sum_sq_err = 0;
83 err = median[i] - (double)hist[i];
84 sum_sq_err += err*err;
91 int i, j, best_frame_idx = 0;
92 double avg_hist[
HIST_SIZE] = {0}, sq_err, min_sq_err = -1;
104 for (j = 0; j < inlink->
h; j++) {
105 for (i = 0; i < inlink->
w; i++) {
106 hist[0*256 + p[i*3 ]]++;
107 hist[1*256 + p[i*3 + 1]]++;
108 hist[2*256 + p[i*3 + 2]]++;
121 for (i = 0; i < thumb->
n_frames; i++)
127 for (i = 0; i < thumb->
n_frames; i++) {
129 if (i == 0 || sq_err < min_sq_err)
130 best_frame_idx = i, min_sq_err = sq_err;
134 for (i = 0; i < thumb->
n_frames; i++) {
136 if (i == best_frame_idx)
143 picref = thumb->
frames[best_frame_idx].
buf;
181 if (!available_frames)
192 return ret < 0 ? ret : 0;
228 .description =
NULL_IF_CONFIG_SMALL(
"Select the most representative frame in a given sequence of consecutive frames."),
233 .
inputs = thumbnail_inputs,