[FFmpeg-devel] [PATCH] Implement pixdesctest filter

Stefano Sabatini stefano.sabatini-lala
Sun Jul 4 00:28:54 CEST 2010


On date Tuesday 2010-06-22 02:22:51 +0200, Michael Niedermayer encoded:
> On Mon, Jun 21, 2010 at 11:25:29PM +0200, Stefano Sabatini wrote:
> [...]
> > +static int config_props(AVFilterLink *inlink)
> > +{
> > +    PixdescTestContext *priv = inlink->dst->priv;
> > +
> > +    priv->pix_desc = &av_pix_fmt_descriptors[inlink->format];
> > +
> > +    if (!(priv->line = av_malloc(sizeof(*priv->line) * inlink->w)))
> > +        return AVERROR(ENOMEM);
> > +
> > +    return 0;
> > +}
> > +
> > +static void start_frame(AVFilterLink *inlink, AVFilterPicRef *picref)
> > +{
> > +    PixdescTestContext *priv = inlink->dst->priv;
> > +    AVFilterLink *outlink    = inlink->dst->outputs[0];
> > +    AVFilterPicRef *outpicref;
> > +    int i;
> > +
> > +    outlink->outpic = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
> > +                                                outlink->w, outlink->h);
> > +    outpicref = outlink->outpic;
> 
> > +    outpicref->pts             = picref->pts;
> > +    outpicref->pos             = picref->pos;
> > +    outpicref->pixel_aspect    = picref->pixel_aspect;
> > +    outpicref->interlaced      = picref->interlaced;
> > +    outpicref->top_field_first = picref->top_field_first;
> 
> this code should be factored into its own function it likely is duplicated
> over a few filters

Fixed in the previous patch.

> > +
> > +    for (i = 0; i < 4; i++) {
> > +        int h = outlink->h;
> > +        h = i == 1 || i == 2 ? h>>priv->pix_desc->log2_chroma_h : h;
> > +        if (outpicref->data[i])
> > +            memset(outpicref->data[i], 0, outpicref->linesize[i] * h);
> > +    }
> 
> can linesize be <0 here?

Good catch, fixed.
  
> [...]
> > diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh
> > index ebbc0f3..42fba34 100755
> > --- a/tests/lavfi-regression.sh
> > +++ b/tests/lavfi-regression.sh
> > @@ -86,6 +86,19 @@ if [ -n "$do_lavfi_pix_fmts" ]; then
> >      done
> >  fi
> >  
> > +if [ -n "$do_lavfi_pixdesc" ]; then
> > +    pix_fmts="$($ffmpeg -pix_fmts list 2>/dev/null | sed -ne '9,$p' | grep '^IO' | cut -d' ' -f2)"
> > +
> > +    ref_file=tests/ref/lavfi/lavfi_pixdesc
> > +    rm -f $ref_file
> > +
> > +    for pix_fmt in $pix_fmts; do
> > +        cat $ref_file-$pix_fmt >> $ref_file
> > +        do_video_encoding "lavfi_pixdesc-${pix_fmt}.nut" "" \
> > +            "-vf slicify=random,format=$pix_fmt,pixdesctest -vcodec rawvideo -pix_fmt $pix_fmt"
> 
> shouldnt it be converted back and compared by tiny_psnr too?

Yes, found a much better solution which doesn't require the bundling
of the reference files at all.

Regards.
-- 
FFmpeg = Frightening and Fierce Mournful Problematic Exxagerate Gospel



More information about the ffmpeg-devel mailing list