Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
26th May 2011, 20:01 | #1 | Link |
Registered User
Join Date: Apr 2007
Posts: 240
|
GiCoCu / YUV question - how to add a luma curve properly?
I'd like to add a luma curve to a video (I mean not touching the colors just making the pixels darker or brighter).
I have this little sample script: Code:
LoadPlugin("GiCoCu.dll") ImageReader("td_samp.png") AddLumaCurve("full_flat.amp") # Photoshop curve with full zeros Function AddLumaCurve(clip src, string curve) {# src ConvertToRGB32 MergeChroma(GiCoCU(curve,photoshop=true).ConvertToYUY2,last.ConvertToYUY2) ConvertToYV12 Return(last) } The curve (here: full_flat.amp) I'm using here is full of zeros, meaning it should make all the 0..255 values to zeros. (Of course I will never be using a flat curve, it's just for testing.) So theoretically the end result would be full black. It isn't: I have ran into this before and I know it's YUV colorspace behavior and it's because U and V chroma planes are left untouched, but I just can't find the solution to elude the problem. It must be some GreyScale(), ShowRed/Green/Blue and MergeChroma/Luma trick and not even an extremely complicated one, but I'm playing around for hours now and can't figure it out. Can someone help me out? Thanks in advance. |
26th May 2011, 22:09 | #2 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
edit:
Mergeluma(AddLumaCurve("full_flat.amp")) ?
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread |
26th May 2011, 23:38 | #3 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Modifying luma without regard to chroma as well can result in out of gamut values.
For example if Y=16, then U=128 and V=128 are the only valid in gamut values. Out of gamut values have undefined behaviour when converted back to RGB for eventual display. Avisynth just clamps the individual R, G or B channels to be between 0 and 255 without regard to maintaining either luma, hue or saturation. See U and V ranges for valid RGB and Understanding YUV, Luma, Luminance for a discussion about this. |
28th May 2011, 11:33 | #4 | Link | |
Registered User
Join Date: Apr 2007
Posts: 240
|
Doesn't help. It's trickier than that.
Quote:
How can I take the luma from one clip, the chroma from another clip and merge them together without having the side effects above? Is this calls for some lookup table for the invalid pixels, or is it simpler? |
|
Tags |
curve, gicocu, luma, yuv |
|
|