[FFmpeg-devel] Fade to/from white
mark at mdsh.com
Mon Jul 18 23:03:21 CEST 2011
On 18/07/2011 17:54, Brian Cardarella wrote:
> I'm trying to modify the fade filter to fade from white instead of black.
> I'm guessing the luma plane is where I want to do this. I'm not quite
> sure how best to cycle the luma plane here. I've seen that the Y'
> value of 1 is represented by the integer 65535 (unsigned int). I
> thought it would be as easy as actually using the fade->factor value
> as this is already cycling. The result is not what I want (choppy and
> actually goes to black)
> So any tips on this would be great.
In My Humble Opinion, the fade filter is slightly broken, because what
it currently does is just multiply the input signal by
65535/fade->factor. That makes "studio" level input signals tend towards
0 rather than tending towards 16 (studio level black).
So, assuming the same broken-ness for studio colours, instead of fading
to 0 like this on line 112 of vf_fade.c:
*p = (*p * fade->factor + 32768) >> 16;
You'd need to fade to 255, something like this (not tested in code, but
the principal tested in a spread sheet):
*p = (255 * (65536 - fade->factor) + *p * fade->factor + 32768) >> 16;
I don't think you'll need to alter the chroma multipliers.
Hope that helps.
More information about the ffmpeg-devel