View Full Version : GradFun2DBmod [v1.5 - Update 2009/12/30]
markanini
15th December 2009, 11:23
LaTo, could you suggest some settings for a deblocking type effect?
LaTo
15th December 2009, 21:24
Could you explain what "adapt" does? When I set adapt to high values, I see more noise on brighter areas than darker areas. Setting adapt to low values, I see more noise on darker areas than brighter areas.
Yes it's true, this parameter adapts the strength of the grain depending on the brightness.
The goal is to be as close to reality and to reproduce natural film grain.
I think that adapt=64 is a good value, but it also dependent of the source... Pick the best value for your eyes ;)
Would the settings you mentioned above be an adequate replacement for deband? Is there a setting that provides in your opinion better image quality with a similar performance impact? Awesome work man.
GradFun2DBmod is particularly designed for encode to remove and/or prevent banding.
However you can use it in realtime, the quality will be better but it is slower... It's a tradeoff, I think that the ffdshow deband is faster and good enough for only viewing.
could you suggest some settings for a deblocking type effect?
Never used for deblocking, but set mask=false and increase gradually thr/str parameters until blocks disappear.
rkalwaitis
16th December 2009, 13:35
Thanks for the update Lato.
Dogway
29th December 2009, 02:16
The filter only works in certain points of the filter chain. I dont know if Im doing something wrong. Here is an example where it doesnt work for me:
ffmpegsource("whatever.mp4")
trim(0, 900)
Tweak(sat=1.2, coring=false)
Levels(4, 0.96, 242, 0, 255, coring=false)
tnlmeans(ax=4,ay=4,az=10,sx=2,sy=2,bx=1,by=1,sse=false)
# GradFun2DBmod(thr=1.6,thrC=1.2,str=0,strC=0,radius=3,range=3,mode=2,temp=-1,mask=true,adapt=64) #here it works
Lanczos4Resize(858, 482)
ttempsmooth(maxr=7)
AddBorders(4,2,4,2,color=$000000)
mfToon(strength=0, sharpen=true, cwarp=false, wdepth=15, wblur=1, wthresh=0.5)
LimitedSharpenFaster(Smode=4, strength=20, edgemode=1, soft=-1)
Crop(6, 2, -6, -4)
GradFun2DBmod(thr=1.6,thrC=1.2,str=0,strC=0,radius=3,range=3,mode=2,temp=-1,mask=true,adapt=64) # here it has no effect
Although if I place it just before the resizer it does work. Its strange... And its not only in a certain video, it happens in others as well.
Stephen R. Savage
29th December 2009, 03:41
GradFun2DB, which is the key filter underlying all of GradFun2DBmod, fails silently if the input width is not divisible by 8. After cropping, you have a width of 846, which is not divisible by 8 (nor by 4). What should be done is that the mirroring stage of GradFun2DBmod be changed to pad to a mod8 width.
Alternatively, you could crop/resize to width 840 or 848 instead of 846.
Edit: I missed the AddBorders call. The width in that script is 860, so the point still stands.
LaTo
29th December 2009, 08:34
GradFun2DB, which is the key filter underlying all of GradFun2DBmod, fails silently if the input width is not divisible by 8. After cropping, you have a width of 846, which is not divisible by 8 (nor by 4). What should be done is that the mirroring stage of GradFun2DBmod be changed to pad to a mod8 width.
Alternatively, you could crop/resize to width 840 or 848 instead of 846.
Arf, I will add a warning in GF2DBmod :thanks:
LaTo
29th December 2009, 09:03
v1.5:
added MOD4 restriction
changed script to accept MOD8 clip
updated documentation
:)
Stephen R. Savage
29th December 2009, 16:51
That is unnecessary. Enabling GradFun2DBmod to work on mod2 and mod4 (width) video is as simple as a two line fix. Also, I think GF_Padding is the only edge protection mode necessary. It offers better performance than GF_Mirrors at the corners while still being faster. GF_Borders doesn't actually work (no dithering across sharp black edge), so it doesn't fit either.
Function GF_Padding(clip clp, float thr, float thrC)
{
ow = clp.width
oh = clp.height
w = int(round(ow/8.0)*8) + 32
h = CLP.height() + 32
RDY = CLP.pointresize(w,h,-16,-16,w,h)
LUM = RDY.gradfun2db(thr).Crop(16,16,ow,oh)
CHR = RDY.gradfun2db(thrC).Crop(16,16,ow,oh)
GFP = thr==1.0 && thrC==1.0 ? CLP
\ : thr==thrC ? LUM
\ : thr!=1.0 && thrC==1.0 ? LUM.mergechroma(CLP)
\ : thr==1.0 && thrC!=1.0 ? CLP.mergechroma(CHR)
\ : LUM.mergechroma(CHR)
Return GFP
}
I think this can be worked into the other modes, but I'll leave that for you to do.
Dogway
30th December 2009, 03:43
Thank you Stephen. I spent a lot of time trying to figure out.
Being mod 8 isn't too strict? limiting to 848 pixels width either messes up the AR, or I have to crop 3 pixels each side.
I normaly prefer pixel to pixel sampling with no scaling involved, I wouldn't mind encoding anamorphic unless desktop divx players respect custom AR(?)(ie. 848x480 vs 720x480)
sorry for the offtopic bit.
LaTo
30th December 2009, 11:05
That is unnecessary. Enabling GradFun2DBmod to work on mod2 and mod4 (width) video is as simple as a two line fix.
Yes, you're right indeed... So, now it accepts mod4 input.
Also, I think GF_Padding is the only edge protection mode necessary. It offers better performance than GF_Mirrors at the corners while still being faster. GF_Borders doesn't actually work (no dithering across sharp black edge), so it doesn't fit either.
Yes, it's why GF_Padding (mode=2) is the default mode ;)
/!\ I HAVE UPDATED THE SCRIPT FOR MOD4 INPUT
YOU SHOULD DOWNLOAD AGAIN THE V1.5 /!\
kool
28th January 2010, 11:53
Hi LaTo, thanks for this wonderful script, my first time using it, need your suggestion. Here (http://www.sendspace.com/file/7c23ty) is small clip of source, I have tried with
MCTemporalDenoise(settings="medium")
GradFun2DBmod()
What will be your suggestion here?
LaTo
28th January 2010, 12:33
Hi LaTo, thanks for this wonderful script, my first time using it, need your suggestion. Here (http://www.sendspace.com/file/7c23ty) is small clip of source, I have tried with
MCTemporalDenoise(settings="medium")
GradFun2DBmod()
What will be your suggestion here?
GradFun2DBmod is integrated in MCTemporalDenoise, so you should see "enhance" option instead (faster)...
kool
28th January 2010, 12:53
ah, That is why my encoding was slow :p. Would you suggest to use MCTemporalDenoise(settings="medium") and I will get GradFun2DBmod to work with defaults, or I should touch any params?
If I want to make some changes to GradFun2DBmod, how I would do that with MCTemporalDenoise, and what are the most important param to play with?
Thanks in advance.
LaTo
28th January 2010, 14:16
ah, That is why my encoding was slow :p. Would you suggest to use MCTemporalDenoise(settings="medium") and I will get GradFun2DBmod to work with defaults, or I should touch any params?
If I want to make some changes to GradFun2DBmod, how I would do that with MCTemporalDenoise, and what are the most important param to play with?
Thanks in advance.
It's in the .avsi of MCTemporalDenoise:
### +---------+
### | ENHANCE |
### +---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
### | enhance : Enable GradFun2DBmod post processing to enhance flat areas (may avoid banding & blocking when encoding too) |
### | GFthr : Gradfun2db threshold [1.0=off,...] |
### | AGstr : AddGrain strength [0.0=off,...] |
### | bias : Brightness bias for adaptative grain mask (the higher, the less grain in dark areas & the more grain in bright areas) [-1=off,0=input,1...254,255=invert] |
### | temp : Temporal stabilization for grain (the higher, the more calm) [0=nervous,...,100=static] |
### +---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Dogway
6th February 2011, 12:54
One year since last post, but I think it might be for good on the filter.
Its actually 2 things. Im having some ghosting problems on an anime source. Its in the sides of black strokes in a fast motion scene, I discarded mask, radius,mode.... I can upload example if you want.
The second one is more a petition, since this dither is going to be encoded in some way, it will mostly convert into annoying blocking. Maybe it could better fit a film grain type of noise rather than the actual small random pixels, but I know that that doesn't depend on you since gradfun calls addgrain, but maybe adding the grain size parameter could help.
egrimisu
12th February 2011, 01:35
why addgrain and not grainfactroy3? grainfactory seems more nice.
Dogway
12th February 2011, 16:44
my bad, I just discovered grainfactory3 in the first page :o Im trying to pass it through mask=true, does it work?
SilaSurfer
12th February 2011, 17:01
With mask=true you are dihtering parts where there is susceptibility that banding will occur. Why use GrainFactory's silver grain affect only in those areas, when in my opinion should be used in whole picture since it really fools your eyes that there is more detail in it.
Dogway
12th February 2011, 18:46
Why bother dithering if compression will band it again? Answer would be, use a better/different dithering or use a better/different compressor. Well, at the moment I'm looking at the first, to use grainfactory for dithering, since my target is grain free anime.
Nekomander
25th April 2011, 07:36
any suggestion/s with this? the source itself has banding issues.
http://i.imgur.com/SdvzWs.jpg (http://i.imgur.com/SdvzW.jpg)
source: here (http://www.megaupload.com/?d=ORDS0RR1) or here (http://www.mediafire.com/?rrhwddajdg7nnc5)
Vitaliy Gorbatenko
26th April 2011, 03:48
Source practically perfect. Nothing you can do with it.
Nekomander
27th April 2011, 04:51
if you look closely (bottom right) theres banding. i just can't figure out a way to get rid of it without taking away too much details.
Vitaliy Gorbatenko
27th April 2011, 11:52
You want to disguise the noise using for this? By smoothing you get nothing, when coding, since color space contains only 8 bits.
Nekomander
27th April 2011, 13:03
i just want to remove the artifact and have a result from this>
http://img124.imageshack.us/img124/3313/broken21db.png
to this>
http://img124.imageshack.us/img124/9458/source24az.png
Vitaliy Gorbatenko
28th April 2011, 05:45
Then you need to store videos in lossless format. I'll say it again - can not save the video in h264 or divx and have the picture without this artifact. All you can do - to mask its noise and no more.
cretindesalpes
28th April 2011, 12:46
The picture is perfectly colorbanding-free in YV12 colorspace. The culprit is the final YUV to RGB converter in your player. See the difference:
AVCSource ("00005.dga")
Interleave (ConvertToRGB24 ().Subtitle ("ConvertToRGB24"),
\ yv12torgb24hq () .Subtitle ("yv12torgb24hq"))
To achieve a better result, all you have to do is just adding a bit of noise. This will smooth the steps created by the RGB conversion.
AddGrainC (var=1.2, uvar=1.2)
If adding noise makes your encode too big or too noisy, try this instead:
GradFun3 (thr=0.35, ampo=2.0)
Edit : typo
Nekomander
29th April 2011, 07:11
true. switched back to my usual renderer (madvr) and it was flawless, not so with evr custom. thanks for the script/s :)
DeNeDe
17th June 2013, 09:58
hey guys,i'm trying to use this script, but can't make Megui to load it. everytime it says that "Object reference is not set to an instance of an object"
the script that i use is:
LoadPlugin("C:\Users\DeNeDe\Downloads\MeGUI_2356_x86\tools\avs\directshowsource.dll")
DirectShowSource("C:\Users\DeNeDe\Downloads\RDG_2.ts", fps=29.970, audio=false, convertfps=true).AssumeFPS(30000,1001)
#deinterlace
#crop
LanczosResize(1280,720) # Lanczos (Sharp)
#denoise
#Trim
Trim(420, 8361) ++ Trim(10160, 21338) ++ Trim(23137, 48371) ++ Trim(50170, 50768)
ConvertToYV12()
#Debanding
Import("C:\Program Files (x86)\AviSynth 2.5\plugins\GradFun2DBmod.v1.5.avsi")
GradFun2DBmod(thr=3,str=0,mask=false)
and the plugins directory from avisynth looks like this
http://i.imgur.com/jNMVQV4.png
stax76
3rd November 2019, 17:31
Maybe somebody can help me with this error.
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\AddGrainC\AddGrainC.dll")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\Average\Average.dll")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\AVS\DCTFilter\DCTFilter.dll")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\AVS\Deblock\Deblock.dll")
Import("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\Deblock_QED\Deblock_QED.avsi")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\DFTTest\dfttest.dll")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\EEDI2\EEDI2.dll")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\FFT3DFilter\fft3dfilter.dll")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\FFT3DGPU\FFT3dGPU.dll")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\AVS\GradFun2DB\gradfun2db.dll")
Import("D:\Projekte\VB\staxrip\bin\Apps\Plugins\AVS\GradFun2DB\GradFun2DBmod.avsi")
Import("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\LSFmod\LSFmod.avsi")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\masktools2\masktools2.dll")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\mvtools2\mvtools2.dll")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\RgTools\RgTools.dll")
LoadPlugin("D:\Projekte\VB\staxrip\bin\Apps\Plugins\both\ffms2\ffms2.dll")
Import("D:\Projekte\VB\staxrip\bin\Apps\Plugins\avs\MCTemporalDenoise\MCTemporalDenoise.avsi")
FFVideoSource("D:\Samples\Test.mkv", cachefile="D:\Samples\Test_temp\Test.ffindex")
MCTemporalDenoise(settings="medium")
Script Error
Script error: expected "val", "bool", "int", "float", "string", "array", or "clip"
(D:\Projekte\VB\staxrip\bin\Apps\Plugins\AVS\GradFun2DB\GradFun2DBmod.avsi, line 137, column 0)
(D:\Samples\Test_temp\Test_new.avs, line 11)
AddGrainC 1.7.1
Average 0.94
DCTFilter 0.5.0
Deblock 2013-12-03
Deblock_QED 2011-11-29
DFTTest -
EEDI2 0.9.2.0
FFT3DFilter 2.6.7
FFT3DGPU 0.8.2.0
GradFun2DB 2010-03-29
GradFun2DBmod 1.5
LSFmod 1.9
masktools2 2.2.18
mvtools2 2.7.41
RgTools 0.98
ffms2 2019-08-30 StvG
MCTemporalDenoise 1.4.20
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.