Adjusts brightness, contrast, and gamma. This is done using the following transfer function:
- output = ( (input - input_low) / (input_high - input_low) )(1 / gamma) * (output_high - output_low) + output_low
- input_low and input_high determine what input pixel values are treated as pure black and pure white.
- output_low and output_high determine what output values are treated as pure black and pure white.
- gamma controls the degree of non-linearity in the conversion.
This is one of those filters for which it would really be nice to have a GUI. Since we can't offer a GUI (though AvsP does), we at least make this filter compatible with VirtualDub's when the clip is RGB. In that case you should be able to take the numbers from VirtualDub's Levels dialog and pass them as parameters to the Levels filter and get the same results. Unlike VirtualDub's filter however, the input and output parameters can be larger than 255d.
When processing data in YUV mode, Levels only gamma-corrects the luma information, not the chroma. Gamma correction is really an RGB concept, and is only approximated here in YUV. If gamma=1.0 (unity), the filter should have the same effect in both RGB and YUV modes. For adjusting brightness or contrast in YUV mode, it may be better (depending on the effect you are looking for) to use Tweak or ColorYUV, because Levels changes the chroma of the clip.
gamma are non-autoscaling – they must be scaled to the target bit depth.all parameters except
Syntax and Parameters
int input_low, float gamma, int input_high,
int output_low, int output_high
[, bool coring , bool dither ] )
- clip clip = (required)
- Source video.
- int input_low = (required)
- Input values at input_low or lower are treated as black, and lighter colors are darkened proportionally.
- Therefore raising input_low darkens the output.
- float gamma = (required)
- int input_high = (required)
- Input values at input_high or higher are treated as white, and darker colors are brightened proportionally.
- Therefore lowering input_high brightens the output.
- int output_low = (required)
- Dark values brighten to gray as output_low becomes larger.
- int output_high = (required)
- Light values darken to gray as output_high becomes smaller.
- bool coring = true
- When true (the default),
- When false, the conversion takes place according to the transfer function, without any scaling.
|v2.53||added coring (true by default, which reflects the behaviour in older versions)|