avfilter/vf_thumbnail: optimize planar processing path

This commit is contained in:
Paul B Mahol 2022-12-05 15:35:05 +01:00
parent 6c814093d8
commit 46642ceeaf
1 changed files with 6 additions and 3 deletions

View File

@ -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_start = (s->planeheight[plane] * jobnr) / nb_jobs;
const int slice_end = (s->planeheight[plane] * (jobnr+1)) / 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 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 j = slice_start; j < slice_end; j++) {
for (int i = 0; i < s->planewidth[plane]; i++) for (int i = 0; i < planewidth; i++)
hist[256*plane + p[i]]++; hhist[p[i]]++;
p += frame->linesize[plane]; p += linesize;
} }
} }
break; break;