[FFmpeg-devel] swscale dither
michaelni at gmx.at
Sat Jul 16 01:08:44 CEST 2011
On Fri, Jul 15, 2011 at 10:19:04AM -0700, Ronald S. Bultje wrote:
> Hi Michael,
> always great to hear from you, thank you for your kind words.
iam just trying to push a little toward some cooperation.
> On Fri, Jul 15, 2011 at 8:33 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > you got the scaling totally wrong and now you add with
> > 55eda370cb6fe9e4c21539f3f90fd940fcf7a103 completely incorrect cliping
> > because you have the scaling wrong. And the 2 bugs dont cancel each
> > other you introduce a significant and wrong bias here.
> So what your scaled-dither code does is to have a start value, add a
> random number to it in the subpixel-range of the destination pixel,
> and then shift. In this example, 10bit -> 8bit has two bits of pixel
> clipping and thus we add a 2bit random number [0,1,2,3] to it, as in
> (10bit + rand[0,1,2,3]) >> 2 = 8bit. As an example, let's take a max
> pixel value of 0x3ff, and add 1 dither of 1, which gives us (0x3ff +
> 1) >> 2 = 0x100. How would you do this without clipping?
the values arent random, not that it matters here
about how i do it, its quite simple the values are just scaled (in the
scalar multiplication sense) so no cliping is needed.
as a sideeffect this also makes the white end and black end behave
symmetrically avoiding bias issues
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the ffmpeg-devel