PDA

View Full Version : U and V limit when applying big gain ?


fjhdavid
16th May 2009, 16:03
Dear all,

When you want to apply a:

ColoYUV(gain_u=100,off_u=-50)

you can't do it because, when you first apply the gain, u will be greater than 240 (or 255), an you will be clamp.

what could be a solution?

thanks
Francois

Gavino
16th May 2009, 23:12
Perhaps I have misunderstood your question, but my understanding is that values are clamped only after the effect of all parameters has been calculated, and not on any intermediate values.

Can you give an example with a specific input value, stating what you want the result to be and how the actual result differs?

fjhdavid
18th May 2009, 13:00
Does someone can confirm that Y,U,V are clamped only after the effect of all parameters has been calculated, or are you sure already about that?

I didn't do any test right now....

J_Darnley
18th May 2009, 13:46
Uh, ColorYUV doesn't clamp/clip/limit to TV-range unless you tell it to. Try with Histogram(mode="Color") so see what is going on.

[EDIT]Oh, right, I get it now. From a quick test I guess all the parameters are applied together and possibly create an intermediate picture which is then output into the range that you want. This could be checked by looking at the source.

Pics to follow.

[EDIT2]
ColorYUV(gain_u=2000, off_u=-750): http://users.telenet.be/darnley/avisynth/coloryuv_gain_u_2000_off_u_-750_000600.png
ColorYUV(off_u=-750, gain_u=2000): http://users.telenet.be/darnley/avisynth/coloryuv_off_u_-750_gain_u_2000_000600.png

They are identical.

[EDIT3] From reading the source, this appears to use a LUT and the output values are calculated as doubles, rounded to ints and then clamped/clipped to unsigned chars