User:Raffriff42/Utils-r41 Quick Reference
This list serves only as a quick reference; see the Utils-r41.avsi source for full documentation.
Contents |
String functions
SplitLines(string s, [int lastcol, int cc])
- Split long lines for Subtitle line wrap
TrimLeft(string s)
- SplitLines helper – trim spaces from left side of string
GetNameFromPath(string path)
- Given a valid file path, get the filename only
GetParentFolder(string path)
- Given a valid file path, get the parent folder path
Numeric functions
_mod(int m, float f)
- Return argument f as integer and ensure it is modulo m
StrinF(float f, [int decimals])
- Format a Float as a String with (by default) 2 decimals
Hex2(int i)
- Hex with leading "0" if less than 2 chars long
IsReallyFloat(val v)
- Bugfixed IsFloat
MakeYUVColor(float y, float u, float v, [float a])
- Given Y, U, V [, A], return an Avisynth color_yuv
MakeRGBColor(float r, [float g, float b, float a])
- Given R, G, B [, A], return an Avisynth color
transparent_color(float a, int color)
- Given Avisynth color, set its transparency
f2c(float f)
- Scale "normal" float arguments to ColorYUV's gain_x, gamma_x & cont_x
_gcd(int x, int y)
- MatchAudioFormat helper – Greatest Common Divisor
CalcWidth(clip C, int new_hgt, [int mod, int lim])
- Given new height, calulate new width, preserving aspect ratio
CalcHeight(clip C, int new_wid, [int mod, int lim])
- Given new width, calulate new height, preserving aspect ratio
Deep color argument scaling functions
getTVBlack(int bits)
- Return TV-black level for given bit depth
getFullscale(int bits)
- Return integer fullscale value for given bit depth (mostly internal use)
scff(int fs_in, int fs_out, float f, [bool cx])
- Scale a value from one fullscale range to another
scbf(int bits_in, int bits_out, float f, bool cx])
- Scale a value from one bit depth to another
scbx(int bits_in, int bits_out, float f)
- Scale a value from one bit depth to another; clamp output
scbs(int bits_in, int bits_out, float f, [int decimals])
- Scale a value from one bit depth to another; string result
sc8f(clip T, float f, [bool cx])
- Scale an 8-bit value for target clip T
sc8x(clip T, float f)
- Scale an 8-bit value for target clip T; clamp output
sc8s(clip T, float f, [int decimals])
- Scale an 8-bit value for target clip T; string result
Utility filters
ToRGB(clip C [, string matrix, int bits_out, clip A] )
- Convert from anything to planar RGB(A); YUV>RGB conversions always done at 16-bit
To444(clip C [, string matrix, int bits_out, clip A] )
- Convert from anything to YUV(A)444; RGB>YUV conversions always done at 16-bit
To16bit(clip C [, clip A] )
- Convert from anything to 'best' equivalent 16-bit version (keep RGB, 444, etc)
To8bit(clip C [, bool dither] )
- Convert from anything to 'best' (v2.6x compatible) equivalent 8-bit version
ToVdubFM(clip C)
- Make changes needed to display on VirtualDub FilterMod
MatchColorFormat(clip C, clip T, [string matrix, bool matchbits, bool dither])
- Match color format of source C to template T
MatchAudioFormat(clip C, clip T, [bool allowresample])
- Match audio properties of source C to template T
GBR2YUV(clip C, [bool yuva])
- Transport RGB in YV24 – G=>Y, B=>U, R=>V
YUV2GBR(clip C, [clip A, bool rgb32])
- Transport YV24 in RGB – Y=>G, U=>B, V=>R
PC2TV(clip C)
TV2PC(clip C(
stack_to_wid(clip C, int wid, [clip R, bool flip])
- Stack clip C horizontally until it is at least wid wide
stack_to_hgt(clip C, int hgt, [clip R, bool flip])
- Stack clip C vertically until it is at least hgt high
stack_to_size(clip C, int wid, int hgt, [bool flip])
- Stack clip C until it is wid x hgt
remove_gamma(clip C, [bool enable, int mode])
- Remove gamma transfer function (if bit depth > 8) for linear-light processing.
restore_gamma(clip C, [bool enable, int mode])
- Apply standard gamma transfer function (if bit depth > 8)
Color and overlay filters
LevelsPlus(clip C,
int input_low, float gamma, int input_high,
int output_low, int output_high,
bool coring, bool dither )
- Scale 0-255 Levels arguments to current bit depth
OverlayAligned(clip base, clip over,
[int x, int y, clip mask, float opacity, string mode,
bool greymask, string output, bool ignore_conditional,
bool pc_range, int align, int borderwidth, int bordercolor])
- Overlay with support for align parameter and adding borders/letterboxing to inset clip
Timeline filters
Slip(clip C, int offset)
- "Slip" a clip in time.
ChangeSpeed(
clip C, float factor, [bool pitchfix, bool noblend])
ChangeAudioSpeed(
clip C, float factor, [bool pitchfix])
- Change speed over a wide range with frame blending in fast forward by default.
Crop, resize and transform filters
Cropa(clip C, int x, int y, int wid, int hgt, [bool align, int mod])
Cropd(clip C, int x, int y, int wid, int hgt, [bool align, int mod])
ScaleSize(clip C, float factor, int mod,
[string sm, string med, string lg,
float thrSm, float thrLg, bool fade, bool ident, bool gamma])
ScaleSize(clip C, float fwid, float fhgt, int mod,
[string sm, string med, string lg,
float thrSm, float thrLg, bool fade, bool ident, bool gamma])
- Switch (or fade) between three Resize clips depending on scale factor
- Calls 'private' resizers ScaleSize_small, ScaleSize_medium and ScaleSize_large by default, but you can specify other resizers.
CropPanTilt(clip C, int wid, int hgt, [float pan, float tilt])
- Crop to size with smooth animated pan & tilt, expressed as percentage (center @ pan=0, tilt=0)
CropShift(clip C, int wid, int hgt, [float off_x, float off_y])
- Crop to size with smooth animated pan & tilt, expressed as pixels (center @ off_x=0, off_y=0)
CropEx(clip C, float wid, float hgt, [int mod,
int border, string mode, bool debug])
- Symmetrically crop or expand a clip to ensure it is a certain size, with size forced to mod-4, mod-8 etc
Shift(clip C, float offh, float offv)
- Shift a clip up-down and left-right (sub-pixel precision);
ShiftUV(clip C, [float ux, float uy, float vx, float vy])
- Shift Chroma relative to Luma
ShiftRedBlue(clip C,
[float rx, float ry,
float bx, float by,
float rxd, float ryd,
float bxd, float byd])
- Shift and/or resize Red and Blue relative to Green
- float rxd, ryd, bxd, byd = 0.0
- "delta" width & height
Debugging filters
bigsub(clip C, string s, [, float sizeMult, bool enable])
- For clip identification – show a semitransparent text string, very large by default
EvalShow(clip C, string s, [bool bypass, float size, int align])
- Execute a script snippet; show script & result on screen
ShowMask(clip C, clip M, [string mode, float opacity])
- Show a mask clip overlaid on another clip for visualization
- string mode = ""
- One of
(""|"luma"|"cyan")
- One of
ColorbarsHD2(clip T, [float tonedb])
ColorbarsHD2([int width, int height, bool rgb_out,
int bits_out, int bits_gen, bool dither, float tonedb])
- ColorBarsHD with optional RGB & deep color output; size & audio level changes
- (1280x720, TV-range, 29.97 fps, 1 hour long, audio tone @ -18dB, 48kz float)
Grayramp(clip T, [int height, bool dither])
Grayramp([int width, int height, bool rgb_out, int bits_out, bool dither])
- Return grayscale ramp
VideoScopes(clip C, [bool shrink, bool vector, string matrix, bool parade])
- Show waveform on top plus optional vectorscope; accepts RGB.
Analyze(clip C)
- Print color channel statistics on the screen; auto RGB / YUV (cf. ColorYUV(analyze=true)
HistogramOverlay(clip B, clip F, [bool "autocrop", int "align",
int "x", int "y", int "wid", int "hgt", int "margin",
float "opacity", string "mode", bool "pc_range")])
- Overlay a user-supplied histogram clip
HistogramTurn(clip C)
- Classic Histogram, waveform on top
Histogram8(clip C, [string mode, float factor])
- 8-bit Histogram for deep color
ShowChannels(clip C, [bool analyze])
- Show original & 3 channels in quad split
ShowFrameNumberAligned(
clip C, [bool scroll, int offset,
float x, float y, string font, int size,
int text_color, int halo_color,
float font_width, float font_angle,
float opacity, int align])
- ShowFrameNumber with support for opacity and align
StackTwoAcrossCropped(clip A, clip B, [clip S,
int border, float pan, int wid,
string titleA, string titleB, int align])
- Make side-by-side split clip (normally, for comparison or preview purposes)
Changes
v0.41 May-2017 | Published |