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

Reimar Döffinger Reimar.Doeffinger
Mon Nov 29 19:39:16 CET 2010


On Mon, Nov 29, 2010 at 10:47:05AM -0500, Alexander Strange wrote:
> On Nov 29, 2010, at 8:46 AM, Ronald S. Bultje wrote:
> > On Mon, Nov 29, 2010 at 7:18 AM, Nolan L <nol888 at gmail.com> wrote:
> >> As part of a GCI task, I've ported the gradfun debanding filter from mplayer
> >> to libavfilter.
> >> 
> >> The patch includes changes to the build system to account for CPU
> >> optimizations that weren't present previously.
> >> 
> >> There is a SSE2 method that remains unported due to lack of SSE2 detection
> >> in the configure script that I wasn't quite sure how to add.
> > 
> > if (HAVE_MMX && flags & AV_CPU_FLAG_MMX2) will do what you want, and
> > then without the #ifdef HAVE_MMX2 parts.
> > 
> >> +static void blur_line_sse2(uint16_t *dc, uint16_t *buf, uint16_t *buf1,
> >> +                           uint8_t *src, int sstride, int width)
> >> +{
> >> +    if (((intptr_t)src|sstride)&15) {
> >> +        BLURV("movdqu");
> >> +    } else {
> >> +        BLURV("movdqa");
> >> +    }
> >> +}
> > 
> > My understanding is that lines in FFmpeg are always 16-byte aligned,
> > so this check is unneeded (we can always use movdqa, which is faster).
> > If my understanding is wrong, that should be fixed, not this check
> > added. :-).
> 
> Lines are only 8-byte aligned - look for STRIDE_ALIGN.

That is what a get_buffer implementation for video codecs must provide,
however there are decoders (CSCD, other gzip or similar based codecs)
that will not give _any_ alignment promises whatsoever.
If libavfilter cannot handle truly arbitrary strides (well, let's
reduce that to stride == width * bitdepth) it _will_ fail for these.



More information about the ffmpeg-devel mailing list