MonoS
15th December 2014, 19:32
I ported MaskDetail by Chibi_Goku to vapoursynth.
https://github.com/MonoS/VS-MaskDetail
The original code can be found here http://recensubshq.forumfree.it/?t=64839203
It was just a function hacked together to use invks/debilinear in openings/endings/anime with 1080 text.
It just does inverse kernel downscale and re-upscale with the same kernel, ideally there should be no differences, if there are it's pretty likely that there was parts with different resolutions.
So, the idea is to calculate does differences, create a "smart" mask, and use it to merge a sharp invks resize (for the upscaled part) with a normal downscale (for the text/credits), keeping the best of both works.
This is useful for upscaled material that you want to downscale to the original resolution using the kernel inversion method, but there are detail at higher resolution in the frame.
Usage
src = core.lsmas.LWLibavSource("")
mask = MonoS.MaskDetail(src, 1280,720)
noalias = core.fmtc.resample(src, 1280,720,kernel="blackmanminlobe", taps=5)
Y = core.fmtc.resample(src, 1280,720,kernel="bilinear", invks=True, invkstaps=4, taps=4, planes=[3,1,1])
masked = core.std.MaskedMerge(Y, noalias, mask)
final = core.std.Splice([ core.std.Trim(Y,0,1000), core.std.trim(masked, 1001,2000),.....])
final.set_output()
I'll try to make a proper readme if someone will be interested [because this function is very specific]
https://github.com/MonoS/VS-MaskDetail
The original code can be found here http://recensubshq.forumfree.it/?t=64839203
It was just a function hacked together to use invks/debilinear in openings/endings/anime with 1080 text.
It just does inverse kernel downscale and re-upscale with the same kernel, ideally there should be no differences, if there are it's pretty likely that there was parts with different resolutions.
So, the idea is to calculate does differences, create a "smart" mask, and use it to merge a sharp invks resize (for the upscaled part) with a normal downscale (for the text/credits), keeping the best of both works.
This is useful for upscaled material that you want to downscale to the original resolution using the kernel inversion method, but there are detail at higher resolution in the frame.
Usage
src = core.lsmas.LWLibavSource("")
mask = MonoS.MaskDetail(src, 1280,720)
noalias = core.fmtc.resample(src, 1280,720,kernel="blackmanminlobe", taps=5)
Y = core.fmtc.resample(src, 1280,720,kernel="bilinear", invks=True, invkstaps=4, taps=4, planes=[3,1,1])
masked = core.std.MaskedMerge(Y, noalias, mask)
final = core.std.Splice([ core.std.Trim(Y,0,1000), core.std.trim(masked, 1001,2000),.....])
final.set_output()
I'll try to make a proper readme if someone will be interested [because this function is very specific]