s->vsub = desc->log2_chroma_h;
s->depth = desc->comp[0].depth;
s->maxsize = 1 << s->depth;
s->vsub = desc->log2_chroma_h;
s->depth = desc->comp[0].depth;
s->maxsize = 1 << s->depth;
- if (s->depth > 8) {
- s->histy = av_malloc_array(s->maxsize, sizeof(*s->histy));
- s->histu = av_malloc_array(s->maxsize, sizeof(*s->histu));
- s->histv = av_malloc_array(s->maxsize, sizeof(*s->histv));
- s->histsat = av_malloc_array(s->maxsize, sizeof(*s->histsat));
-
- if (!s->histy || !s->histu || !s->histv || !s->histsat)
- return AVERROR(ENOMEM);
- }
+ s->histy = av_malloc_array(s->maxsize, sizeof(*s->histy));
+ s->histu = av_malloc_array(s->maxsize, sizeof(*s->histu));
+ s->histv = av_malloc_array(s->maxsize, sizeof(*s->histv));
+ s->histsat = av_malloc_array(s->maxsize, sizeof(*s->histsat));
+
+ if (!s->histy || !s->histu || !s->histv || !s->histsat)
+ return AVERROR(ENOMEM);
static int compute_sat_hue_metrics8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
{
int i, j;
static int compute_sat_hue_metrics8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
{
int i, j;
int miny = -1, minu = -1, minv = -1;
int maxy = -1, maxu = -1, maxv = -1;
int lowy = -1, lowu = -1, lowv = -1;
int miny = -1, minu = -1, minv = -1;
int maxy = -1, maxu = -1, maxv = -1;
int lowy = -1, lowu = -1, lowv = -1;
NULL, FFMIN(s->chromah, ff_filter_get_nb_threads(ctx)));
// Calculate luma histogram and difference with previous frame or field.
NULL, FFMIN(s->chromah, ff_filter_get_nb_threads(ctx)));
// Calculate luma histogram and difference with previous frame or field.
for (j = 0; j < link->h; j++) {
for (i = 0; i < link->w; i++) {
const int yuv = in->data[0][w + i];
for (j = 0; j < link->h; j++) {
for (i = 0; i < link->w; i++) {
const int yuv = in->data[0][w + i];
+ memset(s->histu, 0, s->maxsize * sizeof(*s->histu));
+ memset(s->histv, 0, s->maxsize * sizeof(*s->histv));
+ memset(s->histsat, 0, s->maxsize * sizeof(*s->histsat));
for (j = 0; j < s->chromah; j++) {
for (i = 0; i < s->chromaw; i++) {
const int yuvu = in->data[1][cw+i];
for (j = 0; j < s->chromah; j++) {
for (i = 0; i < s->chromaw; i++) {
const int yuvu = in->data[1][cw+i];
if (miny < 0 && histy[fil]) miny = fil;
if (minu < 0 && histu[fil]) minu = fil;
if (minv < 0 && histv[fil]) minv = fil;
if (miny < 0 && histy[fil]) miny = fil;
if (minu < 0 && histu[fil]) minu = fil;
if (minv < 0 && histv[fil]) minv = fil;