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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 22nd October 2011, 15:32   #1  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 317
CalmGrain - FluxSmooth, now mostly on grain!

Oh snap, it's me again! (Yipe!)

This time, I've been looking at temporal denoisers.
FluxSmooth was one of those I best liked, due to the fact that it was fast. (And about as good as everything non-complex.)

The problem is, however - that FluxSmooth, like many other Temporal DN'ers, tend to grab pretty large details at high thresholds.
Whilst I wanted to stabilize the grain, and not everything else. Coincidentally, grain only begins to get stable at high thresholds.

You can see what this leads to, hmm?

And so I came up with a so-so solution today, by using a spatial denoiser to get a difference mask of the noise, and using that to filter out everything but (mostly) noise that was temporally denoised.

The result? More or less stable grain! (Hooray!)
The gains turned out to be pretty minimal, but at least the noise artifacts post-encoding should be more stable now. ;P

Do report issues here, though I doubt I can do much about them.

(The package of plugins required should be here.)

[Old (first) version]
[Previous version]
Code:
function CalmGrain(clip clp,int "tstr",int "mskstr",int "mskbias")
{
# Requirements: RemoveGrain(SSE3).dll, FluxSmooth.dll, RedAverage.dll (Just look up "RedAverage" on Google.)
# By yours truly, Bloax.

# ~~~~~ Wuzzis now?
# This 'should' calm grain down, I can now say that it "should" improve compressibility by a little bit.
# It certainly reduces the eye-tearing effect of heavy noise compression artifacts post-encoding though. :-)
# ~~~~~

# ~~~~~ Wuzzis do now?
# "tstr" Is the strength of FluxSmoothT, higher values cause more pixels to hang around for the ride.
# Use values around 10 (for very slight reduction) to about 40-60 (or 255 if you so wish), too high values can look horrible though.
# Watch out for artifacts at higher values (eg. Default :P), though!

# "mskstr" Is the intensity of the mask, though instead of the usual multiplication, here I set it to addition.
# Higher values make the mask more intense, values like 45 would result in something that looks like a binary mask.
# While low values, like -15, would look a bit less extreme.
# But honestly, just leave it be. Unless you feel like experimenting.
# Don't go below -17 though!

# "mskbias" Is the bias value for the mask, don't ask what exactly it does though!
# Just leave it there, or mess around with it if you feel like it.

tstr = Default(tstr, 58)
mskstr = Default(mskstr, 0)
mskbias = Default(mskbias, -32)

a = clp.IsYV12() ? clp : clp.ConvertToYV12()

noise = a.RemoveGrain(17,-1).RemoveGrain(4,-1) # You can replace this line with whatever denoiser you want.
# I recommend you to make said denoiser only denoise luma, as that's faster, and provides usable masks anyway.
msk = RAverageW(noise,19+mskstr,a,-18-mskstr,mode=8,u=0,v=0,bias=mskbias) # Set u & v to 3 to include chroma differences.
# It's faster to just do it with luma, and the default denoising is set to luma only. (* luma,-1 chroma)
RMerge(a,FluxSmoothT(a,tstr),msk,mode=255)
}
Latest version (RAverage/Merge one) ought to be about 20% faster than the previous.
Mostly due to a simplification in the denoising chain. It should in addition be less "blended"-ish now. (Oopsie.)

Last edited by Bloax; 3rd December 2011 at 13:31. Reason: Updated script to use RedAverage instead of MaskTools2. Also tweaked it a bit.
Bloax is offline   Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:54.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.