Found awesome deringer, thought I'd share

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
Locked
User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Found awesome deringer, thought I'd share

Post by mirkosp » Tue Jan 05, 2010 11:32 pm

Maybe someone someday will need to dering their animu and won't want to get a blurry output to do so... I know I didn't want to get my sauce blurred much so I looked for a deringer and found this:

Code: Select all

######
##
## HQDering v0.1 by mf
##
## Applies derining by using a smart smoother near edges (where ringing occurs) only.
##
## Usage: Import("HQDering-v0.1.avs")
##        HQDering()
##
####

function HQDering(clip input, int "strength", int "overall", clip "smoother") {

 strength = Default(strength, 255)	# strength, 0-255
 overall  = Default(overall, 0)		# overall smoothing, 0-255
 smoothed = defined(smoother) ? smoother : input.Deen("a3d",4,15,15,20)	# filter that smooths

 normalmask=input.mt_edge(thY1=3, thY2=255, mode="sobel", chroma="none")

 amplifiedmask=normalmask.Levels(0, 3.3, 90, 0, 255).Blur(1.0)

 thickmask=normalmask.mt_inflate().mt_inflate().mt_inflate().Levels(0, 3.3, 90, 0, 255)
  \ .Blur(1.0).mt_inflate().mt_inflate().mt_inflate().Levels(0, 3.3, 255, 0, 255)
  \ .mt_inflate().mt_inflate()

 ringingmask=mt_lutxy(amplifiedmask.mt_invert(), thickmask, expr="x y * 255 /").Levels(60, 3.0, 140, overall, strength)

 mt_merge(input, smoothed, ringingmask)

}
Since the avtech doesn't really help anymore for deringing, besides suggesting to use mpeg2source's cpu parameter (which wasn't doing the job, in this case), and the only deringer suggested in the past was blinddehalo3 which blurred too much to get working results. >_<

I'll note here that this deringer, while giving a nice and non-blurry output, can introduce aliasing, especially noticeable at high strength (default is max, btw, you might want to see how low you can go), even more odd looking if you try to chain it twice. Perhaps the odd look might not be there in anime, but since I had to use this on LA footage, it was pretty noticeable. >_< Still better than blurry output, tho.
Image

User avatar
Zarxrax
Joined: Sun Apr 01, 2001 6:37 pm
Contact:
Org Profile

Re: Found awesome deringer, thought I'd share

Post by Zarxrax » Wed Jan 06, 2010 11:07 am

Can you actually tell any difference with it?
When mf released that filter years ago, I couldn't tell much difference at all in the comparison images that he posted.
http://forum.doom9.org/showthread.php?t=67532

Also, that function could stand to be updated, as it only even uses a hard-edged mask.

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: Found awesome deringer, thought I'd share

Post by mirkosp » Wed Jan 06, 2010 3:06 pm

This is an improved version of it, not the old version anymore. It doesn't even use YV12Layer anymore.
I was able to actually tell a difference... let me get you screenshots. In any case it worked far better than cpu=6 or blinddehalo3.

EDIT:
Ringing:
Image
Deringed:
Image
I used the default settings of hqdering for this example, in actuality I just used strength=100 since nothing more was needed when in the chain with all the other filters (I turned them all down for this example, even bringing cpu back to 0). The ringing is especially noticeable on the ouendan guy on the right.
Image

User avatar
Zarxrax
Joined: Sun Apr 01, 2001 6:37 pm
Contact:
Org Profile

Re: Found awesome deringer, thought I'd share

Post by Zarxrax » Thu Jan 07, 2010 11:50 am

Hmm, I can still barely see any difference :p
But I still think the filter could be improved a lot more. I might try taking a look at it sometime.

User avatar
Sora no Honou 空の炎
Joined: Sun Apr 05, 2009 9:52 pm
Status: The Sky Flame
Location: St. Louis, MO
Org Profile

Re: Found awesome deringer, thought I'd share

Post by Sora no Honou 空の炎 » Thu Jan 07, 2010 2:47 pm

Looks good. Took me a second to see the difference, but it is there, and with no blurring. Good job seeing this :awesome:
Image

User avatar
Sora no Honou 空の炎
Joined: Sun Apr 05, 2009 9:52 pm
Status: The Sky Flame
Location: St. Louis, MO
Org Profile

Re: Found awesome deringer, thought I'd share

Post by Sora no Honou 空の炎 » Fri Jan 08, 2010 12:32 am

How can I make it so that I can use this plugin? Is there like a file download or something? I have never had to add an avisynth plugin before. Sorry...
Image

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Re: Found awesome deringer, thought I'd share

Post by Scintilla » Fri Jan 08, 2010 7:13 am

Copy the script to a new text file in your text editor of choice, save it in your AVISynth plugins directory with the extension .AVSI, and make sure you have MaskTools 2 (MT MaskTools) and Deen (unless you want to provide a separate clip for the "smoother" argument).

I say this only because the version of the script that's on MF's website is apparently out of date. Otherwise you could just save that file as an .AVSI.
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

User avatar
Pwolf
Friendly Neighborhood Pwaffle
Joined: Thu May 03, 2001 4:17 pm
Location: Some where in California, I forgot :\
Contact:
Org Profile

Re: Found awesome deringer, thought I'd share

Post by Pwolf » Sat Jan 09, 2010 1:20 am

what the hell? i can't see anything different between the two pictures other then the "deringed" one is lighter.

User avatar
Emotive
...the Meditant
Joined: Sat Nov 04, 2006 12:20 pm
Org Profile

Re: Found awesome deringer, thought I'd share

Post by Emotive » Sat Jan 09, 2010 5:23 am

Pwolf wrote:what the hell? i can't see anything different between the two pictures other then the "deringed" one is lighter.
There is no difference, it's just qualityfag elitists' illusions as usual.
Image

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: Found awesome deringer, thought I'd share

Post by mirkosp » Sat Jan 09, 2010 8:38 am

Pwolf wrote:what the hell? i can't see anything different between the two pictures other then the "deringed" one is lighter.
I'd try to open each image in its own tab... but either way yeah, the reference screenshot i used doesn't have too much of a noticeable ringing. I'll see about getting a more obvious reference screenshot.

EDIT:
Image

Should be somewhat obvious now. Picked some text with ringing around it.
Image

Locked

Return to “AviSynth Help”