def FinesharpSs(clip, ssf=1.5, sstr=1.05): mWidth = clip.width mHeight = clip.height clip = haf.Resize(clip, int(mWidth*ssf), int(mHeight*ssf), kernel='spline64', noring=True) clip = fs.sharpen(clip, sstr=sstr) clip = haf.Resize(clip, mWidth, mHeight, kernel='spline64', noring=True) return clip
def FinesharpSs(clip, ssf=1.5, sstr=1.05): mWidth = clip.width mHeight = clip.height clip = haf.Resize(clip, int(mWidth * ssf), int(mHeight * ssf), kernel='spline64', noring=True) clip = fs.sharpen(clip, sstr=sstr) clip = haf.Resize(clip, mWidth, mHeight, kernel='spline64', noring=True) return clip
def PostProcessing(clip, dispWidth, dispHeight, deblock, deband, nnedi3, supersampling, ssf, sharpen, sstr, gpu_scaling, smooth): mWidth = clip.width mHeight = clip.height scaling = False if mWidth > dispWidth or mHeight > dispWidth: scaling = "DOWN" elif mWidth < dispWidth and mHeight < dispWidth: scaling = "UP" ratio = (mWidth / mHeight) newHeight = round((dispWidth / ratio) / 8) * 8 if newHeight > dispHeight: newHeight = dispHeight newWidth = round((newHeight * ratio) / 8) * 8 else: newWidth = dispWidth if deblock: if (mWidth % 8 == 0) and (mHeight % 8 == 0): clip = core.deblock.Deblock(clip) if scaling == "UP": if nnedi3: if supersampling: clip = core.nnedi3.nnedi3_rpow2(clip, 2) if sharpen == "finesharp": clip = fs.sharpen(clip, sstr=sstr) elif sharpen == "lsfmod": ssf = 1.0 clip = haf.LSFmod(clip, defaults="slow", ss_x=ssf, ss_y=ssf, strength=sstr, noring=True) if supersampling: clip = haf.Resize(clip, mWidth, mHeight, kernel='spline64', noring=True) if not supersampling: clip = core.nnedi3.nnedi3_rpow2(clip, 2) else: if sharpen == "finesharp": if supersampling: clip = FinesharpSs(clip, ssf=ssf, sstr=sstr) else: clip = fs.sharpen(clip, sstr=sstr) elif sharpen == "lsfmod": if not supersampling: ssf = 1.0 clip = haf.LSFmod(clip, defaults="slow", ss_x=ssf, ss_y=ssf, strength=sstr, noring=True) if not gpu_scaling: clip = haf.Resize(clip, newWidth, newHeight, kernel='spline64', noring=True) if deband: clip = core.f3kdb.Deband(clip, grainy=0, grainc=0, output_depth=8) elif scaling == "DOWN": if sharpen == "finesharp": clip = fs.sharpen(clip, sstr=sstr) elif sharpen == "lsfmod": ssf = 1.0 clip = haf.LSFmod(clip, defaults="slow", ss_x=ssf, ss_y=ssf, strength=sstr) if not gpu_scaling: clip = haf.Resize(clip, newWidth, newHeight, kernel='spline64', noring=True) if deband: clip = core.f3kdb.Deband(clip, grainy=0, grainc=0, output_depth=8) else: if sharpen == "finesharp": if supersampling: clip = FinesharpSs(clip, ssf=ssf, sstr=sstr) else: clip = fs.sharpen(clip, sstr=sstr) elif sharpen == "lsfmod": if not supersampling: ssf = 1.0 clip = haf.LSFmod(clip, defaults="slow", ss_x=ssf, ss_y=ssf, strength=sstr) if deband: clip = core.f3kdb.Deband(clip, grainy=0, grainc=0, output_depth=8) if smooth: clip = Interpolation(clip) return clip
def PostProcessing(clip, dispWidth, dispHeight, deblock, deband, nnedi3, supersampling, ssf, sharpen, sstr, gpu_scaling, smooth): mWidth = clip.width mHeight = clip.height scaling = False if mWidth > dispWidth or mHeight > dispWidth: scaling = "DOWN" elif mWidth < dispWidth and mHeight < dispWidth: scaling = "UP" ratio = (mWidth/mHeight) newHeight= round((dispWidth/ratio)/8)*8 if newHeight > dispHeight: newHeight=dispHeight newWidth=round((newHeight*ratio)/8)*8 else: newWidth=dispWidth if deblock: if (mWidth % 8 == 0) and (mHeight % 8 == 0): clip = core.deblock.Deblock(clip) if scaling == "UP": if nnedi3: if supersampling: clip = core.nnedi3.nnedi3_rpow2(clip, 2) if sharpen == "finesharp": clip = fs.sharpen(clip, sstr=sstr) elif sharpen == "lsfmod": ssf=1.0 clip = haf.LSFmod(clip, defaults="slow", ss_x=ssf, ss_y=ssf, strength=sstr, noring=True) if supersampling: clip = haf.Resize(clip, mWidth, mHeight, kernel='spline64', noring=True) if not supersampling: clip = core.nnedi3.nnedi3_rpow2(clip, 2) else: if sharpen == "finesharp": if supersampling: clip = FinesharpSs(clip, ssf=ssf, sstr=sstr) else: clip = fs.sharpen(clip, sstr=sstr) elif sharpen == "lsfmod": if not supersampling: ssf=1.0 clip = haf.LSFmod(clip, defaults="slow", ss_x=ssf, ss_y=ssf, strength=sstr, noring=True) if not gpu_scaling: clip = haf.Resize(clip, newWidth, newHeight, kernel='spline64', noring=True) if deband: clip = core.f3kdb.Deband(clip, grainy=0, grainc=0, output_depth=8) elif scaling == "DOWN": if sharpen == "finesharp": clip = fs.sharpen(clip, sstr=sstr) elif sharpen == "lsfmod": ssf=1.0 clip = haf.LSFmod(clip, defaults="slow", ss_x=ssf, ss_y=ssf, strength=sstr) if not gpu_scaling: clip = haf.Resize(clip, newWidth, newHeight, kernel='spline64', noring=True) if deband: clip = core.f3kdb.Deband(clip, grainy=0, grainc=0, output_depth=8) else: if sharpen == "finesharp": if supersampling: clip = FinesharpSs(clip, ssf=ssf, sstr=sstr) else: clip = fs.sharpen(clip, sstr=sstr) elif sharpen == "lsfmod": if not supersampling: ssf=1.0 clip = haf.LSFmod(clip, defaults="slow", ss_x=ssf, ss_y=ssf, strength=sstr) if deband: clip = core.f3kdb.Deband(clip, grainy=0, grainc=0, output_depth=8) if smooth: clip = Interpolation(clip) return clip