ColorKeyFrame - linear interpolation of color correction with key frames.
The plugin is similar and based on ColorYUV
AviSynth filter.
In Avisynth it is a hard to set different color correction for various part of clip, especially smoothly varying correction.
(the Animate function is not very convenient).
There are two functions in new plugin: ColorKeyFrame and ColorInterpolate. Several ColorKeyFrame commands can be used to define color correction data for some given frames (key frames). ColorInterpolate function make color correction by given values at key frames and smooth transition of color correction between key frames by linear interpolation of the color correction data. If you define exactly one key frame, the color correction by ColorInterpolation will be uniform for whole clip, just as ColorYUV.
Plugin uses some hack of Avisynth interface to transmit its setting (the similar method is used by DGDecode, IVTC, DePan, MVTools, etc). Output of ColorKeyFrame function is special clip with color correction data (for given key frame and previous key frames) in framebuffer. This output can be used as a source for next call of ColoKeyFrame for defining of correction of some other key frame, and so on. Finally the output of last ColorKeyFrame is used as second input clip (keys) for ColorInterpolation function to interpolate the color correction.
ColorKeyFrame
(clip, int "frame",
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")
first parameter is the source clip or keys data clip from previous ColorKeyFrame function.
frame is key frame number with given color correction data
Other ColorKeyFrame
parameters are from ColorYUV
AviSynth filter.
All settings for this filter are optional. All values are defaulting to "0".
gain, off, gamma and cont can be set independent on each channel.
gain is a multiplier for the value, and it stretches the signal up from the bottom. In order to confuse you, in the filter Tweak this setting is called contrast. That means that if the gain is set to 0, it preserves the values as they are. When gain is 256 all values are multiplied by 2 (twice as bright). If the gain is 512 all values are multiplied by 3. Thus if gain = k*256 for some integer k then Y becomes (k+1)*Y (idem for the chroma). Although it is possible, it doesn't make sense to apply this setting to the chroma of the signal.
off (offset) adds a value to the luma or chroma values. An offset set to 16 will add 16 to the pixel values. An offset of -32 will subtract 32 from all pixel values.
gamma adjusts gamma of the specified channel. A gamma value of 0 is the same as gamma 1.0. When gamma is set to 256 it is the same as gamma 2.0. Gamma is valid down to -256, where it is the same as gamma 0.0.
cont (contrast) is also multiplier for the value, and it stretches the signal out from the center. That means that if the contrast is set to 0, it preserves the values as they are. When the contrast is 256 all values are multiplied by 2 (twice as bright). If the contrast is 512 all values are multiplied by 3. Thus if cont = k*256 for some integer k (and zero gain) then Y becomes Y + k*(Y-128) (idem for the chroma). Although it is possible, it doesn't make sense to apply this setting to the luma of the signal.
ColorInterpolate
(clip, clip "keys")
first parameter is the source clip.
keys is special keys data clip with color correction data (the output of ColorKeyFrame function)
loadplugin("Colorkeyframe.dll") avisource("g:\test.avi") converttoyv12() source=last # copy source Colorkeyframe(0,off_y=0, gain_y=0) # set null correction for frame 0 of source clip ColorKeyFrame(60,off_y=64, gain_y=10) # set big luma correction for frame 60 Colorkeyframe(362,off_y=0, gain_y=0) # set null correction for frame 362 ColorInterpolate(source,keys=last) # make correction of source clip with data from keys (last) clip
The same example with other syntax
loadplugin("Colorkeyframe.dll") avisource("g:\test.avi") converttoyv12() keys=Colorkeyframe(0,off_y=0, gain_y=0) # set null correction for frame 0 of source clip keys=keys.ColorKeyFrame(60,off_y=64, gain_y=10) # set big luma correction for frame 60 keys=keys.Colorkeyframe(362,off_y=0, gain_y=0) # set null correction for frame 362 ColorInterpolate(keys=keys) # make correction of source clip with data from keys (last) clip
This plugin is free software released under the GNU GPL license. See file gpl.txt.
Version 0.1 (17.04.2007)
Version 0.2 (21.04.2007)
Version 0.3 (25.09.2010)