[FFmpeg-cvslog] avfilter/vf_thumbnail: optimize planar processing path
Paul B Mahol
git at videolan.org
Mon Dec 5 22:04:30 EET 2022
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Dec 5 15:35:05 2022 +0100| [46642ceeafeee5b8cbc82ff32ce3dcd7c73af159] | committer: Paul B Mahol
avfilter/vf_thumbnail: optimize planar processing path
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46642ceeafeee5b8cbc82ff32ce3dcd7c73af159
---
libavfilter/vf_thumbnail.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libavfilter/vf_thumbnail.c b/libavfilter/vf_thumbnail.c
index 0622e3706e..f66af760a3 100644
--- a/libavfilter/vf_thumbnail.c
+++ b/libavfilter/vf_thumbnail.c
@@ -191,11 +191,14 @@ static int do_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
const int slice_start = (s->planeheight[plane] * jobnr) / nb_jobs;
const int slice_end = (s->planeheight[plane] * (jobnr+1)) / nb_jobs;
const uint8_t *p = frame->data[plane] + slice_start * frame->linesize[plane];
+ const ptrdiff_t linesize = frame->linesize[plane];
+ const int planewidth = s->planewidth[plane];
+ int *hhist = hist + 256 * plane;
for (int j = slice_start; j < slice_end; j++) {
- for (int i = 0; i < s->planewidth[plane]; i++)
- hist[256*plane + p[i]]++;
- p += frame->linesize[plane];
+ for (int i = 0; i < planewidth; i++)
+ hhist[p[i]]++;
+ p += linesize;
}
}
break;
More information about the ffmpeg-cvslog
mailing list