zee944
21st February 2009, 21:28
I'd like to set the luma level curve in a video. I have certain values that which "input" (original) luma what should be after the adjustment.
I've a tabling for that, something like the following:
original luma ................... target luma
0 ..................................... 1.29789
1 ..................................... 3.57726
2 ..................................... 9.735649
3 ..................................... 10.73178
.
.
.
37 ..................................... 45.86113
38 ..................................... 46.07621
39 ..................................... 52.88022
40 ..................................... 52.79333
.
.
.
251 ..................................... 246.2596
252 ..................................... 248.4447
253 ..................................... 250.6298
254 ..................................... 252.8149
255 ..................................... 253.3412
How could I apply these changes? I thought I can do it one by one (not manually but in an auto-made script) with mt_lut or RGBlut like this:
mt_lut(last,expr="x 252 >= x 253 <= & x 252 - 253 252 - / 250.6298 248.4447 - * 248.4447 + x ?",U=2,V=2)
# changes luma 252 to 248.4447, luma 253 to 250.6298 and luma values in-between accordingly
But I've realized it won't work. There'll be hundreds of mt_lut lines in a row. If I change some luma in one line, then the input luma in the next line may fall into range of the previous output luma and it'll surely end up in a total mess. I guess I have to isolate the already altered pixels somehow. Is there an easy way to do it?
I'd appreciate any help. :)
(P.S.: Theoretically these data could be saved as an .AMP or .ACV file (although I'm not familiar with the format), and fed into GiCoCu, but GiCoCu isn't too faithful to the given values. It smoothes out the curve, or I don't know. Is there another way than GiCoCu?)
I've a tabling for that, something like the following:
original luma ................... target luma
0 ..................................... 1.29789
1 ..................................... 3.57726
2 ..................................... 9.735649
3 ..................................... 10.73178
.
.
.
37 ..................................... 45.86113
38 ..................................... 46.07621
39 ..................................... 52.88022
40 ..................................... 52.79333
.
.
.
251 ..................................... 246.2596
252 ..................................... 248.4447
253 ..................................... 250.6298
254 ..................................... 252.8149
255 ..................................... 253.3412
How could I apply these changes? I thought I can do it one by one (not manually but in an auto-made script) with mt_lut or RGBlut like this:
mt_lut(last,expr="x 252 >= x 253 <= & x 252 - 253 252 - / 250.6298 248.4447 - * 248.4447 + x ?",U=2,V=2)
# changes luma 252 to 248.4447, luma 253 to 250.6298 and luma values in-between accordingly
But I've realized it won't work. There'll be hundreds of mt_lut lines in a row. If I change some luma in one line, then the input luma in the next line may fall into range of the previous output luma and it'll surely end up in a total mess. I guess I have to isolate the already altered pixels somehow. Is there an easy way to do it?
I'd appreciate any help. :)
(P.S.: Theoretically these data could be saved as an .AMP or .ACV file (although I'm not familiar with the format), and fed into GiCoCu, but GiCoCu isn't too faithful to the given values. It smoothes out the curve, or I don't know. Is there another way than GiCoCu?)