4 def gamma_table(table
, gamma
=0.45):
6 p1
= float(point
) / spread
8 out
= int(p1
* spread
) + start
14 lut
[0:0] = [lut
[0]] * start
16 lut
.extend([lut
[-1]] * (256 - stop
))
22 def input_table(start
=0, stop
=256):
25 lut
.extend(range(spread
))
26 lut
.extend([spread
- 1] * (256 - stop
))
29 def cformat(table
, name
="SOME_TABLE", wrap
=75):
31 outs
= ["static guint8 %s [%s] = {" % (name
, len(table
)),
34 if len(outs
[-1]) >= wrap
:
36 outs
.append(' %s' % v
)
38 outs
[-1] += ', %s' % v
44 inputs_full
= input_table()
45 inputs_headroom
= input_table(16, 236)
47 cformat(reversed(gamma_table(inputs_full
)), "sparrow_rgb_gamma_full_range_REVERSE")
48 cformat(reversed(gamma_table(inputs_headroom
)), "sparrow_rgb_gamma_headroom_REVERSE")
50 cformat(reversed(gamma_table(inputs_full
)), "sparrow_rgb_gamma_full_range_REVERSE")
51 cformat(reversed(gamma_table(inputs_headroom
)), "sparrow_rgb_gamma_headroom_REVERSE")