Wilbert
27th July 2002, 19:05
I wrote some descriptions for those functions which are not described in the docs. Until they are I will add them to the faq. For some functions I am missing some info, default values, good descriptions, etc. So I hope you can fill in the missing pieces:
AviSynth v1.0b7a, v1.0b7b, v1.0b6:
Greyscale, RGBAdjust, HSIAdjust, Histogram:
Greyscale(clip): Class to convert YUY2 or RGB(in v2.02) video to greyscale.
RGBAdjust(clip, int r, int g, int b, double a): Adjusts colors in RGB space;
Red (r, 0-255, default 1): This option determines how much red is to be scaled. For example, a scale of x 3 multiplies the red channel of each pixel by 3.
Green (g, 0-255, default 1): This option determines how much green is to be scaled. For example, a scale of x 3 multiplies the green channel of each pixel by 3.
Blue (b, 0-255, default 1): This option determines how much blue is to be scaled. For example, a scale of x 3 multiplies the blue channel of each pixel by 3.
a (0-1, default 1) specifies the alpha channel, that is it represents the transparency information on a per-pixel basis. An alpha value of zero represents full transparency, and a value of 1 represents a fully opaque pixel.
Q1) Are the default values correct?
Q2) Is the range of the alpha channel correct?
HSIAdjust(clip, double h, double s, int min, double gamma, int max): Adjusts colors in HSI space;
h (-180.0 to +180.0, default 0.0) is used to adjust the color hue of the image. Positive values shift the image towards red. Negative values shift it towards green.
s (0.0 to 10.0, default 1.0) is used to adjust the color saturation of the image. Values above 1.0 increase the saturation. Values below 1.0 reduce the saturation. Use s=0 to convert to greyscale.
Min (0-255, default 0?) and Max (0-255, default 255?) have the effect of clipping values below or above those luminance values specified from the input and stretching the rest into the range 8-240.
gamma (0-?, default 1.0) specifies the gamma channel. If the overall gamma of an imaging system is 1.0, its output is linearly proportional to its input. This means that the ratio between the intensities of any two areas in the reproduced image will be the same as it was in the original scene. If the gamma is larger than one it means that intensities of any two areas in the reproduced image will be larger as it was in the original scene.
Q1) Are the default values and the ranges correct?
Q2) What is the range of the gamma correction?
Histogram(clip): Adds a histogram (line by line) to the right edge of the image.
AviSynth v2.00/v2.01:
Decomb (Decimate, FieldDeinterlace, Telecide), Tweak, Layer, Mask, MergeLuma, MergeChroma, Generalconvolution:
Decomb and Tweak are implementations of Donalds package, and MergeLuma/MergeChroma are implementations of Klaus Posts plugins and Generalconvolution is an implementation of Richard Bergs plugin.
Telecide(clip, bool reverse, bool swap, bool firstlast, int guide, int gthresh, bool postprocess, int threshold, int dthreshold, bool blend, bool chroma, int y0, int y1, bool debug)
Decimate(clip, int cycle, int mode, int threshold, bool debug)
FieldDeinterlace(clip, bool full, int threshold, int dthreshold, bool blend, bool chroma, bool debug)
# descriptions can be found on Donalds webpage.
Tweak(clip, double hue, double sat, double bright, double cont):
hue (-180.0 to +180.0, default 0.0) is used to adjust the color hue of the image. Positive values shift the image towards red. Negative values shift it towards green.
sat (0.0 to 10.0, default 1.0) is used to adjust the color saturation of the image. Values above 1.0 increase the saturation. Values below 1.0 reduce the saturation. Use sat=0 to convert to greyscale.
bright (-255.0 to 255.0, default 0.0) is used to change the brightness of the image. Positive values increase the brightness. Negative values decrease it.
cont (0.0 to 10.0, default 1.0) is used to change the contrast of the image. Values above 1.0 increase the contrast. Values below 1.0 decrease the contrast.
Layer(source_clip, overlay_clip, string op, int lev, int x, int y, int t, bool chroma): If you set use_chroma to false (or zero) then only the lum information in overlayclip will be applied to
sourceclip. The default is one, or use_chroma=true. There are five methods for applying the overlay: add, subtract, lighten, darken and fast (available in v2.02). These words must be in quotes as a text string. The fast mode takes the average between the two clips.
op ("add", "lighten", "subtract", "darken", "fast", or "multiply", default "add")
lev (0-255, default 255), amount overlay clip will be applied to source_clip .
x (default 0) position of the overlay clip with respect to the source clip.
y (default 0) position of the overlay clip with respect to the source clip.
t (threshold, default 0) ?
(true/false, default true) luma info of overlayclip will be applied to source_clip.
example:
This can be used to combine to captures of different broadcastings for reducing noise. A discussion of this idea can be found here (http://forum.doom9.org/showthread.php?s=&threadid=28438). A sample script (of course you have to ensure that the frames of the two clips matches exactly, use DeleteFrame if necessary):
clip1=AVISource("F:\shakira-underneath_your_clothes.avi")
clip2=AVISource("F:\shakira-underneath_your_clothes2.avi")
clip1=clip1.ConvertToYUY2.TomsMoComp(0,15,1)
clip2=clip2.ConvertToYUY2.TomsMoComp(0,15,1)
clip3=Layer(clip1,clip2,"fast")
Levels(clip3,3,1.03,255,8,240)
Q) What does this threshold "t" do, range, default settings?
Mask(source_clip, mask_clip): Layers are most powerful when used with masks. So, there's a mask() command to go along with layer(). Mask will take an RGB clip and apply the greyscale version of that clip as a mask for the source clip.
MergeLuma(clip1, clip2, float weight): Merges the luma of clip2 to clip1.
weight (0.0-1.0, default 1.0), where 0.0 is no influence and 1.0 will completely overwrite the specified channel.
MergeChroma(clip1, clip2, float weight): Merges the chroma of clip2 to clip1.
weight (0.0-1.0, default 1.0), where 0.0 is no influence and 1.0 will completely overwrite the specified channel.
Generalconvolution(clip, int nBias, string matrix): Applies a convolution to the clip.
nBias (?, default 0)
matrix (3x3 or 5x5, elements 0-256, default ?) the center being the destination pixel processed
example:
# will result with no process at all (destination pixel is 256/256 of source pixel):
generalconvolution(0, "0 0 0
0 256 0
0 0 0")
# will result in a 3x3 blur destination pixel is the sum of all source pixels multiplied by either 28 or 29,
# and then divided by 256:
generalconvolution(0, "28 29 28
29 28 29
28 29 28")
Q1) What does "nBias" do?
Q2) What are the default values?
AviSynth v2.02:
new mathfunctions: Sin(f), Cos(f), Pi (the constant), Log(f) (natural log), Exp(f) (exponential), pow(f1,f2) (f1^f2), Sqrt(f)
# begin example:
clip1=AVISource("background.avi")
clip2=AVISource("overlay.avi")
clip2=clip2.Mask(clip2.BlankClip(color=$FFFFFF))
function CIRCLE(clip clip, clip "LClip", float "angle") {
return clip.Layer(LClip, "Add", 192, round((clip.width-LClip.width)/2 + cos(angle)*100),
\ round((clip.height-LClip.height)/2 + sin(angle)*100) )
}
Animate(0, 1000, "CIRCLE", clip1, clip2, 0, clip1, clip2, Pi*16)
# end example
Loop(clip, int times, int start, int end): Applies a loop to clip, repeats frame start to frame end times times before going on.
times (default -1) is the number of times the loop is applied.
start (default 0) the frame of the clip where the loop starts.
start (default framecount(clip)) the frame of the clip where the loop ends.
Loop() # make the clip loop (almost) endlessly
Loop(10) # make the clip loop ten times
Loop(10,20,29) # repeat frames 20 to 29 ten times before going on
# actual clip duration increased by 90 frames
Loop(0,20,29) # delete frames 20 to 29
# actual clip duration decreased by 10 frames
Loop(-1,20,29) # frame 20 to 29 is repeated (almost) infinite times
I hope I didn't forget anything ...
AviSynth v1.0b7a, v1.0b7b, v1.0b6:
Greyscale, RGBAdjust, HSIAdjust, Histogram:
Greyscale(clip): Class to convert YUY2 or RGB(in v2.02) video to greyscale.
RGBAdjust(clip, int r, int g, int b, double a): Adjusts colors in RGB space;
Red (r, 0-255, default 1): This option determines how much red is to be scaled. For example, a scale of x 3 multiplies the red channel of each pixel by 3.
Green (g, 0-255, default 1): This option determines how much green is to be scaled. For example, a scale of x 3 multiplies the green channel of each pixel by 3.
Blue (b, 0-255, default 1): This option determines how much blue is to be scaled. For example, a scale of x 3 multiplies the blue channel of each pixel by 3.
a (0-1, default 1) specifies the alpha channel, that is it represents the transparency information on a per-pixel basis. An alpha value of zero represents full transparency, and a value of 1 represents a fully opaque pixel.
Q1) Are the default values correct?
Q2) Is the range of the alpha channel correct?
HSIAdjust(clip, double h, double s, int min, double gamma, int max): Adjusts colors in HSI space;
h (-180.0 to +180.0, default 0.0) is used to adjust the color hue of the image. Positive values shift the image towards red. Negative values shift it towards green.
s (0.0 to 10.0, default 1.0) is used to adjust the color saturation of the image. Values above 1.0 increase the saturation. Values below 1.0 reduce the saturation. Use s=0 to convert to greyscale.
Min (0-255, default 0?) and Max (0-255, default 255?) have the effect of clipping values below or above those luminance values specified from the input and stretching the rest into the range 8-240.
gamma (0-?, default 1.0) specifies the gamma channel. If the overall gamma of an imaging system is 1.0, its output is linearly proportional to its input. This means that the ratio between the intensities of any two areas in the reproduced image will be the same as it was in the original scene. If the gamma is larger than one it means that intensities of any two areas in the reproduced image will be larger as it was in the original scene.
Q1) Are the default values and the ranges correct?
Q2) What is the range of the gamma correction?
Histogram(clip): Adds a histogram (line by line) to the right edge of the image.
AviSynth v2.00/v2.01:
Decomb (Decimate, FieldDeinterlace, Telecide), Tweak, Layer, Mask, MergeLuma, MergeChroma, Generalconvolution:
Decomb and Tweak are implementations of Donalds package, and MergeLuma/MergeChroma are implementations of Klaus Posts plugins and Generalconvolution is an implementation of Richard Bergs plugin.
Telecide(clip, bool reverse, bool swap, bool firstlast, int guide, int gthresh, bool postprocess, int threshold, int dthreshold, bool blend, bool chroma, int y0, int y1, bool debug)
Decimate(clip, int cycle, int mode, int threshold, bool debug)
FieldDeinterlace(clip, bool full, int threshold, int dthreshold, bool blend, bool chroma, bool debug)
# descriptions can be found on Donalds webpage.
Tweak(clip, double hue, double sat, double bright, double cont):
hue (-180.0 to +180.0, default 0.0) is used to adjust the color hue of the image. Positive values shift the image towards red. Negative values shift it towards green.
sat (0.0 to 10.0, default 1.0) is used to adjust the color saturation of the image. Values above 1.0 increase the saturation. Values below 1.0 reduce the saturation. Use sat=0 to convert to greyscale.
bright (-255.0 to 255.0, default 0.0) is used to change the brightness of the image. Positive values increase the brightness. Negative values decrease it.
cont (0.0 to 10.0, default 1.0) is used to change the contrast of the image. Values above 1.0 increase the contrast. Values below 1.0 decrease the contrast.
Layer(source_clip, overlay_clip, string op, int lev, int x, int y, int t, bool chroma): If you set use_chroma to false (or zero) then only the lum information in overlayclip will be applied to
sourceclip. The default is one, or use_chroma=true. There are five methods for applying the overlay: add, subtract, lighten, darken and fast (available in v2.02). These words must be in quotes as a text string. The fast mode takes the average between the two clips.
op ("add", "lighten", "subtract", "darken", "fast", or "multiply", default "add")
lev (0-255, default 255), amount overlay clip will be applied to source_clip .
x (default 0) position of the overlay clip with respect to the source clip.
y (default 0) position of the overlay clip with respect to the source clip.
t (threshold, default 0) ?
(true/false, default true) luma info of overlayclip will be applied to source_clip.
example:
This can be used to combine to captures of different broadcastings for reducing noise. A discussion of this idea can be found here (http://forum.doom9.org/showthread.php?s=&threadid=28438). A sample script (of course you have to ensure that the frames of the two clips matches exactly, use DeleteFrame if necessary):
clip1=AVISource("F:\shakira-underneath_your_clothes.avi")
clip2=AVISource("F:\shakira-underneath_your_clothes2.avi")
clip1=clip1.ConvertToYUY2.TomsMoComp(0,15,1)
clip2=clip2.ConvertToYUY2.TomsMoComp(0,15,1)
clip3=Layer(clip1,clip2,"fast")
Levels(clip3,3,1.03,255,8,240)
Q) What does this threshold "t" do, range, default settings?
Mask(source_clip, mask_clip): Layers are most powerful when used with masks. So, there's a mask() command to go along with layer(). Mask will take an RGB clip and apply the greyscale version of that clip as a mask for the source clip.
MergeLuma(clip1, clip2, float weight): Merges the luma of clip2 to clip1.
weight (0.0-1.0, default 1.0), where 0.0 is no influence and 1.0 will completely overwrite the specified channel.
MergeChroma(clip1, clip2, float weight): Merges the chroma of clip2 to clip1.
weight (0.0-1.0, default 1.0), where 0.0 is no influence and 1.0 will completely overwrite the specified channel.
Generalconvolution(clip, int nBias, string matrix): Applies a convolution to the clip.
nBias (?, default 0)
matrix (3x3 or 5x5, elements 0-256, default ?) the center being the destination pixel processed
example:
# will result with no process at all (destination pixel is 256/256 of source pixel):
generalconvolution(0, "0 0 0
0 256 0
0 0 0")
# will result in a 3x3 blur destination pixel is the sum of all source pixels multiplied by either 28 or 29,
# and then divided by 256:
generalconvolution(0, "28 29 28
29 28 29
28 29 28")
Q1) What does "nBias" do?
Q2) What are the default values?
AviSynth v2.02:
new mathfunctions: Sin(f), Cos(f), Pi (the constant), Log(f) (natural log), Exp(f) (exponential), pow(f1,f2) (f1^f2), Sqrt(f)
# begin example:
clip1=AVISource("background.avi")
clip2=AVISource("overlay.avi")
clip2=clip2.Mask(clip2.BlankClip(color=$FFFFFF))
function CIRCLE(clip clip, clip "LClip", float "angle") {
return clip.Layer(LClip, "Add", 192, round((clip.width-LClip.width)/2 + cos(angle)*100),
\ round((clip.height-LClip.height)/2 + sin(angle)*100) )
}
Animate(0, 1000, "CIRCLE", clip1, clip2, 0, clip1, clip2, Pi*16)
# end example
Loop(clip, int times, int start, int end): Applies a loop to clip, repeats frame start to frame end times times before going on.
times (default -1) is the number of times the loop is applied.
start (default 0) the frame of the clip where the loop starts.
start (default framecount(clip)) the frame of the clip where the loop ends.
Loop() # make the clip loop (almost) endlessly
Loop(10) # make the clip loop ten times
Loop(10,20,29) # repeat frames 20 to 29 ten times before going on
# actual clip duration increased by 90 frames
Loop(0,20,29) # delete frames 20 to 29
# actual clip duration decreased by 10 frames
Loop(-1,20,29) # frame 20 to 29 is repeated (almost) infinite times
I hope I didn't forget anything ...