Revert commit r22596.
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Sun, 19 Dec 2010 18:17:11 +0000 (18:17 +0000)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Sun, 19 Dec 2010 18:17:11 +0000 (18:17 +0000)
  commit ab8610aa176c13b5e25a2d8770df28a14665e169
  Author: koorogi <koorogi@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
  Date:   Thu Mar 18 23:13:04 2010 +0000

    The vflip filter does not need to keep ownership of a picture reference.
    Avoid creating and releasing useless extra picture references in the
    start_frame and end_frame callbacks.

    Originally committed as revision 22596 to svn://svn.ffmpeg.org/ffmpeg/trunk

The new reference creation is required when the linesizes are used by the
previous filters in the filterchain, for example as in "pad=W:H:X:Y,vflip".

Originally committed as revision 26059 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavfilter/vf_vflip.c

index 95d90d3..2ff4441 100644 (file)
@@ -60,21 +60,22 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
     return picref;
 }
 
-static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
+static void start_frame(AVFilterLink *link, AVFilterBufferRef *inpicref)
 {
     FlipContext *flip = link->dst->priv;
+    AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
     int i;
 
     for (i = 0; i < 4; i ++) {
         int vsub = i == 1 || i == 2 ? flip->vsub : 0;
 
-        if (picref->data[i]) {
-            picref->data[i] += ((link->h >> vsub)-1) * picref->linesize[i];
-            picref->linesize[i] = -picref->linesize[i];
+        if (outpicref->data[i]) {
+            outpicref->data[i] += ((link->h >> vsub)-1) * outpicref->linesize[i];
+            outpicref->linesize[i] = -outpicref->linesize[i];
         }
     }
 
-    avfilter_start_frame(link->dst->outputs[0], picref);
+    avfilter_start_frame(link->dst->outputs[0], outpicref);
 }
 
 static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
@@ -95,7 +96,6 @@ AVFilter avfilter_vf_vflip = {
                                     .get_video_buffer = get_video_buffer,
                                     .start_frame      = start_frame,
                                     .draw_slice       = draw_slice,
-                                    .end_frame        = avfilter_null_end_frame,
                                     .config_props     = config_input, },
                                   { .name = NULL}},
     .outputs   = (AVFilterPad[]) {{ .name             = "default",