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. |
6th November 2006, 14:49 | #21 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
Sorry for not replying ... with an all-time-bursting PM box, some PMs might slip through.
Worse is that YlevelsG/S/C indeed is wrongly implemented, and has been like that since day one. Consequently, ffdshow "correctly" incorporates the faulty Ylevels variants ... so my complaints always were unjustified. I am standing there with egg on my face.
__________________
- 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!) |
27th January 2007, 13:27 | #25 | Link |
Registered User
Join Date: Jan 2002
Location: France
Posts: 2,856
|
Just replace yv12lut by mt_lut
__________________
|
30th October 2007, 12:09 | #27 | Link |
Guest
Posts: n/a
|
I need some help understanding this.
I have a DVD that's too "bright" and looks a bit washed out. I can get more of a "film-ish" look if I use: Levels(0, 0.85, 255, 0, 255) But this pulls the brightest bits down a bit too much and gives the illusion of reduced contrast. It sounds like the adjusted curves in this script are what I need to make the dark bits darker and not touch the bright bits too much, but reading the first post it looks as if this filter was not desinged for gamma values less than 1.0? (Where it says "YlevelsG (not YlevelsS) does "inverse" scaling for gamma values < 1.0, but that's not that great. It's just for completeness.") Of course I could just try it and see what it looks like, but if someone could clarify whether I should be using this or if something else would do a better job? |
30th October 2007, 12:23 | #28 | Link |
German doom9/Gleitz SuMo
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,782
|
You should use a limited luminance (and chrominance) range when encoding to MPEG2 for DVD. MPEG2 encoders may expect "TV range" material (due to the fact that TV sets expect a limited signal voltage range from the receiver), and if you give them "PC range" instead, you will get overbright results especially on CRT TV sets.
You should apply the filter ColorYUV(levels="PC->TV") on full range material before encoding it. http://avisynth.org/mediawiki/ColorYUV |
31st October 2007, 19:28 | #30 | Link |
Guest
Posts: n/a
|
My quick test:
Code:
a=ImageReader("greyscale.png").converttoyv12().histogram() b=ImageReader("greyscale.png").converttoyv12().levels(0, 0.6, 255, 0 , 255).histogram() c=ImageReader("greyscale.png").converttoyv12().ylevels(0, 0.6, 255, 0 , 255).histogram() d=ImageReader("greyscale.png").converttoyv12().ylevelsg(0, 0.6, 255, 0 , 255).histogram() e=ImageReader("greyscale.png").converttoyv12().ylevelss(0, 0.6, 255, 0 , 255).histogram() stackvertical(a, b, c, d, e) YLevels and YLevelsG seems to clip the black too much. YLevelsS reduces the peak white. Using gamma values >1.0, I see similar clipping in the white. |
1st November 2007, 07:02 | #31 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
You might also test the coring=false option to Levels(). This option changes the range scaling from 16..235 to 0..255
Code:
...ImageReader("greyscale.png").converttoyv12().levels(0, 0.6, 255, 0 , 255, coring=false) Code:
...ImageReader("greyscale.png").converttoyv12().levels(16, 0.6, 235, 16 , 235, coring=false) |
1st November 2007, 22:19 | #32 | Link |
Guest
Posts: n/a
|
I should have used the 16-235 levels in my YLevels script above!
e.g. ImageReader("greyscale.png").converttoyv12().ylevelsg(16, 0.6, 235, 16 , 235).histogram() is correct with no clipping. But, is there any reason why I shouldn't do this: Code:
ImageReader("greyscale.png").ConvertToYV12().FlimsYLevels(15).Histogram() function FlimsYlevels(clip clp, float amp) { wicked="x x 16 - 34,85493 / sin "+string(amp)+" * -" return( clp.mt_lut(Yexpr = wicked) ) } Last edited by FlimsyFeet; 10th March 2008 at 14:25. |
18th February 2008, 11:30 | #33 | Link |
Registered User
Join Date: Apr 2007
Posts: 240
|
Didée, this filter is a great idea. I hope you'll continue refining it. Very useful.
My problem with it that I can't call forth the effect I want. I'd like to define which range I want to boost up a little. I've played around a lot with the values, but I just can't do it. What I want is to only affect pixels that have luma value between (say) 50 and 200. I don't want to touch pixels under and above a certain brightness. So probably the gamma curve should be shrinked to fit between 50 and 200. Is it possible? |
28th February 2008, 14:17 | #34 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
Answered zee944's question here.
Summary: Possible, but not feasable to do that with MaskTools' lookup tables.
__________________
- 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!) |
29th February 2008, 13:13 | #35 | Link |
Registered User
Join Date: Apr 2006
Posts: 57
|
i'm trying to use this filter on a jap dvd r2 anime.i'm calling ylevels in my script like : "ylevelsS(16, 1.0, 235, 0 , 255).
i can adjust input_low and output_low settings to reach a 0-255 full range (checking it with histogram)only with gamma=1. if i try with i.e. gamma =1.6(or any other value), i get dark levels too bright with i.e. input_low=34 and too dark with next value(i.e. input_low=35, there are no mid-ways).where am i wrong? |
6th March 2008, 14:17 | #36 | Link | |
Guest
Posts: n/a
|
I tried to test ylevels, but the problem I got is, when I try to work on source with AvsP everythink looks ok,but when rip finish I don't see any effect of ylevels in my rip...any Idea why.
I am using this script and Virtualdub for rip. Script: Quote:
With AvsP Output |
|
22nd April 2010, 15:47 | #37 | Link | |
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
FlimsyFeet,
I know this is quite an old thread, but I'm experimenting with routines for simulating 'film-looks', ideally keeping the process in YV12. Since there seems to be no easy way to import Photoshop/Gimp curves without color space conversion (and I'm not sure if the Levels > Curves control in FFDSHow avoids that), I've been using a Masktools (mt_lutxy) function (128-centred multiply) that achieves the same result as the Overlay blend mode, found in After Effects etc. http://forum.doom9.org/showthread.ph...67#post1387067 This effectively creates an S-shaped luma curve, the 'strength' of which can be somewhat adjusted by opacity. I also came across your FlimsYLevels function, which produces a sinusoidal S-curve. Quote:
Cheers.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 22nd April 2010 at 15:55. |
|
23rd June 2011, 10:56 | #39 | Link | |
LaTo INV.
Join Date: Jun 2007
Location: France
Posts: 701
|
Quote:
Or you can add YUY2 indirectly in these functions: Code:
clip = last ConvertToYV12() xxxlevels(...) ConvertToYUY2() MergeChroma(clip) Last edited by LaTo; 23rd June 2011 at 12:16. |
|
27th October 2019, 14:49 | #40 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,829
|
Would anyone with a wiki account care to fix the version of Ylevels on the wiki?
For the version on the wiki, the "show_function" argument is integer, when it should be bool. Code:
function Ylevels(clip clp, \ int "input_low", float "gamma", int "input_high", \ int "output_low", int "output_high", int "show_function") Wiki version: Code:
return( show_function ? clp.subtitle(wicked) : clp.mt_lut(Yexpr = wicked, U=2,V=2) ) Code:
######## # Levels transforms by Didée # Requires MaskTools v2.0 or greater # last revision 2004-12-07; update to MaskTools v2.0 semantics 2008-03-09 # # PARAMETERS: # "input_low" : (Default: 0) # "gamma" : (Default: 1.0) # "input_high" : (Default: 255) # "output_low" : (Default: 0) # "output_high" : (Default: 255) # "show_function" : (Default: false) - the function to be made into a lookup-table # transform, shown in postfix notation # # USAGE: # YLevels(0, 1.2, 255, 0, 255, false) # YLevels(0, 1.2, 255) # YLevels(gamma=1.2) # Constant function Ylevels(clip clp, \ int "input_low", float "gamma", int "input_high", \ int "output_low", int "output_high", bool "show_function") { input_low = Default(input_low, 0) gamma = Default(gamma, 1.0) input_high = Default(input_high, 255) output_low = Default(output_low, 0) output_high = Default(output_high, 255) show_function = Default(show_function, false) wicked = "x " +string(input_low)+ " - " +string(input_high)+ " " +string(input_low)+ " - / 1 " +string(gamma)+ \ " / ^ " +string(output_high)+ " " +string(output_low)+ " - * " +string(output_low)+ " +" return show_function ? \ clp.mt_lut(Yexpr = wicked, U=2,V=2).subtitle(wicked) : \ clp.mt_lut(Yexpr = wicked, U=2,V=2) } # Gradient function YlevelsG(clip clp, \ int "input_low", float "gamma", int "input_high", \ int "output_low", int "output_high", bool "show_function") { input_low = Default(input_low, 0) gamma = Default(gamma, 1.0) input_high = Default(input_high, 255) output_low = Default(output_low, 0) output_high = Default(output_high, 255) show_function = Default(show_function, false) wicked = gamma > 1.0 \ ? "x " +string(input_low)+ " - " +string(input_high)+ " " +string(input_low)+ " - / 1 " +string(gamma)+ \ " / ^ " +string(output_high)+ " " +string(output_low)+ " - * " +string(output_low)+ " + x * x 255 x - * + 255 /" \ : "x " +string(input_low)+ " - " +string(input_high)+ " " +string(input_low)+ " - / 1 " +string(gamma)+ \ " / ^ " +string(output_high)+ " " +string(output_low)+ " - * " +string(output_low)+ " + 255 x - * x x * + 255 /" return show_function ? \ clp.mt_lut(Yexpr = wicked, U=2,V=2).subtitle(wicked) : \ clp.mt_lut(Yexpr = wicked, U=2,V=2) } # Sine function YlevelsS(clip clp, \ int "input_low", float "gamma", int "input_high", \ int "output_low", int "output_high", bool "show_function") { input_low = Default(input_low, 0) gamma = Default(gamma, 1.0) input_high = Default(input_high, 255) output_low = Default(output_low, 0) output_high = Default(output_high, 255) show_function = Default(show_function, false) wicked="x " +string(input_low)+ " - " +string(input_high)+ " " +string(input_low)+ " - / 1 " +string(gamma)+ \ " / ^ " +string(output_high)+ " " +string(output_low)+ " - * " +string(output_low)+ " + x 162,97466 /" + \ " sin 255 * * x 255 x 162,97466 / sin 255 * - * + 255 /" return show_function ? \ clp.mt_lut(Yexpr = wicked, U=2,V=2).subtitle(wicked) : \ clp.mt_lut(Yexpr = wicked, U=2,V=2) } # Cosine function YlevelsC(clip clp, \ int "input_low", float "gamma", int "input_high", \ int "output_low", int "output_high", bool "show_function") { input_low = Default(input_low, 0) gamma = Default(gamma, 1.0) input_high = Default(input_high, 255) output_low = Default(output_low, 0) output_high = Default(output_high, 255) show_function = Default(show_function, false) wicked="x " +string(input_low)+ " - "+ string(input_high)+ " " +string(input_low)+ " - / 1 "+string(gamma)+ \ " / ^ " +string(output_high)+ " " +string(output_low)+ " - * " +string(output_low)+ " + 255 x 162,97466" + \ " / cos 255 * - * x x 162,97466 / cos 255 * * + 255 /" return show_function ? \ clp.mt_lut(Yexpr = wicked, U=2,V=2).subtitle(wicked) : \ clp.mt_lut(Yexpr = wicked, U=2,V=2) } |
|
|