Xaa

From Avisynth wiki
Jump to: navigation, search
Abstract
Author Desbreko
Version v1.2.1
Download xaa_v1.2.1.avsi
Category Anti-aliasing
License
Discussion

Contents

[edit] Description

A highly versatile anti-aliasing function.

[edit] Requirements

[edit] Required Plugins

Latest version of the following plugins are recommended unless stated otherwise.

[edit] Required Scripts


[edit] Syntax and Parameters

xaa (clip input, int "ow", int "oh", float "ss", val "ssw", val "ssh", string "mode", string "uscl", string "dscl", int "csharp", float "cstr", int "mask", string "mtype", float "mthr", int "chroma", string "cplace", int "nns", float "eedimthr", float "eediA", float "eediB", float "eediG", bool "lsb_in", bool "lsb", int "threads")


clip  input =
Input clip to be processed.


int  ow = input.width()
int  oh = input.height()
The output width and height. Useful for when the video is going to be resized after antialising.
Use a negative value for either to disable resizing after supersampling. If not defined it defaults to the dimensions of the input clip.


float  ss = 2.0
The multiplier for determining the supersampled resolution which is then rounded to mod4.
Defaults to 1.0 (no supersampling) for double rate and double image antialiasing modes


val  ssw = ss
val  ssh = ss
Allows separate control of the supersampled width and height. Overrides the ss value.
When specified as a float, they act as a multiplier like the ss parameter.
When specified as an int, the given value is used for the supersampled width or height without rounding to mod4.


string  mode = "sr SangNom2"
Specifies how to perform antialiasing in the format "[aa mode][direction][passes] [type] [sclip]" with the settings below available for each option. Antialiasing can also be disabled with "null"
AA mode: sr, dr, di
Direction: h, v, b
Passes: 1 to 9
Type: SangNom2, nnedi3, nnedi3ocl, eedi3, eedi2
Sclip: SangNom2, nnedi3, nnedi3ocl, eedi2, or any resize kernel
AA Mode
The antialiasing mode determines what method of antialiasing is used.
  • sr uses single rate deinterlacing, discarding one field of the frame and interpolating it from the remaining field.
  • dr uses double rate deinterlacing, interpolating full-height frames from both fields and then blending the two together.
  • di doubles the image height by interpolating every other line for the first pass, uses single rate deinterlacing for subsequent passes, and then downscales back to the original resolution.
Direction
By setting the direction to h or v, antialiasing can be applied only horizontally or vertically. If the direction is set to b or omitted, antialiasing will be applied in both directions.
Passes
The more passes used, the stronger the antialiasing will be. If the number of passes is omitted, it will default to 1.
Type
The type determines which deinterlacing plugin is used for antialiasing.
Sclip
The sclip option only applies when the type is set to eedi3 and will be undefined if omitted. If specified, the given deinterlacer or resize kernel will be used to generate the sclip for eedi3. See eedi3's documentation for more details.
Preset Modes
Preset modes which change the default settings to mimic other antialiasing functions are also available: "maa2, "daa", "Mrdaa" or "MrdaaLame", "santiag"
Equivalent settings:
maa2: xaa(mtype="sobel", mthr=7)
daa: xaa(mode="drv nnedi3", csharp=1, mask=0, chroma=1)
Mrdaa: xaa(mode="null", uscl="nnedi3", csharp=2, cstr=1.0, mask=0, chroma=1)
santiag: xaa(mode="di2 nnedi3", mask=0, chroma=1)


string  uscl = "Spline36"
string  dscl = "Spline36"
The resize kernels used when upscaling, such as when supersampling, and when downscaling, such as when scaling back to the input resolution after supersampling.
Supports all of AviSynth's internal resizers and ResizeX's bicubic presets, and for upscaling, "nnedi3", "nnedi3ocl", "eedi3", and "eedi2" can also be used for their rpow2 image enlargement.
  • For the Lanczos, Blackman, and Sinc kernels, the number of taps can be set with a number after the kernel name. E.g. "Blackman3" for BlackmanResize(taps=3).
  • For eedi3 upscaling, the sclip setting can be specified with a resize kernel name or edi method on the end of the string. E.g. "eedi3 nnedi3" to upscale with eedi3 using nnedi3 as the sclip.


int  csharp = 0
  • 0 : No contra-sharpening.
  • 1 : Applies contra-sharpening before scaling to output resolution.
  • 2 : Applies contra-sharpening after scaling to output resolution.


float  cstr = -1.0
Controls the strength of the contra-sharpening.
Any negative value uses RemoveGrain(11) as in daa.
A positive value uses Blur as in Mrdaa, up to a max of 7.9.
A value of 0 disables contra-sharpening and overrides the csharp setting.


int  mask = 1
  • 0 : Processes the entire frame
  • 1 : Processes edges only
  • 2 : Processes everything except edges
A negative value will show an overlay of the mask.


string  mtype = "TEMmod"
The type of edge mask to use. Options are: "TEMmod", "TCannyMod", and mt_edge's "sobel", "roberts", "laplace", "prewitt", "cartoon", and "min/max". A custom kernel for mt_edge may also be used. See its documentation for more info.
TEMmod's type parameter can be set with a number on the end of the string. E.g. "TEMmod5" for type=5. If no number is given, the default of 4 is used. See TEMmod's documentation for explanations of the different types.
This setting also determines the mask type for the eedimthr parameter.


float  mthr = 8.0
The threshold of the edge mask. Rounded to the nearest integer for mt_edge types.
  • When mask=1, lower values result in more edges getting antialiased.
  • When mask=2, lower values result in fewer edges getting excluded.


int  chroma = 0
  • 0 : Processes the luma plane only
  • 1 : Processes both the luma and chroma planes
  • 2 : Processes the chroma planes only


string  cplace = "MPEG2"
Specifies the input's chroma placement. Options are "MPEG1" and "MPEG2".
Only applies to formats with subsampled chroma. Note that only YV12 should be able to have MPEG1 chroma placement.


int  nns = 1
nnedi3's nns parameter for nnedi3 and nnedi3ocl antialiasing. Ranges from 0 to 4. Higher values will provide better quality but will be slower.
This setting doesn't affect upscaling with nnedi3 or nnedi3ocl.


float  eedimthr = 0.0
A value greater than 0 creates an edge mask with the given value's threshold to be used with eedi3 antialiasing and upscaling.
Edge-directed interpolation will be used only on masked edges, increasing eedi3's speed as the threshold is raised, but at the risk of excluding edges that need antialiasing.


float  eediA = 0.2
float  eediB = 0.25
float  eediG = 20.0
eedi3's alpha, beta, and gamma parameters for eedi3 antialiasing and upscaling. They adjust the balance between connecting lines and creating artifacts.
eediA and eediB must be in the range 0 to 1 and their sum can't exceed 1. See eedi3's documentation for more info.


bool  lsb_in = false
Set to true if the input is a stacked 16-bit clip.
Because none of the plugins used for antialiasing support 16-bit, the input will almost always need to be dithered to 8-bit at some point, but it will be processed in 16-bit where possible.


bool  lsb = false
Set to true to output a stacked 16-bit clip.
Because some functions don't support 16-bit, a few combinations of settings will result in the lsb being empty.


int  threads = Undefined
The number of threads to use for each instance of SangNom2, nnedi3, and eedi3.
Leave this undefined to let the plugins choose automatically.


[edit] Examples

xaa with default settings:

AviSource("Blah.avi")
xaa()

Downscaling an 8-bit source with 16-bit processing (source)

# 8-bit 1080p source 
xaa(ow=1280, oh=720, mode="nnedi3", lsb=true)
GradFun3(thr=0.2, lsb=true, lsb_in=true)
Dither_out()


[edit] Changelog

Version      Date            Changes
v1.2.1 09/13/2015 - Fixed a bug in eedi3 upscaling with an sclip setting.
v1.2 09/11/2015 - Added nnedi3ocl antialiasing and upscaling - FTurn is now optional - Resize8 is no longer required - ResizeX is now required - edi_rpow2 is now required - Added support for YV16 and YUY2 - Removed dithermode parameter - Added cplace parameter - Changed the syntax of the mode parameter string (old settings still work) - Added "santiag" preset mode - Added double image antialiasing mode - Added multipass antialiasing - Added horizontal-only and vertical-only antialiasing - All deinterlacing plugins can now be used for all antialiasing modes - The eedimthr parameter now also applies to upscaling with eedi3 - Expanded support for eedi3's sclip parameter for both antialiasing and upscaling - Added eedi2 upscaling
v1.1.2 08/14/2015 - Fixed center shift and csharp=1 for mode="eedi2". Border fix now used for all modes but eedi2.
v1.1.1 04/09/2015 - Added option to set TEMmod's type that I forgot - Improved handling of borders with merged modes
v1.1 02/28/2015 - Supports TEMmod and TCannyMod masks, more eedi3 options, MrdaaLame preset as fast as the original.
v1.0.3 11/06/2014 - Fixed a bug with csharp=2. It wasn't actually being applied when lsb=true
v1.0.2 11/02/2014 - Now preserves the lsb in masked areas when using csharp=2, cstr>0, mask>0


[edit] External Links




Back to External Filters

Personal tools