summaryrefslogtreecommitdiff
path: root/libavfilter/vf_thumbnail.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-12-05 15:35:05 +0100
committerPaul B Mahol <onemda@gmail.com>2022-12-05 21:07:11 +0100
commit46642ceeafeee5b8cbc82ff32ce3dcd7c73af159 (patch)
tree88f0ce24a950ef6225d85b75f5e271f066878cc6 /libavfilter/vf_thumbnail.c
parent6c814093d8a0351d0a5f5264deba2285a436e88a (diff)
downloadffmpeg-46642ceeafeee5b8cbc82ff32ce3dcd7c73af159.tar.gz
avfilter/vf_thumbnail: optimize planar processing path
Diffstat (limited to 'libavfilter/vf_thumbnail.c')
-rw-r--r--libavfilter/vf_thumbnail.c9
1 files 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;