blob: 738c4e50c199a8328f9b9f2ecdc80bdd7eda9282 [file] [log] [blame]
Guido van Rossumb6775db1994-08-01 11:34:53 +00001
Guido van Rossuma3309961993-07-28 09:05:47 +00002#ifndef Py_YUV_H
3#define Py_YUV_H
4#ifdef __cplusplus
5extern "C" {
6#endif
7
Sjoerd Mullender6b517fd1993-03-16 12:25:30 +00008/*
9 * SVideo YUV 4:1:1 format.
10 *
11 * 4 consecutive quadwords describe 8 pixels on 2 lines, as depicted
12 * below. An array of (width/4) of the below structure describes 2
13 * scan lines.
14 *
15 * +-------------------+
16 * | 00 | 01 | 02 | 03 | . . .
17 * +-------------------+
18 * | 10 | 11 | 12 | 13 | . . .
19 * +-------------------+
20 */
21struct yuv411 {
22 struct {
23 unsigned int dummy:8;
24 unsigned int y0:8;
25 unsigned int u0:2;
26 unsigned int v0:2;
27 unsigned int y1:8;
28 unsigned int u1:2;
29 unsigned int v1:2;
30 } v[4];
31};
32
33#define YUV411_Y00(y) (y).v[0].y0
34#define YUV411_Y01(y) (y).v[1].y0
35#define YUV411_Y02(y) (y).v[2].y0
36#define YUV411_Y03(y) (y).v[3].y0
37#define YUV411_Y10(y) (y).v[0].y1
38#define YUV411_Y11(y) (y).v[1].y1
39#define YUV411_Y12(y) (y).v[2].y1
40#define YUV411_Y13(y) (y).v[3].y1
41#define YUV411_U00(y) ((y).v[0].u0<<6|(y).v[1].u0<<4|(y).v[2].u0<<2|(y).v[3].u0)
42#define YUV411_U01(y) YUV411_U00(y)
43#define YUV411_U02(y) YUV411_U00(y)
44#define YUV411_U03(y) YUV411_U00(y)
45#define YUV411_U10(y) ((y).v[0].u1<<6|(y).v[1].u1<<4|(y).v[2].u1<<2|(y).v[3].u1)
46#define YUV411_U11(y) YUV411_U10(y)
47#define YUV411_U12(y) YUV411_U10(y)
48#define YUV411_U13(y) YUV411_U10(y)
49#define YUV411_V00(y) ((y).v[0].v0<<6|(y).v[1].v0<<4|(y).v[2].v0<<2|(y).v[3].v0)
50#define YUV411_V01(y) YUV411_V00(y)
51#define YUV411_V02(y) YUV411_V00(y)
52#define YUV411_V03(y) YUV411_V00(y)
53#define YUV411_V10(y) ((y).v[0].v1<<6|(y).v[1].v1<<4|(y).v[2].v1<<2|(y).v[3].v1)
54#define YUV411_V11(y) YUV411_V10(y)
55#define YUV411_V12(y) YUV411_V10(y)
56#define YUV411_V13(y) YUV411_V10(y)
57
58/*
59 * Compression Library YUV 4:2:2 format.
60 *
61 * 1 longword describes 2 pixels.
62 *
63 * +-------+
64 * | 0 | 1 |
65 * +-------+
66 */
67struct yuv422 {
68 unsigned int u:8;
69 unsigned int y0:8;
70 unsigned int v:8;
71 unsigned int y1:8;
72};
73#define YUV422_Y0(y) (y).y0
74#define YUV422_Y1(y) (y).y1
75#define YUV422_U0(y) (y).u
76#define YUV422_U1(y) (y).u
77#define YUV422_V0(y) (y).v
78#define YUV422_V1(y) (y).v
79
80/*
81 * Compression library YUV 4:2:2 Duplicate Chroma format.
82 *
83 * This is like the previous format, but the U and V values are
84 * duplicated vertically (and hence there is some redundancy in the
85 * data). With other words, lines 2*n and 2*n+1 have the same U and V
86 * values but different Y values.
87 */
88
89/*
90 * Conversion functions.
91 */
92void yuv_sv411_to_cl422dc(int, void *, void *, int, int);
93void yuv_sv411_to_cl422dc_quartersize(int, void *, void *, int, int);
94void yuv_sv411_to_cl422dc_sixteenthsize(int, void *, void *, int, int);
Guido van Rossuma3309961993-07-28 09:05:47 +000095
96#ifdef __cplusplus
97}
98#endif
99#endif /* !Py_YUV_H */