|
Мазизов
Стаж: 7 лет 8 месяцев Сообщений: 1134
|
Мазизов ·
31-Авг-19 16:12
(5 лет 4 месяца назад)
|
|
торрент иваниваныч
Стаж: 15 лет 1 месяц Сообщений: 1154
|
торрент иваниваныч ·
31-Авг-19 20:11
(спустя 3 часа)
Мазизов
Там нет варианта с внешней маской. Где взять плагин YAHR2?
|
|
Tempter57
Стаж: 16 лет 3 месяца Сообщений: 4963
|
Tempter57 ·
31-Авг-19 20:21
(спустя 10 мин.)
торрент иваниваныч писал(а):
77896746Где взять плагин YAHR2?
В папке с плагинами, там сейчас все три версии
скрытый текст
# YAHR's functions 2018-03-31 # Y'et A'nother H'alo R'educing script function YAHR(clip clp)
{
b1 = clp.minblur(2).removegrain(11,-1)
b1D = mt_makediff(clp,b1)
w1 = clp.aWarpSharp(depth=32,blurlevel=2,thresh=0.5)
w1b1 = w1.minblur(2,1).removegrain(11,-1)
w1b1D = mt_makediff(w1,w1b1)
DD = b1D.repair(w1b1D,13)
DD2 = mt_makediff(b1D,DD)
clp.mt_makediff(DD2,U=2,V=2)
} # Y'et A'nother H'alo R'educing script
# YAHR A.SONY mod 1.38, original YAHR was by Didée
# good deHalo for modern DVD and other cases function YAHR2(clip clp, int "depth", int "blur", bool "useawarp4", int "depthV", int "blurV")
{ depth = Default(depth, 8)
useawarp4 = Default(useawarp4, false) blur = defined(blurV) && !defined(blur) ? depth==0 ? 0 : blur : blur defined(depthV) ? depthV != 0 && depth==0 ? eval("blurV=defined(blurV) ? blurV : blur Chr(3) blur=defined(blur) ? blur : 0") : depthV==0 && depth != 0 ? eval("blurV=defined(blurV) ? blurV : 0") : nop() : nop() awarp_params = defined(depthV) ? ",depthV=" + string(depthV) : ""
awarp_params = defined(blurV) ? awarp_params + ",blurV=" + string(blurV) : defined(depthV) ? depthV==0 ? ",blurV=0" : awarp_params : awarp_params b1 = clp.minblur(2).removegrain(11,-1)
b1D = mt_makediff(clp,b1)
w1 = useawarp4 ? clp.aWarpSharp4xx(depth=depth,blur=blur,chroma=1,useawarp4=true,depthV=depthV,blurV=blurV) : eval("clp.aWarpSharp2(depth=depth,blur=blur,chroma=1" + awarp_params + ")")
w1b1 = w1.minblur(2,1).removegrain(11,-1)
w1b1D = mt_makediff(w1,w1b1)
DD = b1D.repair(w1b1D,13)
DD2 = mt_makediff(b1D,DD)
clp.mt_makediff(DD2,U=2,V=2)
} function YAHR3(clip src, int "depth", int "radius", int "blur", bool "useawarp4", int "depthV", int "blurV", bool "honly", bool "lumaonly")
{
depth = Default(depth, 32)
radius = Default(radius, 6)
src
edgm = EMask_dhh(ColorYUV(autogain=true), 3, 140,true,honly=honly,lumaonly=lumaonly)
hfil = YAHR2(depth=depth,blur=blur,useawarp4=useawarp4,depthV=depthV,blurV=blurV)
RM2 = DR_Radius_dhh(edgm.mt_inflate(),radius,0).mt_inflate()
DeRinging = mt_Merge(hfil, src, edgm.mt_inflate(155,155))
mt_Merge(src, DeRinging, RM2, u=2, v=2)
} # YAHRmask, by Tophf
# With slight modifications (merging both functions into one). Output should be identical. function YAHRmask(clip input, int "expand", int "warpdepth", int "blur", bool "useawarp4", clip "yahr", int "warpdepthV", int "blurV") { expand = Default(expand, 5)
warpde = Default(warpdepth, 32)
blur = Default(blur, 2) yahr = defined(yahr) ? yahr : input.YAHR2(warpde, blur, useawarp4, warpdepthV, blurV) input
vEdge = mt_lutxy(last, mt_expand().mt_expand(),"x y - abs 8 - 7 <<") mt_merge(yahr, vEdge.binomialblur(expand*2, u=1, v=1)
\ .mt_lut("x 4 <<")
\ .mt_logic(vEdge.removegrain(12, -1)
\ .mt_invert(), "min"), true)
}
|
|
торрент иваниваныч
Стаж: 15 лет 1 месяц Сообщений: 1154
|
торрент иваниваныч ·
31-Авг-19 21:12
(спустя 51 мин.)
Tempter57
Скачал последнюю версию, там YAHR.avs и YARHmod.avsi, третий какой? Я запускаю DeHaloHmod, пишет "there is not function named 'yahr2' " Ошибка возникает при smooth=true.
|
|
Tempter57
Стаж: 16 лет 3 месяца Сообщений: 4963
|
Tempter57 ·
31-Авг-19 22:01
(спустя 49 мин.)
торрент иваниваныч
Так откройте скрипт YAHR.avs, там внутри все три YAHR
|
|
торрент иваниваныч
Стаж: 15 лет 1 месяц Сообщений: 1154
|
торрент иваниваныч ·
31-Авг-19 22:28
(спустя 26 мин.)
Tempter57
Я уже сам нашёл, но что-то не работает оно. Завтра буду разбираться.
|
|
Tempter57
Стаж: 16 лет 3 месяца Сообщений: 4963
|
Tempter57 ·
01-Сен-19 13:42
(спустя 15 часов, ред. 01-Сен-19 13:42)
торрент иваниваныч
Обновите ещё раз архив, поскольку в фильтры с новым DeHaloHmod.avsi v.2.44 внутри необходимо подключить ещё другие плагины.
|
|
торрент иваниваныч
Стаж: 15 лет 1 месяц Сообщений: 1154
|
торрент иваниваныч ·
03-Сен-19 01:48
(спустя 1 день 12 часов, ред. 03-Сен-19 01:48)
Tempter57
Обновил, заработало. Спасибо.
Не могу TAAmbk в 16бит запустить. Он вообще умеет?
Код:
ConvertBits(16)
ConvertToStacked()
TAAmbk(lsb_in=true, lsb_out=true, aatype=1, preaa=0, postaa=false, sharp=50, mtype=0, cycle=0, dark=0.0)
Цитата:
Dither_limitdif16: clip "src" has a height of 960 instead of 480.
Видео 720-480.
|
|
Tempter57
Стаж: 16 лет 3 месяца Сообщений: 4963
|
Tempter57 ·
03-Сен-19 13:20
(спустя 11 часов, ред. 03-Сен-19 13:20)
торрент иваниваныч
Если исходник format="YUV420P10", то вы должны выполнить
скрытый текст
video = LWLibavVideoSource("E:\[OnF-Supremes]_Hyouka_04_[Hi10p][1280x720_x264_AAC][FB5D1506].mkv", stream_index=-1, cache=true, dr=false, format="YUV420P10", stacked=false).AssumeFPS(23.976)
audio = LWLibavAudioSource("E:\[OnF-Supremes]_Hyouka_04_[Hi10p][1280x720_x264_AAC][FB5D1506].mkv", stream_index=1, cache=true, av_sync=false)
AudioDub(video, audio)
W = width(last)
H = height(last) ConvertFromDoubleWidth(bits=10)
convertBits(16)
ConvertToStacked() TAAmbk(lsb_in=true, lsb_out=true, aatype=1, preaa=0, postaa=false, sharp=50, mtype=0, cycle=0, dark=0.0) # ==== ресайз 16-битного видео ====
Dither_Resize16(W, H, kernel="spline36")
OUTPUT_BIT_DEPTH = 10 # изменить 10 на 8 при отладке или установить 16 без обрезания верхних битов скриптом (OUTPUT_BIT_DEPTH == 16) ? Eval("""
Dither_convey_yuv4xxp16_on_yvxx() # 16-бит
""") : (OUTPUT_BIT_DEPTH == 10) ? Eval("""
Down10(10, stack=false, dither=-3) # 10-бит
""") : Down10(8) # 8-бит
Если обычный 8-битный, то
скрытый текст
video = LWLibavVideoSource("E:\1.mkv", stream_index=-1, cache=true, dr=false, format="YUV420P8", stacked=true).AssumeFPS(23.976)
audio = LWLibavAudioSource("E:\1.mkv", stream_index=1, cache=true, av_sync=false)
AudioDub(video, audio)
W = width(last)
H = height(last) U16() # variant 1 #Dither_convert_8_to_16() # variant 2 #dfttest (sigma=2.0, tbsize=3, lsb=true, threads=1) # variant 3 /*
# variant 4
# ==== Denoiced =====
blksize = 16
overlap = blksize/2
halfblksize = blksize/2
halfoverlap = blksize/4
halfthSAD = 100
chroma = true
planes = chroma?4:0
tr = 4 # Temporal radius
thSAD = 256
thSAD2 = 130
dct = 8 source = last
super = source.MSuper(pel=2, pelclip=LanczosResize(width*2,height*2,src_left=0.25, src_top=0.25), sharp=2, rfilter=2, chroma=chroma)
multi_vec = MAnalyse(super,multi=true,delta=tr,blksize=blksize,overlap=overlap,chroma=chroma,truemotion=true,search=5,dct=dct)
multi_vec = MRecalculate(super, multi_vec, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, chroma=chroma, truemotion=true, tr=tr)
source.MDegrainN (super, multi_vec, tr, thSAD=thSAD, thSAD2=thSAD2,thSCD1=300,thSCD2=116,limit=180, plane=planes, lsb=true)
*/ TAAmbk(lsb_in=true, lsb_out=true, aatype=1, preaa=0, postaa=false, sharp=50, mtype=0, cycle=0, dark=0.0) # ==== ресайз 16-битного видео ====
Dither_Resize16(W, H, kernel="spline36")
OUTPUT_BIT_DEPTH = 10 # изменить 10 на 8 при отладке или установить 16 без обрезания верхних битов скриптом (OUTPUT_BIT_DEPTH == 16) ? Eval("""
Dither_convey_yuv4xxp16_on_yvxx() # 16-бит
""") : (OUTPUT_BIT_DEPTH == 10) ? Eval("""
Down10(10, stack=false, dither=-3) # 10-бит
""") : Down10(8) # 8-бит
|
|
торрент иваниваныч
Стаж: 15 лет 1 месяц Сообщений: 1154
|
торрент иваниваныч ·
03-Сен-19 13:35
(спустя 14 мин.)
Tempter57
8бит, ошибка та же в обоих вариантах.
скрытый текст
Import("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\functions\AudioFunctions.avs")
Import("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\functions\VideoFunctions.avs")
LoadPlugin("C:\Program Files (x86)\XviD4PSP 5\apps\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\NicAudio.dll")
LoadPlugin("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\TIVTC.dll")
LoadPlugin("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\yadifmod.dll")
LoadPlugin("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\nnedi3.dll")
LoadPlugin("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\ColorMatrix.dll") MPEG2Source("C:\Temp\Jutaijima 01.index\Jutaijima 01_T01.d2v", cpu=0, info=3) ConvertToYV12(interlaced = true)
ColorMatrix(hints=true, interlaced=true)
interp = nnedi3(field=1, qual=2)
deint = YadifMod(order=1, edeint=interp)
TFM(order=1, mode=3, clip2=deint, slow=2).TDecimate(hybrid=1) ###[FILTERING]###
XviD4PSPPluginsPath = "C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\"
LoadPlugin(XviD4PSPPluginsPath + "avstp.dll")
LoadPlugin(XviD4PSPPluginsPath + "RGTools.dll")
LoadPlugin(XviD4PSPPluginsPath + "masktools2.dll")
LoadPlugin(XviD4PSPPluginsPath + "EEDI2.dll")
LoadPlugin(XviD4PSPPluginsPath + "EEDI3.dll")
LoadPlugin(XviD4PSPPluginsPath + "nnedi3.dll")
LoadPlugin(XviD4PSPPluginsPath + "nnedi3ocl.dll")
LoadPlugin(XviD4PSPPluginsPath + "fturn-26.dll")
LoadPlugin(XviD4PSPPluginsPath + "mvtools2.dll")
LoadPlugin(XviD4PSPPluginsPath + "SangNom2.dll")
LoadPlugin(XviD4PSPPluginsPath + "TCannymod.dll")
LoadPlugin(XviD4PSPPluginsPath + "TEMmod.dll")
LoadPlugin(XviD4PSPPluginsPath + "Toon-v1.1.dll")
LoadPlugin(XviD4PSPPluginsPath + "MSharpen.dll")
LoadPlugin(XviD4PSPPluginsPath + "awarpsharp2.dll")
LoadPlugin(XviD4PSPPluginsPath + "warpsharp.dll")
LoadPlugin(XviD4PSPPluginsPath + "variableblur.dll")
LoadPlugin(XviD4PSPPluginsPath + "dfttest.dll")
LoadPlugin(XviD4PSPPluginsPath + "AddGrainC.dll")
LoadPlugin(XviD4PSPPluginsPath + "dither.dll")
LoadPlugin(XviD4PSPPluginsPath + "TEdgeMask.dll")
LoadPlugin(XviD4PSPPluginsPath + "flash3kyuu_deband.dll")
Import(XviD4PSPPluginsPath + "LumaDB_v0.7.avsi")
Import(XviD4PSPPluginsPath + "GrainFactory3mod_v1.2.avsi")
Import(XviD4PSPPluginsPath + "Dither.avsi")
Import(XviD4PSPPluginsPath + "Soothe.avs")
Import(XviD4PSPPluginsPath + "LSFmod v1.9.avsi")
Import(XviD4PSPPluginsPath + "TAAmbk.avsi") # setmemorymax(640) W = width(last)
H = height(last) U16()
#Dither_convert_8_to_16() TAAmbk(lsb_in=true, lsb_out=true, aatype=1, preaa=0, postaa=false, sharp=50, mtype=0, cycle=0, dark=0.0) Dither_Resize16(W, H, kernel="spline36") OUTPUT_BIT_DEPTH = 8 # изменить 10 на 8 при отладке или установить 16 без обрезания верхних битов скриптом (OUTPUT_BIT_DEPTH == 16) ? Eval("""
Dither_convey_yuv4xxp16_on_yvxx() # 16-бит
""") : (OUTPUT_BIT_DEPTH == 10) ? Eval("""
Down10(10, stack=false, dither=-3) # 10-бит
""") : Down10(8) # 8-бит # Назначение: для антиайлиазинга и дебандинга аниме с низким уровнем шумов
# Тип антиайлизинга по умолчанию: Taa
# Тип шумоподавителя: tcanny
# Тип шарпера: LSFmod
# Наличие фильтра DeBanding по умолчанию: LumaDB
# Скорость обработки: средняя
###[FILTERING]###
|
|
Tempter57
Стаж: 16 лет 3 месяца Сообщений: 4963
|
Tempter57 ·
03-Сен-19 15:09
(спустя 1 час 33 мин., ред. 03-Сен-19 15:09)
торрент иваниваныч
Посмотрел функцию TAAmbk.avsi и увидел ,что она по своей структуре имеет 8-битную обработку, кроме стр. 80, которая говорит, что при наличии на входе исходного клипа 16 битного, его сразу преобразовывают в 8 битный
Код:
input = lsb_in ? input.Ditherpost(mode=-1) : input
И на выходе скрипта просто идёт тупая конвертация в 16 бит в стр.111
Код:
output = (lsb_in && lsb_out) ? input.dither_limit_dif16( aaStabed.dither_convert_8_to_16(), thr=1.0, elast=2.0) : aaStabed
Редкий бред и полный обман пользователя!!! Поясняю: в скрипте используется клип
Код:
src = Default(src, input)
Этот клип используется в строках c LSFmod и не только, где он подразумевается , как 8 битный по ходу, отсюда конфликт размеров форматов поскольку надо править скрипт. Там в этом плане полная лажа!!!
Мой вам совет: откажитесь от параметров lsb_in=true, lsb_out=true и используйте в своём случае также, как в фильтре 10bit Anime TAA или пробуйте для своих целей применить
xaa.avsi
/* xaa v1.2.1 A highly versatile antialiasing function. ##### Requirements ##### Plugins:
Dither
eedi2
eedi3
FTurn
MaskTools2
nnedi3
nnedi3ocl
RgTools
SangNom2
TCannyMod
TEMmod Scripts:
edi_rpow2
ResizeX FTurn is optional but recommended.
Other plugins not used with your chosen settings don't need to be loaded. Color formats:
Y8, YV12, YV16, YUY2, YV24 ##### Parameters ##### int ow, int oh (defaults: input width, 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. float ss (default: 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, val ssh (defaults: 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 (default: "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 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, string dscl (defaults: "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 (default: 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 (default: -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 (default: 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 (default: "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 (default: 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 (default: 0)
-----------------------
0: Processes the luma plane only
1: Processes both the luma and chroma planes
2: Processes the chroma planes only string cplace (default: "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 (default: 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 (default: 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, float eediB, float eediG (defaults: 0.2, 0.25, 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 (default: 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 (default: 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 (default: undefined)
--------------------------------
The number of threads to use for each instance of SangNom2, nnedi3, and eedi3.
Leave this undefined to let the plugins choose automatically.
*/ function 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") { lsb_in = Default(lsb_in, false)
lsb = Default(lsb, false) iw = input.Width()
ih = lsb_in ? input.Height()/2 : input.Height() mode = Default(mode, "sr SangNom2")
ow = Default(ow, iw)
oh = Default(oh, ih)
cplace = Default(cplace, "MPEG2")
nns = Default(nns, 1)
eedimthr = Default(eedimthr, 0.0)
eediA = Default(eediA, 0.2)
eediB = Default(eediB, 0.25)
eediG = Default(eediG, 20.0) # Backwards compatibility with pre-v1.2 mode strings
mode = mode == "SangNom2" ? "sr SangNom2"
\ : mode == "nnedi3" ? "sr nnedi3"
\ : mode == "nnedi3ocl" ? "sr nnedi3ocl"
\ : mode == "eedi3" ? "sr eedi3"
\ : mode == "eedi3+nnedi3" ? "sr eedi3 nnedi3"
\ : mode == "eedi2" ? "sr eedi2"
\ : mode == "dnnedi3" ? "drv nnedi3"
\ : mode == "dnnedi3ocl" ? "drv nnedi3ocl"
\ : mode == "deedi3" ? "drv eedi3"
\ : mode == "deedi3+dnnedi3" ? "drv eedi3 nnedi3"
\ : mode mode.LeftStr(2) == "dr" ||
\ mode.LeftStr(2) == "di" ? Eval("""
ss = Default(ss, 1.0)
ssw = Default(ssw, ss)
ssh = Default(ssh, ss)
uscl = Default(uscl, "Spline36")
dscl = Default(dscl, "Spline36")
csharp = Default(csharp, 0)
cstr = Default(cstr, -1.0)
mask = Default(mask, 1)
mtype = Default(mtype, "TEMmod")
mthr = Default(mthr, 8.0)
chroma = Default(chroma, 0)
""")
\ : mode == "maa2" ? Eval("""
mode = "sr SangNom2"
ss = Default(ss, 2.0)
ssw = Default(ssw, ss)
ssh = Default(ssh, ss)
uscl = Default(uscl, "Spline36")
dscl = Default(dscl, "Spline36")
csharp = Default(csharp, 0)
cstr = Default(cstr, -1.0)
mask = Default(mask, 1)
mtype = Default(mtype, "sobel")
mthr = Default(mthr, 7.0)
chroma = Default(chroma, 0)
""")
\ : mode == "daa" ? Eval("""
mode = "drv nnedi3"
ss = Default(ss, 1.0)
ssw = Default(ssw, ss)
ssh = Default(ssh, ss)
uscl = Default(uscl, "Spline36")
dscl = Default(dscl, "Spline36")
csharp = Default(csharp, 1)
cstr = Default(cstr, -1.0)
mask = Default(mask, 0)
mtype = Default(mtype, "TEMmod")
mthr = Default(mthr, 8.0)
chroma = Default(chroma, 1)
""")
\ : mode == "Mrdaa" ||
\ mode == "MrdaaLame" ? Eval("""
mode = "null"
ss = Default(ss, 2.0)
ssw = Default(ssw, ss)
ssh = Default(ssh, ss)
uscl = Default(uscl, "nnedi3")
dscl = Default(dscl, "Spline36")
csharp = Default(csharp, 2)
cstr = Default(cstr, 1.0)
mask = Default(mask, 0)
mtype = Default(mtype, "TEMmod")
mthr = Default(mthr, 8.0)
chroma = Default(chroma, 1)
""")
\ : mode == "santiag" ? Eval("""
mode = "di2 nnedi3"
ss = Default(ss, 1.0)
ssw = Default(ssw, ss)
ssh = Default(ssh, ss)
uscl = Default(uscl, "Spline36")
dscl = Default(dscl, "Spline36")
csharp = Default(csharp, 0)
cstr = Default(cstr, -1.0)
mask = Default(mask, 0)
mtype = Default(mtype, "TEMmod")
mthr = Default(mthr, 8.0)
chroma = Default(chroma, 1)
""")
\ : Eval("""
ss = Default(ss, 2.0)
ssw = Default(ssw, ss)
ssh = Default(ssh, ss)
uscl = Default(uscl, "Spline36")
dscl = Default(dscl, "Spline36")
csharp = Default(csharp, 0)
cstr = Default(cstr, -1.0)
mask = Default(mask, 1)
mtype = Default(mtype, "TEMmod")
mthr = Default(mthr, 8.0)
chroma = Default(chroma, 0)
""") Assert(ow != 0, "xaa: output width cannot be 0")
Assert(oh != 0, "xaa: output height cannot be 0")
Assert(ss > 0, "xaa: ss must be greater than 0")
Assert(ssw > 0, "xaa: ssw must be greater than 0")
Assert(ssh > 0, "xaa: ssh must be greater than 0")
Assert(dscl != "nnedi3" && dscl != "nnedi3ocl" && dscl.LeftStr(5) != "eedi3" && dscl != "eedi2",
\ "xaa: "+dscl+" can't be used for downscaling")
Assert(cplace == "MPEG1" || cplace == "MPEG2", "xaa: cplace must be MPEG1 or MPEG2") ##### Set variable values based on parameter settings ##### # Get the input clip's colorspace and make sure it's supported
csp = input.IsY8() ? "Y8"
\ : input.IsYV12() ? "YV12"
\ : input.IsYV16() ? "YV16"
\ : input.IsYUY2() ? "YUY2"
\ : input.IsYV24() ? "YV24"
\ : Assert(false, "xaa: input must be Y8, YV12, YV16, YUY2, or YV24") # Check for subsampled chroma
hssc12 = csp == "YV12" || csp == "YV16" || csp == "YUY2" ? true : false
vssc12 = csp == "YV12" ? true : false Assert(ow < 0 || !hssc12 || ow%2 == 0, "xaa: output width of "+csp+" must be a multiple of 2")
Assert(oh < 0 || !vssc12 || oh%2 == 0, "xaa: output height of "+csp+" must be a multiple of 2") # Override the chroma setting if the input is Y8
chroma = csp == "Y8" ? 0 : chroma # Set chroma values for plugins based on the chroma parameter setting
UVint = chroma == 0 ? 1
\ : chroma == 1 ||
\ chroma == 2 ? 3
\ : Assert(false, "xaa: invalid chroma value")
UVint2 = chroma == 0 ? 0 : 1
UVbool = chroma == 0 ? false : true # YUY2 input has to be converted to YV16 for planar processing and then converted back to YUY2 for output.
input = csp == "YUY2" ? input.ConvertToYV16() : input # If ssw or ssh is a float, use it as a multiplier to determine the supersampled resolution
ssw = ssw.IsInt() && ssw > 5 ? ssw
\ : ssw.IsFloat() && ssw == 1.0 ? iw
\ : ssw.IsFloat() ? Int(Round(iw*ssw/4.0)*4)
\ : Assert(false, "xaa: ssw value must be a float or int")
ssh = ssh.IsInt() && ssh > 5 ? ssh
\ : ssh.IsFloat() && ssh == 1.0 ? ih
\ : ssh.IsFloat() ? Int(Round(ih*ssh/4.0)*4)
\ : Assert(false, "xaa: ssh value must be a float or int") # Output at the supersampled resolution if the output width or height is negative
ow < 0 || oh < 0 ?
\ Eval("""
ow = ssw
oh = ssh
""")
\ : NOP() # Get the aa mode from the mode string
aa_mode = mode == "null" ? "null"
\ : mode.LeftStr(2) == "sr" ||
\ mode.LeftStr(2) == "dr" ||
\ mode.LeftStr(2) == "di" ? mode.LeftStr(2)
\ : Assert(false, "xaa: invalid mode string")
mode = mode != "null" ? mode.RightStr(mode.StrLen()-2) : mode # Remove spacers from the mode string
mode = mode.LeftStr(1) == " " ||
\ mode.LeftStr(1) == "_" ||
\ mode.LeftStr(1) == "+" ||
\ mode.LeftStr(1) == "-" ? mode.RightStr(mode.StrLen()-1)
\ : mode # Get the aa direction from the mode string
mode.LeftStr(1) == "b" ?
\ Eval("""
aa_h = true
aa_v = true
mode = mode.RightStr(mode.StrLen()-1)
""")
\ : mode.LeftStr(1) == "h" ?
\ Eval("""
aa_h = true
aa_v = false
mode = mode.RightStr(mode.StrLen()-1)
""")
\ : mode.LeftStr(1) == "v" ?
\ Eval("""
aa_h = false
aa_v = true
mode = mode.RightStr(mode.StrLen()-1)
""")
\ : Eval("""
aa_h = true
aa_v = true
""") mode = mode.LeftStr(1) == " " ||
\ mode.LeftStr(1) == "_" ||
\ mode.LeftStr(1) == "+" ||
\ mode.LeftStr(1) == "-" ? mode.RightStr(mode.StrLen()-1)
\ : mode # Get the number of aa passes from the mode string
Assert(mode.LeftStr(1) != "0", "xaa: number of aa passes must be > 0")
mode.LeftStr(1).Value() > 0 ?
\ Eval("""
aa_pass = mode.LeftStr(1).Value().Int()
mode = mode.RightStr(mode.StrLen()-1)
""")
\ : Eval("""
aa_pass = 1
""") mode = mode.LeftStr(1) == " " ||
\ mode.LeftStr(1) == "_" ||
\ mode.LeftStr(1) == "+" ||
\ mode.LeftStr(1) == "-" ? mode.RightStr(mode.StrLen()-1)
\ : mode # Get the aa type from the mode string
aa_type = mode == "null" ? "null"
\ : mode.LeftStr(8) == "SangNom2" ? "SangNom2"
\ : mode.LeftStr(6) == "nnedi3" &&
\ mode.LeftStr(9) != "nnedi3ocl" ? "nnedi3"
\ : mode.LeftStr(9) == "nnedi3ocl" ? "nnedi3ocl"
\ : mode.LeftStr(5) == "eedi3" ? "eedi3"
\ : mode.LeftStr(5) == "eedi2" ? "eedi2"
\ : Assert(false, "xaa: invalid mode string") # Get the aa sclip from the mode string
mode = aa_type == "eedi3" && mode.StrLen() > 5 ? mode.RightStr(mode.StrLen()-5) : ""
mode = mode.LeftStr(1) == " " ||
\ mode.LeftStr(1) == "_" ||
\ mode.LeftStr(1) == "+" ||
\ mode.LeftStr(1) == "-" ? mode.RightStr(mode.StrLen()-1)
\ : mode
aa_sclip = mode # These aa types can process Y8, YV16, and YV24 while others require conversion to YV12
Yx_aa_type = aa_type == "SangNom2" ||
\ aa_type == "nnedi3" ||
\ aa_type == "nnedi3ocl" ? true : false # Get the sclip setting for eedi3 upscaling from the uscl string
uscl.LeftStr(5) == "eedi3" && uscl.StrLen() > 5 ?
\ Eval("""
rs_sclip = uscl.RightStr(uscl.StrLen()-5)
uscl = "eedi3"
""")
\ : Eval("""
rs_sclip = ""
""")
rs_sclip = rs_sclip.LeftStr(1) == " " ||
\ rs_sclip.LeftStr(1) == "_" ||
\ rs_sclip.LeftStr(1) == "+" ||
\ rs_sclip.LeftStr(1) == "-" ? rs_sclip.RightStr(rs_sclip.StrLen()-1)
\ : rs_sclip # Define these before the resize sections so they can be used as conditionals
aa_ow = aa_mode == "di" && csharp != 1 && !aa_v ? ssw*2 : ssw
aa_oh = aa_mode == "di" && csharp != 1 && aa_v ? ssh*2 : ssh rs1_type = ssw > iw || ssh > ih ? uscl : dscl
rs1_isedi = rs1_type == "nnedi3" || rs1_type == "nnedi3ocl" ||
\ rs1_type == "eedi3" || rs1_type == "eedi2" ? true : false
rsaa_type = ow > aa_ow || oh > aa_oh ? uscl : dscl
rsaa_isedi = rsaa_type == "nnedi3" || rsaa_type == "nnedi3ocl" ||
\ rsaa_type == "eedi3" || rsaa_type == "eedi2" ? true : false
rs2_type = ow > iw || oh > ih ? uscl : dscl
rs2_isedi = rs2_type == "nnedi3" || rs2_type == "nnedi3ocl" ||
\ rs2_type == "eedi3" || rs2_type == "eedi2" ? true : false # Override the csharp setting if cstr=0, or if csharp=1 and mode="null" since it won't have any effect in that case.
# Override the cstr setting if csharp=0 since it won't be used.
csharp = cstr == 0 || csharp == 1 && aa_mode == "null" ? 0 : csharp
cstr = csharp == 0 ? 0 : cstr # Get TEMmod's type parameter from the mtype string if present, or otherwise default to type 4
Assert(mtype.LeftStr(6) != "TEMmod" || mtype.LeftStr(6) == "TEMmod" && mtype.StrLen() <= 7, "xaa: invalid TEMmod type") mtype.LeftStr(6) == "TEMmod" && mtype.StrLen() > 6 ?
\ Eval("""
temtype = mtype.RightStr(1).Value().Int()
mtype = "TEMmod"
Assert(temtype > 0 && temtype < 6, "xaa: invalid TEMmod type")
""")
\ : Eval("""
temtype = 4
""") # Round the mthr values for mt_edge mask types
mthr = mtype != "TEMmod" && mtype != "TCannyMod" ? mthr.Round() : mthr
eedimthr = mtype != "TEMmod" && mtype != "TCannyMod" ? eedimthr.Round() : eedimthr ##### Scale the input clip to the supersampled resolution ##### stack16i = lsb_in ? true : false
stack16o = stack16i && aa_mode == "null" && csharp == 0 && !rsaa_isedi ||
\ stack16i && aa_mode == "null" && cstr <= 0 && !rsaa_isedi ||
\ lsb && aa_mode == "null" && cstr <= 0 && !rsaa_isedi ||
\ lsb && aa_mode == "di" && csharp == 1 && cstr <= 0 && !rsaa_isedi ||
\ lsb && aa_mode == "di" && csharp == 1 && cstr <= 0 && !rsaa_isedi ? true : false # rs1_type and rs1_isedi are defined earlier
rs1_rfacX = ssw > iw*6-4 ? 8
\ : ssw > iw*3-4 ? 4
\ : ssw > iw ? 2
\ : 1
rs1_rfacY = ssh > ih*6-4 ? 8
\ : ssh > ih*3-4 ? 4
\ : ssh > ih ? 2
\ : 1
rs1_cshift = ssw >= iw*rs1_rfacX || ssh >= ih*rs1_rfacY ? "Spline36" : dscl # To avoid resizing twice, don't correct the edi_rpow2 center shift until
# resizing to the output resolution if no other processing will happen until then.
# This isn't done all the time because the center shift messes with antialiasing.
delay_cshift = aa_mode == "null" && rs1_isedi && ssw == iw*rs1_rfacX && ssh == ih*rs1_rfacY ? true : false
rs1_hshift = !hssc12 || chroma == 0 ? -0.5 : -0.5*(rs1_rfacX-1)
rs1_hshift = delay_cshift && rs1_isedi && rs1_rfacX > 1 ? rs1_hshift : 0
rs1_vshift = delay_cshift && rs1_isedi && rs1_rfacY > 1 ? -0.5 : 0
rs1_hshift_c = delay_cshift && rs1_isedi && rs1_rfacX > 1 && cplace == "MPEG1" && hssc12 && UVbool ? -0.5*(rs1_rfacX-1)+rs1_hshift : rs1_hshift
rs1_vshift_c = delay_cshift && rs1_isedi && rs1_rfacY > 1 && vssc12 && UVbool ? rs1_vshift*2.0 : rs1_vshift input_8bit = stack16i ? input.DitherPost(mode=-1) : input # Edge mask for eedi3's mclip parameter to use for the rs1 and rs2 resizes
uscl == "eedi3" && eedimthr > 0 ?
\ Eval("""
rs12_mclip = mtype == "TEMmod" ? input_8bit.TEMmod(eedimthr,eedimthr,temtype,0,UVint2)
\ .mt_inflate(U=UVint, V=UVint)
\ : mtype == "TCannyMod" ? input_8bit.TCannyMod(t_h=eedimthr, t_l=eedimthr, chroma=UVint2)
\ .mt_expand(mode="both", U=UVint, V=UVint).mt_inflate(U=UVint, V=UVint)
\ .mt_inpand(mode="both", U=UVint, V=UVint).mt_inflate(U=UVint, V=UVint)
\ : input_8bit.mt_edge(mtype,eedimthr,eedimthr,eedimthr,eedimthr, U=UVint, V=UVint)
\ .mt_inflate(U=UVint, V=UVint)
""")
\ : Eval("""
rs12_mclip = Undefined()
""") input_y8 = chroma == 0 ? input.ConvertToY8() : input ssw == iw && ssh == ih ?
\ Eval("""
rs1 = stack16i && !stack16o ? input_y8.DitherPost(mode=6)
\ : !stack16i && stack16o ? input_y8.Dither_convert_8_to_16()
\ : input_y8
""")
\ : rs1_isedi ?
\ Eval("""
rs1 = stack16i ? input_y8.DitherPost(mode=6) : input_y8
rs1 = delay_cshift ? rs1.edi_rpow2(rs1_rfacX,rs1_rfacY,rs1_type, cplace=cplace, lsb=stack16o, YV12cfix=false,
\ alpha=eediA, beta=eediB, gamma=eediG, sclip=rs_sclip, mclip=rs12_mclip, threads=threads)
\ : rs1.edi_rpow2(rs1_rfacX,rs1_rfacY,rs1_type,rs1_cshift,ssw,ssh, cplace=cplace, lsb=stack16o,
\ alpha=eediA, beta=eediB, gamma=eediG, sclip=rs_sclip, mclip=rs12_mclip, threads=threads)
""")
\ : Eval("""
rs1 = input_y8.ResizeX(ssw,ssh, kernel=rs1_type, cplace=cplace, lsb_in=stack16i, lsb=stack16o)
""") rs1_8bit = stack16o ? rs1.DitherPost(mode=6) : rs1 ##### Apply antialiasing to the supersampled clip ##### stack16i = stack16o ? true : false
stack16o = stack16i && aa_mode == "null" ||
\ lsb && aa_mode == "di" && csharp == 1 && cstr <= 0 && !rsaa_isedi ||
\ lsb && aa_mode == "di" && csharp == 1 && cstr <= 0 && !rsaa_isedi ? true : false # Don't output in stack16 after antialiasing horizontally
# if the clip is going to be antialiased vertically afterward.
stack16o_h = stack16o && !aa_v ? true : false # To avoid resizing twice, don't downscale the aaclip after di antialiasing unless needed for csharp=1.
aa_delayresize_h = aa_mode == "di" && csharp != 1 && !aa_v ? true : false
aa_delayresize_v = aa_mode == "di" && csharp != 1 && aa_v ? true : false
aa_hshift = aa_delayresize_h ? -0.5 : 0
aa_vshift = aa_delayresize_v ? -0.5 : 0
aa_hshift_c = aa_delayresize_h && hssc12 && UVbool && cplace == "MPEG1" ? -0.5+aa_hshift : aa_hshift
aa_vshift_c = aa_delayresize_v && vssc12 && UVbool ? aa_vshift*2.0 : aa_vshift # Pad the frame with rows of duplicate pixels to avoid errors from
# mod1 resolutions and edge distortion caused by deinterlacing.
rs1_ismod4 = ssw%4 == 0 && ssh%4 == 0 ? true : false
rs1_ismod8 = ssw%8 == 0 && ssh%8 == 0 ? true : false
rs1_pad8 = !rs1_ismod8 && aa_type == "eedi2" && hssc12 && csp != "YV12" && UVbool ||
\ !rs1_ismod8 && aa_type == "eedi3" && hssc12 && csp != "YV12" && UVbool &&
\ aa_sclip != "" && aa_sclip != "SangNom2" && aa_sclip != "nnedi3" && aa_sclip != "nnedi3ocl" ? true : false # Don't add padding when using di eedi3 antialiasing unless it's
# needed for mod4/mod8 compatibility because it doesn't distort edges.
rs1_addpad = aa_mode == "null" || aa_mode == "di" && aa_type == "eedi3" && rs1_ismod4 && !rs1_pad8 ? false : true rs1_padR = rs1_pad8 ? 8-ssw%8 : 4-ssw%4
rs1_padT = rs1_pad8 ? 8-ssh%8 : 4-ssh%4 rs1_padR = rs1_padR >= 4 ? rs1_padR
\ : rs1_padR+4
rs1_padT = rs1_padT >= 4 ? rs1_padT
\ : rs1_padT+4
rs1_padL = rs1_pad8 && (ssw+rs1_padR+4)%8 == 0 ? 4
\ : rs1_pad8 ? 8
\ : 4
rs1_padB = rs1_pad8 && (ssh+rs1_padT+4)%8 == 0 ? 4
\ : rs1_pad8 ? 8
\ : 4 ssw_pad = rs1_addpad ? ssw+rs1_padR+rs1_padL : ssw
ssh_pad = rs1_addpad ? ssh+rs1_padT+rs1_padB : ssh
ssw_pad_c = hssc12 ? ssw_pad/2 : ssw_pad
ssh_pad_c = vssc12 ? ssh_pad/2 : ssh_pad # Edge mask for eedi3's mclip parameter to use for antialiasing
eedimthr > 0 ?
\ Eval("""
aa_mclip = mtype == "TEMmod" ? rs1_8bit.TEMmod(eedimthr,eedimthr,temtype,0,UVint2)
\ .mt_inflate(U=UVint, V=UVint)
\ : mtype == "TCannyMod" ? rs1_8bit.TCannyMod(t_h=eedimthr, t_l=eedimthr, chroma=UVint2)
\ .mt_expand(mode="both", U=UVint, V=UVint).mt_inflate(U=UVint, V=UVint)
\ .mt_inpand(mode="both", U=UVint, V=UVint).mt_inflate(U=UVint, V=UVint)
\ : rs1_8bit.mt_edge(mtype,eedimthr,eedimthr,eedimthr,eedimthr, U=UVint, V=UVint)
\ .mt_inflate(U=UVint, V=UVint) aa_mclip_pad = rs1_addpad ? aa_mclip.ResizeX(ssw+rs1_padL+rs1_padR, ssh+rs1_padT+rs1_padB, -rs1_padL, -rs1_padT,
\ ssw+rs1_padL+rs1_padR, ssh+rs1_padT+rs1_padB, kernel="Point", chroma=UVbool)
\ : aa_mclip
aa_mclipv = aa_mclip_pad.ConvertToYV12()
aa_mcliph = aa_mclipv.TryFTurnRight(UVbool)
aa_mclipvU = UVbool ? aa_mclip_pad.UToY8().ConvertToYV12() : Undefined()
aa_mcliphU = UVbool ? aa_mclipvU.TryFTurnRight(false) : Undefined()
aa_mclipvV = UVbool ? aa_mclip_pad.VToY8().ConvertToYV12() : Undefined()
aa_mcliphV = UVbool ? aa_mclipvV.TryFTurnRight(false) : Undefined()
""")
\ : Eval("""
aa_mclip = Undefined()
aa_mclipv = Undefined()
aa_mcliph = Undefined()
aa_mclipvU = Undefined()
aa_mcliphU = Undefined()
aa_mclipvV = Undefined()
aa_mcliphV = Undefined()
""") rs1_pad = rs1_addpad ? rs1_8bit.ResizeX(ssw+rs1_padL+rs1_padR, ssh+rs1_padT+rs1_padB, -rs1_padL, -rs1_padT,
\ ssw+rs1_padL+rs1_padR, ssh+rs1_padT+rs1_padB, kernel="Point", chroma=UVbool)
\ : rs1_8bit # Perform antialiasing
aa_mode == "null" ?
\ Eval("""
aaclip = rs1
""")
\ : Yx_aa_type && aa_type != "SangNom2" && csp != "YV16" && csp != "YUY2" ||
\ aa_type != "SangNom2" && csp == "YV12" && UVbool ?
\ Eval("""
# When using SangNom2, it's faster to split the planes into Y8 clips and process them separately
aaclip = aa_h ? rs1_pad.TryFTurnRight(UVbool) : rs1_pad
aaclip = aa_h && aa_mode == "sr" ? aaclip.xaa_sr(aa_type,aa_pass,UVbool,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mcliph,threads)
\ : aa_h && aa_mode == "dr" ? aaclip.xaa_dr(aa_type,aa_pass,UVbool,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mcliph,threads)
\ : aa_h && aa_mode == "di" ? aaclip.xaa_di(aa_type,aa_pass,UVbool,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mcliph,threads)
\ : aaclip
aaclip = aa_h && aa_mode == "di" &&
\ !aa_delayresize_h &&
\ vssc12 && UVbool ? aaclip.ResizeX(ssh_pad,ssw_pad,0,-0.5, kernel=dscl, chroma=false, lsb=stack16o_h)
\ .MergeChroma(aaclip.ResizeX(ssh_pad,ssw_pad,0,-1.0, kernel=dscl, cplace=cplace, luma=false, lsb=stack16o_h))
\ : aa_h && aa_mode == "di" &&
\ !aa_delayresize_h ? aaclip.ResizeX(ssh_pad,ssw_pad,0,-0.5, kernel=dscl, cplace=cplace, chroma=UVbool, lsb=stack16o_h)
\ : aaclip
aaclip = aa_h && stack16o_h ? StackVertical(aaclip.Dither_get_msb().TryFTurnLeft(UVbool),aaclip.Dither_get_lsb().TryFTurnLeft(UVbool))
\ : aa_h ? aaclip.TryFTurnLeft(UVbool)
\ : aaclip
aaclip = aa_v && aa_mode == "sr" ? aaclip.xaa_sr(aa_type,aa_pass,UVbool,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mclipv,threads)
\ : aa_v && aa_mode == "dr" ? aaclip.xaa_dr(aa_type,aa_pass,UVbool,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mclipv,threads)
\ : aa_v && aa_mode == "di" ? aaclip.xaa_di(aa_type,aa_pass,UVbool,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mclipv,threads)
\ : aaclip
aaclip = aa_v && aa_mode == "di" &&
\ !aa_delayresize_v &&
\ vssc12 && UVbool ? aaclip.ResizeX(ssw_pad,ssh_pad,0,-0.5, kernel=dscl, chroma=false, lsb=stack16o)
\ .MergeChroma(aaclip.ResizeX(ssw_pad,ssh_pad,0,-1.0, kernel=dscl, cplace=cplace, luma=false, lsb=stack16o))
\ : aa_v && aa_mode == "di" &&
\ !aa_delayresize_v ? aaclip.ResizeX(ssw_pad,ssh_pad,0,-0.5, kernel=dscl, cplace=cplace, chroma=UVbool, lsb=stack16o)
\ : aaclip
""")
\ : !UVbool ?
\ Eval("""
aaclip = aa_h && Yx_aa_type ? rs1_pad.TryFTurnRight(false)
\ : aa_h ? rs1_pad.TryFTurnRight(false).ConvertToYV12()
\ : Yx_aa_type ? rs1_pad
\ : rs1_pad.ConvertToYV12()
aaclip = aa_h && aa_mode == "sr" ? aaclip.xaa_sr(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mcliph,threads)
\ : aa_h && aa_mode == "dr" ? aaclip.xaa_dr(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mcliph,threads)
\ : aa_h && aa_mode == "di" ? aaclip.xaa_di(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mcliph,threads)
\ : aaclip
aaclip = aa_h && aa_mode == "di" &&
\ !aa_delayresize_h ? aaclip.ResizeX(ssh_pad,ssw_pad,0,-0.5, kernel=dscl, chroma=false, lsb=stack16o_h)
\ : aaclip
aaclip = aa_h && stack16o_h ? StackVertical(aaclip.Dither_get_msb().TryFTurnLeft(false),aaclip.Dither_get_lsb().TryFTurnLeft(false))
\ : aa_h ? aaclip.TryFTurnLeft(false)
\ : aaclip
aaclip = aa_v && aa_mode == "sr" ? aaclip.xaa_sr(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mclipv,threads)
\ : aa_v && aa_mode == "dr" ? aaclip.xaa_dr(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mclipv,threads)
\ : aa_v && aa_mode == "di" ? aaclip.xaa_di(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mclipv,threads)
\ : aaclip
aaclip = aa_v && aa_mode == "di" &&
\ !aa_delayresize_v ? aaclip.ResizeX(ssw_pad,ssh_pad,0,-0.5, kernel=dscl, chroma=false, lsb=stack16o)
\ : aaclip
aaclip = aaclip.ConvertToY8()
""")
\ : Eval("""
aaclipY = aa_h && Yx_aa_type ? rs1_pad.ConvertToY8().TryFTurnRight(false)
\ : aa_h ? rs1_pad.TryFTurnRight(false).ConvertToYV12()
\ : Yx_aa_type ? rs1_pad.ConvertToY8()
\ : rs1_pad.ConvertToYV12()
aaclipY = aa_h && aa_mode == "sr" ? aaclipY.xaa_sr(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mcliph,threads)
\ : aa_h && aa_mode == "dr" ? aaclipY.xaa_dr(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mcliph,threads)
\ : aa_h && aa_mode == "di" ? aaclipY.xaa_di(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mcliph,threads)
\ : aaclipY
aaclipY = aa_h && aa_mode == "di" &&
\ !aa_delayresize_h ? aaclipY.ResizeX(ssh_pad,ssw_pad,0,-0.5, kernel=dscl, chroma=false, lsb=stack16o_h)
\ : aaclipY
aaclipY = aa_h && stack16o_h ? StackVertical(aaclipY.Dither_get_msb().TryFTurnLeft(false),aaclipY.Dither_get_lsb().TryFTurnLeft(false))
\ : aa_h ? aaclipY.TryFTurnLeft(false)
\ : aaclipY
aaclipY = aa_v && aa_mode == "sr" ? aaclipY.xaa_sr(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mclipv,threads)
\ : aa_v && aa_mode == "dr" ? aaclipY.xaa_dr(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mclipv,threads)
\ : aa_v && aa_mode == "di" ? aaclipY.xaa_di(aa_type,aa_pass,false,cplace,48,nns,eediA,eediB,eediG,aa_sclip,aa_mclipv,threads)
\ : aaclipY
aaclipY = aa_v && aa_mode == "di" &&
\ !aa_delayresize_v ? aaclipY.ResizeX(ssw_pad,ssh_pad,0,-0.5, kernel=dscl, chroma=false, lsb=stack16o)
\ : aaclipY aaclipU = aa_h && Yx_aa_type ? rs1_pad.UToY8().TryFTurnRight(false)
\ : aa_h ? rs1_pad.UToY8().TryFTurnRight(false).ConvertToYV12()
\ : Yx_aa_type ? rs1_pad.UToY8()
\ : rs1_pad.UToY8().ConvertToYV12()
aaclipU = aa_h && aa_mode == "sr" ? aaclipU.xaa_sr(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mcliphU,threads)
\ : aa_h && aa_mode == "dr" ? aaclipU.xaa_dr(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mcliphU,threads)
\ : aa_h && aa_mode == "di" ? aaclipU.xaa_di(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mcliphU,threads)
\ : aaclipU
aaclipU = aa_h && aa_mode == "di" &&
\ !aa_delayresize_h ? aaclipU.ResizeX(ssh_pad_c,ssw_pad_c,0,-0.5, kernel=dscl, chroma=false, lsb=stack16o_h)
\ : aaclipU
aaclipU = aa_h && stack16o_h ? StackVertical(aaclipU.Dither_get_msb().TryFTurnLeft(false),aaclipU.Dither_get_lsb().TryFTurnLeft(false))
\ : aa_h ? aaclipU.TryFTurnLeft(false)
\ : aaclipU
aaclipU = aa_v && aa_mode == "sr" ? aaclipU.xaa_sr(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mclipvU,threads)
\ : aa_v && aa_mode == "dr" ? aaclipU.xaa_dr(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mclipvU,threads)
\ : aa_v && aa_mode == "di" ? aaclipU.xaa_di(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mclipvU,threads)
\ : aaclipU
aaclipU = aa_v && aa_mode == "di" &&
\ !aa_delayresize_v ? aaclipU.ResizeX(ssw_pad_c,ssh_pad_c,0,-0.5, kernel=dscl, chroma=false, lsb=stack16o)
\ : aaclipU aaclipV = aa_h && Yx_aa_type ? rs1_pad.VToY8().TryFTurnRight(false)
\ : aa_h ? rs1_pad.VToY8().TryFTurnRight(false).ConvertToYV12()
\ : Yx_aa_type ? rs1_pad.VToY8()
\ : rs1_pad.VToY8().ConvertToYV12()
aaclipV = aa_h && aa_mode == "sr" ? aaclipV.xaa_sr(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mcliphV,threads)
\ : aa_h && aa_mode == "dr" ? aaclipV.xaa_dr(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mcliphV,threads)
\ : aa_h && aa_mode == "di" ? aaclipV.xaa_di(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mcliphV,threads)
\ : aaclipV
aaclipV = aa_h && aa_mode == "di" &&
\ !aa_delayresize_h ? aaclipV.ResizeX(ssh_pad_c,ssw_pad_c,0,-0.5, kernel=dscl, chroma=false, lsb=stack16o_h)
\ : aaclipV
aaclipV = aa_h && stack16o_h ? StackVertical(aaclipV.Dither_get_msb().TryFTurnLeft(false),aaclipV.Dither_get_lsb().TryFTurnLeft(false))
\ : aa_h ? aaclipV.TryFTurnLeft(false)
\ : aaclipV
aaclipV = aa_v && aa_mode == "sr" ? aaclipV.xaa_sr(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mclipvV,threads)
\ : aa_v && aa_mode == "dr" ? aaclipV.xaa_dr(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mclipvV,threads)
\ : aa_v && aa_mode == "di" ? aaclipV.xaa_di(aa_type,aa_pass,false,cplace,0,nns,eediA,eediB,eediG,aa_sclip,aa_mclipvV,threads)
\ : aaclipV
aaclipV = aa_v && aa_mode == "di" &&
\ !aa_delayresize_v ? aaclipV.ResizeX(ssw_pad_c,ssh_pad_c,0,-0.5, kernel=dscl, chroma=false, lsb=stack16o)
\ : aaclipV
aaclip = YToUV(aaclipU,aaclipV,aaclipY)
""") # Crop the padding off
aaclip = rs1_addpad && aa_delayresize_h && stack16o ? aaclip.Dither_crop16(rs1_padL*2,rs1_padT,-rs1_padR*2,-rs1_padB)
\ : rs1_addpad && aa_delayresize_h ? aaclip.Crop(rs1_padL*2,rs1_padT,-rs1_padR*2,-rs1_padB)
\ : rs1_addpad && aa_delayresize_v && stack16o ? aaclip.Dither_crop16(rs1_padL,rs1_padT*2,-rs1_padR,-rs1_padB*2)
\ : rs1_addpad && aa_delayresize_v ? aaclip.Crop(rs1_padL,rs1_padT*2,-rs1_padR,-rs1_padB*2)
\ : rs1_addpad && stack16o ? aaclip.Dither_crop16(rs1_padL,rs1_padT,-rs1_padR,-rs1_padB)
\ : rs1_addpad ? aaclip.Crop(rs1_padL,rs1_padT,-rs1_padR,-rs1_padB)
\ : aaclip ##### Apply contra-sharpening before scaling to the output resolution if csharp=1 ##### stack16i = stack16o ? true : false
stack16o = stack16i ? true : false UVrg = chroma == 0 ? -1 : 11
UVrp = chroma == 0 ? -1 : 13 csharp == 0 || csharp == 2 ? NOP()
\ : csharp == 1 && stack16i ?
\ Eval("""
aadiff = Dither_sub16(rs1, aaclip, dif=true, U=UVint, V=UVint)
aablur = aaclip.Dither_removegrain16(mode=11, modeU=UVrg, modeV=UVrg)
sharpdiff = Dither_sub16(aaclip, aablur, dif=true, U=UVint, V=UVint)
repaired = sharpdiff.Dither_repair16(aadiff, mode=13, modeU=UVrp, modeV=UVrp)
aaclip = aaclip.Dither_add16(repaired, dif=true, U=UVint, V=UVint)
""")
\ : csharp == 1 ?
\ Eval("""
aadiff = mt_makediff(rs1, aaclip, U=UVint, V=UVint)
aablur = cstr < 0 ? aaclip.RemoveGrain(mode=11, modeU=UVrg, modeV=UVrg)
\ : aaclip.Blur(cstr*0.2)
sharpdiff = mt_makediff(aaclip, aablur, U=UVint, V=UVint)
repaired = sharpdiff.Repair(aadiff, mode=13, modeU=UVrp, modeV=UVrp)
aaclip = aaclip.mt_adddiff(repaired, U=UVint, V=UVint)
""")
\ : Assert(false, "xaa: invalid csharp value") ##### Scale the antialiased clip to the output resolution ##### stack16i = stack16o ? true : false
stack16o = lsb && csharp != 2 ||
\ lsb && cstr <= 0 ? true : false # rsaa_type and rsaa_isedi are defined earlier
rsaa_rfacX = ow > aa_ow*6-4 ? 8
\ : ow > aa_ow*3-4 ? 4
\ : ow > aa_ow ? 2
\ : 1
rsaa_rfacY = oh > aa_oh*6-4 ? 8
\ : oh > aa_oh*3-4 ? 4
\ : oh > aa_oh ? 2
\ : 1
rsaa_cshift = ow >= aa_ow*rsaa_rfacX || oh >= aa_oh*rsaa_rfacY ? "Spline36" : dscl # Center shift values for the rsaa resize if edi_rpow2 is used
rsaa_hshift = !hssc12 || chroma == 0 ? -0.5 : -0.5*(rsaa_rfacX-1)
rsaa_hshift = rsaa_isedi && rsaa_rfacX > 1 ? rsaa_hshift : 0
rsaa_vshift = rsaa_isedi && rsaa_rfacY > 1 ? -0.5 : 0
rsaa_hshift_c = rsaa_isedi && rsaa_rfacX > 1 && cplace == "MPEG1" && hssc12 && UVbool ? -0.5*(rsaa_rfacX-1)+rsaa_hshift : rsaa_hshift
rsaa_vshift_c = rsaa_isedi && rsaa_rfacY > 1 && vssc12 && UVbool ? rsaa_vshift*2.0 : rsaa_vshift # Add center shift corrections from rs1 delay_cshift and aa_delayresize to the rsaa corrections
rsaa_hshift = rsaa_isedi ? rsaa_hshift+rs1_hshift*rsaa_rfacX+aa_hshift*rsaa_rfacX
\ : rs1_hshift+aa_hshift
rsaa_vshift = rsaa_isedi ? rsaa_vshift+rs1_vshift*rsaa_rfacY+aa_vshift*rsaa_rfacY
\ : rs1_vshift+aa_vshift
rsaa_hshift_c = rsaa_isedi ? rsaa_hshift_c+rs1_hshift_c*rsaa_rfacX+aa_hshift_c*rsaa_rfacX
\ : rs1_hshift_c+aa_hshift_c
rsaa_vshift_c = rsaa_isedi ? rsaa_vshift_c+rs1_vshift_c*rsaa_rfacY+aa_vshift_c*rsaa_rfacY
\ : rs1_vshift_c+aa_vshift_c
rsaa_UVshift = rsaa_hshift != rsaa_hshift_c || rsaa_vshift != rsaa_vshift_c ? true : false # Reuse the eedi3 mclip mask from antialiasing
rsaa_mclip = uscl == "eedi3" && eedimthr > 0 ? aa_mclip : Undefined() aaclip_y8 = chroma == 0 ? aaclip.ConvertToY8() : aaclip ow == aa_ow && oh == aa_oh &&
\ !delay_cshift && !aa_delayresize_h && !aa_delayresize_v ?
\ Eval("""
rsaa = stack16i && !stack16o ? aaclip_y8.DitherPost(mode=6)
\ : !stack16i && stack16o ? aaclip_y8.Dither_convert_8_to_16()
\ : aaclip_y8
""")
\ : rsaa_isedi && delay_cshift ||
\ rsaa_isedi && aa_delayresize_h ||
\ rsaa_isedi && aa_delayresize_v ?
\ Eval("""
# Use stack16o for ResizeX's lsb_in parameter here because it depends on edi_rpow2's lsb parameter, not stack16i.
rsaa = stack16i ? aaclip_y8.DitherPost(mode=6) : aaclip_y8
rsaa = rsaa.edi_rpow2(rsaa_rfacX,rsaa_rfacY,rsaa_type, cplace=cplace, lsb=stack16o, YV12cfix=false,
\ alpha=eediA, beta=eediB, gamma=eediG, sclip=rs_sclip, mclip=rsaa_mclip, threads=threads)
rsaa = rsaa_UVshift ? rsaa.ResizeX(ow,oh,rsaa_hshift,rsaa_vshift, kernel=rsaa_cshift, chroma=false, lsb_in=stack16o, lsb=stack16o)
\ .MergeChroma(rsaa.ResizeX(ow,oh,rsaa_hshift_c,rsaa_vshift_c, kernel=rsaa_cshift, cplace=cplace, luma=false, lsb_in=stack16o, lsb=stack16o))
\ : rsaa.ResizeX(ow,oh,rsaa_hshift,rsaa_vshift, kernel=rsaa_cshift, cplace=cplace, lsb_in=stack16o, lsb=stack16o)
""")
\ : rsaa_isedi ?
\ Eval("""
rsaa = stack16i ? aaclip_y8.DitherPost(mode=6) : aaclip_y8
rsaa = rsaa.edi_rpow2(rsaa_rfacX,rsaa_rfacY,rsaa_type,rsaa_cshift,ow,oh, cplace=cplace, lsb=stack16o,
\ alpha=eediA, beta=eediB, gamma=eediG, sclip=rs_sclip, mclip=rsaa_mclip, threads=threads)
""")
\ : Eval("""
rsaa = rsaa_UVshift ? aaclip_y8.ResizeX(ow,oh,rsaa_hshift,rsaa_vshift, kernel=rsaa_cshift, chroma=false, lsb_in=stack16i, lsb=stack16o)
\ .MergeChroma(aaclip_y8.ResizeX(ow,oh,rsaa_hshift_c,rsaa_vshift_c, kernel=rsaa_cshift, cplace=cplace, luma=false, lsb_in=stack16i, lsb=stack16o))
\ : aaclip_y8.ResizeX(ow,oh,rsaa_hshift,rsaa_vshift, kernel=rsaa_cshift, cplace=cplace, lsb_in=stack16i, lsb=stack16o)
""") # Make sure the rsaa clip has the same chroma sampling as the input
rsaa = csp == "Y8" ? rsaa.ConvertToY8()
\ : csp == "YV12" ? rsaa.ConvertToYV12()
\ : csp == "YV16" ||
\ csp == "YUY2" ? rsaa.ConvertToYV16()
\ : csp == "YV24" ? rsaa.ConvertToYV24()
\ : Assert(false, "xaa: something went terribly wrong") ##### Scale the input clip to the output resolution without antialiasing for masking and chroma ##### stack16i2 = lsb_in ? true : false
stack16o2 = lsb && csharp != 2 ||
\ lsb && cstr <= 0 ||
\ lsb && csharp == 2 && mask > 0 ? true : false # rs2_type and rs2_isedi are defined earlier
rs2_rfacX = ow > iw*6-4 ? 8
\ : ow > iw*3-4 ? 4
\ : ow > iw ? 2
\ : 1
rs2_rfacY = oh > ih*6-4 ? 8
\ : oh > ih*3-4 ? 4
\ : oh > ih ? 2
\ : 1
rs2_cshift = ow >= iw*rs2_rfacX && oh >= ih*rs2_rfacY ? "Spline36" : dscl ow == iw && oh == ih ?
\ Eval("""
rs2 = stack16i2 && !stack16o2 ? input.DitherPost(mode=6)
\ : !stack16i2 && stack16o2 ? input.Dither_convert_8_to_16()
\ : input
""")
\ : rs2_isedi ?
\ Eval("""
rs2 = stack16i2 ? input.DitherPost(mode=6) : input
rs2 = rs2.edi_rpow2(rs2_rfacX,rs1_rfacY,rs2_type,rs2_cshift,ow,oh, cplace=cplace, lsb=stack16o2,
\ alpha=eediA, beta=eediB, gamma=eediG, sclip=rs_sclip, mclip=rs12_mclip, threads=threads)
""")
\ : Eval("""
rs2 = input.ResizeX(ow,oh, kernel=rs2_type, cplace=cplace, lsb_in=stack16i2, lsb=stack16o2)
""") # 8-bit versions of the rs2 clip for masking
rs2_8bit = stack16o2 ? rs2.DitherPost(mode=-1) : rs2
rs2_8bit_yv24 = rs2_8bit.ConvertToYV24() ##### Apply contra-sharpening after scaling to the output resolution if csharp=2 ##### csharp == 0 || csharp == 1 ? NOP()
\ : csharp == 2 && stack16o && stack16o2 ?
\ Eval("""
aadiff = Dither_sub16(rs2, rsaa, dif=true, U=UVint, V=UVint)
aablur = rsaa.Dither_removegrain16(mode=11, modeU=UVrg, modeV=UVrg)
sharpdiff = Dither_sub16(rsaa, aablur, dif=true, U=UVint, V=UVint)
repaired = sharpdiff.Dither_repair16(aadiff, mode=13, modeU=UVrp, modeV=UVrp)
rsaa = rsaa.Dither_add16(repaired, dif=true, U=UVint, V=UVint)
""")
\ : csharp == 2 && !stack16o && stack16o2 ?
\ Eval("""
rsaa_8bit = rsaa
rsaa = rsaa.Dither_convert_8_to_16()
aadiff = Dither_sub16(rs2, rsaa, dif=true, U=UVint, V=UVint)
aablur = cstr < 0 ? rsaa.Dither_removegrain16(mode=11, modeU=UVrg, modeV=UVrg)
\ : rsaa_8bit.Blur(cstr*0.2).Dither_convert_8_to_16()
sharpdiff = Dither_sub16(rsaa, aablur, dif=true, U=UVint, V=UVint)
repaired = sharpdiff.Dither_repair16(aadiff, mode=13, modeU=UVrp, modeV=UVrp)
rsaa = rsaa.Dither_add16(repaired, dif=true, U=UVint, V=UVint)
""")
\ : csharp == 2 && !stack16o && !stack16o2 ?
\ Eval("""
aadiff = mt_makediff(rs2, rsaa, U=UVint, V=UVint)
aablur = cstr < 0 ? rsaa.RemoveGrain(mode=11, modeU=UVrg, modeV=UVrg)
\ : rsaa.Blur(cstr*0.2)
sharpdiff = mt_makediff(rsaa, aablur, U=UVint, V=UVint)
repaired = sharpdiff.Repair(aadiff, mode=13, modeU=UVrp, modeV=UVrp)
rsaa = rsaa.mt_adddiff(repaired, U=UVint, V=UVint)
""")
\ : Assert(false, "xaa: invalid csharp value") ##### Masking, chroma merging, and output ##### stack16i = stack16o || stack16o2 ? true : false
stack16o = lsb ? true : false # Reuse the eedi3 mclip mask from the rs1 and rs2 resizes if it's the same
emask = rs12_mclip.Defined() && mthr == eedimthr && iw == ow && ih == oh ? rs12_mclip
\ : mtype == "TEMmod" ? rs2_8bit.TEMmod(mthr,mthr,temtype,0,UVint2).mt_inflate(U=UVint, V=UVint)
\ : mtype == "TCannyMod" ? rs2_8bit.TCannyMod(t_h=mthr, t_l=mthr, chroma=UVint2).mt_expand(mode="both", U=UVint, V=UVint)
\ .mt_inflate(U=UVint, V=UVint).mt_inpand(mode="both", U=UVint, V=UVint).mt_inflate(U=UVint, V=UVint)
\ : rs2_8bit.mt_edge(mtype,mthr,mthr,mthr,mthr, U=UVint, V=UVint).mt_inflate(U=UVint, V=UVint) eover = csp == "Y8" ||
\ csp == "YV16" ||
\ csp == "YUY2" ? rs2_8bit_yv24.mt_lut("x 2 /",Y=2,U=3,V=3)
\ : rs2_8bit.mt_lut("x 2 /",Y=2,U=3,V=3)
overlay = csp == "Y8" ||
\ csp == "YV16" ||
\ csp == "YUY2" ? mt_merge(rs2_8bit_yv24,eover,emask, luma=true)
\ : mt_merge(rs2_8bit,eover,emask, luma=true)
overlay = csp == "YV16" ||
\ csp == "YUY2" ? overlay.ConvertToYV16()
\ : overlay stack16i ? Eval("""
merged = mask == 0 && csp == "Y8" ? rsaa
\ : mask == 0 && chroma == 0 ? MergeChroma(rsaa,rs2)
\ : mask == 0 && chroma == 1 ? rsaa
\ : mask == 0 && chroma == 2 ? MergeChroma(rs2,rsaa)
\ : mask == 1 && chroma == 0 ? Dither_merge16_8(rs2,rsaa,emask,Y=3,U=2,V=2)
\ : mask == 1 && chroma == 1 ? Dither_merge16_8(rs2,rsaa,emask,Y=3,U=3,V=3)
\ : mask == 1 && chroma == 2 ? Dither_merge16_8(rs2,rsaa,emask,Y=2,U=3,V=3)
\ : mask == 2 && chroma == 0 ? Dither_merge16_8(rsaa,rs2,emask,Y=3,U=4,V=4)
\ : mask == 2 && chroma == 1 ? Dither_merge16_8(rsaa,rs2,emask,Y=3,U=3,V=3)
\ : mask == 2 && chroma == 2 ? Dither_merge16_8(rsaa,rs2,emask,Y=4,U=3,V=3)
\ : Assert(mask <= 2, "xaa: invalid mask value")
""")
\ : Eval("""
merged = mask == 0 && csp == "Y8" ? rsaa
\ : mask == 0 && chroma == 0 ? MergeChroma(rsaa,rs2)
\ : mask == 0 && chroma == 1 ? rsaa
\ : mask == 0 && chroma == 2 ? MergeChroma(rs2,rsaa)
\ : mask == 1 && chroma == 0 ? mt_merge(rs2,rsaa,emask,Y=3,U=2,V=2)
\ : mask == 1 && chroma == 1 ? mt_merge(rs2,rsaa,emask,Y=3,U=3,V=3)
\ : mask == 1 && chroma == 2 ? mt_merge(rs2,rsaa,emask,Y=2,U=3,V=3)
\ : mask == 2 && chroma == 0 ? mt_merge(rsaa,rs2,emask,Y=3,U=4,V=4)
\ : mask == 2 && chroma == 1 ? mt_merge(rsaa,rs2,emask,Y=3,U=3,V=3)
\ : mask == 2 && chroma == 2 ? mt_merge(rsaa,rs2,emask,Y=4,U=3,V=3)
\ : Assert(mask <= 2, "xaa: invalid mask value")
""") merged = stack16i && !stack16o ? merged.DitherPost(mode=6)
\ : !stack16i && stack16o ? merged.Dither_convert_8_to_16()
\ : merged output = mask < 0 ? overlay : merged
output = csp == "YUY2" ? output.ConvertToYUY2() : output return output
} ##### Recursive functions for multipass antialiasing ##### function xaa_sr(clip input, string "type", int "passes", bool "chroma", string "cplace", int "snaa",
\ int "nns", float "alpha", float "beta", float "gamma", string "sclip", clip "mclip", int "threads",
\ int "f") { iw = input.Width()
ih = input.Height() type = Default(type, "SangNom2")
passes = Default(passes, 1)
chroma = Default(chroma, true)
cplace = Default(cplace, "MPEG2")
snaa = Default(snaa, 48)
sclip = Default(sclip, "")
f = Default(f, 1) # Alternate the field every pass, starting with 1 by default
field = f%2
snfield = field == 1 ? 1 : 2 # SeparateFields will throw an error from mod2 heights if the input is YV12,
# so don't define sf unless it's needed, in which case the resolution will have been padded to mod4.
pad8 = type == "eedi2" || type == "eedi3" && sclip != "" && sclip != "SangNom2" && sclip != "nnedi3" && sclip != "nnedi3ocl" ? true : false
sf = pad8 ? input.AssumeTFF().SeparateFields() : Undefined()
sf = pad8 && field == 1 ? sf.SelectEven()
\ : pad8 ? sf.SelectOdd()
\ : Undefined() # Use a src_top shift dependent on the field when resizing for the sclip to keep it in alignment with the eedi3 clip.
# Additionally, the vertical shift for YV12 chroma is doubled, so the chroma must be resized separately.
rshift = field == 1 ? 0.25 : -0.25 sclip2 = sclip == "" ? Undefined()
\ : sclip == "SangNom2" ? input.SangNom2(snfield,snaa,0,threads)
\ : sclip == "nnedi3" ? input.nnedi3(field, U=chroma, V=chroma, nns=nns, threads=threads)
\ : sclip == "nnedi3ocl" ? input.nnedi3ocl(field, U=chroma, V=chroma, nns=nns)
\ : sclip == "eedi2" ? sf.eedi2(field=field)
\ : chroma && input.IsYV12() ? sf.ResizeX(iw,ih,0,rshift, kernel=sclip, chroma=false)
\ .MergeChroma(sf.ResizeX(iw,ih,0,rshift*2.0, kernel=sclip, cplace=cplace, luma=false))
\ : sf.ResizeX(iw,ih,0,rshift, kernel=sclip, cplace=cplace, chroma=chroma) aa = type == "SangNom2" ? input.SangNom2(snfield,snaa,0,threads)
\ : type == "nnedi3" ? input.nnedi3(field, U=chroma, V=chroma, nns=nns, threads=threads)
\ : type == "nnedi3ocl" ? input.nnedi3ocl(field, U=chroma, V=chroma, nns=nns)
\ : type == "eedi3" ? input.eedi3(field,false,true,chroma,chroma,alpha,beta,gamma, sclip=sclip2, mclip=mclip, threads=threads)
\ : type == "eedi2" ? sf.eedi2(field=field)
\ : Assert(false, "xaa_sr: invalid antialiasing type") return passes > 0 ? aa.xaa_sr(type,passes-1,chroma,cplace,snaa,nns,alpha,beta,gamma,sclip,mclip,threads,f+1)
\ : input
} function xaa_dr(clip input, string "type", int "passes", bool "chroma", string "cplace", int "snaa",
\ int "nns", float "alpha", float "beta", float "gamma", string "sclip", clip "mclip", int "threads") { iw = input.Width()
ih = input.Height() type = Default(type, "nnedi3")
passes = Default(passes, 1)
chroma = Default(chroma, true)
cplace = Default(cplace, "MPEG2")
snaa = Default(snaa, 48)
sclip = Default(sclip, "") pad8 = type == "eedi2" || type == "eedi3" && sclip != "" && sclip != "SangNom2" && sclip != "nnedi3" && sclip != "nnedi3ocl" ? true : false
sf = pad8 ? input.AssumeTFF().SeparateFields() : Undefined()
tf = pad8 ? sf.SelectEven() : Undefined()
bf = pad8 ? sf.SelectOdd() : Undefined()
UVint = chroma ? 3 : 1 sclip2 = sclip == "" ? Undefined()
\ : sclip == "SangNom2" ? input.DoubleWeave().SangNom2(0,snaa,0,threads)
\ : sclip == "nnedi3" ? input.nnedi3(3, nns=nns, U=chroma, V=chroma, threads=threads)
\ : sclip == "nnedi3ocl" ? input.nnedi3ocl(3, U=chroma, V=chroma, nns=nns)
\ : sclip == "eedi2" ? sf.eedi2(field=3)
\ : chroma && input.IsYV12() ? Interleave(tf.ResizeX(iw,ih,0,0.25, kernel=sclip, chroma=false),
\ bf.ResizeX(iw,ih,0,-0.25, kernel=sclip, chroma=false))
\ .MergeChroma(Interleave(tf.ResizeX(iw,ih,0,0.5, kernel=sclip, cplace=cplace, luma=false),
\ bf.ResizeX(iw,ih,0,-0.5, kernel=sclip, cplace=cplace, luma=false)))
\ : Interleave(tf.ResizeX(iw,ih,0,0.25, kernel=sclip, cplace=cplace, chroma=chroma),
\ bf.ResizeX(iw,ih,0,-0.25, kernel=sclip, cplace=cplace, chroma=chroma)) aa = type == "SangNom2" ? input.DoubleWeave().SangNom2(0,snaa,0,threads)
\ : type == "nnedi3" ? input.nnedi3(3, nns=nns, U=chroma, V=chroma, threads=threads)
\ : type == "nnedi3ocl" ? input.nnedi3ocl(3, U=chroma, V=chroma, nns=nns)
\ : type == "eedi3" ? input.eedi3(3,false,true,chroma,chroma,alpha,beta,gamma, sclip=sclip2, mclip=mclip, threads=threads)
\ : type == "eedi2" ? sf.eedi2(field=3)
\ : Assert(false, "xaa_dr: invalid antialiasing type")
aa = mt_average(aa.SelectEven(),aa.SelectOdd(), U=UVint, V=UVint) return passes > 0 ? aa.xaa_dr(type,passes-1,chroma,cplace,snaa,nns,alpha,beta,gamma,sclip,mclip,threads)
\ : input
} function xaa_di(clip input, string "type", int "passes", bool "chroma", string "cplace", int "snaa",
\ int "nns", float "alpha", float "beta", float "gamma", string "sclip", clip "mclip", int "threads",
\ int "f", bool "dh") { iw = input.Width()
ih = input.Height() type = Default(type, "nnedi3")
passes = Default(passes, 1)
chroma = Default(chroma, true)
cplace = Default(cplace, "MPEG2")
snaa = Default(snaa, 48)
sclip = Default(sclip, "")
f = Default(f, 1)
dh = Default(dh, true) # Alternate the field every pass, starting with 1.
# Don't change the f value from the default or else the center shift correction will be wrong.
field = f%2
snfield = field == 1 ? 1 : 2 pad8 = type == "eedi2" || type == "eedi3" && sclip != "" && sclip != "SangNom2" && sclip != "nnedi3" && sclip != "nnedi3ocl" ? true : false
sf = pad8 ? input.AssumeTFF().SeparateFields() : Undefined()
sf = pad8 && field == 1 ? sf.SelectEven()
\ : pad8 ? sf.SelectOdd()
\ : Undefined()
rshift = field == 1 ? 0.25 : -0.25
UVint = chroma ? 3 : 1 sclip2 = sclip == "" ? Undefined()
\ : sclip == "SangNom2" && dh ? input.ResizeX(iw,ih*2, kernel="Point", cplace=cplace, chroma=chroma).SangNom2(snfield,snaa,0,threads)
\ : sclip == "SangNom2" ? input.SangNom2(snfield,snaa,0,threads)
\ : sclip == "nnedi3" ? input.nnedi3(field,dh, U=chroma, V=chroma, nns=nns, threads=threads)
\ : sclip == "nnedi3ocl" ? input.nnedi3ocl(field,dh, U=chroma, V=chroma, nns=nns)
\ : sclip == "eedi2" && dh ? input.eedi2(field=field)
\ : sclip == "eedi2" ? sf.eedi2(field=field)
\ : dh ? chroma && input.IsYV12() ? input.ResizeX(iw,ih*2,0,rshift, kernel=sclip, chroma=false)
\ .MergeChroma(input.ResizeX(iw,ih*2,0,rshift*2.0, kernel=sclip, cplace=cplace, luma=false))
\ : input.ResizeX(iw,ih*2,0,rshift, kernel=sclip, cplace=cplace, chroma=chroma)
\ : chroma && input.IsYV12() ? sf.ResizeX(iw,ih,0,rshift, kernel=sclip, chroma=false)
\ .MergeChroma(sf.ResizeX(iw,ih,0,rshift*2.0, kernel=sclip, cplace=cplace, luma=false))
\ : sf.ResizeX(iw,ih,0,rshift, kernel=sclip, cplace=cplace, chroma=chroma) # The height is only doubled on the first pass
aa = type == "SangNom2" && dh ? input.ResizeX(iw,ih*2, kernel="Point", cplace=cplace, chroma=chroma).SangNom2(snfield,snaa,0,threads)
\ : type == "SangNom2" ? input.SangNom2(snfield,snaa,0,threads)
\ : type == "nnedi3" ? input.nnedi3(field,dh, U=chroma, V=chroma, nns=nns, threads=threads)
\ : type == "nnedi3ocl" ? input.nnedi3ocl(field,dh, U=chroma, V=chroma, nns=nns)
\ : type == "eedi3" ? input.eedi3(field,dh,true,chroma,chroma,alpha,beta,gamma, sclip=sclip2, mclip=mclip, threads=threads)
\ : type == "eedi2" && dh ? input.eedi2(field=field)
\ : type == "eedi2" ? sf.eedi2(field=field)
\ : Assert(false, "xaa_di: invalid antialiasing type") # Double the height of the mclip for passes after the first.
mclip = mclip.Defined() && dh &&
\ input.IsYV12() && chroma ? mclip.ResizeX(iw,ih*2,0,0.25, chroma=false)
\ .MergeChroma(mclip.ResizeX(iw,ih*2,0,0.5, cplace=cplace, luma=false))
\ .mt_binarize(128, U=3, V=3)
\ : mclip.Defined() && dh ? mclip.ResizeX(iw,ih*2,0,0.25, cplace=cplace, chroma=chroma).mt_binarize(128, U=UVint, V=UVint)
\ : mclip return passes > 0 ? aa.xaa_di(type,passes-1,chroma,cplace,snaa,nns,alpha,beta,gamma,sclip,mclip,threads,f+1,false)
\ : input
}
|
|
торрент иваниваныч
Стаж: 15 лет 1 месяц Сообщений: 1154
|
торрент иваниваныч ·
03-Сен-19 15:17
(спустя 7 мин.)
Tempter57
Понятно, спасибо. Про xaa читал на авивики, там написано, что не все его параметры поддерживают 16бит.
|
|
Tempter57
Стаж: 16 лет 3 месяца Сообщений: 4963
|
Tempter57 ·
03-Сен-19 20:56
(спустя 5 часов, ред. 03-Сен-19 20:56)
торрент иваниваныч
Ну, тогда примените просто старую версию TAAmbk без лажового 16 битного входа\выхода
скрытый текст
###################################################
### TAAmbk - TAA Modified By Kewenyu
###
### by kewenyu - 1059902659@qq.com
###
### v0.7.0 - 19 Octobor 2015
###
### Special thanks to Taro06 and his TAA script
###
###
################################################### Function TAAmbk(clip input, int "aatype", int "aatypeU", int "aatypeV", int "preaa", val "mtype",
\ bool "predown", int "mthr", int "cycle", float "dark", int "thin", float "sharp", int "repair",
\ bool "postaa", int "mtype2", int "mthr2", int "eedi3mask", bool "nnedi3CL", clip "src", float "auxmthr",
\ int "stabilize", bool "showmask", float "p1", float "p2", float "p3", float "p4", float "p5", float "p6") { aatype = Default(aatype, 1)
aatypeU = Default(aatypeU, aatype)
aatypeV = Default(aatypeV, aatype)
preaa = Default(preaa, 0)
mtype = Default(mtype, 1)
predown = Default(predown, false)
mthr = Default(mthr, 32)
cycle = Default(cycle, 0)
dark = Default(dark, 0.0)
thin = Default(thin, 0)
repair = (aatype != 1 && aatype != 2 && aatype !=3) ? Default(repair, 20) : Default(repair, 0)
stabilize = Default(stabilize, 0)
showmask = Default(showmask, false)
eedi3mask = Default(eedi3mask, 0)
nnedi3CL = Default(nnedi3CL, false)
mtype2 = Default(mtype2, 0)
mthr2 = Default(mthr2, 0)
sharp = Default(sharp, 0)
absSh = Abs(Sharp)
postaa = ( (absSh > 70) || (absSh > 0.4 && absSh < 1) ) ? Default(postaa, true) : Default(postaa, false)
src = Default(src, input)
auxmthr = IsClip(mtype) ? nop() : (mtype == 1 ) ? Default(auxmthr, 1.2) : (mtype == 3) ? Default(auxmthr, 8.0) : Default(auxmthr, 0) p1 = Default(p1, Undefined())
p2 = Default(p2, Undefined())
p3 = Default(p3, Undefined())
p4 = Default(p4, Undefined())
p5 = Default(p5, Undefined())
p6 = Default(p6, Undefined()) Assert(isYV12(input), """TAAmbk: Only YV12 Input Is Support Now""")
Assert(IsFrameBased(input), """TAAmbk: This Clip Need To Be Deinterlaced First""")
Assert((aatype >= -3 && aatype <= 6), """TAAmbk: "mode int(1~4)" Invaild""")
Assert((aatypeU >= -3 && aatypeU <= 6), """TAAmbk: "modeU int(1~4)" Invaild""")
Assert((aatypeV >= -3 && aatypeV <= 6), """TAAmbk: "modeV int(1~4)" Invaild""")
Assert((preaa >= 0 && preaa <= 1), """TAAmbk: "preaa int(0~1)" Invaild""")
IsInt(mtype) ? Assert( (mtype>=0 && mtype<=6), """TAAmbk: "mtype int(0~6)" invalid!""") : nop()
Assert((mthr >= 0 && mthr <= 255), """TAAmbk: "mthr int(0~255)" Invaild""")
Assert((mtype2 >= 0 && mtype2 <= 6), """TAAmbk: "mtype2 int(0~6)" Invaild""")
Assert((mthr2 >= 0 && mthr2 <= 255), """TAAmbk: "mthr2 int(0~255)" Invaild""")
Assert((cycle >= 0 && cycle <= 6), """TAAmbk: Cycle Too Much(>6) May Crash Your Avisynth""")
Assert((repair >= -24 && repair <= 24), """TAAmbk: "repair int(-24~24)" Invaild""")
Assert((stabilize >= -3 && stabilize <= 3), """TAAmbk: "stabilize int(-3~3)" Invaild""")
IsInt(mtype) ? Assert( (mtype != 0 || showmask != true), """TAAmbk: There Is No Mask To Show""") : nop() #Begining of predown
nn = (preaa == 1) ? input.nnedi3(field=-2) : nop()
nnt = (preaa == 1) ? input.TAAmbk_TurnLeft().nnedi3(field=-2).TAAmbk_TurnRight() : nop()
clph = (preaa == 1) ? mt_average(selecteven(nn), selectodd(nn), U=3, V=3) : nop()
clpv = (preaa == 1) ? mt_average(selecteven(nnt), selectodd(nnt), U=3, V=3) : nop()
preaaC = (preaa == 1) ? mt_average(clph, clpv, U=3, V=3) : input
preaaC = (dark == 0 && thin ==0) ? preaaC :
\ (dark == 0) ? preaaC.aWarpSharp2(depth=thin) :
\ (thin == 0) ? preaaC.Toon(dark) : preaaC.aWarpSharp2(depth=thin).Toon(dark) #Seperating planes
Y = preaaC.Greyscale()
U = preaaC.UToY()
V = preaaC.VToY() Y_AA = (aatype == 0) ? Y : Y.TAAmbk_main(predown, aatype, cycle, eedi3mask, nnedi3CL, p1, p2, p3, p4, p5, p6)
U_AA = (aatypeU == 0) ? U : U.TAAmbk_main(predown, aatypeU, cycle, eedi3mask, nnedi3CL, p1, p2, p3, p4, p5, p6)
V_AA = (aatypeV == 0) ? V : V.TAAmbk_main(predown, aatypeV, cycle, eedi3mask, nnedi3CL, p1, p2, p3, p4, p5, p6)
aaed = YToUV(U_AA, V_AA, Y_AA) aaedsp = (sharp == 0) ? aaed :
\ (sharp >= 1) ? aaed.lsfmod(strength=Int(absSh), defaults="old", source=src) :
\ (sharp > 0) ? aaed.Sharpen(absSh) :
\ (sharp > -1) ? aaed.lsfmod(strength=Round(absSh*100), defaults="fast", source=src) :
\ (sharp == -1) ? aaed.mt_adddiff(mt_makediff(aaed, aaed.RemoveGrain((input.width()>1100) ? 20 : 11), U=3, V=3).Repair(mt_makediff(src, aaed, U=3, V=3), 13), U=3,V=3) :
\ aaed.lsfmod(strength=Int(absSh), defaults="slow", source=src) aaedsp = postaa ? aaedsp.soothe(aaed, keep=48) : aaedsp aaedstab = (stabilize == 0) ? aaedsp :
\ aaedsp.TAAmbk_stabilize(input, stabilize) mask = IsClip(mtype) ? mtype : (mtype == 0) ? nop() : input.TAAmbk_mask(mtype, mthr, mtype2, mthr2, auxmthr)
aamerge = Isint(mtype) ? (mtype == 0) ? aaedstab : mt_merge(input, aaedstab, mask, U=3, Y=3) : mt_merge(input, aaedstab, mtype, U=3, Y=3)
aaedrp = (repair > 0) ? aamerge.Repair(input, mode=repair) : (repair < 0) ? input.Repair(aamerge, mode=repair) : aamerge return showmask ? mask : aaedrp
} Function TAAmbk_main(clip input, bool "predown", int "aatype", int "cycle", int "eedi3mask", bool "nnedi3CL", float "p1", float "p2", float "p3", float "p4", float "p5", float "p6") { pindex = aatype + 3
p1 = Default( p1, Select(pindex, 48, 48, 48, 0, 10, 0.5, 3, 48, 48, 48) )
p2 = Default( p2, Select(pindex, 3, 0.5, 10, 0, 20, 0.2, 1, 1, 0, 0) )
p3 = Default( p3, Select(pindex, 1, 0.2, 20, 0, 20, 20, 2, 3, 0, 0) )
p4 = Default( p4, Select(pindex, 2, 20, 20, 0, 24, 3, 0, 2, 0, 0) )
p5 = Default( p5, Select(pindex, 0, 3, 24, 0, 50, 30, 0, 0, 0, 0) )
p6 = Default( p6, Select(pindex, 0, 30, 50, 0, 0, 0, 0, 0, 0, 0) ) w = width(input)
h = height(input)
downw4 = Round(w*0.1875)*4
downh4 = Round(h*0.1875)*4
input = predown ? Spline36Resize(input, downw4, downh4) : input
upw4 = Round(w*0.375)*4
uph4 = Round(h*0.375)*4
nnedi3type = (nnedi3CL == true) ? "nnedi3ocl" : "nnedi3"
eedi3mclip = (eedi3mask == 0 ) ? nop() : input.MSharpen(threshold=eedi3mask/5, strength=0, mask=true, highq=false)
eedi3mclip_r = (eedi3mask == 0 ) ? nop() : eedi3mclip.BilinearResize(w, uph4).mt_binarize(63, U=3, V=3).TAAmbk_TurnRight() aa_clip = (aatype == -3 || aatype == 4) ? Eval("""input."""+nnedi3type+"""(dh=true, field=1, nsize=int(p2), nns=int(p3), qual=int(p4), U=false, V=false).Spline36Resize(w, uph4, 0, -0.5)
\ .TAAmbk_TurnRight()."""+nnedi3type+"""(dh=true, field=1, nsize=int(p2), nns=int(p3), qual=int(p4), U=false, V=false).Spline36Resize(uph4, upw4, 0, -0.5)
\ .SangNom2(aa=int(p1)).TAAmbk_TurnLeft().SangNom2(aa=int(p1)).Spline36Resize(w, h)""") :
\ (aatype == -2) ? (eedi3mask != 0) ? input.Eedi3(dh=true, field=1, alpha=float(p2), beta=float(p3), gamma=float(p4), nrad=int(p5), mdis=int(p6), mclip=eedi3mclip, U=false, V=false).Spline36Resize(w, uph4, 0, -0.5)
\ .TAAmbk_TurnRight().Eedi3(dh=true, field=1, alpha=float(p2), beta=float(p3), gamma=float(p4), nrad=int(p5), mdis=int(p6), mclip=eedi3mclip_r, U=false, V=false).Spline36Resize(uph4, upw4, 0, -0.5)
\ .SangNom2(aa=int(p1)).TAAmbk_TurnLeft().SangNom2(aa=int(p1)).Spline36Resize(w, h) :
\ input.Eedi3(dh=true, field=1, alpha=p2, beta=p3, gamma=p4, nrad=int(p5), mdis=int(p6), U=false, V=false).Spline36Resize(w, uph4, 0, -0.5)
\ .TAAmbk_TurnRight().Eedi3(dh=true, field=1, alpha=p2, beta=p3, gamma=p4, nrad=int(p5), mdis=int(p6), U=false, V=false).Spline36Resize(uph4, upw4, 0, -0.5)
\ .SangNom2(aa=int(p1)).TAAmbk_TurnLeft().SangNom2(aa=int(p1)).Spline36Resize(w, h) :
\ (aatype == 2) ? (eedi3mask != 0) ? input.Eedi3(dh=true, field=1, alpha=p1, beta=p2, gamma=p3, nrad=int(p4), mdis=int(p5), mclip=eedi3mclip, U=false, V=false).Spline36Resize(w, h, 0, -0.5)
\ .TAAmbk_TurnRight().Eedi3(dh=true, field=1, alpha=p1, beta=p2, gamma=p3, nrad=int(p4), mdis=int(p5), mclip=eedi3mclip.BilinearResize(w, h).TAAmbk_TurnRight(), U=false, V=false)
\ .Spline36Resize(h, w, 0, -0.5).TAAmbk_TurnLeft() :
\ input.Eedi3(dh=true, field=1, alpha=p1, beta=p2, gamma=p3, nrad=int(p4), mdis=int(p5), U=false, V=false).Spline36Resize(w, h, 0, -0.5)
\ .TAAmbk_TurnRight().Eedi3(dh=true, field=1, alpha=p1, beta=p2, gamma=p3, nrad=int(p4), mdis=int(p5), U=false, V=false)
\ .Spline36Resize(h, w, 0, -0.5).TAAmbk_TurnLeft() :
\ (aatype == -1) ? input.eedi2(field=1, mthresh=int(p2), lthresh=int(p3), vthresh=int(p4), maxd=int(p5), nt=int(p6)).Spline36Resize(w, uph4, 0, -0.5).TAAmbk_TurnRight()
\ .eedi2(field=1, mthresh=int(p2), lthresh=int(p3), vthresh=int(p4), maxd=int(p5), nt=int(p6)).Spline36Resize(uph4, upw4, 0, -0.5)
\ .SangNom2(aa=int(p1)).TAAmbk_TurnLeft().SangNom2(aa=int(p1)).Spline36Resize(w, h) :
\ (aatype == 1) ? input.Eedi2(field=1, mthresh=int(p1), lthresh=int(p2), vthresh=int(p3), maxd=int(p4), nt=int(p5)).Spline36Resize(w, h, 0, -0.5).TAAmbk_TurnRight()
\ .Eedi2(field=1, mthresh=int(p1), lthresh=int(p2), vthresh=int(p3), maxd=int(p4), nt=int(p5)).Spline36Resize(h, w, 0, -0.5).TAAmbk_TurnLeft() :
\ (aatype == 3) ? Eval("""input."""+nnedi3type+"""(dh=true, field=1, nsize=int(p1), nns=int(p2), qual=int(p3), U=false, V=false).Spline36Resize(w, h, 0, -0.5).TAAmbk_TurnRight()
\ ."""+nnedi3type+"""(dh=true, field=1, nsize=int(p1), nns=int(p2), qual=int(p3), U=false, V=false).Spline36Resize(h, w, 0, -0.5).TAAmbk_TurnLeft()""") :
\ (aatype == 5) ? input.Spline64Resize(upw4, uph4).Repair(input.GaussResize(upw4, uph4, p=100), 1).SangNom2(aa=int(p1)).TAAmbk_TurnRight()
\ .SangNom(aa=int(p1)).Spline36Resize(h, w).TAAmbk_TurnLeft() :
\ (aatype == 6) ? input.Spline64Resize(w, uph4).SangNom2(aa=int(p1)).Spline36Resize(w, h).TAAmbk_TurnRight()
\ .Spline64Resize(h, upw4).SangNom2(aa=int(p1)).Spline36Resize(h, w).TAAmbk_TurnLeft().Repair(input, mode=int(p2)) : input return (cycle == 0) ? aa_clip : aa_clip.TAAmbk_main(false, aatype, int(cycle - 1), eedi3mask, nnedi3CL, p1, p2, p3, p4, p5, p6)
} Function TAAmbk_mask(clip input, int "mtype", int "mthr", int "mtype2", int "mthr2", float "auxmthr") {
w = input.Width() edge_mask_1 =
\ (mtype == 1) ? input.Tcannymod(sigma=auxmthr, mode=1, sobel=true).mt_lut("x "+string(mthr)+" <= x 1 >> x 1 << ?", U=1, V=1).RemoveGrain((w>1100) ? 20 : 11, -1).mt_inflate() :
\ (mtype == 3) ? input.TEdgeMask(threshY=auxmthr, link=2, preblur=false, valon=-1).mt_lut("x "+string(mthr/5)+" <= x 1 >> x 4 << ?", U=1, V=1).mt_deflate().RemoveGrain( (w>1100) ? 20 : 11, -1 ) :
\ (mtype == 2) ? input.MSharpen(threshold=mthr/5, strength=0, mask=true, highq=false) :
\ (mtype == 4) ? input.mt_edge("sobel",7,7,5,5).mt_inflate() :
\ (mtype == 5) ? input.mt_edge("roberts",0,4,0,4).mt_inflate() :
\ (mtype == 6) ? input.mt_edge("prewitt",0,255,0,0).mt_lut("x "+string(mthr)+" <= x 1 >> x 1.4 ^ ?").RemoveGrain(4,-1).mt_inflate() : nop()
edge_mask_2 = (mtype2 == 0) ? nop() :
\ (mtype2 == 1) ? input.Tcannymod(sigma=1.2, mode=1, sobel=false).mt_lut("x "+string(mthr2)+" <= x 1 >> x 1 << ?", U=1, V=1).RemoveGrain((w>1100) ? 20 : 11, -1).mt_inflate() :
\ (mtype2 == 3) ? input.TEdgeMask(link=2, preblur=false, valon=-1).mt_lut("x "+string(mthr2/5)+" <= x 1 >> x 4 << ?", U=1, V=1).mt_deflate().RemoveGrain( (w>1100) ? 20 : 11, -1 ) :
\ (mtype2 == 2) ? input.MSharpen(threshold=mthr2/5, strength=0, mask=true, highq=false) :
\ (mtype2 == 4) ? input.mt_edge("sobel",7,7,5,5).mt_inflate() :
\ (mtype2 == 5) ? input.mt_edge("roberts",0,4,0,4).mt_inflate() :
\ (mtype2 == 6) ? input.mt_edge("prewitt",0,255,0,0).mt_lut("x "+string(mthr2)+" <= x 1 >> x 1.4 ^ ?").RemoveGrain(4,-1).mt_inflate() : nop()
final_mask = (mtype2 == 0) ? edge_mask_1 : mt_logic(edge_mask_1, edge_mask_2, "max") return final_mask
} Function TAAmbk_stabilize(clip aaed, clip "input", int "stabilize") {
aadiff = mt_makediff(input, aaed, U=3, V=3)
(stabilize < 0) ? Eval("""
aadiff_stab = aadiff.TemporalSoften(abs(stabilize), 255, 255, 255, 2).Repair(aadiff, 4)""") :
\ Eval("""
inputsuper = input.MSuper(pel=1)
diffsuper = aadiff.MSuper(pel=1, levels=1)
fv3 = (stabilize == 3) ? inputsuper.MAnalyse(isb=false,delta=3,overlap=8,blksize=16) : nop()
fv2 = (stabilize >= 2) ? inputsuper.MAnalyse(isb=false,delta=2,overlap=8,blksize=16) : nop()
fv1 = (stabilize >= 1) ? inputsuper.MAnalyse(isb=false,delta=1,overlap=8,blksize=16) : nop()
bv1 = (stabilize >= 1) ? inputsuper.MAnalyse(isb=true,delta=1,overlap=8,blksize=16) : nop()
bv2 = (stabilize >= 2) ? inputsuper.MAnalyse(isb=true,delta=2,overlap=8,blksize=16) : nop()
bv3 = (stabilize == 3) ? inputsuper.MAnalyse(isb=true,delta=3,overlap=8,blksize=16) : nop()
diffstab = (stabilize == 1) ? aadiff.MDegrain1(diffsuper,bv1,fv1) :
\ (stabilize == 2) ? aadiff.MDegrain2(diffsuper,bv1,fv1,bv2,fv2) :
\ (stabilize == 3) ? aadiff.MDegrain3(diffsuper,bv1,fv1,bv2,fv2,bv3,fv3) : nop()
aadiff_stab = mt_lutxy(aadiff, diffstab, "x 128 - abs y 128 - abs < x y ?").mergeluma(diffstab, 0.6)""")
aaed_stab = mt_makediff(input, aadiff_stab, U=3, V=3)
return aaed_stab
} Function TAAmbk_TurnLeft(clip input)
{
try
{
return input.fturnleft()
}
catch(error_msg)
{
return input.TurnLeft()
}
} Function TAAmbk_TurnRight(clip input)
{
try
{
return input.fturnright()
}
catch(error_msg)
{
return input.TurnRight()
}
}
10bit TAAmbk.avs
#avstp.dll
#RGTools.dll
#masktools2.dll
#EEDI2.dll
#EEDI3.dll
#nnedi3.dll
#nnedi3ocl.dll
#fturn-26.dll
#mvtools2.dll
#SangNom.dll
#SangNom2.dll
#TCannymod.dll
#TEMmod.dll
#Toon-v1.1.dll
#MSharpen.dll
#awarpsharp2.dll
#warpsharp.dll
#variableblur.dll
#dfttest.dll
#AddGrainC.dll
#dither.dll
#TEdgeMask.dll
#SmoothAdjust.dll
#flash3kyuu_deband.dll
#LumaDBLite_v0.7.avsi
#GrainFactoryLite_v1.2.avsi
#Dither.avsi
#Soothe.avs
#O16mod.avsi
#LSFmod v1.9.avsi
#TAAmbk.avsi ChangeFPS(last,last,true) # initiate a small forward buffer W = width(last)
H = height(last) MergeChroma(aWarpSharp2(chroma=4))
# checkmate(thr=2, max=2, tthr2=5) TAAmbk(aatype=-3, preaa=1, sharp=-1, repair=24,postaa=true, mtype=1)
# TAAmbk(aatype=-3, preaa=1, postaa=false, sharp=200, mtype=3, cycle=1, dark=0.0) # для пунктирных чёрных линий
# TAAmbk(aatype=1, preaa=0, postaa=false, sharp=50, mtype=0, cycle=0, dark=0.0) # мягкий
# TAAmbk(aatype=5, preaa=0, postaa=false, sharp=0, mtype=3, cycle=0, dark=0.0) # мягкий # ==== варианты с шумоподавлением, затемнением и утончением контурных линий ==== # TAAmbk(aatype=-3, sharp=0.3, preaa=0, mtype=5, repair=0, nnedi3CL=false, dark=0.2, thin=10, stabilize=1, cycle=0)
# TAAmbk(aatype=-3, sharp=90, preaa=0, mtype=5, repair=24, nnedi3CL=false, dark=0.2, thin=10, stabilize=2, cycle=0)
# TAAmbk(aatype=-3, sharp=120, preaa=0, mtype=5, repair=24, nnedi3CL=false, dark=0.2, thin=10, stabilize=3, cycle=0) u16() LumaDBL(g1str=12, g2str=6, g3str=0, g1soft=20, g2soft=40, g3soft=60, g1size=1.2, g2size=0.9, g3size=0.6, thr=0.5, lsb_in=true, lsb=true) # for anime & Cartoon
# LumaDBL(g1str=4, g2str=3, g3str=2, g1soft=5, g2soft=10, g3soft=20, g1size=1.3, g2size=1.0, g3size=0.7, thr=0.35, lsb_in=true, lsb=true) # for Films # ==== ресайз 16-битного видео ====
Dither_Resize16nr(W, H, kernel="spline36", noring=true) OUTPUT_BIT_DEPTH = 10 # изменить 10 на 8 при отладке или установить 16 без обрезания верхних битов скриптом (OUTPUT_BIT_DEPTH == 16) ? Eval("""
Dither_convey_yuv4xxp16_on_yvxx() # 16-бит
""") : (OUTPUT_BIT_DEPTH == 10) ? Eval("""
Down10(10, stack=false, dither=-3) # 10-бит
""") : Down10(8) # 8-бит /*
Для лёгкого и быстрого шумоподавления и конвертации 8-битного исходника в 10 бит c дебандингом ###### ПРЕДУПРЕЖДЕНИЕ ######
Установить в Глобальных настройках: сначала кроп\ресайз потом фильтрация
Штатный ресайзер конвертора лучше отключить и задать в скрипте необходимые значения W и H
Установите режим многопоточности дл¤ threads=4, как setmtmode(3,2)
Выбрать в настройках кодека AVC profile: High 10 Profile
*/
|
|
Мазизов
Стаж: 7 лет 8 месяцев Сообщений: 1134
|
Мазизов ·
03-Сен-19 21:06
(спустя 9 мин.)
Tempter57
Скрытое изменение битности в скрипте наверное можно контролировать визуально.
Берём реальный 10-ти битный исходник, загружаем в скрипт 16 бит :
Подключаем ресайз на 16-ти битах, картинка практически та же :
Делаем выход в 8 бит, конверт назад в 16 бит - картинка другая :
|
|
Tempter57
Стаж: 16 лет 3 месяца Сообщений: 4963
|
Tempter57 ·
04-Сен-19 08:43
(спустя 11 часов, ред. 04-Сен-19 11:54)
торрент иваниваныч
Поделюсь своими впечатлениями о xaa.avsi:
1. Ни один из скриптов антиайлиазинга не предусматривает 16 битной обработки
Цитата:
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.
Вывод: смысла нет в конвертации в 16 бит, хотя lsb_in=true вполне здесь работает в отличии от TAAmbk v.0,8, но конвертация в 16 бит предусмотрена по выходу.
2. В скрипте предусмотрено 4 типа метода антиайлиазинга maa2, daa, Mrdaa, santiag со своими предустановками по умолчанию, которые можно менять, разумеется, они все описаны в документации http://avisynth.nl/index.php/Xaa. При этом с Mrdaa выскакивает сразу ошибка по масштабированию с nnedi3, хотя там и задано по умолчанию uscl="nnedi3", dscl= "Spline36" и полная обработка каналов яркости и хромы chroma=1. При этом используются дополнительные скрипты по масштабированию ResizeX.avsi и edi_rprow2.avsi именно тех версий, которые указаны в документации к xaa.avsi. Помогло только запустить Mrdaa замена nnedi3.dll, на тот, что по ссылке, поэтому мне пришлось перекачивать и обновлять эти плагины в папке plugins. На всяк случай обновил eedi3.dll и проверил с uscl="eedi3".
3. Пресет фильтрации 10bit xaa имеет вид
скрытый текст
#Dither.dll
#eedi2.dll
#eedi3.dll
#FTurn-26.dll
#MaskTools2.dll
#nnedi3.dll
#nnedi3ocl.dll
#RgTools.dll
#AddGrainC.dll
#SangNom2.dll
#TCannyMod.dll
#TEMmod.dll
#TEdgeMask.dll
#SmoothAdjust.dll
#flash3kyuu_deband.dll
#edi_rpow2.avsi
#ResizeX.avsi
#LumaDBLite_v0.7.avsi
#GrainFactoryLite_v1.2.avsi
#Dither.avsi
#O16mod.avsi
#xaa.avsi ChangeFPS(last,last,true) # initiate a small forward buffer W = width(last)
H = height(last) # U16() # при включении U16 ввести параметр lsb_in=true в xaa() # xaa (mode = "nnedi3", chroma=1, lsb = true)
# xaa(mtype="sobel", mthr=7, lsb = true) # maa2
# xaa(mode="drv nnedi3", csharp=1, mask=0, chroma=1, lsb = true) # daa
# xaa(mode="null", uscl="nnedi3", csharp=2, cstr=1.0, mask=0, chroma=1, lsb = true) # Mrdaa()
# xaa(mode="di2 nnedi3", mask=0, chroma=1, cplace = "MPEG2", lsb = true) # santiag xaa(mode="maa2", lsb = true)
# xaa(mode="daa", lsb = true)
# xaa(mode="santiag", lsb = true)
# xaa(mode="Mrdaa", lsb = true) LumaDBL(g1str=8, g2str=4, g3str=0, g1soft=20, g2soft=40, g3soft=60, g1size=1.2, g2size=0.9, g3size=0.6, thr=0.5, lsb_in=true, lsb=true) # for anime & Cartoon
# LumaDBL(g1str=4, g2str=3, g3str=2, g1soft=5, g2soft=10, g3soft=20, g1size=1.3, g2size=1.0, g3size=0.7, thr=0.35, lsb_in=true, lsb=true) # for Films # ==== ресайз 16-битного видео ====
Dither_Resize16nr(W, H, kernel="spline36", noring=true) OUTPUT_BIT_DEPTH = 10 # изменить 10 на 8 при отладке или установить 16 без обрезания верхних битов скриптом (OUTPUT_BIT_DEPTH == 16) ? Eval("""
Dither_convey_yuv4xxp16_on_yvxx() # 16-бит
""") : (OUTPUT_BIT_DEPTH == 10) ? Eval("""
Down10(10, stack=false, dither=-3) # 10-бит
""") : Down10(8) # 8-бит /*
Для антиайлиазинга и конвертации 8-битного исходника в 10 бит c дебандингом ###### ПРЕДУПРЕЖДЕНИЕ ######
Установить в Глобальных настройках: сначала кроп\ресайз потом фильтрация
Штатный ресайзер конвертора лучше отключить и задать в скрипте необходимые значения W и H
Установите режим многопоточности дл¤ threads=4, как setmtmode(3,2)
Выбрать в настройках кодека AVC profile: High 10 Profile
*/
4. Ничего реально выдающегося я не обнаружил в этом скрипте, не смотря на его огромный размер. Но лучше вывод пусть сделает каждый за себя.
Теперь о приятном: мне удалось отредактировать TAAmbk_0.8.avsi и теперь он работает раздельно с lsb_in и lsb_out корректно
TAAmbk_0.8.avsi
###################################################
### Taro's Anti-Aliasing modified by kewenyu ###
### ###
### Original by 06_taro - astrataro@gmail.com ###
### ###
### Modified by kewenyu - 1059902659@qq.com ###
### ###
### v0.8.0 - 17 July 2016 ###
###################################################
###
###
### This is a modified script based on Taro's TAA v1.6.2, a 3pass anti-aliasing script method based on eedi2,
### eedi3, nnedi3 and SangNom2. Several post processes are taken to avoid details loss on scence or bring in
### new artifacts. This script require YUV420P input.
###
### Function TAAmbk(clip input, int "aatype", int "aatypeU", int "aatypeV", float "strength", int "preaa", int "cycle",
\ int "mtype", int "magg", clip "mclip", int "mthr", int "mbnr", bool "mclear", int "mepd", int "mipd", float "sigma", float "sigma2", int "txtprt",
\ int "thin", float "dark",
\ float "sharp", int "aarepair", bool "postaa", clip "src", int "stabilize",
\ bool "eedi3m", bool "nnedi3ocl", bool "lsb_in", bool "lsb_out", bool "showmask",
\ float "p1", float "p2", float "p3", float "p4", float "p5", float "p6")
{
aatype = Default(aatype, 1)
aatypeU = Default(aatypeU, aatype)
aatypeV = Default(aatypeV, aatype)
strength = Default(strength, 1)
preaa = Default(preaa, 0)
cycle = Default(cycle, 0)
mtype = Default(mtype, 1)
magg = (mtype == 1) ? Default(magg, 0) : 0
mthr = Default(mthr, 20)
mbnr = Default(mbnr, 1)
mclear = Default(mclear, True)
mepd = Default(mepd, 1)
mipd = Default(mipd, mepd)
sigma = Default(sigma, 1.2)
sigma2 = Default(sigma2, 2.8)
txtprt = Default(txtprt, 218)
thin = Default(thin, 0)
dark = Default(dark, 0)
sharp = Default(sharp, 0)
aarepair = Default(aarepair, 0)
postaa = (sharp >= 1 || sharp < -1) ? Default(postaa, True) : Default(postaa, False)
stabilize = Default(stabilize, 0)
eedi3m = (abs(aatype) == 2) ? Default(eedi3m, True) : Default(eedi3m, False)
nnedi3ocl = Default(nnedi3ocl, False)
lsb_in = Default(lsb_in, False)
lsb_out = lsb_in ? Default(lsb_out, True) : Default(lsb_out, False)
showmask = Default(showmask, False)
#src = Default(src, input)
absSh = abs(sharp)
p1 = Default(p1, Undefined())
p2 = Default(p2, Undefined())
p3 = Default(p3, Undefined())
p4 = Default(p4, Undefined())
p5 = Default(p5, Undefined())
p6 = Default(p6, Undefined()) Assert(isYV12(input), """TAAmbk: input is not an YV12 clip ! Only YV12 clip is accepted.""")
#Assert( isYV12(src), """TAAmbk: "src" is not an YV12 clip ! Only YV12 clip is accepted.""")
Assert(IsFrameBased(input), """TAAmbk: input must be FrameBased ! You may need to deinterlace first.""")
Assert((aatype >= -4 && aatype <= 7), """TAAmbk: "aatype int(-4~7)" invaild""")
Assert((aatypeU >= -4 && aatypeU <= 7), """TAAmbk: "aatypeU int(-4~7)" invaild""")
Assert((aatypeV >= -4 && aatypeV <= 7), """TAAmbk: "aatypeV int(-4~7)" invaild""")
Assert((preaa>=-1 && preaa<=2),"""TAA: "preaa"(int: -1~2) invalid!""")
Assert((mtype>=0 && mtype<=6), """TAAmbk: "mtype int(0~6)" invalid!""")
Assert((txtprt>=0 && txtprt<=255), """TAAmbk: "txtprt int(0~255)" invalid!""")
Assert((cycle >= 0 && cycle <= 6), """TAAmbk: cycle too many times(>6) may crash your avisynth and meaningless !""")
Assert((aarepair >= -24 && aarepair <= 24), """TAAmbk: "repair int(-24~24)" invaild""")
Assert((stabilize >= -3 && stabilize <= 3), """TAAmbk: "stabilize int(0~3)" invaild""")
Assert((mtype != 0 || defined(mclip) || showmask != true), """TAAmbk: there is no mask to show when you set showmask=True and mtype=0 without defined mclip !""")
Assert((eedi3m != True || mtype != 0 || defined(mclip)), """TAAmbk: there is no mask offer to eedi3 when you set eedi3m=True and mtype=0 without defined a mclip !""")
Assert((mthr >=0 && mthr <= 255), """TAAmbk: mthr int(0~255) invaild""")
Assert((strength >=1 && strength <=2), """TAAmbk: strength int(1~2) invaild""")
Assert((mbnr >= -1 && mbnr <= 8), """TAAmbk: mbnr int(-1~8) invaild""")
#Assert((lsb_in != False || lsb_out != True), """TAAmbk: only when input is 16bit can lsb_out be set to True""") input = lsb_in ? input.Ditherpost(mode=-1) : input
src = input
input16 = input.dither_convert_8_to_16()
preAAc = (preaa == 0) ? input : TAAmbk_preaa(input, mode=preaa)
preLinePlayC = (thin == 0 && dark == 0) ? preAAc : TAAmbk_lineplay(preAAc, thin, dark)
aaMask = defined(mclip) ? mclip :
\ (mtype == 0) ? nop() :
\ preLinePlayC.TAAmbk_mask(mtype, magg, mthr, mbnr, mclear, mepd, mipd, sigma, sigma2, txtprt) yAAClip = (aatype == aatypeU && aatype == aatypeV) ? preLinePlayC.TAAmbk_mainaa(aatype, strength, cycle, nnedi3ocl, eedi3m, p1, p2, p3, p4, p5, p6, eedi3m ? aaMask : undefined()) :
\ preLinePlayC.GreyScale().TAAmbk_mainaa(aatype, strength, cycle, nnedi3ocl, eedi3m, p1, p2, p3, p4, p5, p6, eedi3m ? aaMask : undefined())
uAAClip = (aatype == aatypeU && aatype == aatypeV) ? nop() :
\ preLinePlayC.UToY().TAAmbk_mainaa(aatype, strength, cycle, nnedi3ocl, eedi3m, p1, p2, p3, p4, p5, p6, eedi3m ? aaMask : undefined())
vAAClip = (aatype == aatypeU && aatype == aatypeV) ? nop() :
\ preLinePlayC.VToY().TAAmbk_mainaa(aatype, strength, cycle, nnedi3ocl, eedi3m, p1, p2, p3, p4, p5, p6, eedi3m ? aaMask : undefined()) aaedClip = (aatype == aatypeU && aatype == aatypeV) ? yAAClip : YToUV(uAAClip, vAAClip, yAAClip) aaedSharp = (sharp == 0) ? aaedClip :
\ (sharp >= 1) ? aaedClip.lsfmod(strength=Int(absSh), defaults="old", source=src) :
\ (sharp > 0) ? aaedClip.Sharpen(absSh) :
\ (sharp > -1) ? aaedClip.lsfmod(strength=Round(absSh*100), defaults="fast", source=src) :
\ (sharp == -1) ? aaedClip.mt_adddiff(mt_makediff(aaedClip, aaedClip.RemoveGrain((input.width()>1100) ? 20 : 11), U=3, V=3).Repair(mt_makediff(src, aaedClip, U=3, V=3), 13), U=3,V=3) :
\ aaedClip.lsfmod(strength=Int(absSh), defaults="slow", source=src)
aaedSharpSoo = postaa ? aaedSharp.Soothe(aaedClip, keep=48) : aaedSharp aaedMerge = (mtype == 0 && !defined(mclip)) ? aaedSharpSoo : mt_merge(src, aaedSharpSoo, aaMask, U=3, V=3)
aaedRP = (aarepair == 0) ? aaedMerge :
\ (aarepair > 0) ? src.Repair(aaedMerge, mode=aarepair) :
\ aaedMerge.Repair(src, mode = abs(aarepiar))
aaStabed = (stabilize == 0) ? aaedRP :
\ aaedRP.TAAmbk_stabilize(src, stabilize) output = (lsb_out) ? input16.dither_limit_dif16(aaStabed.dither_convert_8_to_16(), thr=1.0, elast=2.0) : aaStabed return showmask ? aaMask.GreyScale() : output
} Function TAAmbk_preaa(clip input, int "mode")
{
nn = (mode == 2) ? nop() : input.nnedi3(field=-2)
nnt = (mode == 1) ? nop() : input.TAAmbk_TurnLeft().nnedi3(field=-2).TAAmbk_TurnRight()
clph = (mode == 2) ? nop() : mt_average(selecteven(nn), selectodd(nn), U=3, V=3)
clpv = (mode == 1) ? nop() : mt_average(selecteven(nnt), selectodd(nnt), U=3, V=3)
clp = (mode == -1) ? mt_average(clph, clpv, U=3, V=3) : nop()
return (mode == 1) ? clph :
\ (mode == 2) ? clpv :
\ clp
} Function TAAmbk_mainaa(clip input, int "aatype", float "strength", int "cycle", bool "nnedi3ocl", bool "eedi3m",
\ float "p1", float "p2", float "p3", float "p4", float "p5", float "p6", clip "emask")
{
pindex = aatype + 4
p1 = Default( p1, Select(pindex, 48, 48, 48, 48, 0, 10, 0.5, 3, 48, 48, 48, 48) )
p2 = Default( p2, Select(pindex, 10, 3, 0.5, 10, 0, 20, 0.2, 1, 1, 0, 0, 0) )
p3 = Default( p3, Select(pindex, 20, 1, 0.2, 20, 0, 20, 20, 2, 3, 0, 0, 0) )
p4 = Default( p4, Select(pindex, 20, 2, 20, 20, 0, 24, 3, 0, 2, 0, 0, 0) )
p5 = Default( p5, Select(pindex, 24, 0, 3, 24, 0, 50, 30, 0, 0, 0, 0, 0) )
p6 = Default( p6, Select(pindex, 50, 0, 30, 50, 0, 0, 0, 0, 0, 0, 0, 0) ) w = width(input)
h = height(input)
downScale = -0.5 * strength + 1.5
dw = Round(w*downScale/4)*4
dh = Round(h*downScale/4)*4
upw4 = Round(dw*0.375)*4
uph4 = Round(dh*0.375)*4
nnedi3type = nnedi3ocl ? "nnedi3ocl" : "nnedi3"
eedi3mc = eedi3m ? emask.BilinearResize(dw, dh).mt_expand() : nop()
eedi3mct = eedi3m ? eedi3mc.BilinearResize(w, uph4).TAAmbk_turnright() : nop() preDownClip = (strength == 1) ? input : input.Spline36Resize(dw, dh) aaClip = (aatype == -4) ? preDownClip.eedi2(field=1, mthresh=int(p2), lthresh=int(p3), vthresh=int(p4), maxd=int(p5), nt=int(p6)).TAAmbk_turnright()
\ .PointResize(dh*2, dw*2).SangNom2(aa=int(p1)).TAAmbk_turnleft().SangNom2(aa=int(p1)).TAAmbk_spline36resize(w, h, -0.5, -0.5) :
\ (aatype == -3 || aatype == 4) ? preDownClip.Eval(""""""+nnedi3type+"""(dh=true, field=1, nsize=int(p2), nns=int(p3), qual=int(p4))""").TAAmbk_spline36resize(w, uph4, 0, -0.5)
\ .TAAmbk_turnright().Eval(""""""+nnedi3type+"""(dh=true, field=1, nsize=int(p2), nns=int(p3), qual=int(p4))""").TAAmbk_spline36resize(uph4, upw4, 0, -0.5)
\ .SangNom2(aa=int(p1)).TAAmbk_turnLeft().SangNom2(aa=int(p1)).Spline36Resize(w, h) :
\ (aatype == -2) ? preDownClip.Eedi3(dh=true, field=1, alpha=float(p2), beta=float(p3), gamma=float(p4), nrad=int(p5), mdis=int(p6), mclip=eedi3m ? eedi3mc : undefined()).TAAmbk_spline36resize(w, uph4, 0, -0.5)
\ .TAAmbk_turnright().Eedi3(dh=true, field=1, alpha=float(p2), beta=float(p3), gamma=float(p4), nrad=int(p5), mdis=int(p6), mclip=eedi3m ? eedi3mct : undefined()).TAAmbk_spline36resize(uph4, upw4, 0, -0.5)
\ .SangNom2(aa=int(p1)).TAAmbk_turnleft().SangNom2(aa=int(p1)).Spline36Resize(w, h) :
\ (aatype == -1) ? preDownClip.eedi2(field=1, mthresh=int(p2), lthresh=int(p3), vthresh=int(p4), maxd=int(p5), nt=int(p6)).TAAmbk_spline36resize(w, uph4, 0, -0.5).TAAmbk_turnright()
\ .eedi2(field=1, mthresh=int(p2), lthresh=int(p3), vthresh=int(p4), maxd=int(p5), nt=int(p6)).TAAmbk_spline36resize(uph4, upw4, 0, -0.5).SangNom2(aa=int(p1)).TAAmbk_turnLeft()
\ .SangNom2(aa=int(p1)).Spline36Resize(w, h) :
\ (aatype == 1) ? preDownClip.eedi2(field=1, mthresh=int(p1), lthresh=int(p2), vthresh=int(p3), maxd=int(p4), nt=int(p5)).TAAmbk_spline36resize(w, h, 0, -0.5).TAAmbk_turnright()
\ .eedi2(field=1, mthresh=int(p1), lthresh=int(p2), vthresh=int(p3), maxd=int(p4), nt=int(p5)).TAAmbk_spline36resize(h, w, 0, -0.5).TAAmbk_turnleft() :
\ (aatype == 2) ? preDownClip.Eedi3(dh=true, field=1, alpha=float(p1), beta=float(p2), gamma=float(p3), nrad=int(p4), mdis=int(p5), mclip=eedi3m ? eedi3mc : undefined()).TAAmbk_spline36resize(w, h, 0, -0.5).TAAmbk_turnright()
\ .Eedi3(dh=true, field=1, alpha=float(p1), beta=float(p2), gamma=float(p3), nrad=int(p4), mdis=int(p5), mclip=eedi3m ? eedi3mct.BilinearResize(h, w) : undefined()).TAAmbk_spline36resize(h, w, 0, -0.5).TAAmbk_turnleft() :
\ (aatype == 3) ? preDownClip.Eval(""""""+nnedi3type+"""(dh=true, field=1, nsize=int(p1), nns=int(p2), qual=int(p3))""").TAAmbk_spline36resize(w, h, 0, -0.5).TAAmbk_turnright()
\ .Eval(""""""+nnedi3type+"""(dh=true, field=1, nsize=int(p1), nns=int(p2), qual=int(p3))""").TAAmbk_spline36resize(h, w, 0, -0.5).TAAmbk_turnleft() :
\ (aatype == 5) ? preDownClip.Spline64Resize(upw4, uph4).Repair(input.GaussResize(upw4, uph4, p=100), 1).SangNom2(aa=int(p1)).TAAmbk_turnright().SangNom2(aa=int(p1)).Spline36Resize(h, w).TAAmbk_turnleft() :
\ (aatype == 6) ? preDownClip.Spline64Resize(w, uph4).SangNom2(aa=int(p1)).Spline36Resize(w, h).TAAmbk_turnright().Spline64Resize(h, upw4).SangNom2(aa=int(p1)).Spline36Resize(h, w).TAAmbk_TurnLeft().Repair(input, mode=int(p2)) :
\ (aatype == 7) ? preDownClip.PointResize(dw, dh*2).SangNom2(aa=int(p1)).TAAmbk_spline36resize(w, h, 0, -0.5).TAAmbk_turnright().PointResize(dh, dw*2).SangNom2(aa=int(p1)).TAAmbk_spline36resize(h, w, 0, -0.5).TAAmbk_turnleft() :
\ preDownClip return (cycle==0) ? aaClip : aaClip.TAAmbk_mainaa(aatype, strength, cycle - 1, nnedi3ocl, eedi3m, p1, p2, p3, p4, p5, p6, emask)
} Function TAAmbk_mask(clip input, int "mtype", int "magg", int "mthr", int "mbnr", bool "mclear", int "mepd", int "mipd", float "sigma", float "sigma2", int "txtprt")
{
w = input.width()
h = input.height()
aaMask = (mtype == 1) ? input.Tcannymod(mode=1, sigma=sigma, sobel=true) :
\ (mtype == 2) ? input.TEdgeMask(link=2, preblur=false, valon=-1) :
\ (mtype == 3) ? input.MSharpen(threshold=mbnr/5, strength=0, mask=true, highq=false) :
\ (mtype == 4) ? input.mt_edge("sobel",7,7,5,5) :
\ (mtype == 5) ? input.mt_edge("roberts",0,4,0,4) :
\ (mtype == 6) ? input.mt_edge("prewitt",0,255,0,0) : nop() aaMaskThr = (mbnr <= 0) ? aaMask :
\ (mtype == 1) ? aaMask.mt_lut("x "+string(mthr)+" <= x "+string(mbnr)+" >> x "+string(mbnr)+" << ?", U=1, V=1) :
\ (mtype == 2) ? aaMask.mt_lut("x "+string(mthr/5)+" <= x "+string(mbnr)+" >> x "+string(4*mbnr)+" << ?", U=1, V=1) :
\ (mtype == 6) ? aaMask.mt_lut("x "+string(mthr)+" <= x "+string(mbnr)+" >> x 1.4 ^ ?") : aaMask aaMaskBnr = (mbnr == -1) ? aaMaskThr.mt_binarize(mthr) : aaMaskThr aaMaskAgg = (mtype == 1 && magg != 0) ? Eval("""
aggMask = input.Tcannymod(mode=0, sigma=sigma2, sobel=True).mt_expand()
return mt_lutxy(aggMask, aaMaskBnr, "y "+string(magg)+" > x 0 ?")
""") : aaMaskBnr aaMaskClear = mclear ? aaMaskAgg : aaMaskAgg.RemoveGrain(4, 4)
aaMaskExpand = (mepd == 0) ? aaMaskClear : aaMaskClear.TAAmbk_expand(mepd)
aaMaskInpand = (mipd == 0) ? aaMaskExpand : aaMaskExpand.TAAmbk_inpand(mipd) aaMaskAvg = aaMaskInpand.RemoveGrain(20, 20) txtMask = (txtprt != 0) ? Eval("""
srcY = input.GreyScale()
srcU = input.UToY().Spline64Resize(w, h, 0.25)
srcV = input.VToY().Spline64Resize(w, h, 0.25)
mt_lutxyz(srcY,srcU,srcV,"x "+string(txtprt)+" > y 128 - abs 1 <= & z 128 - abs 1 <= & 255 0 ?").mt_expand(mode=mt_circle(2)).mt_expand().RemoveGrain(20, 20)
""") : nop() aaMaskFinal = (txtprt != 0) ? mt_lutxy(aaMaskAvg, txtMask, "x y -") : aaMaskAvg
aaMaskUV = aaMaskFinal.GreyScale().BilinearResize(width(aaMaskFinal)/2, height(aaMaskFinal)/2)
aaMaskOutput = YToUV(aaMaskUV, aaMaskUV, aaMaskFinal)
return aaMaskOutput
} Function TAAmbk_stabilize(clip input, clip "src", int "stabilize")
{
aaDiff = mt_makediff(src, input, U=3, V=3)
inSuper = input.MSuper(pel=1)
diffSuper = aaDiff.MSuper(pel=1, levels=1) fv3 = (stabilize == 3) ? inSuper.MAnalyse(isb=false,delta=3,overlap=8,blksize=16) : nop()
fv2 = (stabilize >= 2) ? inSuper.MAnalyse(isb=false,delta=2,overlap=8,blksize=16) : nop()
fv1 = (stabilize >= 1) ? inSuper.MAnalyse(isb=false,delta=1,overlap=8,blksize=16) : nop()
bv1 = (stabilize >= 1) ? inSuper.MAnalyse(isb=true,delta=1,overlap=8,blksize=16) : nop()
bv2 = (stabilize >= 2) ? inSuper.MAnalyse(isb=true,delta=2,overlap=8,blksize=16) : nop()
bv3 = (stabilize == 3) ? inSuper.MAnalyse(isb=true,delta=3,overlap=8,blksize=16) : nop() diffStab = (stabilize == 1) ? aaDiff.MDegrain1(diffsuper,bv1,fv1) :
\ (stabilize == 2) ? aaDiff.MDegrain2(diffsuper,bv1,fv1,bv2,fv2) :
\ (stabilize == 3) ? aaDiff.MDegrain3(diffsuper,bv1,fv1,bv2,fv2,bv3,fv3) : nop() diffCompare = mt_lutxy(aaDiff, diffStab, "x 128 - abs y 128 - abs < x y ?").mergeluma(diffStab, 0.6)
aaStab = mt_makediff(src, diffCompare, U=3, V=3)
return aaStab
} Function TAAmbk_lineplay(clip input, int "thin", float "dark")
{
return (thin != 0 && dark != 0) ? input.aWarpSharp2(depth=thin).Toon(dark) :
\ (thin == 0) ? input.Toon(dark) :
\ input.aWarpSharp(depth=thin)
} Function TAAmbk_expand(clip mask, int "n")
{
expMask = mask.mt_expand()
return (n==1) ? expMask : expMask.TAAmbk_expand(n-1)
} Function TAAmbk_inpand(clip mask, int "n")
{
inpMask = mask.mt_inpand()
return (n==1) ? inpMask : inpMask.TAAmbk_inpand(n-1)
} Function TAAmbk_spline36resize(clip input, int "w", int "h", float "sx", float "sy")
{
y = input.GreyScale()
u = input.UToY()
v = input.VToY()
yResize = y.Spline36Resize(w, h, sx, sy)
uResize = u.Spline36Resize(w/2, h/2, sx, sy)
vResize = v.Spline36Resize(w/2, h/2, sx, sy)
return YToUV(uResize, vResize, yResize)
} Function TAAmbk_turnleft(clip input)
{
try
{
return input.fturnleft()
}
catch(error_msg)
{
return input.TurnLeft()
}
} Function TAAmbk_turnright(clip input)
{
try
{
return input.fturnright()
}
catch(error_msg)
{
return input.TurnRight()
}
}
То есть на вход можно подавать как 8 битный, так и 16 битный клип, также на выходе можно получать 8 битный или 16 битный клип, вход и выход уже раздельны, а не связаны, как ранее!!!
При этом пресет обработки имеет вид
10bit TAAmbk_0.8.avs
#avstp.dll
#RGTools.dll
#masktools2.dll
#EEDI2.dll
#EEDI3.dll
#nnedi3.dll
#nnedi3ocl.dll
#fturn-26.dll
#mvtools2.dll
#SangNom2.dll
#TCannymod.dll
#TEMmod.dll
#Toon-v1.1.dll
#MSharpen.dll
#awarpsharp2.dll
#warpsharp.dll
#variableblur.dll
#dfttest.dll
#AddGrainC.dll
#dither.dll
#TEdgeMask.dll
#SmoothAdjust.dll
#flash3kyuu_deband.dll
#LumaDBLite_v0.7.avsi
#GrainFactoryLite_v1.2.avsi
#Dither.avsi
#Soothe.avs
#O16mod.avsi
#LSFmod v1.9.avsi
#TAAmbk_0.8.avsi ChangeFPS(last,last,true) # initiate a small forward buffer W = width(last)
H = height(last) MergeChroma(aWarpSharp2(chroma=4))
# checkmate(thr=2, max=2, tthr2=5) # U16() # при подключении установить lsb_in=true в параметрах TAAmbk
TAAmbk(lsb_in=false , lsb_out=true, aatype=-3, preaa=-1, sharp=-1, aarepair=24,postaa=true, mtype=1)
# TAAmbk(lsb_in=false , lsb_out=true, aatype=-3, preaa=-1, postaa=false, sharp=200, mtype=3, cycle=1, dark=0.0) # для пунктирных чёрных линий
# TAAmbk(lsb_in=false , lsb_out=true, aatype=1, preaa=0, postaa=false, sharp=50, mtype=0, cycle=0, dark=0.0) # мягкий
# TAAmbk(lsb_in=false , lsb_out=true, aatype=5, preaa=0, postaa=false, sharp=0, mtype=3, cycle=0, dark=0.0) # мягкий # ==== варианты с шумоподвлением, затемнением и утончением контурных линий ==== # TAAmbk(lsb_in=false , lsb_out=true,aatype=-3, sharp=0.3, preaa=0, mtype=5, aarepair=0, nnedi3ocl=false, dark=0.2, thin=10, stabilize=1, cycle=0)
# TAAmbk(lsb_in=false , lsb_out=true,aatype=-3, sharp=90, preaa=0, mtype=5, aarepair=24, nnedi3ocl=false, dark=0.2, thin=10, stabilize=2, cycle=0)
# TAAmbk(lsb_in=false , lsb_out=true,aatype=-3, sharp=120, preaa=0, mtype=5, aarepair=24, nnedi3ocl=false, dark=0.2, thin=10, stabilize=3, cycle=0) LumaDBL(g1str=12, g2str=6, g3str=0, g1soft=20, g2soft=40, g3soft=60, g1size=1.2, g2size=0.9, g3size=0.6, thr=0.5, lsb_in=true, lsb=true) # for anime & Cartoon
# LumaDBL(g1str=4, g2str=3, g3str=2, g1soft=5, g2soft=10, g3soft=20, g1size=1.3, g2size=1.0, g3size=0.7, thr=0.35, lsb_in=true, lsb=true) # for Films # ==== ресайз 16-битного видео ====
Dither_Resize16nr(W, H, kernel="spline36", noring=true) OUTPUT_BIT_DEPTH = 10 # изменить 10 на 8 при отладке или установить 16 без обрезания верхних битов скриптом (OUTPUT_BIT_DEPTH == 16) ? Eval("""
Dither_convey_yuv4xxp16_on_yvxx() # 16-бит
""") : (OUTPUT_BIT_DEPTH == 10) ? Eval("""
Down10(10, stack=false, dither=-3) # 10-бит
""") : Down10(8) # 8-бит /*
Для антиайлиазинга с возможностью шумоподавления и конвертации 8-битного исходника в 10 бит c дебандингом ###### ПРЕДУПРЕЖДЕНИЕ ######
Установить в Глобальных настройках: сначала кроп\ресайз потом фильтрация
Штатный ресайзер конвертора лучше отключить и задать в скрипте необходимые значения W и H
Установите режим многопоточности дл¤ threads=4, как setmtmode(3,2)
Выбрать в настройках кодека AVC profile: High 10 Profile
*/
P.S. Архив обновил...
|
|
торрент иваниваныч
Стаж: 15 лет 1 месяц Сообщений: 1154
|
торрент иваниваныч ·
04-Сен-19 21:21
(спустя 12 часов)
Tempter57
Хорошие новости. Большое спасибо!
|
|
_KG_
Стаж: 16 лет 1 месяц Сообщений: 304
|
_KG_ ·
08-Сен-19 19:14
(спустя 3 дня)
А можно как то заставить работать в помощь процессору видеокарту?
|
|
Koo1
Стаж: 15 лет 8 месяцев Сообщений: 1145
|
Koo1 ·
08-Сен-19 19:24
(спустя 10 мин.)
_KG_
Только для некоторых плагинов и то ещё может зависеть от того, нвидия или амд.
|
|
Артём Данилов
Стаж: 13 лет 4 месяца Сообщений: 386
|
Артём Данилов ·
09-Сен-19 09:58
(спустя 14 часов, ред. 09-Сен-19 09:58)
Ребята, помогите решить проблему. Выплывает ошибка:
AviSynth Encoder Error: Попытка чтения или записи в защищенную память. Это часто свидетельствует о том, что другая память повреждена. This log was saved here: D:\переполох(2001)Третий отрезок.mkv.error.log Проблема наблюдается только с одним файлом. Все остальное кодируется с такими же настройками нормально. Полгода назад этот же файл был перекодирован нормально. ПК тот же
|
|
Мазизов
Стаж: 7 лет 8 месяцев Сообщений: 1134
|
Мазизов ·
09-Сен-19 13:13
(спустя 3 часа)
Артём Данилов
Вы не заметили, с чего начинается шапка темы ?
Цитата:
При возникновении проблем или ошибок при кодировании, пожалуйста, дополняйте свой вопрос полным логом из окна энкодера!
Лог прячьте под спойлер
|
|
Артём Данилов
Стаж: 13 лет 4 месяца Сообщений: 386
|
Артём Данилов ·
09-Сен-19 13:42
(спустя 28 мин.)
скрытый текст
TASK
------------------------------
Format: MKV
Duration: 01:47:50:464 (155291)
VideoDecoder: DirectShowSource2
Resolution: 1920x1080 > 1920x1038
Aspect: 1.8494 > 1.8497
VCodecPreset: Custom
VEncodingMode: TwoPass
VideoCodec: h264 > x264
VideoBitrate: 22861 > 14330
Quality: 0.459 > 0.300
Framerate: 24.000
SourceType: PROGRESSIVE
FieldOrder: UNKNOWN
AudioDecoder: NicDTSSource
AEncodingPreset: AC3 448k Quality
AudioCodec: DTS > AC3
AudioBitrate: 1536 > 448
Samplerate: 48000
Channels: 6
Normalize: 100%
Accurate: 10%
Gain: 4.570 SCRIPT
------------------------------
Import("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\functions\AudioFunctions.avs")
Import("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\functions\VideoFunctions.avs")
LoadPlugin("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\avss.dll")
LoadPlugin("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\NicAudio.dll") video = DirectShowSource2("D:\Скачка\13\переполох(2001).mkv", fps=24.000, preroll=15, lavs="L3", lavd="L3")
audio = NicDTSSource("D:\Temp\0024_0.dts")
AudioDub(video, audio) AmplifydB(4.570)
ConvertToYV12() ###[FILTERING]###
###[FILTERING]### Crop(2, 22, -2, -22)
Lanczos4Resize(1920, 1038)
Trim(378, 450)++Trim(565, 17158)++Trim(17231, 30674)++Trim(30699, 49009)++Trim(49040, 58856)++\
Trim(58928, 60909)++Trim(60932, 62982)++Trim(63064, 64652)++Trim(64669, 70350)++Trim(70453, 113839)++\
Trim(113852, 117431)++Trim(117614, 121728)++Trim(121947, 122027)++Trim(122561, 122747)++Trim(122965, 134529)++\
Trim(135083, 137911)++Trim(137966, 139748)++Trim(139798, 141773)++Trim(143153, 154783)++Trim(154910, 155094)++\
Trim(155130, 157441)++Trim(157526, 158187)++Trim(158641, 160095) AUDIO ENCODING
------------------------------
Encoding audio to: D:\Temp\0031.ac3
AC3 448kbps 6ch 16bit 48000khz aften.exe: -b 448 -w 43 - "D:\Temp\0031.ac3" Ошибка:
AviSynth Encoder Error: Попытка чтения или записи в защищенную память. Это часто свидетельствует о том, что другая память повреждена. This log was saved here: D:\переполох2001.mkv.error.log
|
|
Мазизов
Стаж: 7 лет 8 месяцев Сообщений: 1134
|
Мазизов ·
09-Сен-19 16:44
(спустя 3 часа)
Артём Данилов
1. Вы показали не полный лог, и на вопрос в принципе можно не отвечать.
2. Прогрессивные исходники с потоком Н264 в MKV лучше кодировать на декодерах с индексом LWLibavVideoSource или FFmpegSource2, предварительно обновив их (пункт 2 третьего поста темы).
3. Анализ пиков звука надо делать 100%, а нормализацию к 90%, посмотрите настройки программы в третьем посту.
4. Для нормального плеера ресайз абсолютно не нужен, и после кропа кодировать в разрешение 1916х1036 .
5. Что касается ошибки, то в Ависинт загружено 155291 кадров, а на трим указано - Trim(155130, 157441)++Trim(157526, 158187)++Trim(158641, 160095) ??
|
|
торрент иваниваныч
Стаж: 15 лет 1 месяц Сообщений: 1154
|
торрент иваниваныч ·
10-Сен-19 23:11
(спустя 1 день 6 часов)
Какое дефолтное значение blur в YAHR3? Внутри не написано.
|
|
AkvenJan
Стаж: 15 лет 7 месяцев Сообщений: 584
|
AkvenJan ·
11-Сен-19 10:02
(спустя 10 часов)
Доброе утро, возник актуальный вопрос.
Имелось видео в контейнере AVI. Там была фишка в том, что звуковая дорожка была на несколько секунд дольше видеодорожки. И при проигрывании после завершении видео ещё пару секунд шёл звук на чёрном фоне (так и было задумано я так понимаю).
Мне по ряду причин понадобилось пересобрать это видео в контейнере. Так вот, после пересборки в полученном файле эти лишние секунды звука просто отрезаются. Видео заканчивается ровно там, где кончается длина видеодорожки.
Как это можно исправить, мне нужно чтобы полученный результат по воспроизведению был аналогичен тому, что было, включая звук на чёрном экране.
Пробовал в VirtualDubMod в настройках интерполяции звука убирать галочку "cut off audio when video ends" - не помогает.
Пробовал в AVI-MUX GUI - тоже обрезает.
|
|
Tempter57
Стаж: 16 лет 3 месяца Сообщений: 4963
|
Tempter57 ·
11-Сен-19 11:18
(спустя 1 час 15 мин., ред. 11-Сен-19 11:18)
торрент иваниваныч писал(а):
77950692Какое дефолтное значение blur в YAHR3? Внутри не написано
Да уж, real.finder also aka A.SONY's заставляет юзеров логически думать
Пробуйте логически связать строку в YAHR2, поскольку он входит в YAHR3
Код:
blur = defined(blurV) && !defined(blur) ? depth==0 ? 0 : blur : blur
, где говорится, что blurV и blur будет определены в "0" в случае depth=0, в противном случае они определяются значением blur, которое вы задаёте. Если значение blur вами принудительно не задано, то дальше идём в документацию фильтра awarpsharp2 и смотрим дефолтное значение blur фильтра awarpsharp2, где сказано
Цитата:
blur: 0..100, default 2 for type 0, 3 for type 1
type: 0..1, default 0 for aWarpSharp2, 1 for aBlur
Type of blur:
0 - radius 6 blur
1 - radius 2 blur, requires around 8x more passes than type 0 for the same
effect (will be just 2.5x slower), but produce better quality
Делаете логический вывод, что по дефолту blur=2
|
|
торрент иваниваныч
Стаж: 15 лет 1 месяц Сообщений: 1154
|
торрент иваниваныч ·
11-Сен-19 18:06
(спустя 6 часов)
Tempter57
Спасибо. Искать в aWarpSharp2 я бы точно не догадался.
YAHR3 вообще странный, включил useawarp4=true, пишет, что в aWarpSharp4xx нет функции "depthV". Посмотрел, её действительно там нет. AkvenJan
Приходит на ум только откусить от авишки в VD кусочек и вставить его в конец.
|
|
Tempter57
Стаж: 16 лет 3 месяца Сообщений: 4963
|
Tempter57 ·
12-Сен-19 10:46
(спустя 16 часов, ред. 18-Сен-19 22:08)
торрент иваниваныч писал(а):
77953776YAHR3 вообще странный, включил useawarp4=true, пишет, что в aWarpSharp4xx нет функции "depthV". Посмотрел, её действительно там нет
Просто функция aWarpSharp4xx.avsi обновилась. Её обновлённую версию надо подключать к YAHR2, а заодно nnedi3 и в случае с lsb=true оба плагина dither
aWarpSharp4xx.avsi
# make aWarpSharp2 work on other planar, for avs 2.6
# mod to make it faster with last aWarpSharp2 and add aWarp4, v1.45 function aWarpSharp4xx (clip osrc, int "thresh", int "blur", int "type", int "depth", int "chroma", int "cdepth", string "cplace", bool "bic", int "cblur", bool "useaWarp4", clip "y_mask", bool "lsb", int "depthV", int "blurV", int "cdepthV", int "cblurV")
{ sisphbd = AvsPlusVersionNumber > 2294 lsb = default(lsb, false)
sisphbd ? Assert(!(osrc.BitsPerComponent() > 8 && lsb), "lsb hack is not Compatible with native high bit depth" ) : nop() src = lsb ? osrc.DitherPost(mode=-1) : osrc fullchr = sisphbd ? src.is444() : src.isyv24()
chr420 = sisphbd ? src.is420() : src.isyv12()
nochr = sisphbd ? src.isy() : src.isy8() depth = default(depth, 16)
type = default(type , 0)
mablur = defined(blur)
blur = default(blur , type==0 ? 2 : 3)
chroma = default(chroma, 4)
cplace = default(cplace, "MPEG2")
cdepth = default(cdepth, fullchr ? depth : depth/2)
blurC_para = defined(cblur) ? ",blurC=" + string(cblur) : ""
cblur = default(cblur, fullchr ? blur : (blur+1)/2)
bic = default(bic, true)
useaW4 = default(useaWarp4, false) Assert(IsPlanar(src) && isyuv(src), "aWarpSharp4xx: input clip must be planar YUV")
assert(0 <= chroma <= 6, "aWarpSharp4xx: argument chroma must be an integer between 0 and 6.")
assert(cplace == "MPEG2" || cplace == "MPEG1", "aWarpSharp4xx: chroma siting must be MPEG2 or MPEG1")
Assert(Defined(y_mask) ? sisphbd ? isy(y_mask) : isy8(y_mask) : true, "aWarpSharp4xx: y_mask clip mustn't has chroma") blur = defined(blurV) && !mablur ? depth==0 ? 0 : blur : blur defined(depthV) ? depthV != 0 && depth==0 ? eval("blurV=defined(blurV) ? blurV : blur Chr(3) blur=mablur ? blur : 0") : depthV==0 && depth != 0 ? eval("blurV=defined(blurV) ? blurV : 0") : nop() : nop() defined(depthV) && !defined(cdepthV) ? depthV != 0 ? fullchr ? eval("cdepthV=depthV") : eval("cdepthV=depthV/2") : eval("cdepthV=0") : nop() defined(cdepthV) ? cdepthV != 0 && cdepth==0 ? eval("""cblurV=defined(cblurV) ? cblurV : cblur Chr(3) cblur=blurC_para!="" ? cblur : 0""") : cdepthV==0 && cdepth != 0 ? eval("cblurV=defined(cblurV) ? cblurV : 0") : nop() : nop() depthV_para = defined(depthV) ? ",depthV=" + string(depthV) : ""
blurV_para = defined(blurV) ? ",blurV=" + string(blurV) : defined(depthV) ? depthV==0 ? ",blurV=0" : "" : ""
cdepthV_para = defined(cdepthV) ? ",depthVC=" + string(cdepthV) : ""
cblurV_para = defined(cblurV) ? ",blurVC=" + string(cblurV) : defined(cdepthV) ? cdepthV==0 ? ",blurVC=0" : "" : ""
cuvdepthV_para = defined(cdepthV) ? ",depthV=" + string(cdepthV) : ""
cuvblurV_para = defined(cblurV) ? ",blurV=" + string(cblurV) : "" chroma = nochr ? 1 : defined(cdepthV) ? cdepthV==0 && cdepth==0 && chroma > 2 ? 2 : chroma : chroma (blurC_para=="" && !Defined(y_mask) && !useaW4 && !IsYV411(src) && !((!fullchr || !nochr) && (chroma == 4 || chroma == 6))) ? \
Eval("""
output = eval("src.aWarpSharp2(thresh=thresh, blur=blur, type=type, depth=depth, chroma=chroma, depthC=cdepth, cplace=cplace" + depthV_para + blurV_para + cdepthV_para + cblurV_para + ")")
""") : \
Eval("""
chrgu = chroma == 4 || chroma == 6
y = chroma > 2 && !(chroma > 4 && Defined(y_mask)) ? sisphbd ? ConvertToY(src) : ConvertToY8(src) : src
u = chroma > 2 ? sisphbd ? ExtractU(src) : UtoY8(src) : nop()
v = chroma > 2 ? sisphbd ? ExtractV(src) : VtoY8(src) : nop() eymask = Defined(y_mask) y_mask = eymask ? y_mask : useaW4 || chrgu ? aSobel(y, thresh=thresh) : nop()
yblurb = !mablur && eymask ? defined(blurV) ? blurV!=0 : false : defined(blurV) ? !(blurV==0 && blur==0) : blur!=0
y_mask = yblurb && (useaW4 || chrgu) ? eval("y_mask.aBlur(blur=blur, type=type" + blurV_para + ")") : y_mask
cshift = chrgu ? IsYV411(src) ? -1.5 : (cplace == "MPEG1" && chr420) ? 0 : -0.5 : nop()
uv_mask = chrgu ? fullchr ? y_mask : bic ? y_mask.BicubicResize(u.width(), v.height(), src_left=cshift) : y_mask.BilinearResize(u.width(), v.height(), src_left=cshift) : nop()
u_mask = chrgu ? uv_mask : chroma > 2 ? aSobel(u, thresh=thresh) : nop()
uvblurb = defined(cblurV) ? !(cblurV==0 && cblur==0) : cblur!=0
u_mask = chrgu ? u_mask : chroma > 2 ? uvblurb ? eval("u_mask.aBlur(blur=cblur, type=type" + cuvblurV_para + ")") : u_mask : nop()
v_mask = chrgu ? uv_mask : chroma > 2 ? aSobel(v, thresh=thresh) : nop()
v_mask = chrgu ? v_mask : chroma > 2 ? uvblurb ? eval("v_mask.aBlur(blur=cblur, type=type" + cuvblurV_para + ")") : v_mask : nop() y = chroma < 5 ? useaW4 ? y.nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2) : y : y
u = chroma > 2 ? useaW4 ? U.nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2) : u : nop()
v = chroma > 2 ? useaW4 ? V.nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2) : v : nop() # warp each channel independently
y_warp = chroma < 5 ? useaW4 ? eval("aWarp4(y, y_mask, depth=depth, chroma=chroma, cplace=cplace" + depthV_para + cdepthV_para + ")") : eval("aWarpSharp2(y, thresh=thresh, blur=blur, type=type, depth=depth, chroma=chroma, cplace=cplace" + depthV_para + blurV_para + cdepthV_para + blurC_para + cblurV_para + ")") : y
u_warp = chroma > 2 ? useaW4 ? eval("aWarp4(u, u_mask, depth=cdepth " + cuvdepthV_para + ")") : eval("aWarp(u, u_mask, depth=cdepth " + cuvdepthV_para + ")") : nop()
v_warp = chroma > 2 ? useaW4 ? eval("aWarp4(v, v_mask, depth=cdepth " + cuvdepthV_para + ")") : eval("aWarp(v, v_mask, depth=cdepth " + cuvdepthV_para + ")") : nop() # luma/chroma processing
output = chroma > 2 ? sisphbd ? CombinePlanes(y_warp,u_warp,v_warp,planes="YUV", source_planes="YYY",sample_clip=src) : YtoUV( u_warp , v_warp , y_warp ) : \
y_warp
""")
output8_16 = lsb==true ? output.Dither_convert_8_to_16() : output
y_ld = chroma < 5 ? 3 : 2
uv_ld = Min(chroma, 3)
Return(lsb==true ? Dither_limit_dif16(osrc, output8_16, thr=1.0, elast=1.5, y=y_ld, u=uv_ld, v=uv_ld) : output8_16)
}
Кроме того стоит помнить о предупреждении внутри на счёт версии AviSynth
Цитата:
sisphbd = AvsPlusVersionNumber > 2294
Хотя понимаю, что у вас стоит v.2772
Вообще, товарищ real.finder - разработчик классный и уникальный, но есть недостаток: для того, чтобы пахали его скрипты, необходимо постоянно подключать чуть ли не все его плагины, поскольку часть вспомогательного скрипта может оказаться в ином скрипте. Тот же QTGMC.avsi работает только в связке SMDegrain.avsi из-за вспомагательного скрипта Dither_Luma_Rebuild, который я просто тупо уже дописую сам в состав QTGMC.avsi. YAHR3 работает только в связке с DeHaloHmod.avsi, во многие скрипты просто тупо приходится добавлять строки
Код:
function IsAvsNeo()
{
FindStr(VersionString, "AviSynth Neo") != 0
} function IsAvsPlus()
{
FindStr(VersionString, "AviSynth+") != 0 || IsAvsNeo
} function AvsPlusVersionNumber()
{
IsAvsNeo ? eval(MidStr(VersionString(),20,4)) : IsAvsPlus ? eval(MidStr(VersionString(),17,4)) : 0
}
чтобы скрипт работал автономно... Ряд вспомогательных функций закопан в Advanced Denoising.avsi...
Просто беда со стыковкой SMDegrain.avsi v3.1.2.104s и его нового LSFmod v.2.183 . Складывается впечатление , что даже не пытался проверять их на совместимость, хотя оба скрипта его...
|
|
торрент иваниваныч
Стаж: 15 лет 1 месяц Сообщений: 1154
|
торрент иваниваныч ·
12-Сен-19 18:49
(спустя 8 часов)
Tempter57
Спасибо ещё раз. У меня был только старый v1.38. YAHR3 чуть лучше YAHR2 и YAHRMask и все они хороши с FineDehalo. Возвращаясь к тому деинтерлейсу: я обнаружил, что там на всём диске 29.97i с двумя фазами движения, вот почему поля не совпадали. Первый раз такое вижу. Достаточно ли будет для удвоения частоты кадров выставить mode=1?
Цитата:
tdeint(mode=1,edeint=QTGMC(preset="placebo", Lossless=2,SourceMatch=3,MatchPreset="placebo",MatchPreset2="placebo",MatchEdi="eedi3",EdiMode="EEDI3+NNEDI3", Edithreads=1), cthresh=4, MI=30, slow=2,mtnmode=1,emask=TMM2(mode=1,ttype=3))
|
|
Tempter57
Стаж: 16 лет 3 месяца Сообщений: 4963
|
Tempter57 ·
12-Сен-19 20:15
(спустя 1 час 26 мин., ред. 12-Сен-19 20:15)
торрент иваниваныч
Да, вполне достаточно. С mode=1 каждое поле интерполируется до полного кадра. Более того, если в каждом поле своя фаза движения, то четкость изображения должна улучшиться, поскольку поля с разной фазой движения не смешиваются. Но в anime можно и не заметить этого, а вот , если взять материал интерлейсного VHS камкодера, то это будет заметно явно именно на данном варианте деинтерлейса.
|
|
Koo1
Стаж: 15 лет 8 месяцев Сообщений: 1145
|
Koo1 ·
12-Сен-19 21:21
(спустя 1 час 5 мин., ред. 12-Сен-19 21:21)
торрент иваниваныч писал(а):
77958770QTGMC(preset="placebo", Lossless=2,SourceMatch=3,MatchPreset="placebo",MatchPreset2="placebo",MatchEdi="eedi3",EdiMode="EEDI3+NNEDI3"
И есть смысл так маньячить? А MatchEnhance=1.0 где?
|
|
|