﻿
[Source]
Automatic = # can be configured at: Tools > Settings > Source Filters
AviSource = AviSource("%source_file%", audio=false)

BestSource = 
    tcFile = "%temp_file%_timestamps.txt" # timestamps file path
    # hwdevice: The interface to use for hardware decoding. Depends on OS and hardware. On windows d3d11va, cuda and vulkan (H264, HEVC and AV1) are probably the ones most likely to work. Defaults to CPU decoding. Will throw errors for formats where hardware decoding isn't possible.
    Exist(tcFile) ? BSVideoSource("%source_file%", track=-1, fpsnum=-1, fpsden=1, rff=False, threads=0, seekpreroll=20, enable_drefs=False, use_absolute_path=False, cachemode=3, cachepath="%source_temp_file%", cachesize=1000, hwdevice="", extrahwframes=9, timecodes=tcFile) : BSVideoSource("%source_file%", track=-1, fpsnum=-1, fpsden=1, rff=False, threads=0, seekpreroll=20, enable_drefs=False, use_absolute_path=False, cachemode=3, cachepath="%source_temp_file%", cachesize=1000, hwdevice="", extrahwframes=9)

D2VSource = D2VSource("%source_file%")
DirectShowSource = DirectShowSource("%source_file%", audio=false) # specify the frame rate with fps=... for wmv or mov files
DSS2 = DSS2("%source_file%") # specify the frame rate with fps=... for wmv or mov files

FFMS2 =
    tcFile = "%temp_file%_timestamps.txt" # timestamps file path
    Exist(tcFile) ? FFMS2("%source_file%", atrack=-2, cachefile="%source_temp_file%.ffindex", timecodes=tcFile) : FFMS2("%source_file%", atrack=-2, cachefile="%source_temp_file%.ffindex")

FFVideoSource =
    tcFile = "%temp_file%_timestamps.txt" # timestamps file path
    Exist(tcFile) ? FFVideoSource("%source_file%", cachefile="%source_temp_file%.ffindex", timecodes=tcFile) : FFVideoSource("%source_file%", cachefile="%source_temp_file%.ffindex")

LSMASHVideoSource = LSMASHVideoSource("%source_file%")
LWLibavVideoSource = LWLibavVideoSource("%source_file%", cachefile="%source_temp_file%.lwi")
Manual = # shows the filter selection dialog
MPEG2Source = MPEG2Source("%source_file%")

[Color]
ColorYUV | AutoAdjust = AutoAdjust(gamma_limit=1.0, scd_threshold=16, gain_mode=1, auto_gain=$select:msg:Enable Auto Gain?;true;false$, auto_balance=$select:msg:Enable Auto Balance?;true;false$, Input_tv=$select:msg:Is the Input using TV Range?;true;false$, output_tv=$select:msg:Do you want to use TV Range for Output?;true;false$, use_dither=$select:msg:Use Dither?;true;false$, high_quality=$select:msg:Use High Quality Mode?;true;false$, high_bitdepth=$select:msg:Use High Bit Depth Mode?;true;false$, threads_count=$enter_text:How Many Threads do you wish to use?$)
ColorYUV | AutoGain = ColorYUV(autogain=$select:msg:Enable AutoGain?;true;false$, autowhite=$select:msg:Enable AutoWhite?;true;false$)
ColorYUV | Grayscale = Grayscale()
ColorYUV | Levels = ColorYUV(levels="$select:TV to PC|TV->PC;PC to TV|PC->TV$")
ColorYUV | Stack = $select:To Stack|ConvertToStacked();From Stacked|ConvertFromStacked()$
ColorYUV | Tweak = Tweak($select:Neutral|hue=0, sat=1, bright=0, cont=1, coring=false, realcalc=true;Brighter|hue=0, sat=1, bright=25, cont=1, coring=false, realcalc=true;Less Contrast|hue=0, sat=0.95, bright=8, cont=0.9, coring=false, realcalc=true;Vivid|hue=0, sat=1.15, bright=2, cont=1.08, coring=false, realcalc=true;Less Color|hue=0, sat=0.82, bright=0, cont=0.96, coring=false, realcalc=true;Selective Blue|sat=2, startHue=300, endHue=50, coring=false, realcalc=true;Selective Yellow Red|sat=2, startHue=50, endHue=200, coring=false, realcalc=true;Desaturate|sat=0$)
Convert | ConvertBits = ConvertBits($select:msg:Select the Bit Depth you want to convert to;8;10;12;14;16;32$)
Convert | ConvertFromDoubleWidth = ConvertFromDoubleWidth(bits=$select:msg:Select the Bit Depth;8;10;12;14;16;32$)
Convert | ConvertTo = ConvertTo$enter_text:Enter the Format you wish to convert to$()
Convert | Format = z_ConvertFormat(pixel_type="$enter_text:Enter the Format you wish to convert to$", colorspace_op="$select:msg:Select Input Color Matrix;rgb;709;unspec;fcc;470bg;170m;240;ycgco;2020ncl;2020cl;chromancl;chromacl;ictcp$:$select:msg:Select Input Color Transfer;709;unspec;470m;470bg;601;240m;linear;log100;log316;xvycc;srgb;2020_10;2020_12;st2084;std-b67$:$select:msg:Select Input Color Primaries;709;unspec;470m;470bg;170m;240m;film;2020;st428;st431-2;st432-1;jedec-p22$:$select:msg:Select Pixel Range;limited;l;full;f$=>$select:msg:Select Output Color Matrix;rgb;709;unspec;fcc;470bg;170m;240;ycgco;2020ncl;2020cl;chromancl;chromacl;ictcp$:$select:msg:Select Output Color Transfer;709;unspec;470m;470bg;601;240m;linear;log100;log316;xvycc;srgb;2020_10;2020_12;st2084;std-b67$:$select:msg:Select Output Color Primaries;709;unspec;470m;470bg;170m;240m;film;2020;st428;st431-2;st432-1;jedec-p22$:$select:msg:Select Pixel Range;limited;l;full;f$", dither_type="$select:msg:Select Dither Type;none;ordered;random;error_diffusion$")
Dither | 8Bit to 16Bit = Dither_convert_8_to_16()
Dither | DFTTest(LSB) = dfttest(lsb=true)
Dither | DitherPost = DitherPost()
Dither | Gamma / Linear = $select:Gamma to Linear|Dither_y_gamma_to_linear;Linear to Gamma|Dither_y_linear_to_gamma$(curve="$select:msg:Select the Color Curve;601;709;2020$")
Dither | Sigmoid = $select:Sigmoid Direct|Dither_sigmoid_direct();Sigmoid Inverse|Dither_sigmoid_inverse()$
Dither | YUV / RGB = $select:RGB to YUV|Dither_convert_rgb_to_yuv();YUV to RGB|Dither_convert_yuv_to_rgb()$
HDRCore | Cube = Cube("$browse_file$")

HDR to SDR | HDRTools | HLG =
    ConvertYUVtoXYZ(Color=0, HDRMode=2, OOTF=false, OutputMode=2)
    ConverXYZ_BT2446_C_HDRtoSDR(PQMode=false, Lhdr=$enter_text:HDR max mastering luminance level (in cd/m2)? (Default: 1000.0)$, Lsdr=100.0, pColor=0)
    ConvertXYZtoYUV(Color=2, pColor=0, OOTF=false, OutputMode=2)
    ConvertBits(10)

HDR to SDR | HDRTools | PQ =
    ConvertYUVtoXYZ(Color=0, HDRMode=0, OOTF=false, OutputMode=2)
    ConverXYZ_BT2446_C_HDRtoSDR(PQMode=true, Lhdr=$enter_text:HDR max mastering luminance level (in cd/m2)? (Default: 10000.0)$, Lsdr=100.0, pColor=0)
    ConvertXYZtoYUV(Color=2, pColor=0, OOTF=false, OutputMode=2)
    ConvertBits(10)

Tonemap | Placebo =
    ConvertBits(16)
    libplacebo_Tonemap(src_csp=$select:msg:Select Source Color Space;SDR|0;HDR10 (default)|1;HLG|2;Dolby Vision|3$, dst_csp=$select:msg:Select Target Color Space;SDR (default)|0;HDR10|1;HLG|2;Dolby Vision|3$, dynamic_peak_detection=$select:msg:Dynamic Peak Detection?;Yes (default)|True;No|False$, tone_mapping_function=$select:msg:Tonemapping Function;Clip|"clip";ST2094_40|"st2094_40";ST2094_10|"st2094_10";BT2390 (default)|"bt2390";BT2446a|"bt2446a";Spline|"spline";Reinhard|"reinhard";Mobius|"mobius";Hable|"hable";Gamma|"gamma";Linear|"linear";LinearLight|"linearlight"$, contrast_recovery=0.3, contrast_smoothness=3.5)
    # ConvertBits(10)
    # ConvertToYUV420()

[Crop]
Crop = $select:msg:Select Version;Crop;Dither_Crop16$(%crop_left%, %crop_top%, -%crop_right%, -%crop_bottom%)
Hardware Encoder = # hardware encoder crops

[Field]
Assume = $select:TFF|AssumeTFF();BFF|AssumeBFF()$
Decimate = Decimate(cycle=5)
Deinterlace | Bwdif = BWDIF(field=$select:msg:Select Mode;Double rate, AviSynth internal order|-2;Same rate, AviSynth internal order (Default)|-1;Same rate, keep Bottom field|0;Same rate, keep Top field|1;Double rate, starts with Bottom|2;Double rate, starts with Top|3$)
Deinterlace | EEDI3 = eedi3()
Deinterlace | FieldDeinterlace = FieldDeinterlace()
Deinterlace | NNEDI3 = nnedi3(field=1)
Deinterlace | QTGMC | QTGMC... = QTGMC(preset="$select:msg:Select a Preset;Draft;Ultra Fast;Super Fast;Very Fast;Faster;Fast;Medium;Slow;Slower;Very Slow;Placebo$", InputType=$select:msg:Select Input Type;Interlaced|0;Progressive|1;Progressive Repair Details|2;Progressive Full Repair|3$, sourceMatch=3, sharpness=0.2, tr2=2, ediThreads=8)

Deinterlace | QTGMC | QTGMC with Repair =
    QTGMC1 = QTGMC(preset="Slower", inputType=2)
    QTGMC2 = QTGMC(preset="Slower", inputType=3, prevGlobals="Reuse")
    $select:msg:Select Repair Mode to use;Repair|Repair(QTGMC1, QTGMC2, 1);Repair16|Dither_Repair16(QTGMC1, QTGMC2, 1)$

Deinterlace | QTGMC | QTGMC+... = QTGMCp(thSAD1=640, thSAD2=256, Preset="$select:msg:Select a Preset;Draft;Ultra Fast;Super Fast;Very Fast;Faster;Fast;Medium;Slow;Slower;Very Slow;Placebo$", SourceMatch=0, MatchPreset="$select:msg:Select a Preset;Draft;Ultra Fast;Super Fast;Very Fast;Faster;Fast;Medium;Slow;Slower;Very Slow;Placebo$", MatchPreset2="$select:msg:Select a Preset;Draft;Ultra Fast;Super Fast;Very Fast;Faster;Fast;Medium;Slow;Slower;Very Slow;Placebo$", MatchEnhance=0.5, Lossless=0, EZDenoise=0.0, EZKeepGrain=1.0, NoisePreset="$select:msg:Select a NoisePreset;Faster;Fast;Medium;Slow;Slower", FPSDivisor=1, threads=$select:msg:Select the number of threads;2;4;6;8;10;12;14;16$, show=false)
Deinterlace | TDeint = TDeint($select:msg:Select Mode;Progressive DoubleHeight ELA|mode=-2;Progressive DoubleHeight ELA2|mode=-1;Same Rate (Default)|mode=0;Double Rate Bobbing|mode=1;Smart Bobbed Field Matching|mode=2$)
Deinterlace | yadifmod2 = yadifmod2($select:msg:Select Mode;Same Rate (Default)|mode=0;Double Rate|mode=1;Same Rate No Spatial Check|mode=2;Double Rate No Spatial Check|mode=3$)
IVTC | AnimeIVTC = AnimeIVTC(mode=$select:msg:Choose Mode;Hard telecined|1;Field blended|2;Double hard telecine|3;Hybrid|4$, omode=$select:msg:Output Framerate?;CFR|1;VFR (intended for MKV files)|2$)
IVTC | Decomb IVTC = Telecide(guide=1).Decimate()
IVTC | TIVTC = TFM().TDecimate()
Select Every Other = $select:Even|SelectEven();Odd|SelectOdd()$
Select Lines | Select Even Lines = SeparateRows(2).SelectEven()
Select Lines | Select Odd Lines = SeparateRows(2).SelectOdd()
SeparateFields = SeparateFields()
SwapFields = SwapFields()
Weave = Weave()

[Frame Rate]
AssumeFPS = AssumeFPS($select:msg:Select a Frame Rate;23.976|24000, 1001;24;25;29.970|30000, 1001;30;47.952|48000, 1001;48;50;59.940|60000, 1001;60;100;120;144;240$)
AssumeFPS Source File = AssumeFPS(%source_mi_v:FrameRate%)
ChangeFPS = ChangeFPS($select:msg:Select a Frame Rate;23.976|24000, 1001;24;25;29.970|30000, 1001;30;47.952|48000, 1001;48;50;59.940|60000, 1001;60;100;120;144;240$)
ConvertFPS = ConvertFPS($select:msg:Select a Frame Rate;23.976|24000, 1001;24;25;29.970|30000, 1001;30;47.952|48000, 1001;48;50;59.940|60000, 1001;60;100;120;144;240$)
InterFrame = InterFrame(preset="Medium", tuning="$select:msg:Select the Tuning Preset;Film;Animation;Smooth;Weak$", newNum=$enter_text:Enter the New Num value for output fps$, newDen=$enter_text:Enter the New Den value for output fps$, cores=$enter_text:Enter the Number of Cores you want to use$, overrideAlgo=$select:msg:Which Algorithm do you want to use?;Strong Predictions (Animation Default)|2;Intelligent (Default)|13;Smoothest (Smooth Default)|23$, GPU=$select:msg:Enable GPU Feature?;True;False$, InputType="$select:msg:Is your source a 3D Video?;No, it is 2D (Default)|2D;3D Full SBS|SBS;3D Full OU|OU;3D Half SBS|HSBS;3D Half OU|HOU$")

SVPFlow =
    Threads = 8
    super_params = "{pel:2,gpu:1}"
    analyse_params = """{block:{w:16,h:16}, main:{search:{coarse:{distance:-10}}}, refine:[{thsad:200}]}""" 
    smoothfps_params = "{rate:{num:4,den:2},algo:23,cubic:1}"
    super = SVSuper(super_params)
    vectors = SVAnalyse(super, analyse_params)
    SVSmoothFps(super, vectors, smoothfps_params, mt=threads)
    #Prefetch(threads) must be added at the end of the script and Threads=9 after the source
    Prefetch(threads)

VFR to CFR | TimecodeFPS =
    # Converts VFR to CFR using MKV timestamps file
    Assert(VarExist("tcFile") && Exist(tcFile), "Use FFMS2 or FFVideoSource source filters only. Timestamps extraction from MKV must be turned on in Options. Remux your input to MKV if it is not an MKV file.")
    TimecodeFPS(timecodes=tcFile, fpsnum=$enter_text:Numerator of the target FPS (in integer)?$, fpsden=$enter_text:Denominator of the target FPS (in integer)?$, report=false, threshone=0.4, threshmore=0.9, start=$select:msg:Is the 0th timestamp in the timestamps file the 0 time?;Yes|true;No (Default)|false$)
    # Don't forget to mux the timestamps file in the output mkv

VFR to CFR | VfrToCfr =
    # Converts VFR to CFR by inserting null frames (exact copies of previous frames)
    Assert(VarExist("tcFile") && Exist(tcFile), "Use FFMS2 or FFVideoSource source filters only. Timestamps extraction from MKV must be turned on in Options. Remux your input to MKV if it is not an MKV file.")
    VfrToCfr(timecodes=tcFile, fpsnum=$enter_text:Numerator of the target FPS (in integer)?$, fpsden=$enter_text:Denominator of the target FPS (in integer)?$)
    # Don't forget to mux the timestamps file in the output mkv

YFRC = YFRC(BlockH=16, BlockV=16, OverlayType=0, MaskExpand=1)

[Line]
Anti-Aliasing | DAA = daa3mod()
Anti-Aliasing | MAA2 = MAA2(mask=1, chroma=false, ss=2.0, aa=48, aac=40, threads=4, show=0)
Anti-Aliasing | SangNom2 = Sangnom2()
Anti-Aliasing | Santiag = santiag(strh=$enter_text:Horizontal Strength (in integer)? (Default: 1, Range: 0 to 3)$, strv=$enter_text:Vertical Strength (in integer)? (Default: 1, Range: 0 to 3)$, type="$select:msg:Interpolation Method?;EEDI2|eedi2;EEDI3|eedi3;NNEDI3 (Default)|nnedi3;SangNom2|sangnom$", nns=1, nsize=6, aa=48, aac=0, scaler_post="Spline36Resize")
Sharpen | aWarpSharp2 = aWarpSharp2(thresh=128, blur=2, type=0, depth=16, chroma=3)
Sharpen | CAS = CAS($enter_text:Enter the Amount of Sharpness in decimal (between 0.0 and 1.0)$)
Sharpen | CASm = CASm($enter_text:Enter the Amount of Sharpness in decimal (between 0.0 and 1.0)$)
Sharpen | FineSharp = FineSharp($select:msg:Select Strength;Light|mode=1, sstr=2, cstr=0.8, xstr=0.19, lstr=1.49, pstr=1.272;Moderate|mode=2, sstr=2.0, cstr=1.3, xstr=0.0, lstr=1.49, pstr=1.472;Strong|mode=3, sstr=6.0, cstr=1.3, xstr=0.0, lstr=1.49, pstr=1.472$)
Sharpen | LSFmod = LSFmod(defaults="slow", strength=100, Smode=5, Smethod=3, kernel=11, secure=true, Szrp=16, Spwr=4, SdmpLo=4, SdmpHi=48, Lmode=4, overshoot=1, undershoot=1, Overshoot2=1, Undershoot2=1, soft=-2, soothe=true, keep=20, edgemode=0, edgemaskHQ=true, ss_x=1.50, ss_y=1.50, dest_x=%target_width%, dest_y=%target_height%, show=false, screenW=1280, screenH=1024)
Sharpen | MSharpen = MSharpen(threshold=10, strength=100, highq=true, mask=false)
Sharpen | MultiSharpen = MultiSharpen(1)
Sharpen | pSharpen = pSharpen(strength=25, threshold=75, ss_x=1.0, ss_y=1.0)
Sharpen | Sharpen = Sharpen($enter_text:Enter the Amount of Sharpness in decimal (from -1.58 to 1.0)$)
Sharpen | vsMSharpen = vsMSharpen(threshold=6.0, strength=39.0, mask=false, luma=true, chroma=false)

[Misc]
Borders | AddBorders = AddBorders(0, 0, 0, 0) #left, top, right, bottom
Borders | FillBorders = FillBorders(left=$enter_text:Number of Left Pixels$, top=$enter_text:Number of Top Pixels$, right=$enter_text:Number of Right Pixels$, bottom=$enter_text:Number of Bottom Pixels$, mode=$select:msg:Select Mode;fillmargins (Default)|0;repeat|1;mirror|2;reflect|3;wrap|4;fade|5;fixborders|6$)
Borders | Letterbox = Letterbox($enter_text:Number of Top Pixels$, $enter_text:Number of Bottom Pixels$, x1=$enter_text:Number of Left Pixels$, x2=$enter_text:Number of Right Pixels$)
Histogram = Histogram("levels", bits=$select:msg:Select BitDepth;8;10;12$)
MTMode | Prefetch = Prefetch($enter_text:Enter the Number of Threads to use$)
MTMode | Set Max Memory = SetMemoryMax($enter_text:Enter the Maximum Memory Avisynth can use$)
MTMode | Set Threads = threads=$enter_text:Enter the Number of Threads to use$
MTMode | SetMTMode Filter = SetFilterMTMode("$enter_text:Enter the Filter Name$", $enter_text:Enter Mode you wish to use$)

SelectEvery =
    # SelectEvery(step-size, offset1, offset2, ...)
    # offset2, ... are optional.
    # Modify the following example:
    SelectEvery(10, 3, 6, 7) # select frames 3, 6, 7, 13, 16, 17, 23, 26, 27, ...

SelectRangeEvery =
    # SelectRangeEvery(every, length, offset)
    # all arguments are optional.
    # By default, select length=50 frames every=1500 frames, starting with frame 0 (offset=0)
    # Modify the following example:
    SelectRangeEvery(1500, 50)

SplitVertical = Splitvertical=true

[Noise]
AddGrainC = AddGrainC(var=1.0, uvar=0.0, hcorr=0.0, vcorr=0.0, seed=6, constant=false, sse2=true)
DeGrainMedian = DeGrainMedian(limitY=4, limitUV=6, mode=1, interlaced=false, norow=false)
DeNoise | Denoise MD = DeNoiseMD1(sigma=4, overlap=2, thcomp=80, str=0.8)DitherPost(mode=7, ampo=1, ampn=0)
DeNoise | Denoise MF = DenoiseMF2(s1=2.0, s2=2.5, s3=3.0, s4=2.0, overlap=4, thcomp=80, str=0.8, gpu=$select:msg:Use GPU Enabled Feature?;True;False$)
DFTTest = dfttest($select:msg:Select Strength;Light|sigma=6, tbsize=3;Moderate|sigma=16, tbsize=5;Strong Static|sigma=64, tbsize=1;Strong Temporal|sigma=64, tbsize=3$, $select:msg:Reduce Banding?;No Deband|dither=0;Deband|dither=1;Add Noise|dither=2;More Noise|dither=3$)
DFTTest Neo = neo_dfttest(ftype=0, sigma=2.0, y=3, u=3, v=3)
FFT3D Neo = neo_fft3d(sigma=2.0, bt=3, y=3, u=3, v=3)
FFT3DFilter | FFT3DFilter = FFT3DFilter()
FFT3DFilter | FFT3DGPU = FFT3DGPU(sigma=1.5, bt=3, bw=32, bh=32, ow=16, oh=16, sharpen=0.4, NVPerf=$select:msg:Enable Nvidia Function;True;False$)
HQDN3D = HQDN3D(ls=4.0, cs=3.0, lt=6.0, ct=4.5, restart=7)
mClean = mClean(thSAD=400, chroma=true, sharp=10, rn=14, deband=4, depth=0, strength=20)
MCTemporalDenoise | MCTemporalDenoise = MCTemporalDenoise(settings="$select:msg:Select Strength;Very Low|very low;Low (Default)|low;Medium|medium;High|high;Very High|very high$")

MCTemporalDenoise | MCTemporalDenoisePP =
    source=last
    denoised=FFT3Dfilter()
    MCTemporalDenoisePP(denoised)

MDegrain | MDegrain2 (matching SMDegrain) =
    # The following code block matches a simple SMDegrain() call (for SD resolutions)
    super_search = Dither_Luma_Rebuild(S0=1.0, c=0.0625).MSuper(rfilter=4)
    bv1 = super_search.MAnalyse(isb=true, delta=1, overlap=4)
    bv2 = super_search.MAnalyse(isb=true, delta=2, overlap=4)
    fv1 = super_search.MAnalyse(isb=false, delta=1, overlap=4)
    fv2 = super_search.MAnalyse(isb=false, delta=2, overlap=4)
    MDegrain2(MSuper(levels=1), bv1, fv1, bv2, fv2, thSAD=300, thSADC=150)
    # The above code block matches a simple SMDegrain() call (for SD resolutions)

MDegrain | MDegrain3 =
    super_search = Dither_Luma_Rebuild(S0=1.0, c=0.0625).MSuper(rfilter=4)
    bv1 = super_search.MAnalyse(isb=true, delta=1, overlap=4)
    bv2 = super_search.MAnalyse(isb=true, delta=2, overlap=4)
    bv3 = super_search.MAnalyse(isb=true, delta=3, overlap=4)
    fv1 = super_search.MAnalyse(isb=false, delta=1, overlap=4)
    fv2 = super_search.MAnalyse(isb=false, delta=2, overlap=4)
    fv3 = super_search.MAnalyse(isb=false, delta=3, overlap=4)
    MDegrain3(MSuper(levels=1), bv1, fv1, bv2, fv2, bv3, fv3, thSAD=300, thSADC=150)

MiniDeen = MiniDeen(radius=1, thrY=10, thrUV=12, Y=3, U=3, V=3)
NLMeans | KNLMeansCL = KNLMeansCL(D=1, A=1, h=$select:msg:Select Strength;Light|2;Medium|4;Strong|8$, device_type="auto")
NLMeans | TNLMeans = TNLMeans(Ax=4, Ay=4, Az=0, Sx=2, Sy=2, Bx=1, By=1, ms=false, rm=4, a=1.0, h=1.8, sse=true)
NLMeans | xNLMeans = xnlmeans(a=4, h=2.2, vcomp=0.5, s=1)
RemoveGrain | RemoveGrain = RemoveGrain(mode=2, modeU=2, modeV=2, planar=false)

RemoveGrain | RemoveGrain | RemoveGrain16 with Repair16 =
    Processed = Dither_removegrain16(mode=2, modeU=2, modeV=2)
    Dither_repair16(Processed, mode=2, modeU=2, modeV=2)

RemoveGrain | RemoveGrain With Repair =
    Processed = RemoveGrain(mode=2, modeU=2, modeV=2, planar=false)
    Repair(Processed, mode=2, modeU=2, modeV=2, planar=false)

SMDegrain | SMDegrain Hard Grain = SMDegrain(tr=4, thSAD=600, prefilter=-1, contrasharp=true, refinemotion=true)
SMDegrain | SMDegrain Normal Grain = SMDegrain(tr=2, thSAD=300, prefilter=-1, contrasharp=true, refinemotion=true)
SMDegrain | SMDegrain Light Grain = SMDegrain(tr=1, thSAD=300, prefilter=-1, contrasharp=true, refinemotion=true)
TemporalDegrain2 = TemporalDegrain2(degrainTR=2, postFFT=3, postSigma=3)
VagueDenoiser = VagueDenoiser(threshold=0.8, method=1, nsteps=6, chromaT=0.8)

[Resize]

Advanced | CropResize =
    CropResize(%target_width%, %target_height%, \
        %crop_left%, %crop_top%, -%crop_right%, -%crop_bottom%, \
        InDAR=%source_dar%, OutDAR=%target_dar%, Info=true)

Advanced | Dither_Resize16 = Dither_resize16(%target_width%, %target_height%)

Advanced | Dither_Resize16 In Linear Light =
    Dither_convert_yuv_to_rgb (matrix="2020", output="rgb48y", lsb_in=true)
    Dither_y_gamma_to_linear(tv_range_in=false, tv_range_out=false, curve="2020", sigmoid=true)
    Dither_resize16nr(%target_width%, %target_height%, kernel="spline36")
    Dither_y_linear_to_gamma(tv_range_in=false, tv_range_out=false, curve="2020", sigmoid=true)
    r = SelectEvery (3, 0)
    g = SelectEvery (3, 1)
    b = SelectEvery (3, 2)
    Dither_convert_rgb_to_yuv(r, g, b, matrix="2020", lsb=true)

Advanced | Hardware Encoder = # hardware encoder resizes
Advanced | NNEDI3_rpow2 = nnedi3_rpow2(rfactor=$select:msg:Enlargement Factor?;2;4;8;16$, cshift="$select:msg:Center Shift Correction Algorithm?;BicubicResize;BilinearResize;BlackmanResize;GaussResize;LanczosResize;Lanczos4Resize;PointResize;SincResize;Spline16Resize;Spline36Resize;Spline64Resize$", fwidth=%target_width%, fheight=%target_height%)
Advanced | Placebo = libplacebo_Resample(%target_width%, %target_height%, "$select:spline16;spline36;spline64;nearest;bilinear;gaussian;sinc;lanczos;ginseng;ewa_jinc;ewa_lanczos;ewa_lanczossharp;ewa_lanczos4sharpest;ewa_ginseng;ewa_hann;ewa_hanning;bicubic;hermite;catmull_rom;mitchell;mitchell_clamp;robidoux;robidouxsharp;ewa_robidoux;ewa_robidouxsharp$")
Advanced | ResizeMT = $select:BicubicResizeMT;BilinearResizeMT;BlackmanResizeMT;GaussResizeMT;LanczosResizeMT;Lanczos4ResizeMT;PointResizeMT;SincResizeMT;Spline16ResizeMT;Spline36ResizeMT;Spline64ResizeMT$(%target_width%, %target_height%, prefetch=4)
Advanced | SuperRes = $select:msg:Select Version;SuperResXBR|SuperResXBR;SuperRes|SuperRes;SuperXBR|SuperXBR$(passes=$select:msg:How many Passes do you wish to perform?;2;3;4;5$, factor=$select:msg:Factor Increase by?;2;4$)
Resize... = $select:BicubicResize;BilinearResize;BlackmanResize;DPID;GaussResize;LanczosResize;Lanczos4Resize;PointResize;SincResize;Jinc36Resize;Jinc64Resize;Jinc144Resize;Jinc256Resize;Spline16Resize;Spline36Resize;Spline64Resize$(%target_width%, %target_height%)

[Restoration]
Chroma Fix | Bifrost = Bifrost(luma_thresh=10.0, variation=5, interlaced=$select:msg:Is the input video Interlaced?;Yes (Default)|true;No|false$, blockx=4, blocky=4)
Chroma Fix | Checkmate = checkmate(thr=12, max=12, tthr2=0)
Chroma Fix | ChubbyRain2 = ChubbyRain2(th=10, radius=10, sft=10) # progressive sources only
Chroma Fix | CNR2 = vsCnr2(mode="oxx", scdthr=10.0, ln=35, lm=192, un=47, um=255, vn=47, vm=255, sceneChroma=false)
Chroma Fix | DeRainbow = $select:msg:Source Color Format?;YV12|DeRainbow;YUY2|DeRainbowYUY2$(thresh=10, interlaced=false)
Chroma Fix | DotKill | DotKillS = DotKillS(iterations=1)

Chroma Fix | DotKill | DotKillZ =
    # 3:2 pulldown NTSC source, spatial
    DotKillZ(order=0, offset=0)

Chroma Fix | DotKill | DotKillT =
    # 3:2 pulldown NTSC source, spatio-temporal
    DotKillT(order=0, offset=0, dupthresh=64, tratio=3)

Chroma Fix | Fix Horizontal Rainbow =
    Assert(Last.ComponentSize==1, "The bit depth must be 8. Consider using ConvertBits(8) before this filter profile.")
    ConvertToYV12(interlaced=$select:msg:Is the input clip Interlaced?;Yes|true;No|false$)
    $select:msg:Input Field Order (if interlaced input) or Field Separation Order (if progressive input)?;Top Field First|AssumeTFF();Bottom Field First|AssumeBFF()$.SeparateFields()
    AddGrainC(var=3)
    even=SelectEven().DeRainbow(thresh=1).DeRainbow(thresh=1).CASm(1)
    odd=SelectOdd().DeRainbow(thresh=1).DeRainbow(thresh=1).CASm(1)
    Interleave(even, odd).AssumeFieldBased().Weave() # Returns interlaced clip. A Deinterlacer should follow.

DeBand | f3kdb = f3kdb()
DeBand | f3kdb Neo = neo_f3kdb(preset="$select:msg:Select Profile;Depth|depth;Low|low;Low and No Grain|low/nograin;Medium|medium;Medium and No Grain|medium/nograin;High (Default)|high;High and No Grain|high/nograin;Very High|veryhigh;Very High and No Grain|veryhigh/nograin;No Grain|nograin;Luma|luma;Chroma|chroma$", output_depth=$select:msg:Select Output Depth;8 Bit|8;16 Bit|16$)
DeBand | Gradfun3 = GradFun3(thr=0.5, radius=12, mode=6, smode=1)

DeBand | Gradfun3_16bit =
    ConvertBits(16)
    ConvertToStacked()
    GradFun3(thr=0.5, radius=12, mode=6, smode=1)
    ConvertFromStacked()

DeBlock | DeBlock_QED = Deblock_QED(quant1=24, quant2=26, aOff1=1, aOff2=1, bOff1=2, bOff2=2, uv=3)
DeBlock | DeBlock = Deblock(quant=25, aOffset=0, bOffset=0)
DeBlock | MipSmooth = MipSmooth(downsizer="lanczos", upsizer="bilinear", scalefactor=1.5, method="strong")
DeBlock | SmoothD2 = SmoothD2(quant=3, num_shift=3, Matrix=3, Qtype=1, ZW=1, ZWce=1, ZWlmDark=0, ZWlmBright=255, ncpu=4)
DeComb | Vinverse = $select:Vinverse|vinverse(sstr=2.7, amnt=255, uv=3, scl=0.25);Vinverse2|vinverse2(sstr=2.7, amnt=255, uv=3, scl=0.25)$

DeDupe | ExactDeDup =
    DUPTXT = "%temp_file%_dupinfo_edd.txt"
    DUPTXT = RT_GetFullPathName(DUPTXT)
    TIMETXT = "%temp_file%_timestamps_edd.txt"
    TIMETXT = RT_GetFullPathName(TIMETXT)
    ExactDedup(firstpass=true, dupinfo=DUPTXT, times=TIMETXT, maxdupcount=1000000, keeplastframe=false)
    RT_ForceProcess()
    ExactDedup(firstpass=false, dupinfo=DUPTXT, times=TIMETXT, maxdupcount=1000000, keeplastframe=false)
    # Don't forget to mux TIMETXT timestamps file in the output mkv

DeDupe | FillDrops = FillDrops(thresh=$enter_text:Enter the Luma Difference Threshold in decimal (Default: 0.1)$)
DeFlicker | DeFlicker = Deflicker(percent=85.0, lag=25, noise=10.0, scene=$enter_text:New Scene Threshold? (Default: 40, Range: 0 to 255)$, info=false)
DeFlicker | ReduceFlicker = ReduceFlicker(strength=$select:msg:Choose Strength;Weak|1;Medium (Default)|2;Strong|3$)
DeHalo | DehaloAlpha = DeHalo_alpha_mt(rx=2.0, ry=2.0, darkstr=1.0, brightstr=1.0, lowsens=50, highsens=50, ss=1.5)
DeHalo | FineDehalo = FineDehalo(rx=2.0, ry=2.0, thmi=80, thma=128, thlimi=50, thlima=100, darkstr=1.0, brightstr=1.0, showmask=0, contra=0.0, excl=true)
DeHalo | HQDeringmod = HQDeringmod()
DeJump | DeJump = DeJump(jumpthresh=$enter_text:Enter the Threshold for detecting Jumps in decimal (<1, Default: 0.88)$, thresh=$enter_text:Enter the Luma Difference Threshold for FillDrops in decimal (Default: 0.4)$, dcycle=$enter_text:Enter the Decimation Cycle in integer (Default: 20)$)
DeScratch | DeScratch = DeScratch(mindif=5, asym=10, maxgap=3, maxwidth=3, minlen=100, maxlen=2048, maxangle=5, blurlen=15, keep=100, border=2, modeY=1, modeU=0, modeV=0, mindifUV=0, mark=false, minwidth=1, left=0, right=%target_width%)

[Flip]
Flip | Horizontal = FlipHorizontal()
Flip | Vertical = FlipVertical()

[Rotation]
Left = TurnLeft()
Right = TurnRight()
Upside Down = Turn180()
