comparison DOCS/tech/colorspaces.txt @ 5586:6ce9c6231bdd

updated
author arpi
date Sat, 13 Apr 2002 02:09:18 +0000
parents 329896ab1989
children 441c98167877
comparison
equal deleted inserted replaced
5585:b7ced8012379 5586:6ce9c6231bdd
1 Huh. The planar YUV modes. 1 In general
2 ========================== 2 ==========
3 3
4 The most missunderstood thingie... 4 There are planar and packed modes.
5 - Planar mode means: you have 3 separated image, one for each component,
6 each image 8 bites/pixel. To get the real colored pixel, you have to
7 mix the components from all planes. The resolution of planes may differ!
8 - Packed mode means: you have all components mixed/interleaved together,
9 so you have small "packs" of components in a single, big image.
5 10
6 Let's see: (some cut'n'paste from www and maillist) 11 There are RGB and YUV colorspaces.
12 - RGB: Read, Green and Blue components. Used by analog VGA monitors.
13 - YUV: Luminance (Y) and Chrominance (U,V) components. Used by some
14 video systems, like PAL. Also most m(j)peg/dct based codecs use this.
15
16 With YUV, they used to reduce the resolution of U,V planes:
17 The most common YUV formats:
18 fourcc: bpp: IEEE: plane sizes: (w=width h=height of original image)
19 ? 24 YUV 4:4:4 Y: w * h U,V: w * h
20 YUY2,UYVY 16 YUV 4:2:2 Y: w * h U,V: (w/2) * h
21 YV12,I420 12 YUV 4:2:0 Y: w * h U,V: (w/2) * (h/2)
22 YVU9 9 YUV 4:1:1 Y: w * h U,V: (w/4) * (h/4)
23
24 conversion: (some cut'n'paste from www and maillist)
7 25
8 RGB to YUV Conversion: 26 RGB to YUV Conversion:
9 Y = (0.257 * R) + (0.504 * G) + (0.098 * B) + 16 27 Y = (0.257 * R) + (0.504 * G) + (0.098 * B) + 16
10 Cr = V = (0.439 * R) - (0.368 * G) - (0.071 * B) + 128 28 Cr = V = (0.439 * R) - (0.368 * G) - (0.071 * B) + 128
11 Cb = U = -(0.148 * R) - (0.291 * G) + (0.439 * B) + 128 29 Cb = U = -(0.148 * R) - (0.291 * G) + (0.439 * B) + 128
33 Conclusion: 51 Conclusion:
34 Y = luminance, the weighted average of R G B components. (0=black 255=white) 52 Y = luminance, the weighted average of R G B components. (0=black 255=white)
35 U = Cb = blue component (0=green 128=grey 255=blue) 53 U = Cb = blue component (0=green 128=grey 255=blue)
36 V = Cr = red component (0=green 128=grey 255=red) 54 V = Cr = red component (0=green 128=grey 255=red)
37 55
38 MPlayer side: 56
39 ============= 57 Huh. The planar YUV modes.
58 ==========================
59
60 The most missunderstood thingie...
61
40 In MPlayer, we usually have 3 pointers to the Y, U and V planes, so it 62 In MPlayer, we usually have 3 pointers to the Y, U and V planes, so it
41 doesn't matter what is they order in memory: 63 doesn't matter what is the order of the planes in the memory:
42 for mp_image_t and libvo's draw_slice(): 64 for mp_image_t and libvo's draw_slice():
43 planes[0] = Y = luminance 65 planes[0] = Y = luminance
44 planes[1] = U = Cb = blue 66 planes[1] = U = Cb = blue
45 planes[2] = V = Cr = red 67 planes[2] = V = Cr = red
46 Note: planes[1] is ALWAYS U, and planes[2] is V, the fourcc 68 Note: planes[1] is ALWAYS U, and planes[2] is V, the fourcc