View Full Version : Preventing blocking from...filtering?
dbzgundam
28th January 2006, 05:37
Yeah... a recent problem I've been noticing, particularly with grainy material, is that filtering it actually creates (or reveals preexisting?) blocking which can clearly be seen even in lossless encodes. I can best describe this as a destruction of gradients... Color banding might be another way of putting it, but if you're smoothing video, shouldn't you not be killing such things?
Source:
http://x4.putfile.com/1/2622335340.png
After cleaning:
http://x4.putfile.com/1/2622365634.png
Script:
Import("D:\Encoding Tools\MISCAVS\FastLineDarken_1.3.avs")
Import("D:\Encoding Tools\MISCAVS\DeHaloalpha.avs")
Import("D:\Encoding Tools\MISCAVS\SeeSaw.avs")
MPEG2Source("D:\GUNDAM_0083_VOL_3\VIDEO_TS\0083op2.d2v",cpu=3)
LoadPlugin("C:\Program Files\AVISynth 2.5\Plugins\warpsharp.dll")
TFM(1,pp=1)
Crop(4,0,716,480).Lanczos4Resize(704,480)
Decimate()
Tweak(sat=1.1,cont=1.05)
FFT3DFilter(sigma=2.5,bt=3,bh=32,bw=32,oh=16,ow=16)
hqdn3d(ls=2,lt=1,cs=2,ct=1.5)
undot().undot()
mergeluma(FastLineDarken(Strength=80,threshold=4,thinning=0))
Lanczos4Resize(704*2,480*2)
mergechroma(awarpsharp(depth=10,blurlevel=1))
Xsharpen(50,50).awarpsharp(Depth=25,blurlevel=2)
Lanczos4Resize(704,480)
dehalo_alpha(brightstr=1,darkstr=.1,highsens=80)
asharp(.7)
Obviously, the filtered version LOOKS cleaner, but if you look, there is actually banding the top middle area of Kou's helmet, and some in Nina's hair... What makes this a million times more irritating is that the banding takes place differently in different frames, so once in motion the effect is VERY noticeable! (Almost like crawling blocks :o) If I can find space to upload it to, I shall put a small video of this to demonstrate the effect (lossless). Any reason why this happens, or filters to avoid doing this?... I've also tried each one the smoothing filters in that list on their own to figure out which one is responsible... It seems unavoidable, even with just one filter.
Mug Funky
28th January 2006, 06:22
hehe... it gets more noticable when the luminance very slowly oscillates. then the bands move in and out and in and out.
i think maybe adding dither to denoisers would help here (8 bits isn't much after all), but that would of course hurt compression a small amount.
you can compromise by merging the non-denoised image back in at a small percentage.
when avs 3.0 comes along with increased bit-depth (and filters begin to support it), you'll be able to say goodbye to the banding to some degree. but any block-based smoother runs the risk of banding simply because gradients can be so slight they're filtered out. overlapping helps, but again it's a precision thing.
COREiP
28th January 2006, 06:23
Upload your sample on http://rapidshare.de/
foxyshadis
28th January 2006, 06:50
I bet all those sharpen steps are making it worse and cause some of the temporal instability too. Try adding another temporal or spacio-temporal (3d) filter after all the sharpening, something like degrainmedian or ttempsmooth. And perhaps consider a strong oversampled limitedsharpen to replace warpsharp, xsharpen, and lanczosresize all in one step, as well as obviating the need for dehalo_alpha.
dbzgundam
28th January 2006, 16:53
Dehalo alpha is needed to begin with unfortunately... Many of you probably don't see any edge enhancement in the source image, but there is. The original video was obviously softened by the authoring company (I can tell because earlier discs are much sharper, but had a different company), and was given a very faint on the edges... But the halo is not exactly on the edge. It's literally a few pixels away, I'm sure we've all seen this sometime before. When in motion it almost looks like these little inner glows (for Photoshop users) are on all the edges. Oo
EDIT: A decent solution found. I took the suggestion of dithering (through blockbuster's "noise" method), and then exploited x264's smoothing effect to get rid of the noise... The banding is much less apparent now.
Mug Funky
29th January 2006, 15:12
looking at the blur on the first image, it might have come from "field-swap by bobbing", which is something i believe after effects does (and possibly other stuff) because i've seen it a few times before. if a sharp interpolator is used for the bobbing, the halos could work on twice the vertical distance, giving the effect you see.
of course it could be something else - i've seen similar sharpening artefacts on some studio ghibli movies (which are otherwise really good transfers), and they most definitely haven't been field-swapped in such a slipshod way.
Chainmax
29th January 2006, 19:39
Sounds like too much filtering to me: you use too many resizings and sharpening steps in my opinion. This is a filterchain that is doing wonders on a DVD I'm making:
FFT3DFilter(sigma=1,bw=32,bh=32,bt=3,ow=16,oh=16,sharpen=0.7)
Crop(2,0,796,432,align=true)
Lanczos4Resize(688,336)
aWarpSharp(depth=16,cm=1)
LimitedSharpen()
TextSub("X:\wherever\asubtitle.srt")
AddBorders(16,72,16,72)
ColorYUV(levels="PC->TV")
I use the LimitedSharpen version on the 1st page of its thread. This is a wee bit oversharpened, but since you are using DeHalo_Alpha it should counter that.
RevGen recommended me the following IVTC method (it uses TDeint.dll, TIVTC.dll and EEDI2.dll):
AssumeTFF()
interp = separatefields().selecteven().EEDI2(field=1)
deinted=tdeint(order=1,field=1,edeint=interp)
TFM(mode=1,order=1,clip2=deinted)
TDecimate(mode=1)
For BFF clips:
interp = separatefields().selecteven().EEDI2(field=0)
deinted = tdeint(edeint=interp,order=0,field=0)
tfm(clip2 = deinted,order=0)
TDecimate(mode=1)
Also, instead of using Undot, you should use RemoveGrain(mode=1) because it is identical to it processes border pixels which Undot doesn't. Plus, instead of chaining two RemoveGrain(mode=1) calls, you can use a single RemoveGrain(mode=5) call.
ARDA
29th January 2006, 20:33
undot().undot()
Plus, instead of chaining two RemoveGrain(mode=1) calls, you can use
a single RemoveGrain(mode=5) call.
Besides that two consecutive undot or removegrian(mode=1) are useless second call will do nothing.
Regards ARDA
Chainmax
29th January 2006, 23:21
You might also want to consider using DeBlock_QED() instead of the cpu=3 switch on mpeg2source.
FredThompson
30th January 2006, 03:34
You've caught filteritis!
The best solution is to spray your screen with a light coat of Krylon clear matte spray paint. It's guaranteed to reduce visible banding effects to the point the human eye will not perceive them.
Don't laugh, it works every time!
Revgen
30th January 2006, 04:08
@dbzgundam
Sometimes when I try to clean a video, I get so caught up in trying to make it look perfect instead of just realizing how much better the video looks compared to the original source.
There is absolutely no way to create a "perfect" video. Sometimes you need to appreciate the positives instead of the negatives.
Soulhunter
30th January 2006, 05:05
@ filter devs
Something that adds dithering (noise) only into areas where banding occurs would be useful! Not only for pre-processing (like in dbzgundams case) but also for post-processing (could be implemented into ffdshow).
Tia n' Bye
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.