View Full Version : Filter to remove macroblocks
kotrtim
11th March 2006, 14:25
There's too much macroblocks in the source, those 16x16 blocks is
very visible and I would like to remove it, are there
any filters in avisynth that i can use?
Besides that, after block removing, I would like to
use limitedsharpen to slightly spharpen the video, so
what coomand line you suggest?
thanks for helping
Chainmax
11th March 2006, 18:44
I'd recommend you to use DeBlock_QED_MT2() and if that doesn't remove all the blocking try this script:
DeBlock_QED_MT2(quant1=30,quant2=51)
Crop(whatever,align=true)
GaussResize(to about 150% size, use MOD16 dimensions)
LimitedSharpenFaster(SMode=4,LMode=3,Strength=1000,wide=true,soft=75)
EEDI2()
TurnRight().EEDI2().TurnLeft()
FFT3DGPU(sigma=1,bt=3,sharpen=0.7,precision=2)
Lanczos4Resize(final size)
AddGrain(x,0,0) <-- with x set in the 2-5 range
foxyshadis
11th March 2006, 22:19
I like that insane, brutal little script you cooked up. You must have some terrible stuff. You could use it a little more simply as a function like:
function BlockTerminator(clip c, int "ss", int "noise", int "dest_x", int "dest_y", int "cx", int "cy", int "cw", int "ch", bool "gpu") {
dest_x=default(dest_x,c.width) # final size
dest_y=default(dest_y,c.height)
ss=sqrt(default(ss,1.5)) # supersampling
noise=default(noise,2) # extra noise
cx=default(cx,0) # cropping params
cy=default(cy,0)
cw=default(cw,0)
ch=default(ch,0)
gpu=default(gpu,false)
c
DeBlock_QED(quant1=30,quant2=51)
crop(cx,cy,cw,ch,align=true)
Spline16Resize(m(16,width*ss),m(16,height*ss))
LimitedSharpenFaster(SMode=4,LMode=3,Strength=1000,wide=true,soft=75,ss_y=1,ss_x=1)
EEDI2().TurnRight().EEDI2().TurnLeft()
gpu ? FFT3DGPU(sigma=1,bt=3,sharpen=0.7,precision=2) : FFT3DFilter(sigma=1,bt=3,sharpen=0.7)
Spline16Resize(dest_x,dest_y)
AddGrain(noise,0,0)
}
function m(int r, float x) {return(x<16?16:int(round(x/float(r))*r))}
I might add it to one of the deblocker pages or even give it its own.
Note, for animation you should call it with noise=0.
Chainmax
11th March 2006, 23:50
That script is not my idea, it was suggested to me by Didée for treatment of some terribly blocky digital camera clips. I can post a couple of before/after screenshots on the two sources I tried it on.
kotrtim
12th March 2006, 03:09
deblock QED MT2, GaussResize, add grain, is it all available in avisynth 2.5?
A question, why resize 3 times.....?
Foxyshadis script is even longer...wooooo....I'll try the shorter one first, actually it is not that bad, the 16x16 blocks appear beacuse the bitrate is little bit lower, but I don't think it needs so much filtering, which line can be removed in the command then?
http://forum.doom9.org/showthread.php?t=84196&page=1&pp=20
anyway, whhere is the limited sharpen .dll , I can't any.
foxyshadis
12th March 2006, 03:45
http://www.avisynth.org/mediawiki/wiki/LimitedSharpen
http://www.avisynth.org/mediawiki/wiki/Deblock_QED
The script chainmax posted would be best suited to videos that have been through the grinder and the compressed to a tenth the size they should have been. (For some reason dragonball z always comes to mind.) If your video has light blocking, you'd be better off with Deblock_QED.
Chainmax
12th March 2006, 04:17
Why did you add DeGrainMedian? The whole point of using AddGrain is to hide whatever remaining artifacting might be left and to give the image a more detailed look, since all the deblocking and sharpening will make it look extremely soft. Something like AddGrain(2,0,0) is barely noticeable and does wonders in those two aspects.
kotrtim
12th March 2006, 04:57
OK, it's basically a clean video, no grain, with ugly 16x16 blocks thats all,
so I think i'll deblock and then limited sharpen first
Foxyshadis, I cannot understand the link you gave me, it gave me avs instead of dlls, and it is hell of dependencies... Is limited sharpen just a script that didee made, some sort of preset using 3 filters all together (masktool, removegrain,warpsharp) to achieve the goal?
foxyshadis
12th March 2006, 05:38
Correct. Didée doesn't make dlls. For the dependencies the direct links are still at www.avisynth.org/LimitedSharpen
Chainmax, I guess because I like my grain softer. I was debating putting it in there, I guess it'd be better outside so I edited. Function didn't work without fixing anyway. :p
You must have one awesome video card. DVDs simply don't work, I have to replace fft3dgpu with fft3dfilter, and it uses up 400 megs and 8 seconds per frame. On the other hand, nasty video where QED hardly makes any difference, that one definitely does. It did wonders for a couple 1-pass test rips.
Jeremy Duncan
12th March 2006, 06:51
That script is not my idea, it was suggested to me by Didée for treatment of some terribly digital camera clips. I can post a couple of before/after screenshots on the two sources I tried it on.
Please do.
kotrtim
12th March 2006, 07:08
so is it like this
loadplugin(.....limitedshrpen.avs)
???
Now, I'm confused , which is the deblocker
ff3dfilter, ff3dgpu?
I can only find ff3dfilter, ff3dfilter & ff3dgpu, they are the same?
In the docs, it is stated that it is a denoiser...
kotrtim
12th March 2006, 14:59
I can't get the avisynth script to work, so I try to emulate the effect with vdubmod, loading the avs, and filter it with ffdshow vdub filter "preview" mode, I tried SPP deblocker That is a very strong deblocker, removes the 100% of the blocks, together with the details, makes hair look like a piece of cloth after processing... After that sharpening it is useless, eveything now look like cartoon with little detail and high contrast edges
Finally, I just use nothing else but noise, that's the best, I like it, the noise helped to distract me from seeing the ugly blocks....The problem is .I hate ffvdub noise filter, it makes the picture look greenish
In the docs, Tom Barry use addgrain(20,0,0) as an example
the first value should be the density of dots added
the other 2 values, should i just leave it zero..
tsp
12th March 2006, 15:42
so is it like this
loadplugin(.....limitedshrpen.avs)
???
Now, I'm confused , which is the deblocker
ff3dfilter, ff3dgpu?
I can only find ff3dfilter, ff3dfilter & ff3dgpu, they are the same?
In the docs, it is stated that it is a denoiser...
fft3dgpu is the graphic card accelerated version of fft3dfilter for people with newer graphics card. The link to the fft3dgpu thread is http://forum.doom9.org/showthread.php?t=89941
they serve as a denoiser and sharpener
Also try posting the error message you get when trying to run the script (and your complete avs script). It would make it easier to help you.
Chainmax
12th March 2006, 17:23
You must have one awesome video card. DVDs simply don't work, I have to replace fft3dgpu with fft3dfilter, and it uses up 400 megs and 8 seconds per frame. On the other hand, nasty video where QED hardly makes any difference, that one definitely does. It did wonders for a couple 1-pass test rips.
I don't use FFT3DGPU, my card is an old Radeon 7200. I assumed most people do, which is why I put it. What did you mean by "DVDs simply don't work, I have to replace fft3dgpu with fft3dfilter, and it uses up 400 megs and 8 seconds per frame"?
Chainmax
12th March 2006, 18:11
Ok, here are the two comparisons I promised. In both cases, the source was roughly 1/4 the size of the original (i.é: like 320x240 is from 640x480), and the filterchain used was slightly altered for each source's needs.
Comparison 1:
http://img389.imageshack.us/img389/3633/comparison17tl.png (http://imageshack.us)
Comparison 2:
http://img389.imageshack.us/img389/2055/comparison27fh.png (http://imageshack.us)
I am aware that in the second comparison the after picture is too red, but the most of the rest of the source wasn't as affected and therefore using color adjusment would have been detrimental.
foxyshadis
12th March 2006, 22:28
I get a bunch of out of memory errors on my 128+384M card :p (I have no idea whether it only uses real GPU memory or also the system spillover.) I got less out-of-memory errors if I used minimal settings, but switching to plain fft3dfilter worked fine (slow).
Here's my test pics from a field-blend sample, left is BT+vmtoon, right is Deblock_QED at max strength:
http://foxyshadis.slightlydark.com/random/bt0000.jpg
http://foxyshadis.slightlydark.com/random/bt0003.jpg
http://foxyshadis.slightlydark.com/random/bt0005.jpg
And the full set: 0 (http://foxyshadis.slightlydark.com/random/bt0000.jpg), 1 (http://foxyshadis.slightlydark.com/random/bt0001.jpg), 2 (http://foxyshadis.slightlydark.com/random/bt0002.jpg), 3 (http://foxyshadis.slightlydark.com/random/bt0003.jpg), 4 (http://foxyshadis.slightlydark.com/random/bt0004.jpg), 5 (http://foxyshadis.slightlydark.com/random/bt0005.jpg)
Chainmax
13th March 2006, 02:05
Wow, that is very crappy, maybe even as much as the two sources I used the combo on. This is definitely suited for this combo at its maximum settings, and since it's animation you can just skip the AddGrain line (would AddGrain(0,0,0) disable it?). I'd recommend to first use one of the many deblenders available, then FFT3DFilter(sigma=12,plane=3,bw=32,bh=32,bt=3,ow=16,oh=16) (maybe with even higher sigma) in order to get rid of those awful color splotches like the one on his elbow or between the boxing glove and his hair. Then use this combo and after the combo use aWarpSharp(depth=16,cm=1). It should look quite watchable after that.
By the way, I like the idea of making the combo into a function. I'd rather have all of the functions it uses embedded it it so that you'd only need to load the plugins though. Let me check with Didée and see what he thinks :).
foxyshadis
13th March 2006, 02:15
Once I get the full version (I'm being sent the LD for processing), there's going to be a lot of hard labor dealing with the partial fieldblending (funkyblending?) and chroma ghosting; see, it's fully interlaced ntsc, made from a pal master, possibly made from an ntsc master or just upconverted from 24 fps. The crappy xvid was just to give me an idea of how bad it was, but it was a great test for this filter. =p That scene looks much nicer on the actual LD.
kotrtim
13th March 2006, 05:10
chainmax, comparison one is really bad, my source looks like comparison 2....thanks..thanks..... what is the script?
Chainmax
13th March 2006, 13:14
It's on my first reply, the second post of this thread. The only change I made is that I used AddGrain(10,0,0), denoised the chroma and readjusted the black and white levels.
Chainmax
13th March 2006, 14:41
By the way, foxyshadis: if the LD source looks better, then this combo is severely overkill. Even thought you are dealing with animated content, I'd advice you to try other alternatives first.
kotrtim
13th March 2006, 16:06
It says
LimitedSharpen is not a valid avs... something something, same to deblock_QED_MT2,
I'd placed both downloaded limted sharpen and deblock QED avs script into avisynth 2.5 plugin folder....
Chainmax
13th March 2006, 16:26
I'd recommend you to put every filter and function in a different folder and load them manually, but if you want to autoload them you have to rename all functions to .AVSI
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.