版面规则
提问时请注意:尽量详细描述操作过程、AVS脚本内容等,最好能写出片名,只贴图有时无法看出问题原因。
提示:发布原创内容请尽量使用附件上传。使用网盘会出现过期失效的问题,请注意。
头像
Holy
核心会员
核心会员
帖子: 235
注册时间: 2010-09-24 9:28

MCAnyTempDenoiser v0.3 (8/13更新)

2011-01-20 22:01

代码: 全选

# Motion-Compensate Any Temporal (Spatial-Temporal) Denoiser # # v0.3 by Holy 2011-08-13 # # 本腳本未預設任何Denoiser,須由使用者自行代入欲借助動態補償的Temporal (Spatial-Temporal) Denoiser # # # 適用對象:覺得壓制速度還不夠慢的人(誤 # # 所需插件:MVTools2 # FFT3DGPU或FFT3DFilter # flash3kyuu_deband # # 範例:MCAnyTempDenoiser(denoiser="dfttest(tbsize=3, dither=2)") # # # v0.1: 初始發布 # v0.2: 新增search參數 # v0.3: 新增dct參數並改預設值為0 # 改用flash3kyuu_deband取代GradFun2db function MCAnyTempDenoiser(clip input, string "denoiser", int "radius", bool "interlaced", bool "GPU", int "ncpu", int "pel", int "search", int "dct", clip "p") { denoiser = Default(denoiser, "empty") # 欲使用的Temporal (Spatial-Temporal) Denoiser radius = Default(radius, 1) # 前後幀的半徑範圍 [1-5] # 例如:dfttest的tbsize=5,則radius=2 # FFT3DGPU的bt=3,則radius=1,暫不支援bt=2或bt=4這種前後幀不相等的模式 interlaced = Default(interlaced, false) # 輸入視訊是否為交錯 GPU = Default(GPU, true) # 使用FFT3DGPU或FFT3DFilter做pre-filtering,或者以參數p指定pre-filtered clip ncpu = Default(ncpu, 1) # FFT3DFilter使用的CPU執行緒數 pel = Default(pel, 2) # 動態估算的精確度 [1-2] # 1: a precision to the pixel (less accurate but faster) # 2: a precision to half a pixel (more accurate but slower) search = Default(search, 4) # 搜尋動態向量的方法,0和1不建議使用所以沒列出來 [2-5] # 2: Diamond search # 3: Exhaustive search # 4: Hexagon search # 5: Uneven Multi Hexagon (UMH) search dct = Default(dct, 0) # 想追求更高品質可以嘗試dct=5 [0-10] # using of block DCT (frequency spectrum) for blocks difference (SAD) calculation. In particular it can improve motion vector estimation at luma flicker and fades # 0: usual spatial blocks, do not use DCT # 1: use block DCT instead of spatial data (slow for block size 8x8 and very slow for other sizes) # 2: mixed spatial and DCT data; weight is dependent on mean frame luma difference # 3: adaptive per-block switching from spatial to equal-weighted mixed mode (experimental, a little faster) # 4: adaptive per-block switching from spatial to mixed mode with more weight of DCT (experimental, a little faster) # 5: SATD instead of SAD for luma # 6: same as 2 only use SATD # 7: same as 3 only use SATD # 8: same as 4 only use SATD # 9: similar to 2, use SATD and weight ranges from SAD only to equal SAD & SATD # 10: similar to 3/4,use SATD weight is on SAD, only on strong luma changes Assert(input.IsYV12(), "This is not an YV12 clip! Please convert color space to YV12 before using MCAnyTempDenoiser()") Assert(denoiser != "empty", "'denoiser' have not been set!") Assert(radius >= 1 && radius <= 5, "'radius' have not a correct value! [1-5]") Assert(ncpu >= 1, "'ncpu' have not a correct value! [>=1]") Assert(pel >= 1 && pel <= 2, "'pel' have not a correct value! [1-2]") Assert(search >= 2 && search <= 5, "'search' have not a correct value! [2-5]") Assert(dct >= 0 && dct <= 10, "'dct' have not a correct value! [0-10]") input = (interlaced) ? input.SeparateFields() : input blksize = (input.Width() > 1024) ? 16 : 8 overlap = blksize/2 p = Defined(p) ? p \ : (GPU) ? input.FFT3DGPU(sigma=3.2, sigma2=2.4, sigma3=1.6, sigma4=0.8, bw=blksize, bh=blksize, ow=overlap, oh=overlap, precision=2).flash3kyuu_deband(Cb=0, Cr=0, ditherY=0, ditherC=0, sample_mode=2) \ : input.FFT3DFilter(sigma=3.2, sigma2=2.4, sigma3=1.6, sigma4=0.8, bw=blksize, bh=blksize, ow=overlap, oh=overlap, ncpu=ncpu).flash3kyuu_deband(Cb=0, Cr=0, ditherY=0, ditherC=0, sample_mode=2) pSuper = p.MSuper(pel=pel) backward_vec5 = (radius == 5) ? MAnalyse(pSuper, blksize=blksize, search=search, isb=true, delta=5, truemotion=false, global=true, overlap=overlap, dct=dct) : NOP() backward_vec4 = (radius >= 4) ? MAnalyse(pSuper, blksize=blksize, search=search, isb=true, delta=4, truemotion=false, global=true, overlap=overlap, dct=dct) : NOP() backward_vec3 = (radius >= 3) ? MAnalyse(pSuper, blksize=blksize, search=search, isb=true, delta=3, truemotion=false, global=true, overlap=overlap, dct=dct) : NOP() backward_vec2 = (radius >= 2) ? MAnalyse(pSuper, blksize=blksize, search=search, isb=true, delta=2, truemotion=false, global=true, overlap=overlap, dct=dct) : NOP() backward_vec1 = MAnalyse(pSuper, blksize=blksize, search=search, isb=true, delta=1, truemotion=false, global=true, overlap=overlap, dct=dct) forward_vec1 = MAnalyse(pSuper, blksize=blksize, search=search, isb=false, delta=1, truemotion=false, global=true, overlap=overlap, dct=dct) forward_vec2 = (radius >= 2) ? MAnalyse(pSuper, blksize=blksize, search=search, isb=false, delta=2, truemotion=false, global=true, overlap=overlap, dct=dct) : NOP() forward_vec3 = (radius >= 3) ? MAnalyse(pSuper, blksize=blksize, search=search, isb=false, delta=3, truemotion=false, global=true, overlap=overlap, dct=dct) : NOP() forward_vec4 = (radius >= 4) ? MAnalyse(pSuper, blksize=blksize, search=search, isb=false, delta=4, truemotion=false, global=true, overlap=overlap, dct=dct) : NOP() forward_vec5 = (radius == 5) ? MAnalyse(pSuper, blksize=blksize, search=search, isb=false, delta=5, truemotion=false, global=true, overlap=overlap, dct=dct) : NOP() iSuper = input.MSuper(pel=pel, levels=1) backward_comp5 = (radius == 5) ? input.MCompensate(iSuper, backward_vec5, thSCD1=300, thSCD2=100) : NOP() backward_comp4 = (radius >= 4) ? input.MCompensate(iSuper, backward_vec4, thSCD1=300, thSCD2=100) : NOP() backward_comp3 = (radius >= 3) ? input.MCompensate(iSuper, backward_vec3, thSCD1=300, thSCD2=100) : NOP() backward_comp2 = (radius >= 2) ? input.MCompensate(iSuper, backward_vec2, thSCD1=300, thSCD2=100) : NOP() backward_comp1 = input.MCompensate(iSuper, backward_vec1, thSCD1=300, thSCD2=100) forward_comp1 = input.MCompensate(iSuper, forward_vec1, thSCD1=300, thSCD2=100) forward_comp2 = (radius >= 2) ? input.MCompensate(iSuper, forward_vec2, thSCD1=300, thSCD2=100) : NOP() forward_comp3 = (radius >= 3) ? input.MCompensate(iSuper, forward_vec3, thSCD1=300, thSCD2=100) : NOP() forward_comp4 = (radius >= 4) ? input.MCompensate(iSuper, forward_vec4, thSCD1=300, thSCD2=100) : NOP() forward_comp5 = (radius == 5) ? input.MCompensate(iSuper, forward_vec5, thSCD1=300, thSCD2=100) : NOP() interleaved = (radius == 5) ? Interleave(forward_comp5, forward_comp4, forward_comp3, forward_comp2, forward_comp1, input, backward_comp1, backward_comp2, backward_comp3, backward_comp4, backward_comp5) \ : (radius == 4) ? Interleave(forward_comp4, forward_comp3, forward_comp2, forward_comp1, input, backward_comp1, backward_comp2, backward_comp3, backward_comp4) \ : (radius == 3) ? Interleave(forward_comp3, forward_comp2, forward_comp1, input, backward_comp1, backward_comp2, backward_comp3) \ : (radius == 2) ? Interleave(forward_comp2, forward_comp1, input, backward_comp1, backward_comp2) \ : Interleave(forward_comp1, input, backward_comp1) output = Eval("interleaved." + denoiser) output = output.SelectEvery(radius*2+1, radius) return (interlaced) ? output.Weave() : output }
一時興起寫的玩意兒,寫這的原因是看到tritical以前做的dfttest、FFT3D加上動態補償效果測試
部分參考自MCTemporalDenoise
可能有用,也可能沒用(死

補充:
若提示MAnalyse找不到FFTW3.DLL,請至http://www.fftw.org/install/windows.html下載Precompiled Windows DLL,解壓縮後將libfftw3f-3.dll重新命名為fftw3.dll,32位元系統丟到C:\Windows\System32,64位元系統丟到C:\Windows\SysWOW64
附件
MCAnyTempDenoiser v0.3.7z
(2.78 KiB) 下载 287 次
图片

回到 “AviSynth”