[FFmpeg-devel] [PATCH] vf_psnr: always calculate MSE over full pixel range.

Michael Niedermayer michael at niedermayer.cc
Sat Jul 11 18:54:08 CEST 2015


On Sat, Jul 11, 2015 at 02:50:52PM +0000, Paul B Mahol wrote:
> Dana 11. 7. 2015. 13:23 osoba "Ronald S. Bultje" <rsbultje at gmail.com>
> napisala je:
> >
> > This makes the output compatible with that of pretty much any other
> > tool that calculates PSNR.
> > ---
> >  libavfilter/vf_psnr.c | 31 ++++---------------------------
> >  1 file changed, 4 insertions(+), 27 deletions(-)
> >
> > diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
> > index 0c2c950..cc4546a 100644
> > --- a/libavfilter/vf_psnr.c
> > +++ b/libavfilter/vf_psnr.c
> > @@ -260,33 +260,10 @@ static int config_input_ref(AVFilterLink *inlink)
> >          return AVERROR(EINVAL);
> >      }
> >
> > -    switch (inlink->format) {
> > -    case AV_PIX_FMT_GRAY8:
> > -    case AV_PIX_FMT_GRAY16:
> > -    case AV_PIX_FMT_GBRP:
> > -    case AV_PIX_FMT_GBRP9:
> > -    case AV_PIX_FMT_GBRP10:
> > -    case AV_PIX_FMT_GBRP12:
> > -    case AV_PIX_FMT_GBRP14:
> > -    case AV_PIX_FMT_GBRP16:
> > -    case AV_PIX_FMT_GBRAP:
> > -    case AV_PIX_FMT_GBRAP16:
> > -    case AV_PIX_FMT_YUVJ411P:
> > -    case AV_PIX_FMT_YUVJ420P:
> > -    case AV_PIX_FMT_YUVJ422P:
> > -    case AV_PIX_FMT_YUVJ440P:
> > -    case AV_PIX_FMT_YUVJ444P:
> > -        s->max[0] = (1 << (desc->comp[0].depth_minus1 + 1)) - 1;
> > -        s->max[1] = (1 << (desc->comp[1].depth_minus1 + 1)) - 1;
> > -        s->max[2] = (1 << (desc->comp[2].depth_minus1 + 1)) - 1;
> > -        s->max[3] = (1 << (desc->comp[3].depth_minus1 + 1)) - 1;
> > -        break;
> > -    default:
> > -        s->max[0] = 235 * (1 << (desc->comp[0].depth_minus1 - 7));
> > -        s->max[1] = 240 * (1 << (desc->comp[1].depth_minus1 - 7));
> > -        s->max[2] = 240 * (1 << (desc->comp[2].depth_minus1 - 7));
> > -        s->max[3] = (1 << (desc->comp[3].depth_minus1 + 1)) - 1;
> > -    }
> > +    s->max[0] = (1 << (desc->comp[0].depth_minus1 + 1)) - 1;
> > +    s->max[1] = (1 << (desc->comp[1].depth_minus1 + 1)) - 1;
> > +    s->max[2] = (1 << (desc->comp[2].depth_minus1 + 1)) - 1;
> > +    s->max[3] = (1 << (desc->comp[3].depth_minus1 + 1)) - 1;
> >
> >      s->is_rgb = ff_fill_rgba_map(s->rgba_map, inlink->format) >= 0;
> >      s->comps[0] = s->is_rgb ? 'r' : 'y' ;
> > --
> > 2.1.2
> >
> 
> LGTM

applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150711/142128ba/attachment.sig>


More information about the ffmpeg-devel mailing list