View Full Version : Dealing with compression-killing interlaced luma variations
DrScotsman
17th June 2006, 17:52
So I have the R2 Family Guy Season 3 DVDs. Unlike the first two Seasons, the quality of this is astounding. Not a single blend anywhere, PAL speedup with pitch correction, etc.
However, while the episodes are progressive, they're encoded interlaced. I'm aware that usually this means nothing and it should just be treated as progressive. However when I view it with Histogram(mode="luma"), you can see that there are differences between fields (there's no problem with the chroma for the record). Putting a Bob() afterwards proves this; Bob.SelectEven and Bob.SelectOdd look fine (well, better), but Bob doesn't.
M2V sample (http://nuticulus.net/drscotsman/trash/familyguysample.m2v), 20MB
And a sample histogrammed image:
http://img.photobucket.com/albums/v34/Cyberdude93/f0788685.png
I've tried an x264 encode, and this issue seems to kill compression. In addition, I'd like to resize it to 720x540 (to make it square pixel), and a vertical resize is never good for interlacing.
So, are there any filters that can solve this?
Thanks in advance.
foxyshadis
17th June 2006, 19:15
Try using a denoiser. frfun7+degrainmedian warms my heart for mild or moderate noise, and a slight sharpening (limitedsharpen or seesaw) to remove the softness it'll cause. If the combing is normally too faint to notice, that'll completely get rid of it, and if not, at least mitigate it.
Or you actually could try resizing, because the variations should be small enough that resizing will mix them back together in an eye-pleasing instead of disruptive way. (Since they're supposed to be together anyway, unlike combing.) But you probably can't resize down far enough to make a noticeable difference, and it'd be best to keep the original DVD resolution.
Didée
17th June 2006, 19:28
Try the following - it's not the definite solution, but it improves very much on the problem, while impact on actual detail is very little.
BTW, basically this is just good old "Blur(1.0).Sharpen(1.0)" ... but done correctly. ;)
Edit 26 Oct '06: Function updated (hopefully all inconsistencies eliminated).
# Vinverse: a small, but effective Function against (residual) combing, by Didée
# sstr: strength of contra sharpening
# amnt: change no pixel by more than this (default=255: unrestricted)
# uv : chroma mode, as in MaskTools: 1=trash chroma, 2=pass chroma through, 3=process chroma
function Vinverse(clip clp, float "sstr", int "amnt", int "uv")
{
uv = default(uv,3)
sstr = default(sstr,2.7)
amnt = default(amnt,255)
uv2 = (uv==2) ? 1 : uv
STR = string(sstr)
AMN = string(amnt)
vblur = clp.mt_Convolution("1","50 99 50",U=uv,V=uv)
vblurD = mt_MakeDiff(clp,vblur,U=uv2,V=uv2)
Vshrp = mt_LutXY(vblur,vblur.mt_Convolution("1","1 4 6 4 1",U=uv2,V=uv2),expr="x x y - "+STR+" * +",U=uv2,V=uv2)
VshrpD = mt_MakeDiff(Vshrp,vblur,U=uv2,V=uv2)
VlimD = mt_LutXY(VshrpD,VblurD,expr="x 128 - y 128 - * 0 < x 128 - abs y 128 - abs < x y ? 128 - 0.25 * 128 + x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
mt_AddDiff(Vblur,VlimD,U=uv,V=uv)
(amnt>254) ? last : (amnt==0) ? clp : mt_LutXY(clp,last,expr="x "+AMN+" + y < x "+AMN+" + x "+AMN+" - y > x "+AMN+" - y ? ?",U=uv,V=uv)
return(last)
}
Should deal well with most forms of residual combing.
Fizick
17th June 2006, 21:10
I remember my first plugin Equlines :)
Katie Boundary
5th July 2022, 02:45
# Vinverse: a small, but effective Function against (residual) combing, by Didée
# sstr: strength of contra sharpening
# amnt: change no pixel by more than this (default=255: unrestricted)
# uv : chroma mode, as in MaskTools: 1=trash chroma, 2=pass chroma through, 3=process chroma
function Vinverse(clip clp, float "sstr", int "amnt", int "uv")
{
uv = default(uv,3)
sstr = default(sstr,2.7)
amnt = default(amnt,255)
uv2 = (uv==2) ? 1 : uv
STR = string(sstr)
AMN = string(amnt)
vblur = clp.mt_Convolution("1","50 99 50",U=uv,V=uv)
vblurD = mt_MakeDiff(clp,vblur,U=uv2,V=uv2)
Vshrp = mt_LutXY(vblur,vblur.mt_Convolution("1","1 4 6 4 1",U=uv2,V=uv2),expr="x x y - "+STR+" * +",U=uv2,V=uv2)
VshrpD = mt_MakeDiff(Vshrp,vblur,U=uv2,V=uv2)
VlimD = mt_LutXY(VshrpD,VblurD,expr="x 128 - y 128 - * 0 < x 128 - abs y 128 - abs < x y ? 128 - 0.25 * 128 + x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
mt_AddDiff(Vblur,VlimD,U=uv,V=uv)
(amnt>254) ? last : (amnt==0) ? clp : mt_LutXY(clp,last,expr="x "+AMN+" + y < x "+AMN+" + x "+AMN+" - y > x "+AMN+" - y ? ?",U=uv,V=uv)
return(last)
}
I cannot make heads or tails of just what all that crap is supposed to do or how it works. If I hadn't seen it on Doom9, I wouldn't have even recognized it as AVIsynth language.
johnmeyer
5th July 2022, 05:15
Didée's scripts were always at a different level. I could not figure out most of them, but they often worked brilliantly. I miss his contributions.
FranceBB
5th July 2022, 11:44
Katie, this is Didée we're talking about. He made the history of Doom9 and rest assured his filters still work to this very day.
I miss his contributions.
Me too. :(
We've had some of the very best developers here on Doom9.
It's a shame that some of them retired, but I guess it's just the way it works. One of my colleagues also retired and he was like: "please, I'll never stop posting on Doom9 or use Avisynth"... until he did, 1 and a half years later to spend his days catching carps in the river.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.