[FFmpeg-devel] [PATCH] lavfi: Port fspp to FFmpeg

Michael Niedermayer michaelni at gmx.at
Thu Dec 18 23:02:15 CET 2014


On Thu, Dec 18, 2014 at 01:57:27PM +0530, arwa arif wrote:
> >
> >
> > > --- a/libavfilter/allfilters.c
> > > +++ b/libavfilter/allfilters.c
> > > @@ -141,6 +141,7 @@ void avfilter_register_all(void)
> > >      REGISTER_FILTER(FRAMEPACK,      framepack,      vf);
> > >      REGISTER_FILTER(FRAMESTEP,      framestep,      vf);
> > >      REGISTER_FILTER(FREI0R,         frei0r,         vf);
> > > +    REGISTER_FILTER(FSPP,           fspp,           vf);
> > >      REGISTER_FILTER(GEQ,            geq,            vf);
> > >      REGISTER_FILTER(GRADFUN,        gradfun,        vf);
> > >      REGISTER_FILTER(HALDCLUT,       haldclut,       vf);
> > > diff --git a/libavfilter/libmpcodecs/vf_fspp.c
> > b/libavfilter/libmpcodecs/vf_fspp.c
> > > index d457859..3a80dc2 100644
> > > --- a/libavfilter/libmpcodecs/vf_fspp.c
> > > +++ b/libavfilter/libmpcodecs/vf_fspp.c
> > > @@ -710,8 +710,8 @@ const vf_info_t ff_vf_info_fspp = {
> > >  #if HAVE_MMX_INLINE
> > >
> > >  DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_382683433)=FIX64(0.382683433,
> > 14);
> > > -DECLARE_ALIGNED(8, uint64_t, ff_MM_FIX_0_541196100)=FIX64(0.541196100,
> > 14);
> > > -DECLARE_ALIGNED(8, uint64_t, ff_MM_FIX_0_707106781)=FIX64(0.707106781,
> > 14);
> > > +extern uint64_t ff_MM_FIX_0_707106781;
> > > +extern uint64_t ff_MM_FIX_0_541196100;
> >
> > still looks weird
> >
> 
> Carl Eugen Hoyos has commented on it in previous mails.
> 
> > +
> > > +typedef int32_t int_simd16_t;
> > > +static const int16_t FIX_0_382683433   = FIX(0.382683433, 14);
> > > +static const int16_t FIX_0_541196100   = FIX(0.541196100, 14);
> > > +static const int16_t FIX_0_707106781   = FIX(0.707106781, 14);
> > > +static const int16_t FIX_1_306562965   = FIX(1.306562965, 14);
> > > +static const int16_t FIX_1_414213562_A = FIX(1.414213562, 14);
> > > +static const int16_t FIX_1_847759065   = FIX(1.847759065, 13);
> > > +static const int16_t FIX_2_613125930   = FIX(-2.613125930, 13);
> > > +static const int16_t FIX_1_414213562   = FIX(1.414213562, 13);
> > > +static const int16_t FIX_1_082392200   = FIX(1.082392200, 13);
> > > +
> >
> > > +typedef struct fsppContext {
> >
> > typedef struct {
> >
> > should be enough
> 
> 
> The mul_thrmat function uses a pointer to this struct, so can't remove
> that.

>  LICENSE.md                        |    1 
>  configure                         |    1 
>  doc/filters.texi                  |   30 
>  libavfilter/Makefile              |    1 
>  libavfilter/allfilters.c          |    1 
>  libavfilter/libmpcodecs/vf_fspp.c |    4 
>  libavfilter/version.h             |    4 
>  libavfilter/vf_fspp.c             |  672 ++++++++++++++++++
>  libavfilter/vf_fspp.h             |   96 ++
>  libavfilter/x86/Makefile          |    1 
>  libavfilter/x86/vf_fspp.c         | 1405 ++++++++++++++++++++++++++++++++++++++
>  11 files changed, 2212 insertions(+), 4 deletions(-)
> 93ddfa311e296ef6149a7ae8492e34786cf61db9  0001-lavfi-port-mp-uspp-to-a-native-libavfilter-filter.patch
> From 3da2573bb66205999cf170997a8d088ccb61c350 Mon Sep 17 00:00:00 2001
> From: Arwa Arif <arwaarif1994 at gmail.com>
> Date: Sun, 14 Dec 2014 12:03:31 +0530

> Subject: [PATCH] lavfi: port mp=uspp to a native libavfilter filter

fspp, not uspp


[...]
> +static int config_input(AVFilterLink *inlink)
> +{
> +
> +    AVFilterContext *ctx = inlink->dst;
> +    FSPPContext *fspp = ctx->priv;
> +    const int h = FFALIGN(inlink->h + 16, 16);
> +    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
> +
> +    fspp->hsub = desc->log2_chroma_w;
> +    fspp->vsub = desc->log2_chroma_h;
> +
> +    fspp->temp_stride = FFALIGN(inlink->w + 16, 16);
> +    fspp->temp = av_malloc_array(fspp->temp_stride, h * sizeof(*fspp->temp));
> +    fspp->src  = av_malloc_array(fspp->temp_stride, h * sizeof(*fspp->src));
> +
> +    if (!fspp->temp || !fspp->src)
> +        return AVERROR(ENOMEM);
> +
> +    if (ARCH_X86)
> +        ff_fspp_init_x86(fspp);
> +
> +    else {
> +        fspp->store_slice  = store_slice_c;
> +        fspp->store_slice2 = store_slice2_c;
> +        fspp->mul_thrmat   = mul_thrmat_c;
> +        fspp->column_fidct = column_fidct_c;
> +        fspp->row_idct     = row_idct_c;
> +        fspp->row_fdct     = row_fdct_c;
> +    }

the *_c functions should be set before ff_fspp_init_x86() and
unconditionally
otherwise functons not set by ff_fspp_init_x86() would be NULL
and would segfault
you can see this by using -cpuflags 0

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141218/e26ed873/attachment.asc>


More information about the ffmpeg-devel mailing list