[FFmpeg-cvslog] lavfi/vflip: use FF_CEIL_RSHIFT for chroma w/h rounding.

Clément Bœsch git at videolan.org
Sun May 12 13:13:19 CEST 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sat May 11 01:06:53 2013 +0200| [60f0e304312d0fe1d26f7344cb86dc4cdab52b15] | committer: Clément Bœsch

lavfi/vflip: use FF_CEIL_RSHIFT for chroma w/h rounding.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=60f0e304312d0fe1d26f7344cb86dc4cdab52b15
---

 libavfilter/vf_vflip.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c
index 28fa800..fc05e61 100644
--- a/libavfilter/vf_vflip.c
+++ b/libavfilter/vf_vflip.c
@@ -55,9 +55,10 @@ static AVFrame *get_video_buffer(AVFilterLink *link, int w, int h)
 
     for (i = 0; i < 4; i ++) {
         int vsub = i == 1 || i == 2 ? flip->vsub : 0;
+        int height = FF_CEIL_RSHIFT(h, vsub);
 
         if (frame->data[i]) {
-            frame->data[i] += (((h + (1<<vsub) - 1) >> vsub) - 1) * frame->linesize[i];
+            frame->data[i] += (height - 1) * frame->linesize[i];
             frame->linesize[i] = -frame->linesize[i];
         }
     }
@@ -72,9 +73,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
 
     for (i = 0; i < 4; i ++) {
         int vsub = i == 1 || i == 2 ? flip->vsub : 0;
+        int height = FF_CEIL_RSHIFT(link->h, vsub);
 
         if (frame->data[i]) {
-            frame->data[i] += (((link->h + (1<<vsub)-1)>> vsub)-1) * frame->linesize[i];
+            frame->data[i] += (height - 1) * frame->linesize[i];
             frame->linesize[i] = -frame->linesize[i];
         }
     }



More information about the ffmpeg-cvslog mailing list