<p>If by linear scale, the (Cinelerra manual) "saying" means gamma = 1.0, then that's not my understanding of most video codecs.</p>

<p>GPUs, OTOH, probably do operate upon values decoded and stored as a linear representation of a higher precision than the source, which would be typically 8-bits per channel.</p>

CC BY-SA 3.0
2015-12-28T15:01:55.997Z
2015-12-28T15:01:55.997Z
Gyan
<p>The correctness of this statement depends on the color model. The statement will typically be correct for color models such as RGB and CMY. In HSx (HSV, HSL) color models the model doesn't store explicit colors, and their transformation to explicit colors is non-linear.</p>

<p>EDIT:</p>

<p>My comment below on YUV is incorrect, YUV transforms linearly to RGB, thanks @Mulvya!</p>

CC BY-SA 3.0
2015-12-28T19:34:24.140Z
How about YUV (YCbCr) ?
max_user
CC BY-SA 3.0
2015-12-28T19:41:12.653Z
YUV does not transform linearly to colors, see the transformation formula in https://en.wikipedia.org/wiki/YCbCr#YCbCr
avnr
CC BY-SA 3.0
2015-12-30T12:44:40.643Z
a) the YUV<->RGB conversion is linear, they are of the form AX + BY + CZ + D  b) the statement that the OP quotes is from the manual of a video editor (Cinelerra). CMY, HSx models don't come into it. Even those codecs which store video as RGB e.g. qtrle or x264rgb, don't store linear RGB values (by default).
Gyan
CC BY-SA 3.0
2015-12-30T13:23:11.550Z
@Mulvya maybe you are correct, but I understood the OPs wording "YUV (YCbCr)" as meaning Y'CbCr which AFAIK maps to RGB non-linearly.
avnr
CC BY-SA 3.0
2015-12-30T13:34:21.987Z
The wiki page you linked to, has the formulae, which are all linear.
Gyan
CC BY-SA 3.0
2015-12-30T13:54:31.917Z
Thanks, I stand corrected, what got me confused is: "Y′ (with prime) is distinguished from Y, which is luminance, meaning that light intensity is nonlinearly encoded based on gamma corrected RGB primaries"; of course the light intensity can be non-linearly encoded and still retain linearity with RGB values. I'll edit my answer to reflect the problem with my above comment.
avnr
CC BY-SA 3.0
2015-12-28T15:05:30.857Z
2015-12-30T13:56:23.490Z
2015-12-30T13:56:23.490Z
avnr
<p>Not likely, most monitors and most display devices have a nonlinear response. This is useful, as human eyes are not linearily sensitive.</p>

<p>Having the data stored in nonlinear scale is thus a very simple compression scheme. In fact, your display device depends on this gamma correction. If you would not have a gammacorected datasource then the image would appear dark. While this image could be corrected you would lose color data as the values would get nonliearily distributed. End result is that 8bit color would no longer be enough to display continious color without banding. This is why cameras have 10, 12 or 14 bit sensors, as he sensors themselves are linear in nature.</p>

<p>So while it certainly is possible to have colorspaces that are linear, most videosoursces would not be linear. Simply because that would mean need to store over 8 bits of color info. Codecs certainly can have different settings and many of the color modes would not be practical without nonlinear data. </p>

<p>In general its rather safe to assume that the data stored is not linear even if stored in a space that could represent linear data. Unless the source specifically mentions its linear and it stores more than 8 bit color then it most likely is not linear.</p>

CC BY-SA 3.0
2015-12-31T06:32:59.833Z
From [wiki](https://en.wikipedia.org/wiki/Gamma_correction#Explanation): *Human vision, under common illumination conditions (not pitch black nor blindingly bright), follows an approximate gamma or power function, with greater sensitivity to relative differences between darker tones than between lighter ones.*
Gyan
CC BY-SA 3.0
2015-12-31T06:43:33.777Z
@Mulvya hmm... Its a bit trickily worded to parse correctly. Fixed.
joojaa
CC BY-SA 3.0
2015-12-31T06:28:59.017Z
2015-12-31T06:41:28.440Z
2015-12-31T06:41:28.440Z
joojaa
<p>Is this saying correct ?</p>

<p><em>The graphics card and most video codecs store colors in a linear scale.</em></p>

<video><codec><color>
Graphics card and video codecs: are colors stored in a linear scale?
max_user
# Graphics card and video codecs: are colors stored in a linear scale?

(Asked by: username_0 on 2015-12-28)

Is this saying correct ?

*The graphics card and most video codecs store colors in a linear scale.*

**Tags:** video, codec, color


---

## 3 answers

### Answer by username_1 on 2015-12-28. Score: 1

If by linear scale, the (Cinelerra manual) "saying" means gamma = 1.0, then that's not my understanding of most video codecs.

GPUs, OTOH, probably do operate upon values decoded and stored as a linear representation of a higher precision than the source, which would be typically 8-bits per channel.


---

### Answer by username_2 on 2015-12-28. Score: 1

The correctness of this statement depends on the color model. The statement will typically be correct for color models such as RGB and CMY. In HSx (HSV, HSL) color models the model doesn't store explicit colors, and their transformation to explicit colors is non-linear.

EDIT:

My comment below on YUV is incorrect, YUV transforms linearly to RGB, thanks @Mulvya!

> **Comments:**
> **username_0**: How about YUV (YCbCr) ?  
> **username_2**: YUV does not transform linearly to colors, see the transformation formula in https://en.wikipedia.org/wiki/YCbCr#YCbCr  
> **username_1**: a) the YUV<->RGB conversion is linear, they are of the form AX + BY + CZ + D  b) the statement that the OP quotes is from the manual of a video editor (Cinelerra). CMY, HSx models don't come into it. Even those codecs which store video as RGB e.g. qtrle or x264rgb, don't store linear RGB values (by default).  
> **username_2**: @Mulvya maybe you are correct, but I understood the OPs wording "YUV (YCbCr)" as meaning Y'CbCr which AFAIK maps to RGB non-linearly.  
> **username_1**: The wiki page you linked to, has the formulae, which are all linear.  
> **username_2**: Thanks, I stand corrected, what got me confused is: "Y′ (with prime) is distinguished from Y, which is luminance, meaning that light intensity is nonlinearly encoded based on gamma corrected RGB primaries"; of course the light intensity can be non-linearly encoded and still retain linearity with RGB values. I'll edit my answer to reflect the problem with my above comment.  

---

### Answer by username_3 on 2015-12-31. Score: 0

Not likely, most monitors and most display devices have a nonlinear response. This is useful, as human eyes are not linearily sensitive.

Having the data stored in nonlinear scale is thus a very simple compression scheme. In fact, your display device depends on this gamma correction. If you would not have a gammacorected datasource then the image would appear dark. While this image could be corrected you would lose color data as the values would get nonliearily distributed. End result is that 8bit color would no longer be enough to display continious color without banding. This is why cameras have 10, 12 or 14 bit sensors, as he sensors themselves are linear in nature.

So while it certainly is possible to have colorspaces that are linear, most videosoursces would not be linear. Simply because that would mean need to store over 8 bits of color info. Codecs certainly can have different settings and many of the color modes would not be practical without nonlinear data.

In general its rather safe to assume that the data stored is not linear even if stored in a space that could represent linear data. Unless the source specifically mentions its linear and it stores more than 8 bit color then it most likely is not linear.

> **Comments:**
> **username_1**: From [wiki](https://en.wikipedia.org/wiki/Gamma_correction#Explanation): *Human vision, under common illumination conditions (not pitch black nor blindingly bright), follows an approximate gamma or power function, with greater sensitivity to relative differences between darker tones than between lighter ones.*  
> **username_3**: @Mulvya hmm... Its a bit trickily worded to parse correctly. Fixed.  

---

