Log in

View Full Version : Noise Reduction/Deinterlacing/Upscaling advice


NerdWithNoLife
23rd December 2008, 04:26
Noise reduction isn't my strong suit. Here's what I want to do: Take this NTSC DV footage (http://www.megaupload.com/?d=M9EMR5V1), reduce noise and deinterlace it, scale to 1280x960, then crop to 16:9 1280x720. The reason is, this is an alternate camera to be cut with 30p HD footage.

I thought it wise to ask for help because of the multiple things going on here, and problems that can result if filtering is not done in the proper order. So far, I've come up with this strategy to be done in this order: 1. Denoising (like FFT3DFilter with interlaced=true) 2. Deinterlacing (Yadif perhaps?) 3. Resizing (Spline36?) 4. Cropping last. Does that sound right? I know the HD camera will still put this footage to shame, but I've seen some folks here do things that make me feel like a chimpanzee in calculus class, so please let me know if you have better ideas.

Sagekilla
23rd December 2008, 06:46
Honestly, it would be better if you did:

1) deinterlace, 2) denoise, 3) resize/crop:

MPEG2Source("YourFile.d2v")
Yadif()
YourDenoiser()
Spline16Resize(1280,960).Crop(0,120,0,-120)

thetoof
23rd December 2008, 11:10
TempGaussMC uses mvdegrain in the bobbing process, so you may combine step 1 and 2 with it (and add additionnal denoising afterwards, but seeing your clip I don't think it's necessary)
Here's a modded version for the latest MVTools2 or the multithreaded build by josey_wells in which I added a bool "mt" parameter (true = mvtools 2.3.0.0, false = mvtools 1.9.7.7). Chroma shift correction has been disabled with MVTools2 since it has been corrected in MVTools 1.10.2.1.
http://www.mediafire.com/download.php?zjmtgc2qrzi
#compare the 3 edimodes... each has its pros and cons (they work better with different elements of the frame). Test and choose! tr2=3 = mvdegrain3 (2=mvdegrain2 and 1=mvdegrain1) You can (should) play with the other settings to see what leads to better results on the whole clip.
a=tempgaussmc_beta1mod(edimode="eedi2", tr2=3)
b=tempgaussmc_beta1mod(edimode="nnedi", tr2=3)
c=tempgaussmc_beta1mod(edimode="yadif", tr2=3)
interleave(a,b,c)
Dehaloing is also strongly recommended. I'd like to give you a good mt_convolution line for that, but unfortunately I don't fully understand how it works yet (help anyone?). In the meantime, you can look into dehalo_alpha, yahr and a few others.
http://forum.doom9.org/showthread.php?t=140623
http://forum.doom9.org/showthread.php?p=1205653#post1205653

So, here's my workflow suggestion:
tgmc
if you want pc levels : smoothlevels(preset="tv2pc" (+ a bunch of other tweaks)) or ylevels or coloryuv
dehalo
color correction/enhancement
resize (could do it with lsfmod to sharpen)
crop

NerdWithNoLife
23rd December 2008, 23:24
So, here's my workflow suggestion:
tgmc
if you want pc levels : smoothlevels(preset="tv2pc" (+ a bunch of other tweaks)) or ylevels or coloryuv
dehalo
color correction/enhancement
resize (could do it with lsfmod to sharpen)
crop
Uh... thanks, I think. I did TGMC with NNEDI, then resized while using LimitedSharpFaster. It produces a frame about every 40 seconds on my computer. I tried playing with dehalo_alpha and yahr, but they made the video look like a cartoon (or GIMP's olify filter), even at low strength. Great for cartoons, bad for noncartoons. So I skipped it, but even with some halos it's still way better than what I was doing. Hopefully the 946 frames I need will be done by tomorrow.

Nightshiver
23rd December 2008, 23:45
You can always do a rendering pass to make things go faster.

Sagekilla
23rd December 2008, 23:46
TGMC can be sped up quite a bit so it isn't so absurdly slow. Try tweaking the settings a bit to your taste. Otherwise, if speed is a huge concern still yadif + MVDegrain works pretty good IMO :)

NerdWithNoLife
24th December 2008, 00:15
You can't call your encoding speed slow until you start measuring in seconds per frame.
I just got that Sagekilla, lol! Seconds per frame as opposed to frames per second. There's nothing like experiencing.

thetoof
24th December 2008, 01:19
Yeah, the approach *.mp4 guy used in the "right edge halos" thread is the way to go with real life footage... Tough I'd need an even more dumbed down explanation than the one at the bottom of the thread to understand how to create a mt_convolution line from scratch...
Help, mt2 pros?

NerdWithNoLife
8th January 2009, 18:19
As an update, I found why it was going so slow for me. I wasn't using the MVTools 2 mod of TGMC from thetoof. After properly following the instructions, I got it to a much more tolerable one frame ever six seconds. Seems very reasonable in comparison to one frame every 40 seconds! Both CPUs were thinking a lot. But I'm not skilled enough to know for sure about all that multithreading stuff. Anyway. Success.

To follow rule 11, I waited until I had something else to say, but:thanks:

Sagekilla
8th January 2009, 22:06
IIRC, M4G uses some tools to build the correct convolution. I'd have to go digging through search a bit for it, but he actually detailed the process he used once.

Note: 6 seconds per frame still seems a bit excessive (but still plausible). I was able to get much faster processing on -HD- material. What CPU do you have and are you using the defaults?

NerdWithNoLife
8th January 2009, 23:08
Nothing impressive: AMD Athlon 64X2 Dual Core 3600+, 1.9GHz, 1GB RAM. I did use thetoof's mod of TGMC posted above and this line: tempgaussmc_beta1mod(edimode="nnedi", tr2=3)

I guess I could get more RAM (among other things) but right now I'm OK with waiting longer and having more money in my pocket. Maybe there is a faster way though; I'm just not smart enough to change the options, so I don't mess with what works.

Sagekilla
8th January 2009, 23:24
That's not much worse than my rig (equivelant to an Athlon 64 X2 4000+ w/ 2 GB of RAM).

But, now that you posted it I can see -why- it's so slow: nnedi ;) I believe EEDI2 (which I used) has a speed edge over NNEDI. Likewise, I used a much smaller radius for tr2 (1 instead of 3), so that can explain things a bit. If you lower tr2 to 1 or 2, you might get a decent speedup.

NerdWithNoLife
9th January 2009, 00:19
Perhaps I'll try lighter settings if I'm in a pinch sometime then. One thing that really impressed me was that my laptop, running AviSynth through Wine on Ubuntu, was able to keep up at about the same rate as my desktop! I'm not sure I'd do it all the time for fear of cooking the chips though. But it does have more RAM, Ubuntu isn't a memory hog, and AviSynth is essentially a conduit that connects codecs to DLL's, is it not?

*.mp4 guy
9th January 2009, 23:19
Dehaloing this source will leave it extremely blurry. Sharpening it up later, without reintroducing halos will result in a very plastic/fake look. This isn't going to look good in HD, but I'll see if I can keep it from looking bad.