vf_lut: optimize planar case
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Apr 2012 15:49:04 +0000 (17:49 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Apr 2012 15:49:04 +0000 (17:49 +0200)
2500 -> 1900 cpu cycles

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/vf_lut.c

index 4119916..2dcd0a1 100644 (file)
@@ -318,8 +318,10 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
             outrow = outpic->data[plane] + (y>>vsub) * outpic->linesize[plane];
 
             for (i = 0; i < h>>vsub; i ++) {
-                for (j = 0; j < inlink->w>>hsub; j++)
-                    outrow[j] = lut->lut[plane][inrow[j]];
+                const uint8_t *tab = lut->lut[plane];
+                int w = inlink->w>>hsub;
+                for (j = 0; j < w; j++)
+                    outrow[j] = tab[inrow[j]];
                 inrow  += inpic ->linesize[plane];
                 outrow += outpic->linesize[plane];
             }