User:Raffriff42/sandbox
From Avisynth wiki
Template test; variant of Template:Par2b;
Rationale: see Talk:ColorYUV
Syntax and Parameters
ColorYUV(clip [, float gain_y] [, float off_y] [, float gamma_y] [, float cont_y] [, float gain_u] [, float off_u] [, float gamma_u] [, float cont_u] [, float gain_v] [, float off_v] [, float gamma_v] [, float cont_v] [, string levels] [, string opt] [, boolean showyuv] [, boolean analyze] [, boolean autowhite] [, boolean autogain] [, boolean conditional])
- clip =
- Input clip
- float gain_y = 0
- float gain_u = 0
- float gain_v = 0
- A multiplier for the value which for positive values stretches the signal up from the bottom and for negative values it shrinks the signal up from the bottom. When gain_X is set to -128, all values are multiplied by 0.5. When gain_X is set to 0, it preserves the values as they are. When gain_X is 256, all values are multiplied by 2 (twice as bright). When gain_X is set to 512 all values are multiplied by 3. Thus when gain_X = k*256 for some value k then Y becomes (k+1)*Y (idem for the chroma). gain_X is valid down to -256, where the signal is set to 0.
- Although it is possible, it doesn't make sense to apply this setting to the chroma of the signal.
- In order to confuse you, in the filter Tweak this setting is called contrast.
- A multiplier for the value which for positive values stretches the signal up from the bottom and for negative values it shrinks the signal up from the bottom. When gain_X is set to -128, all values are multiplied by 0.5. When gain_X is set to 0, it preserves the values as they are. When gain_X is 256, all values are multiplied by 2 (twice as bright). When gain_X is set to 512 all values are multiplied by 3. Thus when gain_X = k*256 for some value k then Y becomes (k+1)*Y (idem for the chroma). gain_X is valid down to -256, where the signal is set to 0.
- float off_y = 0
- float off_u = 0
- float off_v = 0
- Adds an offset (a value) to the luma or chroma values. An off_X of 16 will add 16 to all pixel values. An off_X of -32 will subtract 32 from all pixel values.
- float gamma_y = 0
- float gamma_u = 0
- float gamma_v = 0
- Adjusts gamma of the specified channel as X^(1/g) where g=(gamma_X+256)/256. When gamma_X is set to 0, it applies a gamma of 1.0. When gamma_X is set to 256, it applies a gamma of 2.0. gamma_X is valid down to -256, where a minimal gamma of 0.01 is applied.
- Note: gamma for chroma is not implemented (gamma_u and gamma_v are dummy parameters).
- Adjusts gamma of the specified channel as X^(1/g) where g=(gamma_X+256)/256. When gamma_X is set to 0, it applies a gamma of 1.0. When gamma_X is set to 256, it applies a gamma of 2.0. gamma_X is valid down to -256, where a minimal gamma of 0.01 is applied.
- float cont_y = 0
- float cont_u = 0
- float cont_v = 0
- Like gain_X, a multiplier for the value, but for positive values cont_X stretches the signal out from the center and for negative values it shrinks the signal trowards the center. This is most useful for the chroma components, where it translates to saturation. When cont_X is set to -128, all values (taken from the center) are multiplied by 0.5. When cont_X is set to 0, it preserves the values as they are. When cont_X is set to 256, all values (taken from the center) are multiplied by 2 (for Y, twice as much contrast; for U and V, twice as saturated). When cont_X is set to 512, all values (taken from the center) are multiplied by 3. Thus when cont_X = (k-1)*256 for some value k (and zero gain) then U becomes 128 + k*(U-128) (and V likewise). cont_X is valid down to -256, where the signal is set to 128.
- Although it is possible, it doesn't make sense to apply this setting to the luma of the signal.
- Like gain_X, a multiplier for the value, but for positive values cont_X stretches the signal out from the center and for negative values it shrinks the signal trowards the center. This is most useful for the chroma components, where it translates to saturation. When cont_X is set to -128, all values (taken from the center) are multiplied by 0.5. When cont_X is set to 0, it preserves the values as they are. When cont_X is set to 256, all values (taken from the center) are multiplied by 2 (for Y, twice as much contrast; for U and V, twice as saturated). When cont_X is set to 512, all values (taken from the center) are multiplied by 3. Thus when cont_X = (k-1)*256 for some value k (and zero gain) then U becomes 128 + k*(U-128) (and V likewise). cont_X is valid down to -256, where the signal is set to 128.
- string levels = ""
- Can be set to either "TV->PC" or "PC->TV". This will perform a range conversion. Normally YUV values are not mapped from 0 to 255 (PC range), but a limited range (TV range). This performs conversion between the two formats. If no parameter is specified, no conversion will be made (default operation).
- string opt = ""
- Can be either "coring" or "" (nothing, default setting). Specifying "coring" will clip your YUV values to the valid TV-ranges. Otherwise "invalid results" will be accepted.
- bool showYUV = false
- If true, this option will overwrite your image with a new 448x448 image showing all chroma values along the two axes. This can be useful if you need to adjust the color of your image, but need to know how the colors are arranged. At the topleft of the image, the chroma values are '16'. At the right side of the image, U is at maximum. At the bottom of the screen V is at its maximum. In the middle both chroma is 128 (or grey). See example image below.
- bool analyze = false
- If true, this option will print out color statistics on the screen. There are maximum and minimum values for all channels. There is an average for all channels. There is a "loose maximum" and "loose minimum". The "loose" values are made to filter out very bright or very dark noise creating an artificially low or high minimum / maximum.
- bool autowhite = false
- If true, this option will use the information from the analyzer, and attempt to center the color offsets. If you have recorded some material, where the colors are shifted toward one color, this filter may help. But be careful - it isn't very intelligent - if your material is a clear blue sky, autowhite will make it completely grey! If you add "off_u" or "off_v" parameters at the same time as autowhite, they will not be used!
- bool autogain = false
- If true, this option will use the information from the analyzer, and attempt to create as good contrast as possible. That means, it will scale up the Y (luma) values to match the minimum and maximum values. This will make it act like an "autogain" setting on cameras, amplifying dark scenes very much, while leaving scenes with good contrast alone. Some places this is also refered to as "autolevels".
- bool conditional = false
- If false, this option will ignore any given conditional variables. See the Conditional Variables section for an overview of the conditional variables and their use with ColorYUV.