我基本没看过日本动漫 (只看过叮当猫) 所以不知道你在说什么情况
不过目测在描述类似多数rgb图像里面蓝通道噪声多 有块状斑纹的情况 只不过你现在是所有通道都像蓝通道有这个问题 处理块状斑纹 我是用小sigma npass dfttest解决的 sigma足够小 对细节的损失就很小 然后多次使用 逐渐削弱最终完全清除噪声 比如我清理蓝通道会用dfttest的sigma=0.25,sigma2=0.25 64次 蓝通道的噪声以及块状斑纹就都没了 同时细节损失也比较小
代码: 全选
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\MP_Pipeline-0.18\x86\MP_Pipeline.dll")
LWLibavVideoSource("H:\00\[aozaki_aoko;aozaki.aoko@TSDM@1234567]GUNDAM00_03\GUNDAM00_03\BDMV\STREAM\00002.m2ts", threads=1)
#aa
maa2()
#pp
last.U16
#pre-filter
nr16 = Dither_removegrain_emul(11, 11).Dither_removegrain_emul(20, 0)
#get noise diff clip
noise = Dither_sub16(last, nr16, Y=3, U=3, V=3, dif=True)
prewitt = nr16.DitherPost(mode=-1, U=1, V=1).mt_edge("prewitt", 6, 6, 0, 0, V=1, U=1)
dbmask = mt_hysteresis(prewitt.RemoveGrain(4, -1).RemoveGrain(4, -1), prewitt, U=1, V=1).RemoveGrain(11, -1).RemoveGrain(20, -1)
#de-banding on pre-filtered clip
db = nr16.f3kdb(16, 40, 40, 40, 0, 0, input_mode=1, output_mode=1).Dither_limit_dif16(last, ref=nr16, thr=0.30, elast=2.5, y=3, u=3, v=3)
#add back noise
#dba = db.Dither_add_grain16(last,noise,Y=3, U=3, V=3, dif=True)
#stacked-16bit output
Dither_merge16_8(db, nr16, dbmask, luma=true, Y=3, U=3, V=3)
Down10(stack=false, dither=-2)
代码: 全选
MP_Pipeline("""
setMemoryMax(300)
a="F:\llx\BLACK_REBELLION\BDMV\STREAM\00002.m2ts"
#FFIndex(a,demuxer="lavf")
#FFVideoSource(a,threads=1,seekmode=-1)
LWLibavVideoSource(a,threads=1)
src8=last
### prefetch: 64,48
### export clip:src8
### ###
setMemoryMax(3000)
Y = 3
UV = 3
Yt = Y == 3
UVt = UV == 3
Y32 = Yt ? 3 : 2
UV32 = UVt ? 3 : 2
Y11 = (Y==3) ? 11 : 0
Y20 = (Y==3) ? 20 : 0
UV11 = (UV==3) ? 11 : 0
UV20 = (UV==3) ? 20 : 0
src16 = src8.U16()
maskY = src8.tcannyMod(sigma=0.85,mode=1)
maskU = src8.UtoY().tcannyMod(sigma=0.75,mode=1).BilinearResize(1920,1080,src_left=0.25)
maskV = src8.VtoY().tcannyMod(sigma=0.75,mode=1).BilinearResize(1920,1080,src_left=0.25)
mask = mt_logic(maskY,mt_logic(maskU,maskV,"max"),"max")
nr16 = src16.GSMC_SBR(lsb_in=true,lsb=true,r=3,Y=Y32,U=UV32,V=UV32)
pre_nr = nr16.ditherpost(mode=-1)
dif_nr = mt_makediff(src8, pre_nr, Y=3, U=3, V=3)
### prefetch: 36,28
### export clip:pre_nr,dif_nr,src16,mask,nr16
### pass clip:src8
### ###
setMemoryMax(3000)
Preset = "Faster"
pnum = preset == "Very Fast" ? 0
\ : preset == "Faster" ? 1
\ : preset == "Fast" ? 2
\ : preset == "Medium" ? 3
\ : preset == "Slow" ? 4
\ : preset == "Slower" ? 5
\ : preset == "Very Slow" ? 6
\ : 7
radius = 3
HD = True
Y = 3
UV = 3
Yt = Y == 3
UVt = UV == 3
bs = HD ? 16 : 8
bs2 = HD ? 32 : 16
blksize = Select(pnum, bs2, bs2, bs2, bs, bs, bs, bs )
ol = blksize/2
ol2 = blksize/4
overlap = Select(pnum, ol2, ol2, ol2, ol, ol, ol, ol )
thSAD = 400
thSADC = 200
thSCD1 = 400
thSCD2 = 150
truemotion = False
pel = Select(pnum, 1, 1, HD?1:2,HD?1:2,2, 2, 2 )
pelsearch = Select(pnum, 1, 2, 2, 2, 2, 2, 2 )
search = Select(pnum, 2, 4, HD?5:2,HD?3:4,4, 5, 3 )
searchparam = Select(pnum, 1, 2, 2, 2, 2, 2, 2 )
plane = !Yt ? 3: !UVt ? 0 : 4
psuper = pre_nr.MSuper(pel=pel, levels=0, sharp=2, chroma=UVt)
difsuper = dif_nr.MSuper(pel=pel, levels=1, sharp=2, chroma=UVt)
fv3 = radius>=3 ? psuper.MAnalyse(isb=False, delta=3, truemotion=truemotion, blksize=blksize, overlap=overlap, pelsearch=pelsearch, search=search, searchparam=searchparam, chroma=UVt) : NOP()
fv2 = radius>=2 ? psuper.MAnalyse(isb=False, delta=2, truemotion=truemotion, blksize=blksize, overlap=overlap, pelsearch=pelsearch, search=search, searchparam=searchparam, chroma=UVt) : NOP()
fv1 = radius>=1 ? psuper.MAnalyse(isb=False, delta=1, truemotion=truemotion, blksize=blksize, overlap=overlap, pelsearch=pelsearch, search=search, searchparam=searchparam, chroma=UVt) : NOP()
bv1 = radius>=1 ? psuper.MAnalyse(isb=True, delta=1, truemotion=truemotion, blksize=blksize, overlap=overlap, pelsearch=pelsearch, search=search, searchparam=searchparam, chroma=UVt) : NOP()
bv2 = radius>=2 ? psuper.MAnalyse(isb=True, delta=2, truemotion=truemotion, blksize=blksize, overlap=overlap, pelsearch=pelsearch, search=search, searchparam=searchparam, chroma=UVt) : NOP()
bv3 = radius>=3 ? psuper.MAnalyse(isb=True, delta=3, truemotion=truemotion, blksize=blksize, overlap=overlap, pelsearch=pelsearch, search=search, searchparam=searchparam, chroma=UVt) : NOP()
dif_sb = radius==1 ? dif_nr.MDegrain1(difsuper, bv1, fv1 , thSAD=thSAD, thSADC=thSADC, thSCD1=thSCD1, thSCD2=thSCD2, plane=plane, lsb=true)
\ : radius==2 ? dif_nr.MDegrain2(difsuper, bv1, fv1, bv2, fv2 , thSAD=thSAD, thSADC=thSADC, thSCD1=thSCD1, thSCD2=thSCD2, plane=plane, lsb=true)
\ : dif_nr.MDegrain3(difsuper, bv1, fv1, bv2, fv2, bv3, fv3, thSAD=thSAD, thSADC=thSADC, thSCD1=thSCD1, thSCD2=thSCD2, plane=plane, lsb=true)
dif_sb = dif_sb.dither_repair16(dif_nr.U16(),13)
### prefetch: 26,18
### export clip:dif_sb
### pass clip:src8,src16,mask,nr16
### ###
setMemoryMax(3000)
nr16
f3kdb( 12, 52, 24, 24, 0, 0, input_mode=1, output_mode=1).Dither_limit_dif16(last, ref=nr16, thr=0.40, elast=2.0, y=3, u=3, v=3)
f3kdb( 24, 36, 16, 16, 0, 0, input_mode=1, output_mode=1).Dither_limit_dif16(last, ref=nr16, thr=0.35, elast=1.5, y=3, u=3, v=3)
dbed = Dither_add16(last, dif_sb, Y=3, U=3, V=3, dif=True)
Lmask=src8.mt_lut("x 36 <= 170 255 ?",u=1,v=1)
nonedge=dither_merge16_8(src16,dbed,Lmask,luma=true)
### export clip:nonedge
### pass clip:src8,src16,mask
### prefetch: 16,8
### ###
setMemoryMax(3000)
sharp = src8.mt_adddiff(mt_makediff(src8, src8.RemoveGrain(20).RemoveGrain(20), U=3, V=3), U=3,V=3)
eemask = mask.mt_expand(u=1,v=1).mt_expand(u=1,v=1).removeGrain(20,-1).mt_inpand(u=1,v=1).mt_inpand(u=1,v=1).mt_lut(" 0.2 x x x * * *",u=1,v=1).removeGrain(20,-1)
edge16 = mt_merge(sharp, src8, eemask, luma=true).removeGrain(2).U16()
dbmask=mask.mt_lut("x 1 <= x 3 >> x 10 << ?",u=1,v=1).removeGrain(20,-1).mt_expand(u=1,v=1).removeGrain(20,-1).mt_inpand(u=1,v=1).removeGrain(20,-1).mt_inpand(u=1,v=1).mt_inpand(u=1,v=1).removeGrain(20,-1).mt_lut(" x 1 << ",u=1,v=1)
dither_merge16_8(nonedge,edge16,dbmask,luma=true)
down10(stack=false)
""")
是Dither_add16不是Dither_add,removegrain的11、20等mode本来就是blur模式,用了之后又不把diff加回去当然会变模糊。lwjkk666 写了:啃了一下午多拉大神的masktool教程,还有扒了一下dither文档,写了这么一个AVS,成功pass,不过也出现了不少问题,画面的那些难看的banding确实去除了不少,deband效果甚至好于上一个dfftest,关键是速度也完爆了dfftest,问题来了
1.画面变糊了,而且是很糊的那种,而且画面底部出现了不知什么原因引起的绿边。
2.Dither_add(noise,Y=3, U=3, V=3, dif=True)mawen大给的这个语句我添加上去之后会报错:unexpected character “ ”
上图对比,处理之后的,源的banding比这更明显的说
所以请教大神下面的脚步该如何修改才能是正确的姿势。代码: 全选
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\MP_Pipeline-0.18\x86\MP_Pipeline.dll") LWLibavVideoSource("H:\00\[aozaki_aoko;aozaki.aoko@TSDM@1234567]GUNDAM00_03\GUNDAM00_03\BDMV\STREAM\00002.m2ts", threads=1) #aa maa2() #pp last.U16 #pre-filter nr16 = Dither_removegrain_emul(11, 11).Dither_removegrain_emul(20, 0) #get noise diff clip noise = Dither_sub16(last, nr16, Y=3, U=3, V=3, dif=True) prewitt = nr16.DitherPost(mode=-1, U=1, V=1).mt_edge("prewitt", 6, 6, 0, 0, V=1, U=1) dbmask = mt_hysteresis(prewitt.RemoveGrain(4, -1).RemoveGrain(4, -1), prewitt, U=1, V=1).RemoveGrain(11, -1).RemoveGrain(20, -1) #de-banding on pre-filtered clip db = nr16.f3kdb(16, 40, 40, 40, 0, 0, input_mode=1, output_mode=1).Dither_limit_dif16(last, ref=nr16, thr=0.30, elast=2.5, y=3, u=3, v=3) #add back noise #dba = db.Dither_add_grain16(last,noise,Y=3, U=3, V=3, dif=True) #stacked-16bit output Dither_merge16_8(db, nr16, dbmask, luma=true, Y=3, U=3, V=3) Down10(stack=false, dither=-2)
我去掉的原因是因为加了dither_add16会报错,默认用Dither_removegrain的话报no funcion,fch大大那个也有dither_add16,但是又没有报错,feisty2 写了:你把高频分离以后没有加成回来 当然变模糊了
dither_add16就是把高频加回来的 你把这个写掉了
mawen的脚本有个typo 一个comma打成了全角 正确应该是半角 所以出现了你的问题 你自己改一下就好了
感谢回复,待会试试效果先mawen1250 写了:最简单的,对噪点diff用SMDegrain轰一遍,注意用prefilter指定nr后的clip用于me(否则,直接对噪点diff做me得到的motion vector没什么意义),像这样
noise = noise.SMDegrain(prefilter=nr16.DitherPost(mode=-1), lsb_in=True, lsb=True, lsb_out=True)
这样处理的方式其实基本就和GSMC的原理相同了。