Log in

View Full Version : MPEG noise reduction


byme
12th September 2010, 21:00
I tried the Msmooth, but flattens a bit too the image.

know a good alternative to eliminate the dirt created by MPEG compression?

:thanks:

Bi11
12th September 2010, 21:45
You didn't provide a sample so it's hard to give a specific solution.
Does the general light denoising function below help?
# Deblock Denoise Sharpen Placebo
function DDSP (clip input, float "sigma", int "sbsize", int "sosize", int "tbsize",\
int "ftype", int "merange",\
bool "deblk", bool "clean", bool "sharp") {

sigma = default(sigma, 5) # increase to 16 or more for stronger denoising, but may cause blurring
tbsize = default(tbsize, 3) # increase to 5 or 7 if denoising is too fast, but denoising may be stronger
sbsize = default(sbsize, 32) # decrease to 16 or less for large slow noise, but may blur large details
sosize = default(sosize, 3*sbsize/4) # decrease to sbsize/2 or less for speed, but will be less accurate
ftype = default(ftype, 1) # ftype=1 hard threshold; mult = psd < sigma ? 0.0 : 1.0; (psd = magnitude squared)
merange = default(merange,5) # increase to 8 or more for HD or fast motion, but will be slower
deblk = default(deblk, true)
clean = default(clean, true)
sharp = default(sharp, true)# slow!

# Deblock_QED removes stubborn blocks that dfttest misses, thereby preventing those blocks from being sharpened.
# Deblock_QED uses DCTFilter to interpolate border values over the whole block, so it's also more accurate.
source = deblk ? input.Deblock_QED(quant1=24,quant2=25,aOff1=1,aOff2=1,bOff1=1,bOff2=1) : input

# This is intended to increase accuracy of finding motion vectors.
cleanclip = source.dfttest(ftype=1,sigma=3,sbsize=24,sosize=16,tbsize=1,dither=0)

# Create super clip and super vector clip
super = MSuper(source)
superv = clean ? MSuper(cleanclip) : super

# Get vectors
b1v = MAnalyse(superv, delta=1, blksize=4, overlap=2, search=5, searchparam=merange, truemotion=false, isb=true)
f1v = MAnalyse(superv, delta=1, blksize=4, overlap=2, search=5, searchparam=merange, truemotion=false)
b2v = MAnalyse(superv, delta=2, blksize=4, overlap=2, search=5, searchparam=merange+4, truemotion=false, isb=true)
f2v = MAnalyse(superv, delta=2, blksize=4, overlap=2, search=5, searchparam=merange+4, truemotion=false)
b3v = MAnalyse(superv, delta=3, blksize=4, overlap=2, search=4, searchparam=merange+6, truemotion=false, isb=true)
f3v = MAnalyse(superv, delta=3, blksize=4, overlap=2, search=4, searchparam=merange+6, truemotion=false)

# Compensated frames
b1 = MCompensate(source, super, b1v)
f1 = MCompensate(source, super, f1v)
b2 = MCompensate(source, super, b2v)
f2 = MCompensate(source, super, f2v)
b3 = MCompensate(source, super, b3v)
f3 = MCompensate(source, super, f3v)

# Interleave compensated frames
mcclip = tbsize==7 ? interleave(f3,f2,f1,source,b1,b2,b3) : tbsize==5 ? interleave(f2,f1,source,b1,b2) :\
tbsize==3 ? interleave(f1,source,b1) : source

# Denoise motion-compensated clip
denoised = mcclip.dfttest(sigma=sigma,sbsize=sbsize,sosize=sosize,tbsize=tbsize,ftype=ftype)\
.selectevery(tbsize,(tbsize-1)/2)


output = sharp ? denoised.LSFmod(source=source, Smode=3, Smethod=3, kernel=19, Lmode=2, overshoot=0,\
soft=100, soothe=false, ss_x=1, SdmpLo=0, SdmpHi=0) : denoised
return output
}

byme
12th September 2010, 22:23
sorry...

not a problem of blocks, but dirt (not grain ... for that I use MCTemporalDenoise)


after sharp

http://file2.net/thb/100912/6847dh.png (http://file2.net/100912img6847dh.png.html)

http://file2.net/thb/100912/6394ok.png (http://file2.net/100912img6394ok.png.html)

http://file2.net/thb/100912/4550ge.png (http://file2.net/100912img4550ge.png.html)


before sharp

http://file2.net/thb/100912/6903zk.png (http://file2.net/100912img6903zk.png.html)

http://file2.net/thb/100912/2121yk.png (http://file2.net/100912img2121yk.png.html)

http://file2.net/thb/100912/2395zc.png (http://file2.net/100912img2395zc.png.html)

Didée
12th September 2010, 22:57
Another case to stress the saying "crap in, crap out" ...

The source doesn't really have much detail to begin with, but it has lots of artifacts. Because of the plenty artifacts, you cannot sharpen directly. When you remove the artifacts, you'll lose even more detail and make the source blurrier, so there will be even less left over that you could sharpen.

The glory of overcompressed TV transmissions. A dead horse keeps being a dead horse, no matter how hard you beat it.

byme
13th September 2010, 11:01
so I can not do anything?

unfortunately Italian TV is so, but is that I register

Yobbo
13th September 2010, 11:15
Are those "before sharp" pics raw & untouched?

byme
13th September 2010, 11:25
yes, except for the deinterlacing

Hagbard23
13th September 2010, 11:57
Deblock/Dering before deinterlacing (you can use it via DGDecode with iPP=true)

after that i would use LSF or LSFMod.

And you can consider using Kassandros RemoveDirt Package - it works really nice, but expect blurring...wether you use it before or after sharpening depends...i would try it out.

But: With such a source i would consider doing no postprocessing at all (except deinterlacing) and applying just a high compression(MPeg4 ASP) afterwards. A high compression Matrix should eat small details (incl. Noise) as well.

It makes no sense to me to tweak hours and hours on such a bad source.

BTW: What Deinterlacer have you used exactly? If you have chosen a simple "discard field", then the low detail level is no surprise...try YADIF instead...

Didée
13th September 2010, 13:00
frfun7(1.6,10.0,5.0)

Edit:

Sharpen(0.6).MergeChroma(last)
frfun7(1.4,10.0,5.0)

byme
13th September 2010, 16:28
thanks Hagbard23 and Didèe!

the frfun7 is good


@ Didèe:

for you should the MCTemporalDenoise before the frfun7?

Didée
13th September 2010, 17:14
Can't tell that from static screenshots. To rate a temporal filter, one must see the pictures in motion.

byme
12th January 2011, 17:06
Can you tell me how to disable the deblocking in dfttest? (to see if without the deblocking, I do not need, retains more detail)
I would like to remove the mosquito, but I do not need do deblocking

or you have a better solution to eliminate this mosquito?

http://file2.net/thb/110112/5388rw.png (http://file2.net/110112img5388rw.png.html) http://file2.net/thb/110112/6345cn.png (http://file2.net/110112img6345cn.png.html) http://file2.net/thb/110112/781af.png (http://file2.net/110112img781af.png.html)