diff options
author | Clément Bœsch <ubitux@gmail.com> | 2013-05-11 01:06:53 +0200 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2013-05-12 12:59:00 +0200 |
commit | 60f0e304312d0fe1d26f7344cb86dc4cdab52b15 (patch) | |
tree | 7edd1c9c771e6cda49f84e0184293a29839549d0 | |
parent | 59d33eafd19ab9dc0ba2c1ba83738d55047fba48 (diff) | |
download | ffmpeg-60f0e304312d0fe1d26f7344cb86dc4cdab52b15.tar.gz |
lavfi/vflip: use FF_CEIL_RSHIFT for chroma w/h rounding.
-rw-r--r-- | libavfilter/vf_vflip.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c index 28fa800f3b..fc05e614d8 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]; } } |