Log in

View Full Version : SmoothLevels [depreciated version, see SmoothAdjust]


Pages : 1 [2]

LaTo
26th November 2008, 11:37
v1.00:
first stable release
optimized limiting code (faster and less rounding error)
added new parameters for limiting (Ecenter,Ecurve)
changed strength parameter for 2 others (DarkSTR & BrightSTR)
changed code of protect option (hard->soft threshold)

:devil:

zee944
14th December 2008, 16:37
LaTo, I've probably discovered a bug. Both SmoothLevels(gamma=1.0, Lmode=1, DarkSTR=250, BrightSTR=250) and LimitedGamma2(gamma=1.0,dark_str=250,bright_str=250) create black dots on white surfaces around edges.

These pixels are pure whites (255, 255, 255) originally (looking them at in RGB colorspace), but not all of them becomes black. (Perhaps a rounding error?)


http://i179.photobucket.com/albums/w286/zee944/LimitedGamma_bug_default.jpg
http://i179.photobucket.com/albums/w286/zee944/LimitedGamma_bug_processed.jpg

LaTo
14th December 2008, 17:37
LaTo, I've probably discovered a bug. Both SmoothLevels(gamma=1.0, Lmode=1, DarkSTR=250, BrightSTR=250) and LimitedGamma2(gamma=1.0,dark_str=250,bright_str=250) create black dots on white surfaces around edges.

I tried with your original image:
ImageSource("LimitedGamma_bug_default.jpg").ConvertToYV12()

#SmoothLevels(gamma=1.0, Lmode=1, DarkSTR=250, BrightSTR=250)
LimitedGamma2(gamma=1.0,dark_str=250,bright_str=250)
But I can't reproduce the same result, no problem on my side...

Please post your script & a sample ;)

EDIT: Be sure that MaskTools is up-to-date (v2.0a35) and use the good .dll (mt_masktools-25.dll)

zee944
15th December 2008, 09:35
EDIT: Be sure that MaskTools is up-to-date (v2.0a35) and use the good .dll (mt_masktools-25.dll)

Damn! I checked mt_masktools.dll but forgot to check MaskTools.dll. I used an ancient one. Anyway... sorry :o

zee944
20th December 2008, 20:03
Please post your script & a sample ;)

EDIT: Be sure that MaskTools is up-to-date (v2.0a35) and use the good .dll (mt_masktools-25.dll)

I hope I won't make a fool of myself again, but after replacing mt_masktools with the latest version, I still have the same problem.

It seems it depends on source. Your script with ImageSource() works fine. But loading the original .D2V/.M2V file (taken from a DVD), the black dots appear again.

I use AviSynth 2.5.7. The filters seem fine too, they're all the needed versions:

mt_masktools-25[2.0a35].dll .................. 2008.04.19 11:02 ...... 724,992 bytes
gradfun2db[1.0].dll ................................. 2006.03.15 21:49 ...... 61,440 bytes
SmoothLevels.v1.00.avsi ....................... 2008.12.14 15:57 ...... 20,313 bytes
RemoveGrain[1.0].dll ............................. 2005.07.31 23:07 ...... 27,648 bytes

My script:
LoadPlugin("mt_masktools-25[2.0a35].dll")
LoadPlugin("gradfun2db[1.0].dll")
Import("SmoothLevels.v1.00.avsi")
LoadPlugin("RemoveGrain[1.0].dll")

MPEG2Source("TD_Joy_Sales_sample.d2v")
ConvertToYV12()

SmoothLevels(gamma=1.2, Lmode=1, DarkSTR=250, BrightSTR=250)

My video sample (3.8 Mbytes): http://www.badongo.com/file/12571008

What's wrong? :confused:

LaTo
22nd December 2008, 09:43
I hope I won't make a fool of myself again, but after replacing mt_masktools with the latest version, I still have the same problem.
What's wrong? :confused:
I found the bug... Fixed in the next version :p

LaTo
22nd December 2008, 18:27
v1.01:
fixed a bug in Lmode=1&3 (pi approx)

:devil:

thetoof
25th December 2008, 11:20
Hey,
Just wanted to say thanks for this nice little script! Works like wonders, especially since the first stable release. (darkstr & brightstr = ^_^)

rkalwaitis
25th January 2009, 17:40
Lato I looked through the script you made and I can not find the presets that everyone is mentioning ie pc2tv.....

Where am I not looking?

rkalwaitis
25th January 2009, 17:42
Oops guess it helps to read the whole thing. Sorry. It really helped me clean up some older items I had about. Thanks.

rkalwaitis
25th January 2009, 17:54
I get some really nice results if I tweak the saturation a bit prior to utilizing the script. Very nice indeed. This is another quality Lato script...Thanks

Blue_MiSfit
28th January 2009, 01:26
I just wanted to add my two cents - this is an AWESOME filter! I have lots of sources that come in PC range, and this filter does a MUCH nicer job than ColorYUV!

~MiSfit

LaTo
28th January 2009, 17:52
v1.02:
changed show clip (with screenW & screenH)

jongsbee
26th July 2009, 12:59
Have you ever read this thread?
I think it's the part that you already know.
http://forum.doom9.org/showthread.php?p=806356#post806356

Gradfun2db leaves a 16pix border on each side.
To resolve this problem, gradfunkmirror (http://foru
m.doom9.org/showthread.php?p=812357#post812357) (script) is already created.

In the gradfunkmirror code, change "int strength" to "float strength"
then this will work.

Function gradfunkmirror( clip c, float "strength" )
{
strength = default( strength, 1.2 )
w = c.width()
h = c.height()
vflip = c.FlipVertical()
hflip = c.FlipHorizontal()

stackhorizontal( hflip.crop( w-16, 0, 16, h ).addborders( 0, 16, 0, 16 ),
\ stackvertical( vflip.crop( 0, h-16, w, 16 ), c, vflip.crop( 0, 0, w, 16 ) ),
\ hflip.crop( 0, 0, 16, h ).addborders( 0, 16, 0, 16 ) )
gradfun2db( strength )
crop( 16, 16, -16, -16 )

Return last
}


http://img520.imageshack.us/img520/2325/24copyn.png
<Gradfun2db(120)>

http://img248.imageshack.us/img248/9295/76808681.png
<addborders(16,16,16,16).gradfun2db(120).crop(16,16,-16,-16)>

http://img520.imageshack.us/img520/9669/erfb.png
<gradfunkmirror(120)>

For this reason, you can modify the inside of SmoothLevels script code.

addborders(16,16,16,16,color=$808080).GradFun2DB(thrshld).crop(16,16,-16,-16)
-> gradfunkmirror(thrshld)

example..
level = mt_lut(limitI, Yexpr=exprL+" "+exprP+" * "+exprY+" x - * x +", Uexpr=exprC, Vexpr=exprC, U=chr31, V=chr31)
diff = mt_lutxy(limitI, level, "x y - "+string(Mfactor)+" * 128 +", U=chr31, V=chr31)
process = diff.RemoveGrain(RGmode,RGmodeUV)
process = ( useGF == True ) ? process.mt_lut("x 128 - "+string(Mfactor)+" / 128 +", U=chr31, V=chr31).gradfunkmirror(thrshld)
\ : process
smth = ( useGF == True ) ? mt_makediff(limitI, process, U=chr31, V=chr31)
\ : mt_lutxy(limitI, process, "x y 128 - "+string(Mfactor)+" / -", U=chr31, V=chr31)

.. right? This is not a problem?
"UseGF=True" part bothers me a little.

LaTo
26th July 2009, 13:03
For this reason, you can modify the inside of SmoothLevels script code.

addborders(16,16,16,16,color=$808080).GradFun2DB(thrshld).crop(16,16,-16,-16)
-> gradfunkmirror(thrshld)

.. right? This is not a problem?
"UseGF=True" part bothers me a little.

Slower and completely useless in this context

jongsbee
26th July 2009, 13:30
Slower and completely useless in this context
Oh!! Thank you for answer my question.. Simple and nice!!

aNToK
21st August 2009, 20:29
Waiting for a loong filter run on another file, but I wanted to ask: Would this filter be useful in trying to bring some life back into some very old vhs captures? I've been using the tweak function, but haven't been very happy with the results.

I should note that I'm doing some pretty heavy denoising and that I'm trying to get a more vivid picture. Old one is very dim and washed-out.

LaTo
1st October 2009, 17:13
Waiting for a loong filter run on another file, but I wanted to ask: Would this filter be useful in trying to bring some life back into some very old vhs captures? I've been using the tweak function, but haven't been very happy with the results.

I should note that I'm doing some pretty heavy denoising and that I'm trying to get a more vivid picture. Old one is very dim and washed-out.

Sorry for this late reply :)

Try with Lmode=2, something like this: SmoothLevels(gamma=1.6,Lmode=2,protect=16) # protect=16 is useful in TV-range(16-235)

Tweak gamma to your taste...

thetoof
22nd January 2010, 09:13
Question: Why did you set chroma to 50 by default?

LaTo
22nd January 2010, 16:38
Question: Why did you set chroma to 50 by default?

Because it's a good compromise between 0 & 100 :D

( 0: really lifeless sometimes
100: too much saturation )

thetoof
22nd January 2010, 18:17
Great, just wanted to be sure there wasn't anything else behind this decision :)

LaTo
22nd January 2010, 18:32
Great, just wanted to be sure there wasn't anything else behind this decision :)

No, it's just a personal taste ;)

rkalwaitis
29th January 2010, 15:28
Lato, I am attempting to use Smoothlevels in conjunction with gradfun2dmod. I used Gradfun2dmod on its default settings and it helped rid me of a banding issue on a source. So thanks for that. My second problem was all kinds of +/-1 value difference, caused by the limited precision of 8bit-colorspace, best seen in large flat areas of pitch-black frames, even more so after denoising. Although the gradfun2dmod process helped a lot with this too, it did not completely rid me of the problem. So I used Smoothlevels thinking that I may have a color issue (so I used Smoothlevels (preset="tv2pc"). Now I have no more issues with the banding or the +/-1 value differences.

However, I think that I may have made the dark areas a bit to dark. Ive been trying to figure it out and a little kick in the butt is needed.

In the example below is what I tried to help me remedy the issue. My question is this. Chroma works like saturation? And I believe that DarkSTR=100 refers to how much to affect the dark areas with the process. Correct? I can not seem to do so however. My goal is not to have black so black (if that makes sense); the scenes seem to dark. Am I missing something?
SmoothLevels(preset="tv2pc", Lmode=2, chroma=20, DarkSTR=100)

thanks in advance, they are both very useful scripts and Im glad you shared them.

LaTo
29th January 2010, 15:48
However, I think that I may have made the dark areas a bit to dark. Ive been trying to figure it out and a little kick in the butt is needed.

In the example below is what I tried to help me remedy the issue. My question is this. Chroma works like saturation? And I believe that DarkSTR=100 refers to how much to affect the dark areas with the process. Correct? I can not seem to do so however. My goal is not to have black so black (if that makes sense); the scenes seem to dark. Am I missing something?
SmoothLevels(preset="tv2pc", Lmode=2, chroma=20, DarkSTR=100)
Try with gamma=1.5 and/or DarkSTR=200, it is better?

rkalwaitis
29th January 2010, 16:00
That is gorgeous. Thank you very very much.

K

mastrboy
9th March 2010, 02:15
any options in SmoothLevels that should be used instead of tweak(sat=x.x) ?

Currently using:
SmoothLevels(preset="tv2pc",Lmode=3)
Tweak(sat=1.10)

The closest thing i could find was chroma=80, but it's not the exact same... (No problem running tweak() but would be great if i could set all color related settings in smoothlevels ;) )

btw, the output after running Smoothlevels is too green, any way to limit that?

VincAlastor
19th May 2010, 16:00
thank you for your smoothlevels filter LaTo. i searched a long time for a good brightener just for dark areas. but now i have a problem. i wrote the following script:

dgsource("1920x1080/24p.bt709 material")
smoothlevels(gamma=2, chroma=0, lmode=2, protect=16, smode=0, usegf=false)
fft3dgpu(sigma=2.8, sharpen=1, precision=1)
gradfun2db(1.51)

this script is slowing down the encoding first pass very much (usage of cpu=45%, ram=85%; without smoothlevels: usage of cpu=70%, ram=80%). if i write this script:

dgsource("1920x1080/24p.bt709 material")
fft3dgpu(sigma=2.8, sharpen=1, precision=1)
smoothlevels(gamma=2, chroma=0, lmode=2, protect=16, smode=0, usegf=true)

smoothlevels doesn't slow down the encoding significant, but the output shows terrible banding. what is my mistake? i would like to use your gradfun2dbmod too, but mostly mask tools slow down the process on my system (q6600 @3,4 ghz, ddr2 2048 mb, win7 x64, avisynth 2.6 x86). could someone help me, please?

LaTo
30th May 2010, 14:31
thank you for your smoothlevels filter LaTo. i searched a long time for a good brightener just for dark areas. but now i have a problem. i wrote the following script:

dgsource("1920x1080/24p.bt709 material")
smoothlevels(gamma=2, chroma=0, lmode=2, protect=16, smode=0, usegf=false)
fft3dgpu(sigma=2.8, sharpen=1, precision=1)
gradfun2db(1.51)

this script is slowing down the encoding first pass very much (usage of cpu=45%, ram=85%; without smoothlevels: usage of cpu=70%, ram=80%). if i write this script:

dgsource("1920x1080/24p.bt709 material")
fft3dgpu(sigma=2.8, sharpen=1, precision=1)
smoothlevels(gamma=2, chroma=0, lmode=2, protect=16, smode=0, usegf=true)

smoothlevels doesn't slow down the encoding significant, but the output shows terrible banding. what is my mistake? i would like to use your gradfun2dbmod to, but mostly mask tools slow down the process on my system (q6600 @3,4 ghz, ddr2 2048 mb, win7 x64, avisynth 2.6 x86). could someone help me, please?

Yes it's slow, but a faster version will be available next week so stay tuned!

VincAlastor
31st May 2010, 20:53
i just could say that tiny stupid word: "cooooooooool" :D


thank you LaTo

kurish
5th June 2010, 03:32
For this reason, you can modify the inside of SmoothLevels script code.

addborders(16,16,16,16,color=$808080).GradFun2DB(thrshld).crop(16,16,-16,-16)
-> gradfunkmirror(thrshld)

.. right? This is not a problem?
"UseGF=True" part bothers me a little.Slower and completely useless in this context

To the contrary, and with due respect and thanks for this and your other great functions, I found jongsbee's suggestion very useful.

SmoothLevels 1.02 still gives me the classic GradFun2DB 16-pixel border issue. Here's my script and a screenshot, with a YV12 source that's previously been hit with greyscale():

avisource("My Source.avi")
orig=last
smoothlev=orig.smoothlevels(8,0.9,251,0,255,chroma=0)
standardlev=orig.levels(8,0.9,251,0,255)
stackhorizontal(smoothlev,standardlev)

http://img9.imageshack.us/img9/9140/smoothlevelslvslevelsr.th.jpg (http://img9.imageshack.us/img9/9140/smoothlevelslvslevelsr.jpg)

The issue is most easily seen on the right edge (of the left image).

jongsbee's suggestion, however, resolved the issue:

http://img198.imageshack.us/img198/4969/jongsbeefix.th.jpg (http://img198.imageshack.us/img198/4969/jongsbeefix.jpg)

(I also tried inserting GradFun2DBmod instead of GradFunkMirror, but GFmod wasn't happy with the thr value that had been calculated by SmoothLevels ["'thr' have not a correct value! [>=1.0]"].)

So, thank you to both of you. Looking forward to the next release of SmoothLevels.

LaTo
5th June 2010, 07:16
To the contrary, and with due respect and thanks for this and your other great functions, I found jongsbee's suggestion very useful.

SmoothLevels 1.02 still gives me the classic GradFun2DB 16-pixel border issue. Here's my script and a screenshot, with a YV12 source that's previously been hit with greyscale():

avisource("My Source.avi")
orig=last
smoothlev=orig.smoothlevels(8,0.9,251,0,255,chroma=0)
standardlev=orig.levels(8,0.9,251,0,255)
stackhorizontal(smoothlev,standardlev)

http://img9.imageshack.us/img9/9140/smoothlevelslvslevelsr.th.jpg (http://img9.imageshack.us/img9/9140/smoothlevelslvslevelsr.jpg)

The issue is most easily seen on the right edge (of the left image).

jongsbee's suggestion, however, resolved the issue:

http://img198.imageshack.us/img198/4969/jongsbeefix.th.jpg (http://img198.imageshack.us/img198/4969/jongsbeefix.jpg)

(I also tried inserting GradFun2DBmod instead of GradFunkMirror, but GFmod wasn't happy with the thr value that had been calculated by SmoothLevels ["'thr' have not a correct value! [>=1.0]"].)

So, thank you to both of you. Looking forward to the next release of SmoothLevels.

Next release doesn't use gradfun2db, so no more edge issue :D

LaTo
5th June 2010, 14:55
This scripted version is now depreciated!

-->See SmoothAdjust (http://forum.doom9.org/showthread.php?t=154971) for up-to-date version!

All the discussion and support continues on the other thread.

(if a moderator can lock this thread it would be great...)