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. |
5th May 2008, 16:34 | #1 | Link |
LaTo INV.
Join Date: Jun 2007
Location: France
Posts: 701
|
SmoothLevels [depreciated version, see SmoothAdjust]
Code:
######################################################################################### ### ### ### function Smooth Levels : SmoothLevels() ### ### ### ### v1.02 by "LaTo INV." ### ### ### ### 28 January 2009 ### ### ### ######################################################################################### ### ### ### /!\ Needed filters : Masktools (v2.0a35), Removegrain (v1.0PR), GradFun2db (v1.0). ### -------------------- ### ### ### USAGE: SmoothLevels(input_low, gamma, input_high, output_low, output_high, ### chroma, limiter, ### Lmode, DarkSTR, BrightSTR, Ecenter, protect, Ecurve, ### Smode, Mfactor, RGmode, useGF, ### show, screenW, screenH, preset) ### ### ### ### +---------+ ### | GENERAL | ### +---------+ ### ### Levels options: ### --------------- ### input_low, gamma, input_high, output_low, output_high [default: 0, 1.0, 255, 0, 255] ### ### chroma [default: 50] ### --------------------- ### 0 = no chroma processing (similar as Ylevels) ### xx = intermediary ### 100 = normal chroma processing (similar as Levels) ### ### limiter [default: 0] ### -------------------- ### 0 = no limiter (similar as Ylevels) ### 1 = input limiter ### 2 = output limiter (similar as Levels: coring=false) ### 3 = input & output limiter (similar as Levels: coring=true) ### ### ### ### +----------+ ### | LIMITING | ### +----------+ ### ### Lmode [default: 0] ### ------------------ ### 0 = no limit ### 1 = limit conversion on dark & bright areas (apply conversion @0% at luma=0 & @100% at luma=Ecenter & @0% at luma=255) ### 2 = limit conversion on dark areas (apply conversion @0% at luma=0 & @100% at luma=255) ### 3 = limit conversion on bright areas (apply conversion @100% at luma=0 & @0% at luma=255) ### ### DarkSTR [default: 100] ### ---------------------- ### Strength for limiting: the higher, the more conversion are reduced on dark areas (for Lmode=1&2) ### ### BrightSTR [default: 100] ### ------------------------ ### Strength for limiting: the higher, the more conversion are reduced on bright areas (for Lmode=1&3) ### ### Ecenter [default: 128] ### ---------------------- ### Center of expression for Lmode=1 ### ### protect [default: -1] ### --------------------- ### -1 = protect off ### >=0 = pure black protection ### ---> don't apply conversion on pixels egal or below this value ### (ex: with 16, the black areas like borders ### and generic are untouched so they don't look washed out) ### ### Ecurve [default: 0] ### ------------------- ### Curve used for limit & protect: ### 0 = use sine curve ### 1 = use linear curve ### ### ### ### +-----------+ ### | SMOOTHING | ### +-----------+ ### ### Smode [default: -2] ### ------------------- ### 2 = smooth on, maxdiff must be < to "255/Mfactor" ### 1 = smooth on, maxdiff must be < to "128/Mfactor" ### 0 = smooth off ### -1 = smooth on if maxdiff < "128/Mfactor", else off ### -2 = smooth on if maxdiff < "255/Mfactor", else off ### ### Mfactor [default: 2] ### -------------------- ### The higher, the more precise but the less maxdiff alowed: ### maxdiff=128/Mfactor for Smode1&-1 and maxdiff=255/Mfactor for Smode2&-2 ### ### RGmode [default: 12] ### -------------------- ### In strength order: + 19 > 12 >> 20 > 11 - ### ### useGF [default: true] ### --------------------- ### Use gradfun2db on top of removegrain: prevent posterize when doing levels conversion ### ### ### ### +--------+ ### | OTHERS | ### +--------+ ### ### show [default: false] ### --------------------- ### Show the debug clip ### ### screenW [default: 1280] ### ----------------------- ### Screen horizontal resolution for debug clip ### ### screenH [default: 1024] ### ---------------------- ### Screen vertical resolution for debug clip ### ### preset: ### ------- ### pc2tv = "PC -> TV" conversion ### tv2pc = "TV -> PC" conversion ### ### ######################################################################################### Old scripted version : SmoothLevels v1.02 -->See SmoothAdjust for up-to-date version! Comparaison SmoothLevels <-> Levels: Source SmoothLevels(preset="tv2pc",chroma=2) Levels(16,1.0,235,0,255,coring=false) _ Last edited by LaTo; 5th June 2010 at 14:51. |
6th May 2008, 18:48 | #2 | Link |
Registered User
Join Date: Feb 2004
Posts: 743
|
Two problems
I am running into two problems, first if color is set to 1 or 2 any ajustments to levels will create a bright green or redish-pink screen.
Second is I can't get "mode" to work, error on "y","s" or"g" Code:
Ulevels(chroma=0,mode=y,protect=true,input_low=[<"Low brt (0)", 0, 150, 31>],Gamma=[<"Gamma (1)", .2, 3.00, 1.11>],Input_high=[<"Brt High (255)", 0, 255, 210>],output_low=[<"Output Low Val (0)", 0, 100, 29>],output_high=[<"Output Hi Val(255)", 0, 255, 218>])#,1.0,123,0,200) photorecall.net |
6th May 2008, 18:54 | #3 | Link |
LaTo INV.
Join Date: Jun 2007
Location: France
Posts: 701
|
For mode:
Code:
Ulevels(mode="Y") Code:
Ulevels(mode=Y) RemoveGrain1.0 prerelease: http://home.arcor.de/kassandro/Remov...emoveGrain.rar MT MaskTools 2.0a32: http://manao4.free.fr/masktools-v2.0a32.zip Last edited by LaTo; 6th May 2008 at 19:09. |
6th May 2008, 19:01 | #5 | Link | |
Registered User
Join Date: Feb 2004
Posts: 743
|
Quote:
EDIT: Yes that did it, NO only the Mode works. Richard Last edited by rfmmars; 6th May 2008 at 21:42. |
|
8th May 2008, 18:39 | #8 | Link |
Registered User
Join Date: Feb 2004
Posts: 743
|
I have installed it on another computer, a AMD 3.2 gig and if I select "Color mode" 1 or 2, any adjustment to the input or output sliders, it causes a color shift. It can be balanced out but I don't think that's how it should work. Gamma causes no change in color.
Next I am going to install it to a Intel MT machine to see what happens. You might want to post in detail more on how and what its does. Thanks, Richard |
9th May 2008, 01:33 | #10 | Link |
Registered User
Join Date: Jan 2004
Posts: 849
|
I am on AMD single core and I got the 2 filters linked by LaTo in his second post. While I don't see any color 1/2 settings, but since Richard bolded chroma, I'm assuming he's talking about chroma=1/2, both of those work flawlessly for me. And I like the colour correction quality much better than FFDshow's built in Levels, new King!
Also Richard maybe you should try with a simpler line? I use ulevels(chroma=2, preset="tv2pc") does that work for you or are you getting artifacts?
__________________
Geforce GTX 260 Windows 7, 64bit, Core i7 MPC-HC, Foobar2000 Last edited by lexor; 9th May 2008 at 01:39. |
9th May 2008, 07:42 | #11 | Link | |
Registered User
Join Date: Feb 2004
Posts: 743
|
Quote:
So something needs to be fixed or its of little use to me. Richard |
|
9th May 2008, 13:36 | #12 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
The color shifting is no mystery. Regarding chroma, the function scales chroma values linearily from [in(put)_low,in(put)_high] to [out(put)_low,out(put)_high]. To keep colors neutral, both the input/output pairs have to be symmetric to 128.
The point is that these (chroma) values are directly derived from the luma-targetting parameters. Hence, if the in/out/low/high values for luma happen to be symmetric to 128, then you get correct colors. If they aren't, then you get a color shift. Since you probably don't ever want any kind of color shifting from a *levels* function (if you need that, you'd use something else), a suggestion: Use (output_high - output_low) / (input_high - input_low) as scaling factor cF, then use "x 128 - cF * 128 +" for the chroma channels. Gives the same effect if luma in/out.. points are symmetric, and a reasonable effect if they aren't. Introducing completely independent chroma parameters is another option.
__________________
- 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!) |
9th May 2008, 15:08 | #13 | Link | |
Ursus arctos horribilis
Join Date: Dec 2007
Posts: 186
|
Quote:
I know that you meant it as an example that ULevels does a better job of preserving the original if you do the inverse, but it wouldn't the example work better if it was based on a real transformation you might do? I admit, I don't understand a lot about levels stuff, so correct me if I'm wrong. Also, why is half-croma preferred? I'd think that you'd want full chroma... explain why this isn't the case |
|
9th May 2008, 20:20 | #14 | Link | |
LaTo INV.
Join Date: Jun 2007
Location: France
Posts: 701
|
Quote:
|
|
10th May 2008, 12:47 | #15 | Link |
LaTo INV.
Join Date: Jun 2007
Location: France
Posts: 701
|
The chroma expression was on my todo list, but I forgot to change it because I made my tests with symmetric input/output... I'm tired
So, the new version 8.05d fix the chroma shift! Last edited by LaTo; 10th May 2008 at 15:35. |
10th May 2008, 13:04 | #16 | Link | |
LaTo INV.
Join Date: Jun 2007
Location: France
Posts: 701
|
Quote:
--> it's chroma=2 "Didée Ylevels" doesn't process the chroma at all. --> it's chroma=0 I think that a balance of the two method is a good compromise: change the chroma less (division by 2) than the luma to preserve a bit the color saturation. --> it's chroma=1 |
|
15th May 2008, 12:51 | #19 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
May I offer a fix ...
Delete: ( it's a) probably wrong, and b) superfluous due to the following fix) Code:
in_low = (chroma == 2) ? round(input_low/2) : round(input_low/4) in_high = (chroma == 2) ? round(input_high/2) : round((input_high+(255-input_high)/2)/2) out_low = (chroma == 2) ? round(output_low/2) : round(input_low/4) out_high = (chroma == 2) ? round(output_high/2) : round((output_high+(255-output_high)/2)/2) Replace: Code:
### CHROMA exprC = "x 128 - 0 < 0 x 128 - abs "+string(in_low)+" - "+string( .... # etc., veeery long line ... exprC = ( chroma == 0 ) ? "x" : exprC Code:
### CHROMA scaleC = (float(output_high)-output_low)/(input_high-input_low) scaleC = chroma==2 ? scaleC : (scaleC+1.0)/2 exprC = "x 128 - "+string(scaleC)+" * 128 +" exprC = ( chroma == 0 ) ? "x" : exprC
__________________
- 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!) |
15th May 2008, 16:18 | #20 | Link |
Registered User
Join Date: Jan 2004
Posts: 849
|
mode="S" seems broken, Y and G identical picture (or close enough to be identical), and S is much worse. You know how if you don't use any levels the whole picture looks like it has this grayish overlay, if mode S is active that overlay isn't removed, it just gets slightly reduced. Also protect=true only seems to work with mode S, and is broken for Y and G (by broken I mean solid black parts of the picture are replaced with weird gray)
This like works fine: Ulevels(mode="Y", chroma=1, smooth=0, preset="tv2pc") This one looks too gray: Ulevels(mode="S", chroma=1, smooth=0, preset="tv2pc") This one has black replaced: Ulevels(mode="Y", chroma=1, smooth=0, protect=true, preset="tv2pc")
__________________
Geforce GTX 260 Windows 7, 64bit, Core i7 MPC-HC, Foobar2000 Last edited by lexor; 15th May 2008 at 16:23. |
Thread Tools | Search this Thread |
Display Modes | |
|
|