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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st December 2005, 04:50   #21  |  Link
Razorholt
Cyberspace Citizen
 
Razorholt's Avatar
 
Join Date: Nov 2005
Posts: 457
I think I have a great combinaison of filters here. Although I'm not sure about the order...


Quote:
SPresso(2,33,4)
DeGrainMedian(limitY=5,limitUV=7,mode=1)
Undot()
Unfilter(-5,-5)
BilinearResize(800,448)
Razorholt is offline   Reply With Quote
Old 24th August 2006, 08:54   #22  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
Quote:
Originally Posted by Didée
May I hop in with a small function?

SPresso() is one I use a lot (mostly for internal processing within more complex functions), but it also deals very well as a standalone.

(It doesn't matter if you like caffeine or not (I do) - SPresso stands for Spatial Pressdown.)

On my usual, usual-noisy DVB sources, compression gain usually is from 2% to 3% (light settings -> changes almost invisible) up to 10 to 12% (stronger settings -> slight, gentle softening, not very obvious).

Format:

SPresso( limit, bias, [RGmode] )

"limit" tells the maximum change to do to any pixel
"bias" is, well, something like "aggessivity": '20' is a very light setting, '33' is already quite strong.
"RGmode" tells the RemoveGrain mode to use. The default of "4" is the best in most cases.

Posting screenshots makes not much sense, because there is so little difference to see. So just try it. Needed are MaskTools and RemoveGrain.


Code:
function SPresso(clip clp, int "limit", int "bias", int "RGmode")
{
limit  = default( limit,  2 )
bias   = default( bias,  25 )
RGmode = default( RGmode, 4 )

LIM1  = (limit>0) ? string( round(limit*100.0/bias-1.0) ) : string( round(100.0/bias) )
LIM2  = (limit<0) ? "1" : string(limit)
BIA   = string(bias)

expr  = (limit<0) ?   "x y - abs "+LIM1+" < x x 1 x y - x y - abs / * - ?"
 \                :   "x y = x x "+LIM1+" + y < x "+LIM2+" + x "+LIM1+" - y > x "+LIM2+" - " \ 
                    + "x 100 "+BIA+" - * y "+BIA+" * + 100 / ? ? ?"

yv12lutxy( clp, clp.removegrain(RGmode,-1), expr, U=2,V=2)
}
Note: Chroma is not touched at all. Spresso works only on the luma channel. Could be changed easily, however.

BTW: For those prefering tee over coffe, there's also a "TPresso" counterpart ... I just don't have it with me at the moment.
Could you please make a Spresso for Chroma.
Owen says that the Noise is mostly in Chroma, and I use HQDN3D(0.0, 2.0, 0.0, 4.0) so Chroma is affected but not Luma.
It would sure be nice if you could make a Spresso for Chroma only.

Jeremy Duncan is offline   Reply With Quote
Old 24th August 2006, 11:09   #23  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Supposely this "reduced-medianfilter" method isn't so awfully effective for removing chroma noise. Temporal filters should be a better choice here.

But, for what it's worth, here's SPresso extended to work on either luma, chroma, or both:

( EDIT 2006-09-04: corrected a BIG bug.)
Code:
function SPresso(clip clp, int "limit", int "bias", int "RGmode", int "limitC", int "biasC", int "RGmodeC")
{
limit   = default( limit,   2 )
limitC  = default( limitC,  4 )
bias    = default( bias,   25 )
biasC   = default( biasC,  50 )
RGmode  = default( RGmode,  4 )
RGmodeC = default( RGmodeC, 0 )

yy = (RGmode ==0) ? 2 : 3
uv = (RGmodeC==0) ? 2 : 3
LIM1  = (limit>0) ? string( round(limit*100.0/bias-1.0) ) : string( round(100.0/bias) )
LIM2  = (limit<0) ? "1" : string(limit)
BIA   = string(bias)
LIM1c = (limitC>0) ? string( round(limitC*100.0/biasC-1.0) ) : string( round(100.0/biasC) )
LIM2c = (limitC<0) ? "1" : string(limitC)
BIAc  = string(biasC)

expr  = (limit<0) ?   "x y - abs "+LIM1+" < x x 1 x y - x y - abs / * - ?"
 \                :   "x y - abs 0 <= x x "+LIM1+" + y < x "+LIM2+" + x "+LIM1+" - y > x "+LIM2+" - " \ 
                    + "x 100 "+BIA+" - * y "+BIA+" * + 100 / ? ? ?"
exprC = (limit<0) ?   "x y - abs "+LIM1c+" < x x 1 x y - x y - abs / * - ?"
 \                :   "x y - abs 0 <= x x "+LIM1c+" + y < x "+LIM2c+" + x "+LIM1c+" - y > x "+LIM2c+" - " \ 
                    + "x 100 "+BIAc+" - * y "+BIAc+" * + 100 / ? ? ?"

# For (old) MaskTools v1.5.8 :
# yv12lutxy( clp, clp.removegrain(RGmode,RGmodeC), expr,exprC,exprC, Y=yy,U=uv,V=uv)

# For (new) MaskTools v2.x :
mt_lutxy( clp, clp.removegrain(RGmode,RGmodeC), yexpr=expr,uexpr=exprC,vexpr=exprC, Y=yy,U=uv,V=uv)

return( last )
}
Per default, chroma still is not processed, just passed through. To also process chroma, call SPresso() with "RGmodeC=4" (or 19, or 20). To not process luma, set "RGmode=0".
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 4th September 2006 at 01:58.
Didée is offline   Reply With Quote
Old 24th August 2006, 12:52   #24  |  Link
frednerk33
Registered User
 
Join Date: Jan 2006
Posts: 25
Sorry, Spresso is mentioned in a LimitedSharpen thread, http://forum.doom9.org/showthread.ph...137#post867137 but can some kind soul point me to an explanation of what Spresso does and when to apply it ? Jeremy's link http://forum.doom9.org/showthread.ph...137#post867137 has the some flash-looking code. ... but I'm unsure what is it that SPresso is meant to do and why. It seems to be used in the context of noise filtering ?

Last edited by frednerk33; 24th August 2006 at 12:55.
frednerk33 is offline   Reply With Quote
Old 24th August 2006, 12:54   #25  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
Thank you very much.

Last edited by Jeremy Duncan; 24th August 2006 at 21:50.
Jeremy Duncan is offline   Reply With Quote
Old 24th August 2006, 19:11   #26  |  Link
n3w813
Registered User
 
Join Date: Jan 2006
Posts: 80
So the new call with chorma processing only would be....

SPresso(0, 0, 0, 4, 50, 4)

Right?
n3w813 is offline   Reply With Quote
Old 24th August 2006, 21:52   #27  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
Quote:
Originally Posted by n3w813
So the new call with chorma processing only would be....

SPresso(0, 0, 0, 4, 50, 4)

Right?
The bolded parts are Chroma.

SPresso(0, 4, 0, 40, 1, 17)
Jeremy Duncan is offline   Reply With Quote
Old 24th August 2006, 22:01   #28  |  Link
n3w813
Registered User
 
Join Date: Jan 2006
Posts: 80
Quote:
Originally Posted by Jeremy Duncan
The bolded parts are Chroma.

SPresso(0, 4, 0, 40, 1, 17)
Are you sure...in the script it shows....

function SPresso(clip clp, int "limit", int "bias", int "RGmode", int "limitC", int "biasC", int "RGmodeC")

the variables with 'C' are the chroma settings right?

Last edited by n3w813; 24th August 2006 at 22:04.
n3w813 is offline   Reply With Quote
Old 24th August 2006, 22:05   #29  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
Quote:
Originally Posted by n3w813
Are you sure...in the script it shows....

function SPresso(clip clp, int "limit", int "bias", int "RGmode", int "limitC", int "biasC", int "RGmodeC")

the variables with 'C' are the chroma settings right?
The Bolded are the Chroma.

limit = default( limit, 2 )
limitC = default( limitC, 4 )
bias = default( bias, 25 )
biasC = default( biasC, 50 )
RGmode = default( RGmode, 4 )
RGmodeC = default( RGmodeC, 0 )

SPresso(0, 4, 0, 40, 1, 17)
Jeremy Duncan is offline   Reply With Quote
Old 24th August 2006, 22:22   #30  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
NO NO NO, it's the order in the function definition that's important, and this is a good time to reiterate:

Don't call functions with bare arguments, use names, never worry about the order.

Otherwise it happens all the time, you upgrade a dll or script and the video turns green and looks vertically blurred, or whatever, because the order of arguments changed. Or an argument was swapped out with one with an entirely different meaning. Named optional arguments are one of the biggest conveniences of avisynth; even if the calls get wider they get much more understandable.

Btw, SPresso is essentially what SeeSaw does when you supply no denoised argument, right? (Its effect is that high freqency noise is smoothed out somewhat, though I'm not entirely sure of the details; a quick n' dirty one.)

Last edited by foxyshadis; 24th August 2006 at 22:25.
foxyshadis is offline   Reply With Quote
Old 24th August 2006, 22:42   #31  |  Link
n3w813
Registered User
 
Join Date: Jan 2006
Posts: 80
Quote:
Originally Posted by foxyshadis

Don't call functions with bare arguments, use names, never worry about the order.
So.....if using MT......
MT("SPresso(limit=0, bias=0, RGmode=0, limitC=4, biasC=50, RGmodeC=4)",3)

Sorry, I'm a REAL n3w813 when it comes to avisynth scripts. :P
n3w813 is offline   Reply With Quote
Old 25th August 2006, 00:17   #32  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Either order will work just fine now; the precise values are open to taste.
foxyshadis is offline   Reply With Quote
Old 25th August 2006, 13:42   #33  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
Quote:
Originally Posted by n3w813
So.....if using MT......
MT("SPresso(limit=0, bias=0, RGmode=0, limitC=4, biasC=50, RGmodeC=4)",3)

Sorry, I'm a REAL n3w813 when it comes to avisynth scripts. :P
Code:
MT("SPresso(limit=0, limitC=4, bias=0, biasC=40, RGmode=1, RGmodeC=17)",3)
The colors will be messed up if you don't use at least #1 on RGmode.
I've bolded in the quote the setting that needs to be at least # 1.
Jeremy Duncan is offline   Reply With Quote
Old 25th August 2006, 20:08   #34  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
RGMode=0 should mean that luma is simply copied as it is - it shouldn't do anything to the colors. If it does, there's something wrong in Didée's function.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 25th August 2006, 20:37   #35  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
Quote:
Originally Posted by Boulder
RGMode=0 should mean that luma is simply copied as it is - it shouldn't do anything to the colors. If it does, there's something wrong in Didée's function.
Using this code;
Code:
SPresso(limit=0, limitC=4, bias=0, biasC=40, RGmode=1, RGmodeC=17)
And setting RGmode=0, the colors go way off. It's very ugly.
Jeremy Duncan is offline   Reply With Quote
Old 25th August 2006, 20:49   #36  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
I can't reproduce that. There's nothing wrong in the function, as far as I can see, and RGmode=0 / limit=0 works fine for me.


@ foxyshadis

Lol, good description of might happen. You forgot "video might start playing backwards".

Quote:
Originally Posted by foxyshadis
Btw, SPresso is essentially what SeeSaw does when you supply no denoised argument, right? (Its effect is that high freqency noise is smoothed out somewhat, though I'm not entirely sure of the details; a quick n' dirty one.)
Yes, it's the same principle, only that SPresso's defaults are weaker. In SeeSaw, it's stronger because of the "indirect processing" that is done ... the denoising can be stronger, because more denoising only means there will be less detail (and thereby less artefacts) that will be sharpened.

Generally, Spresso is just a limited Removegrain(4). Put in words, SPresso(RGmode=4,bias=25,limit=2) reads:

"Apply 25% of RemoveGrain(4), with a maximum pixelchange of +/- 2".
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 25th August 2006 at 20:52.
Didée is offline   Reply With Quote
Old 25th August 2006, 21:10   #37  |  Link
BigDid
Actually in reserve
 
Join Date: Oct 2004
Posts: 1,605
Quote:
Originally Posted by Didée
... Generally, Spresso is just a limited Removegrain(4). Put in words, SPresso(RGmode=4,bias=25,limit=2) reads:

"Apply 25% of RemoveGrain(4), with a maximum pixelchange of +/- 2".
Thanks, crystal clear.

I really need to learn scripting more

Did
__________________
Having a problem with AutoGK? Read & use the FAQ & MORE FAQ first
Want to exchange on AutoGK? try doom10.org
In reserve (inactive) for an undefined period of time.
BigDid is offline   Reply With Quote
Old 26th August 2006, 01:27   #38  |  Link
frednerk33
Registered User
 
Join Date: Jan 2006
Posts: 25
Quote:
Originally Posted by Didée
Yes, it's the same principle, only that SPresso's defaults are weaker. In SeeSaw, it's stronger because of the "indirect processing" that is done ... the denoising can be stronger, because more denoising only means there will be less detail (and thereby less artefacts) that will be sharpened.

Generally, Spresso is just a limited Removegrain(4). Put in words, SPresso(RGmode=4,bias=25,limit=2) reads:

"Apply 25% of RemoveGrain(4), with a maximum pixelchange of +/- 2".
Teriffic, thanks for the clarfication.
frednerk33 is offline   Reply With Quote
Old 4th September 2006, 01:22   #39  |  Link
Jeremy Duncan
Didée Fan
 
Jeremy Duncan's Avatar
 
Join Date: Feb 2006
Location: Canada
Posts: 1,079
Quote:
Originally Posted by foxyshadis
I just thought I'd point out that this spresso suffers the same problem as the old deblock_qed, with a couple of incorrect = signs in the lut expr. (Should be ==.)
Is this the correct code ?

Code:
function SPresso(clip clp, int "limit", int "bias", int "RGmode", int "limitC", int "biasC", int "RGmodeC")
{
limit   = default( limit,   2 )
limitC  = default( limitC,  4 )
bias	= default( bias,   25 )
biasC   = default( biasC,  50 )
RGmode  = default( RGmode,  4 )
RGmodeC = default( RGmodeC, 0 )

yy = (RGmode ==0) ? 2 : 3
uv = (RGmodeC==0) ? 2 : 3
LIM1  = (limit>0) ? string( round(limit*100.0/bias-1.0) ) : string( round(100.0/bias) )
LIM2  = (limit<0) ? "1" : string(limit)
BIA   = string(bias)
LIM1c = (limitC>0) ? string( round(limitC*100.0/biasC-1.0) ) : string( round(100.0/biasC) )
LIM2c = (limitC<0) ? "1" : string(limitC)
BIAc  = string(biasC)

expr  = (limit<0) ?   "x y - abs "+LIM1+" < x x 1 x y - x y - abs / * - ?"
 \				:   "x y == x x "+LIM1+" + y < x "+LIM2+" + x "+LIM1+" - y > x "+LIM2+" - " \ 
					+ "x 100 "+BIA+" - * y "+BIA+" * + 100 / ? ? ?"
exprC = (limit<0) ?   "x y - abs "+LIM1c+" < x x 1 x y - x y - abs / * - ?"
 \				:   "x y == x x "+LIM1c+" + y < x "+LIM2c+" + x "+LIM1c+" - y > x "+LIM2c+" - " \ 
					+ "x 100 "+BIAc+" - * y "+BIAc+" * + 100 / ? ? ?"

# For (old) MaskTools v1.5.8 :
# yv12lutxy( clp, clp.removegrain(RGmode,RGmodeC), expr,exprC,exprC, Y=yy,U=uv,V=uv)

# For (new) MaskTools v2.x :
mt_lutxy( clp, clp.removegrain(RGmode,RGmodeC), yexpr=expr,uexpr=exprC,vexpr=exprC, Y=yy,U=uv,V=uv)

return( last )
}
Jeremy Duncan is offline   Reply With Quote
Old 4th September 2006, 01:56   #40  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Not bad. But I prefer the one some posts above.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Reply


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


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