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.

 

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

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th September 2015, 14:18   #1  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
halobuster - high quality halo remover

the filter is very high quality and almost harmless to details
cuz, it picks NLMeans, an advanced denoising algorithm instead of stuff like, blurring, minblur, destructive anyways as the dehalo kernel
Code:
Function HaloBuster (clip input, bool "lsb", int "a", float "h", float "thr", float "elast")
{
lsb = Default(lsb, False)
a= Default (a, 32)
h = Default(h, 6.4)
thr = Default(thr, 1.0)
elast = Default(elast, 1.5)
gray = lsb ? input.converttoy8 () : input.converttoy8 ().Dither_convert_8_to_16()
gray = stackvertical (dither_get_msb (gray).padding (a, a, a, a),dither_get_lsb (gray).padding (a, a, a, a))
clean = knlmeanscl (gray, d=0, a=a, s=0, h=h, lsb_inout=True)
mask = TCannyMod (converttoyv12 (clean.ditherpost (mode=-1)), sigma=1.5, mode=1, gmmax=50)
mask = mask.converttoy8 ()
mask = mt_lut (mask, "x 255 / 0.24 - 3.2 * 0.0 max 1.0 min 255 *")
mask = mt_expand (mask)
mask = mt_inflate (mask)
merge  = dither_merge16_8 (gray, clean, mask)
limit = Dither_limit_dif16 (gray, merge, thr=thr, elast=elast)
crop = Dither_crop16 (limit, a, a, -a, -a)
luma = lsb ? crop : crop.ditherpost (mode=-1)
final = input.IsY8 () ? luma : ytouv (input.utoy8 (), input.vtoy8 (), luma)
return final
}

Function Padding (clip input, int "left", int "top", int "right", int "bottom")
{
w = input.width ()
h = input.height ()

output = input.PointResize (w+left+right, h+top+bottom, -left, -top, w+left+right, h+top+bottom)

return output
}
parameters:
lsb --- clip is stacked 16bits or not (8bits)
h --- filtering strength
thr --- threshold, 0-255 scale, return pixel from the source clip if the difference < thr, otherwise, return pixel from the processed clip
elast --- softness of the threshold

only luma will be processed, chroma will be copied from the source clip

demo:
before





after
Code:
HaloBuster ()




Last edited by feisty2; 14th September 2015 at 15:16.
feisty2 is offline   Reply With Quote
Old 12th September 2015, 15:02   #2  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Had a quick look, nice.

1.2 frames/second on SD material (i5 2500K @4GHz) - yikes.
Groucho2004 is offline   Reply With Quote
Old 12th September 2015, 15:09   #3  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by Groucho2004 View Post
Had a quick look, nice.

1.2 frames/second on SD material (i5 2500K @4GHz) - yikes.
I don't really give a shoot about performance
I care about quality, my one and only goal
feisty2 is offline   Reply With Quote
Old 12th September 2015, 15:18   #4  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by feisty2 View Post
I don't really give a shoot about performance
Yeah, you're young, lots of time left. We old geezers need things done faster or we'll be pushing up daisies by the time the job is done.
Groucho2004 is offline   Reply With Quote
Old 12th September 2015, 15:33   #5  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
I know this won't increase performance by much but you could use TCannyMod over TCanny. Also how about making padding optional? If the source has black borders (just like your sample) it's useless to add padding since you're essentially padding black borders.

I have some DVDs from the early 2000's, they have massive halos from extreme EE. I wonder how HaloBuster will handle such halos?

Edit: I didn't know mastertapes had halos .

Quote:
Originally Posted by Groucho2004 View Post
Yeah, you're young, lots of time left. We old geezers need things done faster or we'll be pushing up daisies by the time the job is done.
A few years ago I had the same mentality, fortunately I've gotten most of my priorities straight since then, plus I pay the light bill .

Last edited by Reel.Deel; 12th September 2015 at 15:54. Reason: wrong link
Reel.Deel is offline   Reply With Quote
Old 12th September 2015, 15:33   #6  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
Quote:
Originally Posted by feisty2 View Post
demo:


ftfy
creaothceann is offline   Reply With Quote
Old 12th September 2015, 16:21   #7  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by Reel.Deel View Post
I know this won't increase performance by much but you could use TCannyMod over TCanny. Also how about making padding optional? If the source has black borders (just like your sample) it's useless to add padding since you're essentially padding black borders.

I have some DVDs from the early 2000's, they have massive halos from extreme EE. I wonder how HaloBuster will handle such halos?

Edit: I didn't know mastertapes had halos .



A few years ago I had the same mentality, fortunately I've gotten most of my priorities straight since then, plus I pay the light bill .
1. not sure why, but, tcannymod gives me quite different result from tcanny, guess that's something related to "gmmax" (this parameter from tcanny just, vanished in tcannymod), so please stick to tcanny
and about padding, maybe you should crop the clip first, didn't crop my test clip cuz I'm sure everyone knows I'm lazy like hell
2. maybe it will work, just did some insane tests to see how it performs in extreme cases
so I just sharpened the already full of halo clip, now it's... no comment
Code:
sharpen (1)

Code:
sharpen (1)
HaloBuster (h=32)

guess it works, you'll need a very large "h"
3.I "make" mastertapes, that means I distribute the "final results" without ANY sacrifice to quality, but the material clips might be... not so nice

edit: I think I just typed "materiel"...

Last edited by feisty2; 12th September 2015 at 16:46.
feisty2 is offline   Reply With Quote
Old 12th September 2015, 16:25   #8  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by creaothceann View Post
ftfy
thx, man!
u no gurl, ain't ya
feisty2 is offline   Reply With Quote
Old 12th September 2015, 19:10   #9  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
This works extraordinarily well with the subtle halos in your original. It will be interesting to see if it can be tweaked to remove some of the really huge halos that happen with oversharpening of old SD material, like VHS. I look forward to playing around with it.
johnmeyer is offline   Reply With Quote
Old 12th September 2015, 20:09   #10  |  Link
Dreamland
Registered User
 
Join Date: Sep 2013
Location: Central Italy
Posts: 46
This is my first post..
ciao from Italy
very good interesting thread
excuse me for my bad english ..i'm trying to import avs halo remover but there are problems

win8.1 32bit Avisinth 2.6 final







I've installed Visual C++ Redistributable Package for Visual Studio 2015 (x86) in my system , but doesnt' work!

Help me !!

thx a lot!

Last edited by Dreamland; 12th September 2015 at 20:49.
Dreamland is offline   Reply With Quote
Old 12th September 2015, 20:29   #11  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 317
Quote:
Originally Posted by Groucho2004 View Post
Had a quick look, nice.

1.2 frames/second on SD material (i5 2500K @4GHz) - yikes.
The biggest performance bottleneck is this:
Code:
knlmeanscl (gray, d=0, a=32, s=0, h=h, lsb_inout=True)
'a' values over 15 are basically unusable for non-stillimage purposes due to the enormous calculation complexity put on the GPU. (Not the CPU!)
Consequently the performance could be greatly improved by lowering this value, likely at the slight cost of quality.

Code:
Function HaloBuster (clip input, bool "lsb", float "h", float "thr", float "elast", int 'a')
{
lsb = Default(lsb, False)
avalue = Default(a, 32)
h = Default(h, 6.4)
thr = Default(thr, 1.0)
elast = Default(elast, 1.5)
gray = lsb ? input.converttoy8 () : input.converttoy8 ().Dither_convert_8_to_16()
gray = stackvertical (dither_get_msb (gray).padding (32, 32, 32, 32),dither_get_lsb (gray).padding (32, 32, 32, 32))
clean = knlmeanscl (gray, d=0, a=avalue, s=0, h=h, lsb_inout=True)
mask = TCanny (converttoyv12 (clean.ditherpost (mode=-1)), sigma=1.5, mode=1)
mask = mask.converttoy8 ()
mask = mt_lut (mask, "x 255 / 0.24 - 3.2 * 0.0 max 1.0 min 255 *")
mask = mt_expand (mask)
mask = mt_inflate (mask)
merge  = dither_merge16_8 (gray, clean, mask)
limit = Dither_limit_dif16 (gray, merge, thr=thr, elast=elast)
crop = Dither_crop16 (limit, 32, 32, -32, -32)
luma = lsb ? crop : crop.ditherpost (mode=-1)
final = ytouv (input.utoy8 (), input.vtoy8 (), luma)
return final
}

Function Padding (clip input, int "left", int "top", int "right", int "bottom")
{
w = input.width ()
h = input.height ()

output = input.PointResize (w+left+right, h+top+bottom, -left, -top, w+left+right, h+top+bottom)

return output
}
To translate that to human speak, just run HaloBuster(blah,blah,a=18) to make performance less glacial at some kind of hit to quality. Even lower might work.
Because let's not forget that we're talking about the same person who absolutely insists on stupendous amounts of colorspace precision (int32 because int16 isn't enough!!) for something that is so extremely destructive in its nature that it would not benefit from it at all (MVTools).
Bloax is offline   Reply With Quote
Old 12th September 2015, 21:19   #12  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by Dreamland View Post
I've installed Visual C++ Redistributable Package for Visual Studio 2015 (x86) in my system , but doesnt' work!

Help me !!

thx a lot!
You need Visual C++ Redistributable Package for Visual Studio 2013 for this plugin.
Groucho2004 is offline   Reply With Quote
Old 12th September 2015, 21:27   #13  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
Quote:
Originally Posted by johnmeyer View Post
It will be interesting to see if it can be tweaked to remove some of the really huge halos that happen with oversharpening of old SD material, like VHS.
Like this? :]
creaothceann is offline   Reply With Quote
Old 12th September 2015, 21:31   #14  |  Link
Dreamland
Registered User
 
Join Date: Sep 2013
Location: Central Italy
Posts: 46
Quote:
Originally Posted by Groucho2004 View Post
You need Visual C++ Redistributable Package for Visual Studio 2013 for this plugin.

now works!! thx a lot!
Dreamland is offline   Reply With Quote
Old 13th September 2015, 15:06   #15  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,348
...but why aren't you removing all of the halos?




*.mp4 guy is offline   Reply With Quote
Old 13th September 2015, 15:15   #16  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
I'm all ears, any more specific suggestions?
feisty2 is offline   Reply With Quote
Old 13th September 2015, 17:02   #17  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by feisty2 View Post
1. not sure why, but, tcannymod gives me quite different result from tcanny, guess that's something related to "gmmax" (this parameter from tcanny just, vanished in tcannymod), so please stick to tcanny
Updated TCannyMod with "gmmax" parameter. Thanks Chikuzen!
Reel.Deel is offline   Reply With Quote
Old 14th September 2015, 14:04   #18  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
updated
feisty2 is offline   Reply With Quote
Old 14th September 2015, 15:05   #19  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
@feisty2

Change the following to support Y8 input:
Code:
final = input.IsY8() ? luma : ytouv (input.utoy8 (), input.vtoy8 (), luma)
Reel.Deel is offline   Reply With Quote
Old 14th September 2015, 15:16   #20  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
done.
feisty2 is offline   Reply With Quote
Reply

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 05:40.


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