Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
21st January 2008, 03:44 | #1 | Link |
Registered User
Join Date: Jan 2008
Location: London
Posts: 156
|
FizzKiller - Death to High Contrast Noise
[See post 30 for current version]
I've been using MVDegrain2 for the cleaning up of "noise" for a while now. I've noticed that there's one type of noise, high-contrast noise, that utterly defeats MVD2. I have provided two clips for the purposes of this thread, both from the same film, Concursante:
This is how I've been using MVD2 for a while now: Code:
function MVDegrain2p(clip source, int "blksize", int "overlap", int "sharp", int "thSAD", int "idx") { # Motion compensated denoiser for progressive source clip, adapted from http://avisynth.org.ru/mvtools/mvtools.html # uses MVTools plugin blksize = default(blksize, 8) # blksize value (4, 8 or 16) overlap = default(overlap, blksize/2) # overlap value (0 to half blksize) sharp = default(sharp, 1) # 0=bilinear softest, 1=bicubic, 2=Wiener sharpest thSAD = default(thSAD, 400) # higher risks motion ghosting and swimming, lower risks blotchy denoising idx = default(idx, 1) # use various idx for different sources in same script backward_vec2 = source.MVAnalyse(isb = true, delta = 2, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) backward_vec1 = source.MVAnalyse(isb = true, delta = 1, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) forward_vec1 = source.MVAnalyse(isb = false, delta = 1, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) forward_vec2 = source.MVAnalyse(isb = false, delta = 2, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) source.MVDegrain2(backward_vec1, forward_vec1, backward_vec2, forward_vec2, thSAD=thSAD, idx=idx) } MVDegrain2p(last, blksize = 16, sharp = 2) as it's considerably faster than running blksize 8, and the "extra" cleaning power of 16 is acceptable to me. The motion artefacts are reduced with blksize 8 and lowered further with blksize 4 - but on balance I can live with what I get at 16. For cleaning this high contrast noise I've been inspired by various discussions of "prefiltered" MVD2 using a "calm" clip. I've tried using FFT3DFilter/FFT3DGPU (various block sizes up to 128, bt 1, 3 and 5, sigma from 2 to 64 and various strengths of sigma2/3/4), then tried combining this with RemoveGrain(mode=17), luma only or luma+chroma, in various orderings and counts. So, this is where I've got to: Code:
function FizzKiller(clip source, int "blksize", int "overlap", int "sharp", int "thSAD") { # Motion compensated denoiser for progressive source clip with prefiltering optimised to reduce high-contrast noise # Uses MVTools and RemoveGrain blksize = default(blksize,8) # blksize value (4, 8 or 16) overlap = default(overlap,blksize/2) # overlap value (0 to half blksize) sharp = default(sharp,1) # 0=bilinear softest, 1=bicubic, 2=Wiener sharpest thSAD = default(thSAD,400) # higher risks motion ghosting and swimming, lower risks blotchy denoising idx = 20 # "safe" idx for use within this function only # Prefilter the clip calm = source.invert("Y").levels(0, 0.5, 255, 0, 255, coring = false) calm = calm.removegrain(mode = 17) calm = calm.removegrain(mode = 17) calm = calm.removegrain(mode = 17) backward_vec2 = calm.MVAnalyse(isb = true, delta = 2, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) backward_vec1 = calm.MVAnalyse(isb = true, delta = 1, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) forward_vec1 = calm.MVAnalyse(isb = false, delta = 1, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) forward_vec2 = calm.MVAnalyse(isb = false, delta = 2, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) source.MVDegrain2(backward_vec1, forward_vec1, backward_vec2, forward_vec2, thSAD = thSAD, idx = idx + 1) } last.FizzKiller(blksize = 16, sharp = 2) So, any ideas for tweaking this to improve it? Less motion artefacts would always be welcome (my CPU makes blksize 8 uncomfortable, halving encode rate)? Also perhaps it could be made a bit stronger on "flat" areas of the picture, but not at the cost of making the motion artefacts worse. I haven't finished playing with this, but I've been playing so long I thought I'd share the results so far. I'd be interested in clips that cause problems. I've tested other clips and I have yet more clips to test with... Jawed Last edited by Jawed; 19th January 2011 at 11:58. |
21st January 2008, 17:22 | #2 | Link |
x264aholic
Join Date: Jul 2007
Location: New York
Posts: 1,752
|
This sounds very much like the degraining filter created by Didee that I turned into a function. I'll test yours against mine, I'm curious as to how different the output is from the two methods. No doubt yours is much faster though, since Temporal Degrain calls FFT3DFilter and then MVDegrain2 twice. Will post results soon, see if there's anything I can do to help improve our functions.
Edit: By the way, try out mediafire next time Much better site to use for files. Last edited by Sagekilla; 21st January 2008 at 17:24. |
21st January 2008, 17:35 | #4 | Link |
x264aholic
Join Date: Jul 2007
Location: New York
Posts: 1,752
|
Found a bug by the way. You have to change the source from clip "source", to clip source. No quotations for your source video! Here's the fixed function until you come around to fix it:
Code:
function FizzKiller(clip source, int "blksize", int "overlap", int "sharp", int "thSAD") { # Motion compensated denoiser for progressive source clip with prefiltering optimised to reduce high-contrast noise # Uses MVTools and RemoveGrain blksize = default(blksize,8) # blksize value (4, 8 or 16) overlap = default(overlap,blksize/2) # overlap value (0 to half blksize) sharp = default(sharp,1) # 0=bilinear softest, 1=bicubic, 2=Wiener sharpest thSAD = default(thSAD,400) # higher risks motion ghosting and swimming, lower risks blotchy denoising idx = 20 # "safe" idx for use within this function only # Prefilter the clip calm = source.invert("Y").levels(0, 0.5, 255, 0, 255, coring = false) calm = calm.removegrain(mode = 17) calm = calm.removegrain(mode = 17) calm = calm.removegrain(mode = 17) backward_vec2 = calm.MVAnalyse(isb = true, delta = 2, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) backward_vec1 = calm.MVAnalyse(isb = true, delta = 1, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) forward_vec1 = calm.MVAnalyse(isb = false, delta = 1, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) forward_vec2 = calm.MVAnalyse(isb = false, delta = 2, pel = 2, blksize=blksize, overlap=overlap, sharp=sharp, idx = idx) source.MVDegrain2(backward_vec1, forward_vec1, backward_vec2, forward_vec2, thSAD = thSAD, idx = idx + 1) } |
21st January 2008, 17:48 | #6 | Link | |||
Registered User
Join Date: Jan 2008
Location: London
Posts: 156
|
Quote:
Quote:
Quote:
Jawed |
|||
21st January 2008, 18:02 | #9 | Link | |
Registered User
Join Date: Jan 2008
Location: London
Posts: 156
|
Quote:
last.MC_Spuds(frames=2,strength=5) but didn't go any higher as I don't have MVDegrain3 and decided that if MVD2 doesn't solve the problem, a longer temporal filter wouldn't be any better. Jawed |
|
21st January 2008, 18:05 | #10 | Link | |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
Quote:
Here, the pre-denoising is done pure spatially by a RG(17) cascade. It works out quite OK for this source, but: like already told in Zep's thread, the caveat is that pure spatial pre-denoising leaves too much flicker in flat areas. That's why Jawed gets those "swimming" artefacts. Also, the gamma-adjustment done for the search clip isn't a bad idea, but it's not well balanced. gamma=2.0 between 0->0 & 255->255 will map 16->64 ... one quarter of the available gammut isn't used anymore at all, and the bright parts lose information.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
21st January 2008, 18:08 | #11 | Link | |
Registered User
Join Date: Jan 2008
Location: London
Posts: 156
|
Quote:
Jawed |
|
21st January 2008, 18:23 | #12 | Link | ||
*Space Reserved*
Join Date: May 2006
Posts: 953
|
Quote:
So like: MC_Spuds(frames=3,strength=5,flow=true) Quote:
|
||
21st January 2008, 19:05 | #13 | Link | |||
Registered User
Join Date: Jan 2008
Location: London
Posts: 156
|
Quote:
Quote:
Quote:
levels(0, 2, 255, 0, 255, coring = false) I get worse motion artefacts - the bitrate is notably lower, about 3.5% on the Smoke clip. Clearly I could tweak that "2" to be something else, after all the whole thing is empirical... it's just where I landed. I started experimenting with a gamma change (I set about changing the image into linear space) because I'm always suspicious that image processing software handles gamma incorrectly: http://www.4p8.com/eric.brasseur/gamma.html The asymmetry between Invert("Y").gamma(0.5) and gamma(2) makes me suspicious. The error might be in Invert or Levels or it might be in MVTools. Or everywhere. I've got more experimentation to do... Jawed Last edited by Jawed; 21st January 2008 at 19:27. Reason: added Invert to the possibly erroneous list |
|||
22nd January 2008, 18:28 | #15 | Link | |
Flying Skull
Join Date: Jan 2005
Posts: 397
|
Quote:
MVDegrain2 17.95fps MVDegrain3 13.66fps FizzKiller 16.91fps (replaces borked version) The script: Code:
SetMTMode(5) DGDecode_mpeg2source("smoke.d2v",idct=4,info=3) SetMTMode(2) Tweak(bright=-16, cont=1.164, coring=false) DeBlock_QED_mt2( quant1=20, quant2=24, aOff1=2, bOff1=4, aOff2=4, bOff2=8 ) #crop( 10, 80, -6, -80) #original, erroneous crop( 10, 80, -6, -80, align=true) #mvdegrain2p (source=last,blksize=16,overlap=8,sharp=2,thSAD=400,idx=1) #mvdegrain3p (source=last,blksize=16,overlap=8,sharp=2,thSAD=400,idx=1) FizzKiller (blksize=16,overlap=8,sharp=2,idx=1) gradfunkmirror(1.2) Last edited by Morte66; 23rd January 2008 at 16:47. |
|
23rd January 2008, 00:24 | #16 | Link |
Registered User
Join Date: Jan 2008
Location: London
Posts: 156
|
Thanks for posting those clips Joel, nice work. Prepare to SCREAM (hmm, maybe you've already started).
But first, comparing MVD2 and MVD3 I can discern a useful reduction in the strength of the noise in the sky at the beginning of the clip. The rest of the clip makes this comparison very difficult. MVD3 only seems to have very slightly worse motion artefacts, judging by the black line on the ambulance (frames 1352 and 1365) - I'd say ignorable, which is a relief. Hopefully FizzKiller will be quite happy working with MVD3... Now, to that scream. FK is completely borked on frames 7, 72, 356+357, 435, 508, 610, 678, 713, 753, 818, 991, 1059, 1201, 1237, 1490. I can't reproduce that problem here. The error is very similar to errors I've encountered when doing silly extreme things to the calm clip. I can't find anything "special" about the corresponding frames in the source clip, or about the neighbouring pairs of frames on both sides. I suppose it's either MVTools beta (did you use it for the FK encode?) or multi-threading. Or some horrid combination of the two. Or, erm... For what it's worth, FK encodes to 34MB here, at ~2.8fps on my lickle A64 3500+, single core. This is for a slightly larger frame, 704x424 versus 704x416. Here's my script: Code:
global MeGUI_darx = 2361 global MeGUI_dary = 1000 DGDecode_mpeg2source("Smoke.d2v") crop(0,64,0,-64) tweak(bright=-16, cont=1.164, coring=false) DeBlock_QED_mt2( quant1=20, quant2=24, aOff1=2, bOff1=4, aOff2=4, bOff2=8 ) last.FizzKiller(blksize=16,sharp=2) crop( 4, 10, -12, -14) gradfunkmirror() and x264 command line: --crf 16 --ref 5 --mixed-refs --no-fast-pskip --bframes 8 --b-pyramid --b-rdo --bime --weightb --subme 6 --analyse p8x8,b8x8,i4x4,i8x8 --8x8dct --me umh --merange 32 --no-dct-decimate --aq-strength 0.3 --aq-sensitivity 5 Jawed |
23rd January 2008, 00:53 | #17 | Link | ||
Flying Skull
Join Date: Jan 2005
Posts: 397
|
Quote:
Quote:
Switched to script with FizzKiller single-threaded, problem gone. I may have mixed single and multi-threaded this afternoon during the smoke sequence. I dimly remember forgetting to switch it on at and "fixing" it some time. I've done a lot of clips today between mvd3 and variance AQ, they run together in my mind... I've uploaded a new version, single-threaded, no flashgun. You can compare now. I've been running multithreaded mvd3 since this afternoon on various stuff without problems. But not FizzKiller. Just did multithreaded mvd3 and mvd2 again on the smoke clip, they work fine. But FizzKiller seems to have a problem with MT, at least here it does. I note that it is a meaningfully different use of mvtools from mvdegrain2p/3p, e.g. it uses two values for idx instead of one, so one script might expose issues that the other doesn't. I will work on this some more tomorrow, and try to either find where I screwed up or work up a useful bug report for somebody. Last edited by Morte66; 23rd January 2008 at 00:55. |
||
23rd January 2008, 01:44 | #18 | Link | |||
Registered User
Join Date: Jan 2008
Location: London
Posts: 156
|
Yeah. I was like WTF is that when I first watched the clip, I don't remember that happening.
Quote:
Quote:
Quote:
With single-threaded FK, see how frames 1395+1396 look, with gamma set to 0.05. That is much like the problem with MT-FK. The error simply looks like the same blocks (mostly bright ones) being used all over the place - on frame 1396 you can see this in action by changing blksize to 8 or 4. You didn't scream - I guess that's your hardened beta tester skin coming into its own... Jawed |
|||
23rd January 2008, 16:35 | #19 | Link |
x264aholic
Join Date: Jul 2007
Location: New York
Posts: 1,752
|
It seems odd that FizzKiller is having issues with MT. The function I use, I always use SetMTMode(2) to (mostly) double the speed of the function. Only difference is you're using RemoveGrain as a prefilter -- perhaps that's what has issues with MT?
|
23rd January 2008, 16:38 | #20 | Link |
Flying Skull
Join Date: Jan 2005
Posts: 397
|
*sigh*
Is seems you're meant to add "align=true" to the crop command when using MT, or stuff sometimes goes wonky. It further seems that I never encountered anything that provoked the problem until I tried your FizzKiller script. It's all OK now. |
Thread Tools | Search this Thread |
Display Modes | |
|
|