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 23rd January 2009, 20:29   #1  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
GradFun2DBmod [v1.5 - Update 2009/12/30]

Code:
########################################################################################
###                                                                                  ###
###                     GradFun2DB MOD : function GradFun2DBmod()                    ###
###                                                                                  ###
###                               v1.5 by "LaTo INV."                                ###
###                                                                                  ###
###                                30 December 2009                                  ###
###                                                                                  ###
########################################################################################
### 
### 
### /!\ Needed filters : Masktools (v2.0a36), Removegrain (v1.0PR),
### -------------------- GradFun2db (v1.0), AddGrainC(v1.4).
### 
###
### USAGE: GradFun2DBmod( thr, thrC, mode,
###                       str, strC, temp, adapt, custom,
###                       mask, radius, range,
###                       show, screenW, screenH ) 
###
###
### +--------+
### | DITHER |
### +--------+
###
### thr [default: 1.2]
### ------------------
### GradFun2DB "thr" parameter
###
### thrC [default: thr]
### -------------------
### GradFun2DB "thrC" parameter
###
### mode [default: 2]
### -----------------
### Mode for the addition of 16 pixels around the image
### 0 = Off                             [same as GradFun2DB]
### 1 = AddBorders  (speed:+ quality:-) [same as GradFunk]
### 2 = PointResize (speed:+ quality:+)
### 3 = Flip/Stack  (speed:- quality:+) [same as GradFunkMirror]
###
###
### +-------+
### | GRAIN |
### +-------+
###
### str [default: 0.8]
### ------------------
### AddGrainC "var" parameter
###
### strC [default: 0.0]
### -------------------
### AddGrainC "uvar" parameter
###
### temp [default: 50]
### ------------------
### Strength for temporal stabilization
### -1  = off
### 0   = nervous grain
### ..
### 100 = calm grain
### 
### adapt [default: 64]
### -------------------
### Threshold for luma-adaptative grain
### -1  = off
### 0   = source
### ..
### 255 = invert
###
### custom [default: "empty"]
### -------------------------
### Use your own grain generator instead of AddGrain
### (temp & adapt parameters are on, set -1 to turn off)
###
###
### +------+
### | MASK |
### +------+
###
### mask [default: true]
### --------------------
### Use adaptative deband mask 
### (dither/grain is only applied to areas with banding's susceptibility)
###
### radius [default: 2]
### -------------------
### Radius for the mask (1 is the fastest, 2-3 are slower)
### 
### range [default: 2]
### ------------------
### Range used in the mask (1-3 are good value)
###
###
### +-------+
### | DEBUG |
### +-------+
###
### show [default: false]
### ---------------------
### Show debug clip & informations
###
### screenW [default: 1280]
### -----------------------
### Screen horizontal resolution (for show clip)
###
### screenH [default: 1024]
### -----------------------
### Screen vertical resolution (for show clip)
###
########################################################################################

Update 2009.12.30 : GradFun2DBmod v1.5


v1.5:
added MOD4 restriction
changed script to accept MOD8 clip
updated documentation

v1.4:
changed "temp" parameter (-1=off)
updated documentation

v1.3:
replaced chroma parameter by thrC & strC

v1.2:
changed int->float for str parameter
added custom parameter

v1.1:
added show parameter
added small speed improvements
added warning for bad settings
fixed small bug with chroma=false

v1.0:
first public release


Quote:

Last edited by LaTo; 9th January 2010 at 08:57.
LaTo is offline   Reply With Quote
Old 23rd January 2009, 20:30   #2  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
A mix of Udeband / GradFunk with new features...

I will add screenshots later...
LaTo is offline   Reply With Quote
Old 23rd January 2009, 22:02   #3  |  Link
jase99
*nix
 
jase99's Avatar
 
Join Date: Feb 2008
Posts: 34
Wow, that was timely. Just what I was looking for. Thank you.
jase99 is offline   Reply With Quote
Old 23rd January 2009, 22:42   #4  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,685
I long for the days when we will no longer need dithering and have high enough color bit depth to remove banding all together.

Oh, and LaTo, what's this? You posting a script with no "show" parameter! Nah, it aint necessary but I got used to it. It's simple enough to implement my own source view.
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 24th January 2009, 07:10   #5  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by Merlin7777 View Post
I long for the days when we will no longer need dithering and have high enough color bit depth to remove banding all together.
Yes, this is clearly one of the biggest problems with DVD/Bluray (and others YV12 source)

Quote:
Originally Posted by Merlin7777 View Post
Oh, and LaTo, what's this? You posting a script with no "show" parameter! Nah, it aint necessary but I got used to it. It's simple enough to implement my own source view.


Maybe later, I haven't time these days...
LaTo is offline   Reply With Quote
Old 24th January 2009, 18:44   #6  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Update v1.1 - 2009/01/24

v1.1:
added show parameter
added small speed improvements
added warning for bad settings
fixed small bug with chroma=false


Omission is repaired

Last edited by LaTo; 24th January 2009 at 20:10.
LaTo is offline   Reply With Quote
Old 25th January 2009, 19:35   #7  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Please re-download the v1.1 because I made a mistake in the show function
LaTo is offline   Reply With Quote
Old 26th January 2009, 07:44   #8  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,685
Quote:
v1.1:
added show parameter
Haha!! Okay, now it's perfect! I have some anime that I can/need to test this on. If only I can find the time.
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 26th January 2009, 11:20   #9  |  Link
McCauley
Registered User
 
Join Date: Nov 2006
Posts: 83
Hi LaTo,

great script, thanks!
Would it be feasible to implement the possibility to call an external Grain Generator (=Grainfactory3) instead of AddGrain?

Regards
McCauley
McCauley is offline   Reply With Quote
Old 26th January 2009, 16:25   #10  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
Ctrl+F -> AddGrain -> Replace with your choice
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame.
Sagekilla is offline   Reply With Quote
Old 26th January 2009, 19:55   #11  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by McCauley View Post
Hi LaTo,

great script, thanks!
Would it be feasible to implement the possibility to call an external Grain Generator (=Grainfactory3) instead of AddGrain?

Regards
McCauley
Why not... I will add a switch between Addgrain & GrainFactory3 later.
LaTo is offline   Reply With Quote
Old 26th January 2009, 20:37   #12  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
You could do it as string "mygraingen" and use eval in the script. This way, you wouldn't need to add all the possible parameters in gradfun2dbmod. (+ more flexibility if the user wants to use a combination of filters, etc etc) mygraingen="grainfactory3(blabla).something else()"
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)
thetoof is offline   Reply With Quote
Old 26th January 2009, 21:25   #13  |  Link
McCauley
Registered User
 
Join Date: Nov 2006
Posts: 83
Quote:
Originally Posted by thetoof View Post
You could do it as string "mygraingen" and use eval in the script. This way, you wouldn't need to add all the possible parameters in gradfun2dbmod. (+ more flexibility if the user wants to use a combination of filters, etc etc) mygraingen="grainfactory3(blabla).something else()"
That's exactly what i had in mind, but i didn't really understand how to implement it with eval().

Regards
McCauley
McCauley is offline   Reply With Quote
Old 26th January 2009, 21:47   #14  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
One way you can do this is to make a helper function.

Code:
function EvalFunction(clip src, string "filter")
{
src
processed = Eval(filter)
return processed
}
It makes script writing easier too:
Code:
# Without the helper function you have to do this:
Avisource("..")
src = last
proc = src.SomeFiltering()

src
dither = Eval("Blur(1)")

# With the helper function you can do this:
Avisource("...")
src = last
proc = src.SomeFiltering()

dither = src.EvalFunction("Blur(1)")
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame.
Sagekilla is offline   Reply With Quote
Old 26th January 2009, 22:14   #15  |  Link
Codex0nz
Doom9 Lover
 
Join Date: Oct 2007
Location: New Zealand
Posts: 117
Wow took me a minute to see the difference without cheating by looking at the bottom, looks fantastic man.

So this filter mainly removes grainy sort of damage?

What program did you use to produce that shot for comparing, could save myself a lot of time if you're willing to care and share
__________________
Creativity is the birth of a new era, will you be creative also?
Codex0nz is offline   Reply With Quote
Old 26th January 2009, 22:21   #16  |  Link
Nightshiver
Quality Freak
 
Join Date: Jun 2007
Location: Area 52
Posts: 597
This filter is for debanding.....
Nightshiver is offline   Reply With Quote
Old 26th January 2009, 22:50   #17  |  Link
Codex0nz
Doom9 Lover
 
Join Date: Oct 2007
Location: New Zealand
Posts: 117
Quote:
Originally Posted by Nightshiver View Post
This filter is for debanding.....
In my defense its still tuesday morning here -_-

The banding is caused by grain though is it not? i'll shut up now...
__________________
Creativity is the birth of a new era, will you be creative also?
Codex0nz is offline   Reply With Quote
Old 26th January 2009, 23:46   #18  |  Link
Nightshiver
Quality Freak
 
Join Date: Jun 2007
Location: Area 52
Posts: 597
No, not always. Grain is sometimes put in movies to cover up banding. It is also caused by bad color gradients/color. In his example picture, there was practically no grain.
Nightshiver is offline   Reply With Quote
Old 27th January 2009, 02:00   #19  |  Link
Sapo84
Registered User
 
Join Date: May 2008
Posts: 41
I think str parameter should be float (it is float in addgrain).
Otherwise it's really a good script, I tried it on some anime clips and it works very well, a lot better than a simple GradFun2DB.
The only problem is that anime shouldn't really have any grain so the default parameters need a little bit of tweaking (supersampling may help too).
Sapo84 is offline   Reply With Quote
Old 28th January 2009, 16:51   #20  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Update 2009/01/28 - v1.2

v1.2:
changed int->float for str parameter
added custom parameter

Last edited by LaTo; 28th January 2009 at 17:19.
LaTo 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 08:39.


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