Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Repair16(clip input, clip source, int "mode", int "modeU", int "modeV", float "weight", float "thr"){
- mode = Default(mode, 1 )
- modeU = Default(modeU, mode )
- modeV = Default(modeV, modeU)
- weight = Default(weight, 1.0 )
- thr = Default(thr, 0.0 )
- weight = min(max(weight, 0.0), 1.0)
- thr = max(thr, 0.0)
- Y = mode >= 1 ? 3 : 1
- U = modeU >= 1 ? 3 : 1
- V = modeV >= 1 ? 3 : 1
- fix16 = input.Dither_repair16(source, mode, modeU, modeV)
- weightM = input.Dither_lut16(Y=Y==1?1:Round(-65535*weight), U=U==1?1:Round(-65535*weight), V=V==1?1:Round(-65535*weight))
- fix16 = thr == 0.0 ? fix16 : input.Dither_limit_dif16(fix16, thr=thr, Y=Y, U=U, V=V)
- final = weight == 0.0 ? input
- \ : weight == 1.0 ? mt_lutxy(fix16, input, Y=mode==0?4:mode>=1?2:1, U=modeU==0?4:modeU>=1?2:1, V=modeV==0?4:modeV>=1?2:1)
- \ : Dither_merge16(input, fix16, weightM, luma=false, Y=mode==0?2:Y, U=modeU==0?2:U, V=modeV==0?2:V)
- return final
- }
- Function Repair16_8(clip input, clip source, int "mode", int "modeU", int "modeV", float "weight", float "thr", bool "lsb_in"){
- mode = Default(mode, 1 )
- modeU = Default(modeU, mode )
- modeV = Default(modeV, modeU)
- weight = Default(weight, 1.0 )
- thr = Default(thr, 0.5 )
- lsb_in = Default(lsb_in, false)
- weight = min(max(weight, 0.0), 1.0)
- thr = max(thr, 0.0)
- Y = mode >= 1 ? 3 : 1
- U = modeU >= 1 ? 3 : 1
- V = modeV >= 1 ? 3 : 1
- input8 = lsb_in ? input .DitherPost(mode=-1, Y=Y, U=U, V=V) : input
- source8 = lsb_in ? source.DitherPost(mode=-1, Y=Y, U=U, V=V) : source
- input16 = lsb_in ? input : input .Dither_convert_8_to_16()
- fix8 = input8 .Repair(source8, mode, modeU, modeV)
- difM8 = lsb_in ? mt_lutxy(input8, fix8, "x y != " + String(255*weight) + " 0 ?", Y=Y, U=U, V=V)
- \ : mt_lut(input8, Y=Y==1?1:Round(-255*weight), U=U==1?1:Round(-255*weight), V=V==1?1:Round(-255*weight))
- fix16 = fix8 .Dither_convert_8_to_16()
- fix16 = input16.Dither_limit_dif16(fix16, thr=thr, Y=Y, U=U, V=V)
- final = weight == 0.0 ? input16
- \ : weight == 1.0 ? mt_lutxy(fix16, input16, Y=mode==0?4:mode>=1?2:1, U=modeU==0?4:modeU>=1?2:1, V=modeV==0?4:modeV>=1?2:1)
- \ : Dither_merge16_8(input16, fix16, difM8, luma=false, Y=mode==0?2:Y, U=modeU==0?2:U, V=modeV==0?2:V)
- return final
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement