Browse code

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

Bobby Bingham authored on 2010/03/19 08:13:04
Showing 1 changed files
... ...
@@ -63,19 +63,18 @@ static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
63 63
 static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
64 64
 {
65 65
     FlipContext *flip = link->dst->priv;
66
-    AVFilterPicRef *ref2 = avfilter_ref_pic(picref, ~0);
67 66
     int i;
68 67
 
69 68
     for (i = 0; i < 4; i ++) {
70 69
         int vsub = i == 1 || i == 2 ? flip->vsub : 0;
71 70
 
72
-        if (ref2->data[i]) {
73
-            ref2->data[i] += ((link->h >> vsub)-1) * ref2->linesize[i];
74
-            ref2->linesize[i] = -ref2->linesize[i];
71
+        if (picref->data[i]) {
72
+            picref->data[i] += ((link->h >> vsub)-1) * picref->linesize[i];
73
+            picref->linesize[i] = -picref->linesize[i];
75 74
         }
76 75
     }
77 76
 
78
-    avfilter_start_frame(link->dst->outputs[0], ref2);
77
+    avfilter_start_frame(link->dst->outputs[0], picref);
79 78
 }
80 79
 
81 80
 static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
... ...
@@ -96,6 +95,7 @@ AVFilter avfilter_vf_vflip = {
96 96
                                     .get_video_buffer = get_video_buffer,
97 97
                                     .start_frame      = start_frame,
98 98
                                     .draw_slice       = draw_slice,
99
+                                    .end_frame        = avfilter_null_end_frame,
99 100
                                     .config_props     = config_input, },
100 101
                                   { .name = NULL}},
101 102
     .outputs   = (AVFilterPad[]) {{ .name             = "default",