Last active
June 25, 2020 04:51
Star
You must be signed in to star a gist
This Avisynth function deemphasizes ringing common to SD video signals resulting from a playback device in the transfer chain poorly compensating for pre-emphasis baked into the source signal.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Deemphasize(clip c, int "strength", bool "interlaced", bool "tff") | |
{ | |
strength = default(strength, 95) | |
strength = strength < 0 ? -strength : strength | |
strength = strength >= 100 ? 0 : 100-strength | |
tff = default(tff, false) | |
interlaced = default(interlaced, false) | |
c = interlaced ? (tff ? c.AssumeTFF().SeparateFields() : c.AssumeBFF().SeparateFields()) : c | |
mask = c.mt_edge("1 0 -1 2 0 -2 1 0 -1", 0, 255, 0, 255) | |
mask = mask.mt_inpand(mode="vertical")\ | |
.mt_inpand(mode="vertical")\ | |
.mt_inpand(mode="vertical")\ | |
.mt_expand(mode="vertical")\ | |
.mt_expand(mode="vertical")\ | |
.mt_expand(mode="vertical") | |
blurred = c.GaussResize(c.width-2, c.height, p=strength).Spline64Resize(c.width, c.height) | |
output = mt_merge(blurred, c, mask) | |
return interlaced ? output.Weave() : output | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment