I long experienced something strange: each time I viewed a DVD on my
computer I had to correct the brightness and contrast of the player to
get less darkish scenes. I didn't have to do such tunings to view
simple pictures.
I learned a few days ago that computer displays are non-linear. What
does this mean? The intensity of say the amount of red in a picture pixel is
commonly encoded inside a byte. That means it is an integer
value between 0 and 255. An amount of 0 means no red and an amount of 255 means full red. The amounts of green and blue are encoded in two other
bytes. If the three bytes contain the values 0, 0 and 0, the pixel is pitch black (no red, no green, no blue). If the bytes contain 0, 255 and 0, the pixel is pitch green (no red, full green, no blue). And 255, 255, 255 means pitch white (full red, full green, full blue). Well, I
thought that a value of 127
(~255/2) means 50% red intensity.
The same way I thought that a value of 2 meant two times more light
intensity than a value of 1.
Dead wrong! Actually a value of 2
implies only slightly more brightness than a value of 1. And a value of 127 implies still a dark red. This is expressed by
saying that the brightness follows a "gamma curve". While this gamma
curve makes things complicated, it is very sound. Indeed, on a linear
system, successive dark color values are much too different from each
other. Very bright colors are uselessly close to each other. The
gamma curve smooths this out. It brings the dark intensities closer to
each other while it makes the bright ones more different from each
other. It is a saner way to make use of the narrow 256 values made
available by a computer byte.
The gamma curve is not standardized. For example a common PC display
has a gamma curve of 2.2. While a genuine Apple Macintosh display has a
gamma
curve of 1.8. This means that if you edit a photograph on a PC and then
you pass it to a Macintosh, it will appear slightly whitish and milky
on the Macintosh display. Reciprocally, if you edit a photograph on a
Macintosh and you pass it to a PC, it will appear slightly darkish.
Actually the above statement is not always true. Some picture file
formats
include a description of the gamma parameter used. Or the gamma
parameter is implied. Then
if you were using quality software on both the PC and the Macintosh, a
translation is made automatically and the same picture file will appear
OK
on both systems. (Such translations can be a nightmare for professional
digital photographers.)
I'm using a standard PC system, with a gamma parameter of 2.2.
Obviously, most if not all pictures I display are encoded with a gamma
of 2.2. Hence they appear
perfect on the screen.
Obviously too, the DVD's and most movie files I've been viewing till
now are
encoded with a gamma parameter that seems closer to 1.8. That's why I
constantly
felt the need to twiddle with the brightness and contrast while viewing
a movie; it's a coarse way to approximate a gamma tuning. I never got a
perfect result that way.
Today I inserted a gamma parameter in my X server configuration file to
compensate the 2.2 gamma of my monitor and get a gamma of 1.8. The
movies I then tried out displayed ways better. I felt like I was back
in a
theater. But of course displaying photographs was a little poor...
Till shortly I tought none of the usable movie players on my computer
had a gamma
tuning. Though the VLC Media Player is still not finished, it allows me
to play DVD images with a correct control interface and a neat gamma
tuning system. It allowed me to notice the gamma tuning needed can vary
a lot between different movies.
I downloaded the source code of the Xine movie player library and
parsed through it for the word "gamma". There were plenty of source
code lines with gamma calculations. So I suppose at least some movies
will be played correctly. Or at least approximate gamma tunings are
performed. Anyway the addition of a user-configurable gamma tuning
seems mandatory to me. Possibly a more complete implementation of gamma
calculations is needed.