[FFmpeg-devel] [PATCH] Port gradfun to libavfilter (GCI)

Loren Merritt lorenm
Wed Dec 1 07:22:46 CET 2010

On Tue, 30 Nov 2010, Nolan L wrote:
> Things that still need to be addressed (mostly with the asm):
> -Factoring the asm; I don't have enough asm experience to do this.
> -alignment issues with the asm code. (hopefully someone more
>  experienced can take care of this.)
> -gpl vs lgpl


>+ @var{radius} is the neighborhood to fid the gradient to. A larger radius
>+ makes for smoother gradients, but also prevents the filter from modifying
>+ the pixels near detailed regions (default: 16).

typo "fid"

>+ /// The implementation of the filter algorithm we are using.
>+ void (*filter_line) (uint8_t *dst, uint8_t *src, uint16_t *dc, int width, int thresh, const uint16_t *dithers);
>+ /// The implementation of the blur algorithm we are using.
>+ void (*blur_line) (uint16_t *dc, uint16_t *buf, uint16_t *buf1, uint8_t *src, int src_linesize, int width);

I would cover both of those with just "/// DSP functions". Anything more 
verbose than that makes it sound like something weird is going on, when it 

>+ av_log(ctx, AV_LOG_INFO, "threshold:%.2f radius:%d filter_mmx2:%s filter_ssse3:%s blur_sse2:%s\n",
>+     thresh, gf->radius, gf->filter_line == ff_gradfun_filter_line_mmx2 ? "yes" : "no",
>+     gf->filter_line == ff_gradfun_filter_line_ssse3 ? "yes" : "no",
>+     gf->blur_line == ff_gradfun_blur_line_sse2 ? "yes" : "no");

Why would you print that?

On Wed, 1 Dec 2010, Stefano Sabatini wrote:
> Direct rendering in this context simply means that the filter doesn't
> request a new buffer for the picture, but will directly write in the
> buffer passed by the start_frame function (check the drawbox filter
> for an example).
> Note that this isn't generally possible, in the case you process the
> neighborhood of each processed pixel like you're doing in this filter
> (so you need those values not be altered). Point filters (e.g. the eq
> filter) only process the pixel so they can don't need to write the
> output in a separate buffer.

vf_gradfun, as I wrote it in MPlayer, can and does use direct rendering.
The only part missing from this code is the part that tells libavfilter 
that dst==src is ok.

--Loren Merritt

More information about the ffmpeg-devel mailing list