[FFmpeg-devel] [PATCH] rotate filter

Stefano Sabatini stefasab at gmail.com
Tue Jun 11 15:12:31 CEST 2013


On date Thursday 2011-05-05 04:17:55 +0200, Michael Niedermayer encoded:
> On Thu, May 05, 2011 at 01:31:26AM +0200, Stefano Sabatini wrote:
> > On date Wednesday 2011-05-04 14:56:12 +0200, Michael Niedermayer encoded:
> > > On Wed, May 04, 2011 at 12:31:29PM +0200, Stefano Sabatini wrote:
> > [...]
> > > > > frac_x >>= 6;
> > > > > frac_y >>= 6;
> > > > > for (i = 0; i < src_linestep; i++) {
> > > > >     int s00 = src[src_linestep * int_x  + i + src_linesize * int_y ];
> > > > >     int s01 = src[src_linestep * int_x1 + i + src_linesize * int_y ];
> > > > >     int s10 = src[src_linestep * int_x  + i + src_linesize * int_y1];
> > > > >     int s11 = src[src_linestep * int_x1 + i + src_linesize * int_y1];
> > > > >     int s0 = (((1<<10) - frac_x)*s00 + frac_x*s01);
> > > > >     int s1 = (((1<<10) - frac_x)*s10 + frac_x*s11);
> > > > > 
> > > > >     dst_color[i] = (((1<<10) - frac_y)*s0 + frac_y*s1)>>20;
> > > > > }
> > > > > 
> > > > > you can also shift by just 4 instead of 6 and use unsigned values
> > > > 
> > > > Isn't this losing precision (and indeed producing a different output)?
> > > > Which are the pros/cons?
> > > 
> > > 64bit arithmetic is slow on hw that does not have native 64bit support
> > > and with infinite precisse coeffs you will have +-0.5 errors
> > > with 16bit ~0.502
> > > with 12bit ~0.531
> > > 
> > > these worst case errors happen on black white transitions. in flatly
> > > colored areas the difference is significantly smaller that is its all
> > > pretty much 0.5 there
> > > 
> > > also mmx/sse optimized code would not use 64bit arithmetic so it would
> > > produce different output when C is using 64bit arithmetic
> > 
> > Yes I see the point but the code changed like that as a rather visible
> > quality loss.
> 
> well ive not tested, it could contain bugs.
> you could commit the int64 version and i could test and change to
> int32 later
> 
> maybe you could publish your work in a branch or something this way we
> could easier both work on the code.

Updated, please review.

Fixed the border problem, updated/fixed/extended the code.
-- 
FFmpeg = Frightening & Fierce Miracolous Patchable Exploitable Gadget
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavfi-add-rotate-filter.patch
Type: text/x-diff
Size: 21598 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130611/b106c244/attachment.bin>


More information about the ffmpeg-devel mailing list