[FFmpeg-cvslog] vf_lut: optimize rgb codepath
Michael Niedermayer
git at videolan.org
Tue Apr 3 18:44:24 CEST 2012
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Apr 3 18:13:33 2012 +0200| [002d9ded4a6f982b12cfe14314abb49c9fb55085] | committer: Michael Niedermayer
vf_lut: optimize rgb codepath
19k -> 15k cpu cycles
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=002d9ded4a6f982b12cfe14314abb49c9fb55085
---
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 2dcd0a1..ee485f3 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;
}
More information about the ffmpeg-cvslog
mailing list