User:Raffriff42/Utils-r41 Quick Reference

From Avisynth wiki
< User:Raffriff42(Difference between revisions)
Jump to: navigation, search
m (remove dead scnf)
m (update)
Line 109: Line 109:
 
=== Utility filters ===
 
=== Utility filters ===
 
----
 
----
{{FuncDefH4|Cropd}}
 
{{FuncDef|Cropd(clip C, int x, int y, int wid, int hgt, [bool ''align'', int ''mod''])}}
 
: Show a diagnostic string on [[Crop]] failure; optionally enforce [[Mod]]
 
 
 
{{FuncDefH4|MatchColorFormat}}
 
{{FuncDefH4|MatchColorFormat}}
 
{{FuncDef|MatchColorFormat(clip C, clip T, [string ''matrix'', bool ''matchbits'', bool ''dither''])}}
 
{{FuncDef|MatchColorFormat(clip C, clip T, [string ''matrix'', bool ''matchbits'', bool ''dither''])}}
Line 182: Line 178:
 
=== Crop, resize and transform filters ===
 
=== Crop, resize and transform filters ===
 
----
 
----
 +
{{FuncDefH4|Cropd}}
 +
{{FuncDef|Cropd(clip C, int x, int y, int wid, int hgt, [bool ''align'', int ''mod''])}}
 +
: Show a diagnostic string on [[Crop]] failure; optionally enforce [[Mod]]
 +
 
{{FuncDefH4|ScaleSize}}
 
{{FuncDefH4|ScaleSize}}
 
{{FuncDef|ScaleSize(clip C, float factor, int mod, <br>
 
{{FuncDef|ScaleSize(clip C, float factor, int mod, <br>
Line 243: Line 243:
  
 
{{FuncDefH4|ColorbarsHD2}}
 
{{FuncDefH4|ColorbarsHD2}}
{{FuncDef|ColorbarsHD2([int ''width'', int ''height'', bool ''rgb_out'', int ''bits_out'', bool ''dither''])}}
+
{{FuncDef|ColorbarsHD2(clip T, [float ''tonedb''])}} <br>
: Return [[ColorBarsHD]] with small changes (1280x720, TV-range, 29.97 fps, 1 hour long, audio tone @ -18dB, 48kz)
+
{{FuncDef|ColorbarsHD2([int ''width'', int ''height'', bool ''rgb_out'', <br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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)
  
 
{{FuncDefH4|Grayramp}}
 
{{FuncDefH4|Grayramp}}

Revision as of 12:02, 15 May 2017

This list serves only as a quick reference; see the Utils-r41.avsi source for full documentation.

Contents


String functions


SplitLines

SplitLines(string s, [int lastcol, int cc])

Split long lines for Subtitle line wrap

TrimLeft

TrimLeft(string s)

SplitLines helper – trim spaces from left side of string

GetNameFromPath

GetNameFromPath(string path)

Given a valid file path, get the filename only

GetParentFolder

GetParentFolder(string path)

Given a valid file path, get the parent folder path

Numeric functions


_mod

_mod(int m, float f)

Return argument f as integer and ensure it is modulo m

StrinF

StrinF(float f, [int decimals])

Format a Float as a String with (by default) 2 decimals

Hex2

Hex2(int i)

Hex with leading "0" if less than 2 chars long

IsReallyFloat

IsReallyFloat(val v)

Bugfixed IsFloat

MakeYUVColor

MakeYUVColor(float y, float u, float v, [float a])

Given Y, U, V [, A], return an Avisynth color_yuv

MakeRGBColor

MakeRGBColor(float r, [float g, float b, float a])

Given R, G, B [, A], return an Avisynth color

transparent_color

transparent_color(float a, int color)

Given Avisynth color, set its transparency

f2c

f2c(float f)

Scale "normal" float arguments to ColorYUV's gain_x, gamma_x & cont_x

_gcd

_gcd(int x, int y)

MatchAudioFormat helper – Greatest Common Divisor

CalcWidth

CalcWidth(clip C, int new_hgt, [int mod, int lim])

Given new height, calulate new width, preserving aspect ratio

CalcHeight

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

getTVBlack(int bits)

Return TV-black level for given bit depth

getFullscale

getFullscale(int bits)

Return integer fullscale value for given bit depth (mostly internal use)

scff

scff(int fs_in, int fs_out, float f, [bool cx])

Scale a value from one fullscale range to another

scbf

scbf(int bits_in, int bits_out, float f, bool cx])

Scale a value from one bit depth to another

scbx

scbx(int bits_in, int bits_out, float f)

Scale a value from one bit depth to another; clamp output

scbs

scbs(int bits_in, int bits_out, float f, [int decimals])

Scale a value from one bit depth to another; string result

sc8f

sc8f(clip T, float f, [bool cx])

Scale an 8-bit value for target clip T

sc8x

sc8x(clip T, float f)

Scale an 8-bit value for target clip T; clamp output

sc8s

sc8s(clip T, float f, [int decimals])

Scale an 8-bit value for target clip T; string result

Utility filters


MatchColorFormat

MatchColorFormat(clip C, clip T, [string matrix, bool matchbits, bool dither])

Match color format of source C to template T

MatchAudioFormat

MatchAudioFormat(clip C, clip T, [bool allowresample])

Match audio properties of source C to template T

GBR2YUV

GBR2YUV(clip C, [bool yuva])

Transport RGB in YV24 – G=>Y, B=>U, R=>V

YUV2GBR

YUV2GBR(clip C, [clip A, bool rgb32])

Transport YV24 in RGB – Y=>G, U=>B, V=>R

stack_to_wid

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

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

stack_to_size(clip C, int wid, int hgt, [bool flip])

Stack clip C until it is wid x hgt

remove_gamma

remove_gamma(clip C, [bool enable])

Remove gamma transfer function (if bit depth > 8) for linear-light processing.

restore_gamma

restore_gamma(clip C, [bool enable])

Apply standard gamma transfer function (if bit depth > 8)

Color and overlay filters


LevelsPlus

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

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

Slip(clip C, int offset)

"Slip" a clip in time.

ChangeSpeed

ChangeSpeed(
      clip C, float factor, [bool pitchfix, bool noblend])

ChangeAudioSpeed

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


Cropd

Cropd(clip C, int x, int y, int wid, int hgt, [bool align, int mod])

Show a diagnostic string on Crop failure; optionally enforce Mod

ScaleSize

ScaleSize(clip C, float factor, int mod,
      [string sm, string med, string lg,
      int thrSm, int thrLg, bool fade, bool ident])

ScaleSize(clip C, float fwid, float fhgt, int mod,
      [string sm, string med, string lg,
      int thrSm, int thrLg, bool fade, bool ident])

Switch (or fade) between three Resize clips depending on scale factor

CropPanTilt

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

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

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

Shift(clip C, float offh, float offv)

Shift a clip up-down and left-right (sub-pixel precision);

ShiftUV

ShiftUV(clip C, [float ux, float uy, float vx, float vy])

Shift Chroma relative to Luma

ShiftRedBlue

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

bigsub(clip C, string s, [, float sizeMult, bool enable])

For clip identification – show a semitransparent text string, very large by default

EvalShow

EvalShow(clip C, string s, [bool bypass, float size, int align])

Execute a script snippet; show script & result on screen

vdubFM

vdubFM(clip C)

Make changes needed to display on VirtualDub FilterMod

ShowMask

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")

ColorbarsHD2

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

Grayramp(clip T, [int height, bool dither])
Grayramp([int width, int height, bool rgb_out, int bits_out, bool dither])

Return grayscale ramp

VideoScopes

VideoScopes(clip C, [bool squeeze])

Show waveform + vectorscope; accepts RGB

Analyze

Analyze(clip C)

Print color channel statistics on the screen; auto RGB / YUV (cf. ColorYUV(analyze=true)

HistogramOverlay

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

HistogramTurn(clip C)

Classic Histogram, waveform on top

Histogram8

Histogram8(clip C, [string mode, float factor])

8-bit Histogram for deep color

ShowChannels

ShowChannels(clip C, [bool analyze])

Show original & 3 channels in quad split

ShowFrameNumberAligned

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

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
Personal tools