[FFmpeg-devel] [PATCH] vf_overlay: add support to RGBA packed input and output
Mark Himsley
mark at mdsh.com
Mon Oct 31 10:57:02 CET 2011
On 30/10/2011 21:47, Michael Niedermayer wrote:
>
> i think we want round to nearest which is
> (x+127)/255
> or
> ((x+127)*257 + 257)>>16
>
> this can be simplified to
> ((x+128)*257)>>16
While I was testing and optimising the code I originally sent on
2011-03-13 I went through a number of different equations but failed to
find ((x+128)*257)>>16. The equation I sent was wrong by 1/255th in some
places, but was a large enough speed-up over (x+127)/255 that in my
opinion was perceptually close enough.
I am very grateful to you Michael for pointing out ((x+128)*257)>>16.
--
Mark
More information about the ffmpeg-devel
mailing list