[FFmpeg-devel] [PATCH] Implement pixdesctest filter

Michael Niedermayer michaelni
Tue Jul 6 13:04:37 CEST 2010


On Sun, Jul 04, 2010 at 12:28:54AM +0200, Stefano Sabatini wrote:
> 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

>  Makefile                     |    1 
>  doc/filters.texi             |   13 ++++
>  libavfilter/Makefile         |    1 
>  libavfilter/allfilters.c     |    1 
>  libavfilter/vf_pixdesctest.c |  128 +++++++++++++++++++++++++++++++++++++++++++
>  tests/lavfi-regression.sh    |   20 ++++++
>  6 files changed, 164 insertions(+)
> 614060a98a65df3a7d7b5c24fa3b17aafe5c639d  0002-Add-pixdesctest-filter-and-corresponding-test.patch
> >From 6027e7854a980c41f3035173216bed17fe95dd05 Mon Sep 17 00:00:00 2001
> Message-Id: <6027e7854a980c41f3035173216bed17fe95dd05.1278195876.git.stefano.sabatini-lala at poste.it>
> In-Reply-To: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it>
> References: <95a9c0124d02eb28006f7aa59b2fd336dba63fe8.1278195876.git.stefano.sabatini-lala at poste.it>
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Mon, 7 Jun 2010 22:31:30 +0200
> Subject: [implement-pixdesctest PATCH 2/2] Add pixdesctest filter and corresponding test.
> 
> ---
>  Makefile                     |    1 +
>  doc/filters.texi             |   13 ++++
>  libavfilter/Makefile         |    1 +
>  libavfilter/allfilters.c     |    1 +
>  libavfilter/vf_pixdesctest.c |  128 ++++++++++++++++++++++++++++++++++++++++++
>  tests/lavfi-regression.sh    |   20 +++++++
>  6 files changed, 164 insertions(+), 0 deletions(-)
>  create mode 100644 libavfilter/vf_pixdesctest.c

no reference checksums?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100706/e8c6bb87/attachment.pgp>



More information about the ffmpeg-devel mailing list