[FFmpeg-devel] [PATCH 2/2] libavutil/libavfilter: deshake opencl filter based on comments on 20130330

Wei Gao highgod0401 at gmail.com
Sun Mar 31 03:18:48 CEST 2013


Hi, michaelni, thanks for your reply, a questions about the function
transform.

Thanks
Best regards.


2013/3/30 Michael Niedermayer <michaelni at gmx.at>

> On Sat, Mar 30, 2013 at 06:48:21PM +0800, Wei Gao wrote:
> >
>
> [...]
>
> It would avoid some casts
>
>
> [...]
> > @@ -106,6 +108,13 @@ typedef struct {
> >      int cx;
> >      int cy;
> >      char *filename;            ///< Motion search detailed log filename
> > +    int is_opencl;
> > +    FFDeshakeOpenclEnv opencl_env;
> > +    int (* opencl_transform)(FFDeshakeOpenclEnv *, int, int, int, int,
> const float *, const float *,
> > +               enum InterpolateMethod, enum FillMethod , AVFrame *,
> AVFrame *);
> > +    int (* opencl_init)(AVFilterContext *, FFDeshakeOpenclEnv *);
> > +    void (* opencl_uninit)(FFDeshakeOpenclEnv *);
> > +    int (* opencl_process_inout_buf)(AVFrame *, AVFrame *,
> FFDeshakeOpenclEnv *);
> >  } DeshakeContext;
>
> this should be
>
> int (* transform)(...);
>
I have tried this way, but compile did not pass, because "ISO C requires a
named argument before '...' ",should I define the function
int (* opencl_transform)(FFDeshakeOpenclEnv *, ...);but it add warning,
also the parameter of opencl_tranfrom and C code transform has the
different data type

>
> [...]
> > @@ -531,6 +557,20 @@ static int filter_frame(AVFilterLink *link, AVFrame
> *in)
> >      deshake->last.angle = t.angle;
> >      deshake->last.zoom = t.zoom;
> >
> > +    if (deshake->is_opencl && CONFIG_OPENCL) {
> > +        int ret = 0;
> > +        float matrix_y_opencl[9];
> > +        float matrix_uv_opencl[9];
> > +        avfilter_get_matrix(t.vector.x, t.vector.y, t.angle, 1.0 +
> t.zoom / 100.0, matrix_y_opencl);
> > +        avfilter_get_matrix(t.vector.x / (link->w /
> CHROMA_WIDTH(link)), t.vector.y / (link->h / CHROMA_HEIGHT(link)), t.angle,
> 1.0 + t.zoom / 100.0, matrix_uv_opencl);
> > +
> > +        ret = deshake->opencl_transform(&(deshake->opencl_env),
> link->w, link->h, CHROMA_WIDTH(link), CHROMA_HEIGHT(link),
> > +                                    matrix_y_opencl, matrix_uv_opencl,
> INTERPOLATE_BILINEAR, deshake->edge, in, out);
> > +        if (ret < 0)
> > +            return ret;
> > +        goto end;
> > +    }
>
> this should call transform()
>
> which either then calls the normal C implementation or opencl or
> maybe one day AVX
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The real ebay dictionary, page 3
> "Rare item" - "Common item with rare defect or maybe just a lie"
> "Professional" - "'Toy' made in china, not functional except as doorstop"
> "Experts will know" - "The seller hopes you are not an expert"
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


More information about the ffmpeg-devel mailing list