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

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


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sat May 11 00:56:04 2013 +0200| [59d33eafd19ab9dc0ba2c1ba83738d55047fba48] | committer: Clément Bœsch

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

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

 libavfilter/vf_lut.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index d544419..070cf55 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -305,13 +305,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         for (plane = 0; plane < 4 && in->data[plane]; plane++) {
             int vsub = plane == 1 || plane == 2 ? lut->vsub : 0;
             int hsub = plane == 1 || plane == 2 ? lut->hsub : 0;
+            int h = FF_CEIL_RSHIFT(inlink->h, vsub);
+            int w = FF_CEIL_RSHIFT(inlink->w, hsub);
 
             inrow  = in ->data[plane];
             outrow = out->data[plane];
 
-            for (i = 0; i < (in->height + (1<<vsub) - 1)>>vsub; i ++) {
+            for (i = 0; i < h; i++) {
                 const uint8_t *tab = lut->lut[plane];
-                int w = (inlink->w + (1<<hsub) - 1)>>hsub;
                 for (j = 0; j < w; j++)
                     outrow[j] = tab[inrow[j]];
                 inrow  += in ->linesize[plane];



More information about the ffmpeg-cvslog mailing list