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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th February 2008, 03:16   #1  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,348
ungibbs, a gibbs artifact remover

Code:
function blurfunction2(clip c){
c
dctlimit(dct2=1.625, dct3=0, dct4=0, dct5=0, dct6=0, dct7=0, dct8=0, use64dct=false, use32dct=false, use8dct=true, use4dct=false)
}

function ungibbs(clip c){
	thresh = 224

	c
	predict = c.blurfunction2
	sharp1 = c.limitedsharpenfaster(smode=4, strength=100, overshoot=0)#Xsharpen(31, 255)
	blur1 = c.removegrain(4)
	sharp2 = c.limitedsharpenfaster(smode=3, strength=100, overshoot=0)
	blur2 = c.quantile(2)
	blur3 = c.spline36resize(width*2, height*2).removegrain(4).spline36resize(c.width, c.height)
	
	bp0 = mt_makediff(predict, c)
	bp1 = mt_makediff(sharp1.blurfunction2, c)
	bp2 = mt_makediff(blur1.blurfunction2, c)
	bp3 = mt_makediff(sharp2.blurfunction2, c)
	bp4 = mt_makediff(blur2.blurfunction2, c)
	bp5 = mt_makediff(blur3.blurfunction2, c)

	cp1 = mt_merge(c, sharp1, MT_lutxy(bp0, bp1, "x 128 - abs y 128 - abs - "+string(thresh)+" *", u=1, v=1).frfun7(0.51, 256, 256))
	m100 = mt_makediff(c, cp1.blurfunction2, u=1, v=1)
	
	cp2 = mt_merge(cp1, blur1, MT_lutxy(m100, bp2, "x 128 - abs y 128 - abs - "+string(thresh)+" *", u=1, v=1).frfun7(0.51, 256, 256))
	m101 = mt_makediff(c, cp2.blurfunction2, u=1, v=1)
	
	cp3 = mt_merge(cp2, sharp2, MT_lutxy(m101, bp3, "x 128 - abs y 128 - abs - "+string(thresh)+" *", u=1, v=1).frfun7(0.51, 256, 256))
	m102 = mt_makediff(c, cp3.blurfunction2, u=1, v=1)
	
	cp4 = mt_merge(cp3, blur2, MT_lutxy(m102, bp4, "x 128 - abs y 128 - abs - "+string(thresh)+" *", u=1, v=1).frfun7(0.51, 256, 256))
	m103 = mt_makediff(c, cp4.blurfunction2, u=1, v=1)
	
	cp5 = mt_merge(cp4, blur3, MT_lutxy(m103, bp5, "x 128 - abs y 128 - abs - "+string(thresh)+" *", u=1, v=1).frfun7(0.51, 256, 256))
	m104 = mt_makediff(c, cp5.blurfunction, u=1, v=1)
	
	#cp6 = mt_merge(cp5, blur3, MT_lutxy(m100, bp2, "x 128 - abs y 128 - abs - "+string(thresh)+" *", u=1, v=1))
	#m105 = mt_makediff(c, cp2.blurfunction, u=1, v=1)
	
	
cp5}
Requires: limitedsharpenfaster, removegrain, removegrain HD, masktools 2, dctlimit. [edit] forgot to list frfun7.

This is here (development as opposed to usage) because, its slow, it causes artifacts sometimes, and because I am lazy and don't want to spend all of my time explaining how to make it work.

example script:
Code:
#source
ungibbs().ungibbs()
spline36resize(1280, 720)
Note that it will probably produce very ugly results if used on a source that is not, atleast, a little blurry.

example: processed, unprocessed

Last edited by *.mp4 guy; 7th February 2008 at 15:53.
*.mp4 guy is offline   Reply With Quote
Old 7th February 2008, 12:54   #2  |  Link
ankurs
N00B !
 
Join Date: Jun 2006
Posts: 223
L's nose seems a bit darker is that the effect of artefacts of being removed , did'nt get it to tell the truth , nice work thouh , will have to look into it , seems interesting
ankurs is offline   Reply With Quote
Old 7th February 2008, 15:52   #3  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,348
Quote:
Originally Posted by ankurs View Post
L's nose seems a bit darker is that the effect of artefacts of being removed , did'nt get it to tell the truth , nice work thouh , will have to look into it , seems interesting
The line(s) are darker because of the selective sharpening, via LSF, which is necessary to balance out the bluring. If no sharpening is used, the picture looks too soft/flat, even though the ringing removal is good at avoiding bluring lines.
*.mp4 guy is offline   Reply With Quote
Old 7th February 2008, 16:48   #4  |  Link
ankurs
N00B !
 
Join Date: Jun 2006
Posts: 223
Quote:
Originally Posted by *.mp4 guy View Post
The line(s) are darker because of the selective sharpening, via LSF, which is necessary to balance out the bluring. If no sharpening is used, the picture looks too soft/flat, even though the ringing removal is good at avoiding bluring lines.
yh i get you on that . temporal denoiser by didee/sagekilla is almost of the same perspective though , still have to test this , no time as of yet , will surely put in my contribution n test the thing out n probably also will compare em ( time n speeds ) and post the results .. nice concept though
ankurs is offline   Reply With Quote
Old 14th June 2015, 17:25   #5  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
I was looking at a good deringing filter but i couldn't find any (guess the footage from the phone is just crap with ringing all over the place). So i was trying yours:
Code:
	cp5 = mt_merge(cp4, blur3, MT_lutxy(m103, bp5, "x 128 - abs y 128 - abs - "+string(thresh)+" *", u=1, v=1).frfun7(0.51, 256, 256))
	m104 = mt_makediff(c, cp5.blurfunction, u=1, v=1)
	
	#cp6 = mt_merge(cp5, blur3, MT_lutxy(m100, bp2, "x 128 - abs y 128 - abs - "+string(thresh)+" *", u=1, v=1))
	#m105 = mt_makediff(c, cp2.blurfunction, u=1, v=1)
blurfunction should be blurfunction2 i guess?

I see that yours removes some deringing. Which parameters do i need to tune to make it much stronger?

Last edited by Wilbert; 14th June 2015 at 17:43.
Wilbert is offline   Reply With Quote
Old 14th June 2015, 17:33   #6  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
RemoveGrain mode 24 is designed specifically for ringing removal
feisty2 is offline   Reply With Quote
Old 14th June 2015, 17:45   #7  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
And nlmeans could do a cool dering if you just favor something other than removegrain
Here, knlmeanscl (d=0,a=24,s=0,h=7.2), greater "h"=stronger dering
feisty2 is offline   Reply With Quote
Old 16th June 2015, 23:15   #8  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
That server of images is a crap.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 18th June 2015, 06:30   #9  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,348
Quote:
Originally Posted by Overdrive80 View Post
That server of images is a crap.
There were fewer good image hosts back then. Also, some of the ones which are bad now used to be better. That said, I quite agree with you that it isn't very good.

General Information:

There are a lot of things that get lumped in as ringing, this particular filter was intended for use on the stuff that shows up on analog captures, that is why it has a lowpass filter derived blur function. The blur function is used to estimate how to treat various areas of the image, it is not ever applied to the output directly.

@Wilbert

blurfunction is probably a dependency I forgot to post (and no one used the function, so I never caught it). Replacing it with blurfunction2 should work acceptably. As far as strength goes, you just have to run it multiple times, it is an extremely brute force method, but at the time it was much better than anything else on the material it was written for.

If you care to post a sample of some kind I could probably dig up something much faster with similar or perhaps better quality. One of the main problems is that you really need to know what you're doing to set up deringing filters properly, which is why I haven't posted any besides this - they are too difficult to use and there is very little interest.
*.mp4 guy is offline   Reply With Quote
Old 26th October 2021, 19:37   #10  |  Link
Blankmedia
Registered User
 
Join Date: Oct 2011
Location: Dans le nord
Posts: 65
Hi, is this still a good way to remove Gibb's Noise? I can't find the DCTlimit pluggin and I don't know what it does. Thank you?
Blankmedia is offline   Reply With Quote
Old 26th October 2021, 23:51   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
I can't find the DCTlimit pluggin
https://forum.doom9.org/showthread.p...353#post953353

EDIT: And you'll need DctFilter:- http://avisynth.nl/index.php/Externa...tial_Denoisers
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 26th October 2021 at 23:54.
StainlessS is offline   Reply With Quote
Old 30th October 2021, 06:58   #12  |  Link
Blankmedia
Registered User
 
Join Date: Oct 2011
Location: Dans le nord
Posts: 65
Well thank you!
Blankmedia is offline   Reply With Quote
Old 2nd November 2021, 19:24   #13  |  Link
Blankmedia
Registered User
 
Join Date: Oct 2011
Location: Dans le nord
Posts: 65
Quote:
Originally Posted by StainlessS View Post
Well well well, dctfilter doesn't take offx and offy anymore and I don't know enough to make it works.

But thanks for sending me these!

Edit: I still don't know shit

But to make it work (i.e. stop giving me errors) in blurfunction 2 I changed

dctlimit(dct2=1.625[...]) for dctlimit(dct2=0.0625[...])

I picked 0.0625 because it seemed to be a recurring number in these functions.

In dfilter I reactivated the c.pointresize line while removing offx and offy in dctfilter and I pounded the c.dctfilter line.
Code:
function dfilter(clip c, int offx, int offy, float dc, float dct2, float dct3, float dct4, float dct5, float dct6, float dct7, float dct8) {
	c.PointResize(c.width,c.height,offx,offy,c.width,c.height).dctfilter(dc,dct2,dct3,dct4,dct5,dct6,dct7,dct8,chroma=0).PointResize(c.width,c.height,-offx,-offy,c.width,c.height)
	# c.dctfilter(dc,dct2,dct3,dct4,dct5,dct6,dct7,dct8,chroma=0)
}

Last edited by Blankmedia; 2nd November 2021 at 19:50.
Blankmedia is offline   Reply With Quote
Old 2nd November 2021, 20:07   #14  |  Link
Blankmedia
Registered User
 
Join Date: Oct 2011
Location: Dans le nord
Posts: 65
Well with the changes I made it doesn't give me good results.

But this one here seems to work for my needs. I put mode 27 instead of 17 because it's supposed to retain thin edges better.

Code:
### Gibbs Noise Block ###
function GibbsNoiseBlock( clip IN )
    {
    Edge=MT_Edge( IN, "prewitt", ThY1=20, ThY2=40).RemoveGrain(27) # RemoveGrain(17) 
    Mask=MT_Logic( Edge.MT_Expand().MT_Expand().MT_Expand().MT_Expand(),Edge.MT_Inflate().MT_Inpand(),"xor").Blur(1.0)
    MT_Merge( IN, Minblur( IN ), Mask, Luma = True)
    }
Egit: I don't know where I read that about mode 27, maybe I confused it with mode 26 that preserves corners but not thin lines.

Last edited by Blankmedia; 15th November 2021 at 21:43.
Blankmedia 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 09:08.


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