FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vf_deshake.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Georg Martius <georg.martius@web.de>
3  * Copyright (C) 2010 Daniel G. Taylor <dan@programmer-art.org>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * fast deshake / depan video filter
25  *
26  * SAD block-matching motion compensation to fix small changes in
27  * horizontal and/or vertical shift. This filter helps remove camera shake
28  * from hand-holding a camera, bumping a tripod, moving on a vehicle, etc.
29  *
30  * Algorithm:
31  * - For each frame with one previous reference frame
32  * - For each block in the frame
33  * - If contrast > threshold then find likely motion vector
34  * - For all found motion vectors
35  * - Find most common, store as global motion vector
36  * - Find most likely rotation angle
37  * - Transform image along global motion
38  *
39  * TODO:
40  * - Fill frame edges based on previous/next reference frames
41  * - Fill frame edges by stretching image near the edges?
42  * - Can this be done quickly and look decent?
43  *
44  * Dark Shikari links to http://wiki.videolan.org/SoC_x264_2010#GPU_Motion_Estimation_2
45  * for an algorithm similar to what could be used here to get the gmv
46  * It requires only a couple diamond searches + fast downscaling
47  *
48  * Special thanks to Jason Kotenko for his help with the algorithm and my
49  * inability to see simple errors in C code.
50  */
51 
52 #include "avfilter.h"
53 #include "formats.h"
54 #include "internal.h"
55 #include "video.h"
56 #include "libavutil/common.h"
57 #include "libavutil/mem.h"
58 #include "libavutil/opt.h"
59 #include "libavutil/pixdesc.h"
60 #include "libavcodec/dsputil.h"
61 
62 #include "transform.h"
63 
64 #define CHROMA_WIDTH(link) -((-link->w) >> av_pix_fmt_desc_get(link->format)->log2_chroma_w)
65 #define CHROMA_HEIGHT(link) -((-link->h) >> av_pix_fmt_desc_get(link->format)->log2_chroma_h)
66 
68  EXHAUSTIVE, ///< Search all possible positions
69  SMART_EXHAUSTIVE, ///< Search most possible positions (faster)
71 };
72 
73 typedef struct {
74  int x; ///< Horizontal shift
75  int y; ///< Vertical shift
77 
78 typedef struct {
79  double x; ///< Horizontal shift
80  double y; ///< Vertical shift
81 } MotionVector;
82 
83 typedef struct {
84  MotionVector vector; ///< Motion vector
85  double angle; ///< Angle of rotation
86  double zoom; ///< Zoom percentage
87 } Transform;
88 
89 typedef struct {
90  const AVClass *class;
91  AVFilterBufferRef *ref; ///< Previous frame
92  int rx; ///< Maximum horizontal shift
93  int ry; ///< Maximum vertical shift
94  int edge; ///< Edge fill method
95  int blocksize; ///< Size of blocks to compare
96  int contrast; ///< Contrast threshold
97  int search; ///< Motion search method
99  DSPContext c; ///< Context providing optimized SAD methods
100  Transform last; ///< Transform from last frame
101  int refcount; ///< Number of reference frames (defines averaging window)
102  FILE *fp;
104  int cw; ///< Crop motion search to this box
105  int ch;
106  int cx;
107  int cy;
108  char *filename; ///< Motion search detailed log filename
110 
111 #define OFFSET(x) offsetof(DeshakeContext, x)
112 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
113 
114 static const AVOption deshake_options[] = {
115  { "x", "set x for the rectangular search area", OFFSET(cx), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
116  { "y", "set y for the rectangular search area", OFFSET(cy), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
117  { "w", "set width for the rectangular search area", OFFSET(cw), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
118  { "h", "set height for the rectangular search area", OFFSET(ch), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, .flags = FLAGS },
119  { "rx", "set x for the rectangular search area", OFFSET(rx), AV_OPT_TYPE_INT, {.i64=16}, 0, 64, .flags = FLAGS },
120  { "ry", "set y for the rectangular search area", OFFSET(ry), AV_OPT_TYPE_INT, {.i64=16}, 0, 64, .flags = FLAGS },
121  { "edge", "set edge mode", OFFSET(edge), AV_OPT_TYPE_INT, {.i64=FILL_MIRROR}, FILL_BLANK, FILL_COUNT-1, FLAGS, "edge"},
122  { "blank", "fill zeroes at blank locations", 0, AV_OPT_TYPE_CONST, {.i64=FILL_BLANK}, INT_MIN, INT_MAX, FLAGS, "edge" },
123  { "original", "original image at blank locations", 0, AV_OPT_TYPE_CONST, {.i64=FILL_ORIGINAL}, INT_MIN, INT_MAX, FLAGS, "edge" },
124  { "clamp", "extruded edge value at blank locations", 0, AV_OPT_TYPE_CONST, {.i64=FILL_CLAMP}, INT_MIN, INT_MAX, FLAGS, "edge" },
125  { "mirror", "mirrored edge at blank locations", 0, AV_OPT_TYPE_CONST, {.i64=FILL_MIRROR}, INT_MIN, INT_MAX, FLAGS, "edge" },
126  { "blocksize", "set motion search blocksize", OFFSET(blocksize), AV_OPT_TYPE_INT, {.i64=8}, 4, 128, .flags = FLAGS },
127  { "contrast", "set contrast threshold for blocks", OFFSET(contrast), AV_OPT_TYPE_INT, {.i64=125}, 1, 255, .flags = FLAGS },
128  { "search", "set search strategy", OFFSET(search), AV_OPT_TYPE_INT, {.i64=EXHAUSTIVE}, EXHAUSTIVE, SEARCH_COUNT-1, FLAGS, "smode" },
129  { "exhaustive", "exhaustive search", 0, AV_OPT_TYPE_CONST, {.i64=EXHAUSTIVE}, INT_MIN, INT_MAX, FLAGS, "smode" },
130  { "less", "less exhaustive search", 0, AV_OPT_TYPE_CONST, {.i64=SMART_EXHAUSTIVE}, INT_MIN, INT_MAX, FLAGS, "smode" },
131  { "filename", "set motion search detailed log file name", OFFSET(filename), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
132  { NULL }
133 };
134 
135 AVFILTER_DEFINE_CLASS(deshake);
136 
137 static int cmp(const double *a, const double *b)
138 {
139  return *a < *b ? -1 : ( *a > *b ? 1 : 0 );
140 }
141 
142 /**
143  * Cleaned mean (cuts off 20% of values to remove outliers and then averages)
144  */
145 static double clean_mean(double *values, int count)
146 {
147  double mean = 0;
148  int cut = count / 5;
149  int x;
150 
151  qsort(values, count, sizeof(double), (void*)cmp);
152 
153  for (x = cut; x < count - cut; x++) {
154  mean += values[x];
155  }
156 
157  return mean / (count - cut * 2);
158 }
159 
160 /**
161  * Find the most likely shift in motion between two frames for a given
162  * macroblock. Test each block against several shifts given by the rx
163  * and ry attributes. Searches using a simple matrix of those shifts and
164  * chooses the most likely shift by the smallest difference in blocks.
165  */
166 static void find_block_motion(DeshakeContext *deshake, uint8_t *src1,
167  uint8_t *src2, int cx, int cy, int stride,
169 {
170  int x, y;
171  int diff;
172  int smallest = INT_MAX;
173  int tmp, tmp2;
174 
175  #define CMP(i, j) deshake->c.sad[0](deshake, src1 + cy * stride + cx, \
176  src2 + (j) * stride + (i), stride, \
177  deshake->blocksize)
178 
179  if (deshake->search == EXHAUSTIVE) {
180  // Compare every possible position - this is sloooow!
181  for (y = -deshake->ry; y <= deshake->ry; y++) {
182  for (x = -deshake->rx; x <= deshake->rx; x++) {
183  diff = CMP(cx - x, cy - y);
184  if (diff < smallest) {
185  smallest = diff;
186  mv->x = x;
187  mv->y = y;
188  }
189  }
190  }
191  } else if (deshake->search == SMART_EXHAUSTIVE) {
192  // Compare every other possible position and find the best match
193  for (y = -deshake->ry + 1; y < deshake->ry - 2; y += 2) {
194  for (x = -deshake->rx + 1; x < deshake->rx - 2; x += 2) {
195  diff = CMP(cx - x, cy - y);
196  if (diff < smallest) {
197  smallest = diff;
198  mv->x = x;
199  mv->y = y;
200  }
201  }
202  }
203 
204  // Hone in on the specific best match around the match we found above
205  tmp = mv->x;
206  tmp2 = mv->y;
207 
208  for (y = tmp2 - 1; y <= tmp2 + 1; y++) {
209  for (x = tmp - 1; x <= tmp + 1; x++) {
210  if (x == tmp && y == tmp2)
211  continue;
212 
213  diff = CMP(cx - x, cy - y);
214  if (diff < smallest) {
215  smallest = diff;
216  mv->x = x;
217  mv->y = y;
218  }
219  }
220  }
221  }
222 
223  if (smallest > 512) {
224  mv->x = -1;
225  mv->y = -1;
226  }
227  emms_c();
228  //av_log(NULL, AV_LOG_ERROR, "%d\n", smallest);
229  //av_log(NULL, AV_LOG_ERROR, "Final: (%d, %d) = %d x %d\n", cx, cy, mv->x, mv->y);
230 }
231 
232 /**
233  * Find the contrast of a given block. When searching for global motion we
234  * really only care about the high contrast blocks, so using this method we
235  * can actually skip blocks we don't care much about.
236  */
237 static int block_contrast(uint8_t *src, int x, int y, int stride, int blocksize)
238 {
239  int highest = 0;
240  int lowest = 0;
241  int i, j, pos;
242 
243  for (i = 0; i <= blocksize * 2; i++) {
244  // We use a width of 16 here to match the libavcodec sad functions
245  for (j = 0; i <= 15; i++) {
246  pos = (y - i) * stride + (x - j);
247  if (src[pos] < lowest)
248  lowest = src[pos];
249  else if (src[pos] > highest) {
250  highest = src[pos];
251  }
252  }
253  }
254 
255  return highest - lowest;
256 }
257 
258 /**
259  * Find the rotation for a given block.
260  */
261 static double block_angle(int x, int y, int cx, int cy, IntMotionVector *shift)
262 {
263  double a1, a2, diff;
264 
265  a1 = atan2(y - cy, x - cx);
266  a2 = atan2(y - cy + shift->y, x - cx + shift->x);
267 
268  diff = a2 - a1;
269 
270  return (diff > M_PI) ? diff - 2 * M_PI :
271  (diff < -M_PI) ? diff + 2 * M_PI :
272  diff;
273 }
274 
275 /**
276  * Find the estimated global motion for a scene given the most likely shift
277  * for each block in the frame. The global motion is estimated to be the
278  * same as the motion from most blocks in the frame, so if most blocks
279  * move one pixel to the right and two pixels down, this would yield a
280  * motion vector (1, -2).
281  */
282 static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
283  int width, int height, int stride, Transform *t)
284 {
285  int x, y;
286  IntMotionVector mv = {0, 0};
287  int counts[128][128];
288  int count_max_value = 0;
289  int contrast;
290 
291  int pos;
292  double *angles = av_malloc(sizeof(*angles) * width * height / (16 * deshake->blocksize));
293  int center_x = 0, center_y = 0;
294  double p_x, p_y;
295 
296  // Reset counts to zero
297  for (x = 0; x < deshake->rx * 2 + 1; x++) {
298  for (y = 0; y < deshake->ry * 2 + 1; y++) {
299  counts[x][y] = 0;
300  }
301  }
302 
303  pos = 0;
304  // Find motion for every block and store the motion vector in the counts
305  for (y = deshake->ry; y < height - deshake->ry - (deshake->blocksize * 2); y += deshake->blocksize * 2) {
306  // We use a width of 16 here to match the libavcodec sad functions
307  for (x = deshake->rx; x < width - deshake->rx - 16; x += 16) {
308  // If the contrast is too low, just skip this block as it probably
309  // won't be very useful to us.
310  contrast = block_contrast(src2, x, y, stride, deshake->blocksize);
311  if (contrast > deshake->contrast) {
312  //av_log(NULL, AV_LOG_ERROR, "%d\n", contrast);
313  find_block_motion(deshake, src1, src2, x, y, stride, &mv);
314  if (mv.x != -1 && mv.y != -1) {
315  counts[mv.x + deshake->rx][mv.y + deshake->ry] += 1;
316  if (x > deshake->rx && y > deshake->ry)
317  angles[pos++] = block_angle(x, y, 0, 0, &mv);
318 
319  center_x += mv.x;
320  center_y += mv.y;
321  }
322  }
323  }
324  }
325 
326  if (pos) {
327  center_x /= pos;
328  center_y /= pos;
329  t->angle = clean_mean(angles, pos);
330  if (t->angle < 0.001)
331  t->angle = 0;
332  } else {
333  t->angle = 0;
334  }
335 
336  // Find the most common motion vector in the frame and use it as the gmv
337  for (y = deshake->ry * 2; y >= 0; y--) {
338  for (x = 0; x < deshake->rx * 2 + 1; x++) {
339  //av_log(NULL, AV_LOG_ERROR, "%5d ", counts[x][y]);
340  if (counts[x][y] > count_max_value) {
341  t->vector.x = x - deshake->rx;
342  t->vector.y = y - deshake->ry;
343  count_max_value = counts[x][y];
344  }
345  }
346  //av_log(NULL, AV_LOG_ERROR, "\n");
347  }
348 
349  p_x = (center_x - width / 2);
350  p_y = (center_y - height / 2);
351  t->vector.x += (cos(t->angle)-1)*p_x - sin(t->angle)*p_y;
352  t->vector.y += sin(t->angle)*p_x + (cos(t->angle)-1)*p_y;
353 
354  // Clamp max shift & rotation?
355  t->vector.x = av_clipf(t->vector.x, -deshake->rx * 2, deshake->rx * 2);
356  t->vector.y = av_clipf(t->vector.y, -deshake->ry * 2, deshake->ry * 2);
357  t->angle = av_clipf(t->angle, -0.1, 0.1);
358 
359  //av_log(NULL, AV_LOG_ERROR, "%d x %d\n", avg->x, avg->y);
360  av_free(angles);
361 }
362 
363 static av_cold int init(AVFilterContext *ctx, const char *args)
364 {
365  int ret;
366  DeshakeContext *deshake = ctx->priv;
367  static const char *shorthand[] = {
368  "x", "y", "w", "h", "rx", "ry", "edge",
369  "blocksize", "contrast", "search", "filename",
370  NULL
371  };
372 
373  deshake->refcount = 20; // XXX: add to options?
374 
375  deshake->class = &deshake_class;
376  av_opt_set_defaults(deshake);
377 
378  ret = av_opt_set_from_string(deshake, args, shorthand, "=", ":");
379  if (ret < 0)
380  return ret;
381 
382  deshake->blocksize /= 2;
383  deshake->blocksize = av_clip(deshake->blocksize, 4, 128);
384 
385  if (deshake->filename)
386  deshake->fp = fopen(deshake->filename, "w");
387  if (deshake->fp)
388  fwrite("Ori x, Avg x, Fin x, Ori y, Avg y, Fin y, Ori angle, Avg angle, Fin angle, Ori zoom, Avg zoom, Fin zoom\n", sizeof(char), 104, deshake->fp);
389 
390  // Quadword align left edge of box for MMX code, adjust width if necessary
391  // to keep right margin
392  if (deshake->cx > 0) {
393  deshake->cw += deshake->cx - (deshake->cx & ~15);
394  deshake->cx &= ~15;
395  }
396 
397  av_log(ctx, AV_LOG_VERBOSE, "cx: %d, cy: %d, cw: %d, ch: %d, rx: %d, ry: %d, edge: %d blocksize: %d contrast: %d search: %d\n",
398  deshake->cx, deshake->cy, deshake->cw, deshake->ch,
399  deshake->rx, deshake->ry, deshake->edge, deshake->blocksize * 2, deshake->contrast, deshake->search);
400 
401  return 0;
402 }
403 
405 {
406  static const enum AVPixelFormat pix_fmts[] = {
410  };
411 
413 
414  return 0;
415 }
416 
417 static int config_props(AVFilterLink *link)
418 {
419  DeshakeContext *deshake = link->dst->priv;
420 
421  deshake->ref = NULL;
422  deshake->last.vector.x = 0;
423  deshake->last.vector.y = 0;
424  deshake->last.angle = 0;
425  deshake->last.zoom = 0;
426 
427  deshake->avctx = avcodec_alloc_context3(NULL);
428  dsputil_init(&deshake->c, deshake->avctx);
429 
430  return 0;
431 }
432 
433 static av_cold void uninit(AVFilterContext *ctx)
434 {
435  DeshakeContext *deshake = ctx->priv;
436 
437  avfilter_unref_buffer(deshake->ref);
438  if (deshake->fp)
439  fclose(deshake->fp);
440  if (deshake->avctx)
441  avcodec_close(deshake->avctx);
442  av_freep(&deshake->avctx);
443  av_opt_free(deshake);
444 }
445 
447 {
448  DeshakeContext *deshake = link->dst->priv;
449  AVFilterLink *outlink = link->dst->outputs[0];
451  Transform t = {{0},0}, orig = {{0},0};
452  float matrix[9];
453  float alpha = 2.0 / deshake->refcount;
454  char tmp[256];
455 
456  out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
457  if (!out) {
459  return AVERROR(ENOMEM);
460  }
462 
463  if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) {
464  // Find the most likely global motion for the current frame
465  find_motion(deshake, (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0], in->data[0], link->w, link->h, in->linesize[0], &t);
466  } else {
467  uint8_t *src1 = (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0];
468  uint8_t *src2 = in->data[0];
469 
470  deshake->cx = FFMIN(deshake->cx, link->w);
471  deshake->cy = FFMIN(deshake->cy, link->h);
472 
473  if ((unsigned)deshake->cx + (unsigned)deshake->cw > link->w) deshake->cw = link->w - deshake->cx;
474  if ((unsigned)deshake->cy + (unsigned)deshake->ch > link->h) deshake->ch = link->h - deshake->cy;
475 
476  // Quadword align right margin
477  deshake->cw &= ~15;
478 
479  src1 += deshake->cy * in->linesize[0] + deshake->cx;
480  src2 += deshake->cy * in->linesize[0] + deshake->cx;
481 
482  find_motion(deshake, src1, src2, deshake->cw, deshake->ch, in->linesize[0], &t);
483  }
484 
485 
486  // Copy transform so we can output it later to compare to the smoothed value
487  orig.vector.x = t.vector.x;
488  orig.vector.y = t.vector.y;
489  orig.angle = t.angle;
490  orig.zoom = t.zoom;
491 
492  // Generate a one-sided moving exponential average
493  deshake->avg.vector.x = alpha * t.vector.x + (1.0 - alpha) * deshake->avg.vector.x;
494  deshake->avg.vector.y = alpha * t.vector.y + (1.0 - alpha) * deshake->avg.vector.y;
495  deshake->avg.angle = alpha * t.angle + (1.0 - alpha) * deshake->avg.angle;
496  deshake->avg.zoom = alpha * t.zoom + (1.0 - alpha) * deshake->avg.zoom;
497 
498  // Remove the average from the current motion to detect the motion that
499  // is not on purpose, just as jitter from bumping the camera
500  t.vector.x -= deshake->avg.vector.x;
501  t.vector.y -= deshake->avg.vector.y;
502  t.angle -= deshake->avg.angle;
503  t.zoom -= deshake->avg.zoom;
504 
505  // Invert the motion to undo it
506  t.vector.x *= -1;
507  t.vector.y *= -1;
508  t.angle *= -1;
509 
510  // Write statistics to file
511  if (deshake->fp) {
512  snprintf(tmp, 256, "%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", orig.vector.x, deshake->avg.vector.x, t.vector.x, orig.vector.y, deshake->avg.vector.y, t.vector.y, orig.angle, deshake->avg.angle, t.angle, orig.zoom, deshake->avg.zoom, t.zoom);
513  fwrite(tmp, sizeof(char), strlen(tmp), deshake->fp);
514  }
515 
516  // Turn relative current frame motion into absolute by adding it to the
517  // last absolute motion
518  t.vector.x += deshake->last.vector.x;
519  t.vector.y += deshake->last.vector.y;
520  t.angle += deshake->last.angle;
521  t.zoom += deshake->last.zoom;
522 
523  // Shrink motion by 10% to keep things centered in the camera frame
524  t.vector.x *= 0.9;
525  t.vector.y *= 0.9;
526  t.angle *= 0.9;
527 
528  // Store the last absolute motion information
529  deshake->last.vector.x = t.vector.x;
530  deshake->last.vector.y = t.vector.y;
531  deshake->last.angle = t.angle;
532  deshake->last.zoom = t.zoom;
533 
534  // Generate a luma transformation matrix
535  avfilter_get_matrix(t.vector.x, t.vector.y, t.angle, 1.0 + t.zoom / 100.0, matrix);
536 
537  // Transform the luma plane
538  avfilter_transform(in->data[0], out->data[0], in->linesize[0], out->linesize[0], link->w, link->h, matrix, INTERPOLATE_BILINEAR, deshake->edge);
539 
540  // Generate a chroma transformation matrix
541  avfilter_get_matrix(t.vector.x / (link->w / CHROMA_WIDTH(link)), t.vector.y / (link->h / CHROMA_HEIGHT(link)), t.angle, 1.0 + t.zoom / 100.0, matrix);
542 
543  // Transform the chroma planes
544  avfilter_transform(in->data[1], out->data[1], in->linesize[1], out->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), matrix, INTERPOLATE_BILINEAR, deshake->edge);
545  avfilter_transform(in->data[2], out->data[2], in->linesize[2], out->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), matrix, INTERPOLATE_BILINEAR, deshake->edge);
546 
547  // Cleanup the old reference frame
548  avfilter_unref_buffer(deshake->ref);
549 
550  // Store the current frame as the reference frame for calculating the
551  // motion of the next frame
552  deshake->ref = in;
553 
554  return ff_filter_frame(outlink, out);
555 }
556 
557 static const AVFilterPad deshake_inputs[] = {
558  {
559  .name = "default",
560  .type = AVMEDIA_TYPE_VIDEO,
561  .filter_frame = filter_frame,
562  .config_props = config_props,
563  .min_perms = AV_PERM_READ | AV_PERM_PRESERVE,
564  },
565  { NULL }
566 };
567 
568 static const AVFilterPad deshake_outputs[] = {
569  {
570  .name = "default",
571  .type = AVMEDIA_TYPE_VIDEO,
572  },
573  { NULL }
574 };
575 
577  .name = "deshake",
578  .description = NULL_IF_CONFIG_SMALL("Stabilize shaky video."),
579  .priv_size = sizeof(DeshakeContext),
580  .init = init,
581  .uninit = uninit,
583  .inputs = deshake_inputs,
584  .outputs = deshake_outputs,
585  .priv_class = &deshake_class,
586 };