diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-03 20:13:33 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-04-03 20:13:33 +0400 |
commit | 002d9ded4a6f982b12cfe14314abb49c9fb55085 (patch) | |
tree | 06f6d057c6d6b1436a622f88baa045087aed67a6 /libavfilter/vf_lut.c | |
parent | 79a1d98676d3284ba5cbed90e63e326fa4764a11 (diff) |
vf_lut: optimize rgb codepath
19k -> 15k cpu cycles
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_lut.c')
-rw-r--r-- | libavfilter/vf_lut.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 2dcd0a153c..ee485f36a3 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -297,11 +297,20 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) outrow0 = outpic->data[0] + y * outpic->linesize[0]; for (i = 0; i < h; i ++) { + int w = inlink->w; inrow = inrow0; outrow = outrow0; - for (j = 0; j < inlink->w; j++) { - for (k = 0; k < lut->step; k++) - outrow[k] = lut->lut[lut->rgba_map[k]][inrow[k]]; + for (j = 0; j < w; j++) { + outrow[0] = lut->lut[lut->rgba_map[0]][inrow[0]]; + if (lut->step>1) { + outrow[1] = lut->lut[lut->rgba_map[1]][inrow[1]]; + if (lut->step>2) { + outrow[2] = lut->lut[lut->rgba_map[2]][inrow[2]]; + if (lut->step>3) { + outrow[3] = lut->lut[lut->rgba_map[3]][inrow[3]]; + } + } + } outrow += lut->step; inrow += lut->step; } |