avfilter/vf_signalstats: fix saturation calculation for >8 bit

This commit is contained in:
Paul B Mahol 2016-08-14 10:00:35 +02:00
parent 6612d04933
commit ec4ed2f69c
1 changed files with 5 additions and 5 deletions

View File

@ -190,7 +190,7 @@ static int config_props(AVFilterLink *outlink)
if (!s->jobs_rets) if (!s->jobs_rets)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
s->frame_sat = alloc_frame(AV_PIX_FMT_GRAY8, inlink->w, inlink->h); s->frame_sat = alloc_frame(s->depth > 8 ? AV_PIX_FMT_GRAY16 : AV_PIX_FMT_GRAY8, inlink->w, inlink->h);
s->frame_hue = alloc_frame(AV_PIX_FMT_GRAY16, inlink->w, inlink->h); s->frame_hue = alloc_frame(AV_PIX_FMT_GRAY16, inlink->w, inlink->h);
if (!s->frame_sat || !s->frame_hue) if (!s->frame_sat || !s->frame_hue)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -799,10 +799,10 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in)
AVFrame *sat = s->frame_sat; AVFrame *sat = s->frame_sat;
AVFrame *hue = s->frame_hue; AVFrame *hue = s->frame_hue;
const uint8_t *p_sat = sat->data[0]; const uint16_t *p_sat = (uint16_t *)sat->data[0];
const uint8_t *p_hue = hue->data[0]; const uint16_t *p_hue = (uint16_t *)hue->data[0];
const int lsz_sat = sat->linesize[0]; const int lsz_sat = sat->linesize[0] / 2;
const int lsz_hue = hue->linesize[0]; const int lsz_hue = hue->linesize[0] / 2;
ThreadDataHueSatMetrics td_huesat = { ThreadDataHueSatMetrics td_huesat = {
.src = in, .src = in,
.dst_sat = sat, .dst_sat = sat,