[FFmpeg-devel] [PATCH] libavfilter: created a new filter that obtains the average peak signal-to-noise ratio (PSNR) of two input video files in YUV format.
Stefano Sabatini
stefano.sabatini-lala at poste.it
Thu Jun 23 13:17:07 CEST 2011
On date Tuesday 2011-06-21 16:01:36 +0200, Stefano Sabatini encoded:
> On date Tuesday 2011-06-21 14:44:50 +0200, Roger Pau Monné encoded:
> > Hello,
> >
> > Sorry for the delay, I'm really busy these weeks, I will like to
> > implement the option to store the results in a qpsnr style, but right
> > now I don't have time, let's see if I can do it in a week or two. I've
> > applied the suggested changes, thanks Stefano.
[...]
> > +static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
> > +{
> > + AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
> > + AVFilterContext *ctx = inlink->dst;
> > + PSNRContext *psnr = ctx->priv;
> > +
> > + inlink->dst->outputs[0]->out_buf = outpicref;
> > + outpicref->pts = av_rescale_q(inpicref->pts,
> > + ctx->inputs [0]->time_base,
> > + ctx->outputs[0]->time_base);
Is this required?
> > +
> > + if (psnr->picref) {
> > + avfilter_unref_buffer(psnr->picref);
> > + psnr->picref = NULL;
> > + }
> > + avfilter_request_frame(ctx->inputs[1]);
> > +
> > + avfilter_start_frame(inlink->dst->outputs[0], outpicref);
Note: here we should fail in case avfilter_request_frame returns an
error. Not necessary for this patch since this would possibly require
to change the start_frame signature, but at least we may add a fixme.
> > +}
> > +
> > +static void start_frame_ref(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
> > +{
> > + AVFilterContext *ctx = inlink->dst;
> > + PSNRContext *psnr = ctx->priv;
> > +
> > + psnr->picref = inpicref;
> > + psnr->picref->pts = av_rescale_q(inpicref->pts,
> > + ctx->inputs [1]->time_base,
> > + ctx->outputs[0]->time_base);
Is this required? AFAIK the reference PTS is just ignored.
[...]
> (or we could change avfilter_unref_buffer to accepts a ** and set the
> pointer reference to NULL).
>
> Looks fine otherwise. I'll fix the nits myself if you don't have time
> or you don't care, as for the syntax thing I'd like to think a bit
> about it and get advices.
I addressed some of the nits and did some more changes to the filter,
please keep working on this copy.
--
FFmpeg = Freak Funny Mastodontic Plastic Exxagerate Geisha
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavfi-add-psnr-filter.patch
Type: text/x-diff
Size: 16814 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110623/b17cad41/attachment.bin>
More information about the ffmpeg-devel
mailing list