blob: e8c2fcdfbb8af23ed496343a8f08bba6c1e3fdeb [file] [log] [blame]
Guido van Rossumb6775db1994-08-01 11:34:53 +00001/***********************************************************
Guido van Rossum524b5881995-01-04 19:10:35 +00002Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3The Netherlands.
Guido van Rossumb6775db1994-08-01 11:34:53 +00004
5 All Rights Reserved
6
Guido van Rossumd266eb41996-10-25 14:44:06 +00007Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
Guido van Rossumb6775db1994-08-01 11:34:53 +00009provided that the above copyright notice appear in all copies and that
Guido van Rossumd266eb41996-10-25 14:44:06 +000010both that copyright notice and this permission notice appear in
Guido van Rossumb6775db1994-08-01 11:34:53 +000011supporting documentation, and that the names of Stichting Mathematisch
Guido van Rossumd266eb41996-10-25 14:44:06 +000012Centrum or CWI or Corporation for National Research Initiatives or
13CNRI not be used in advertising or publicity pertaining to
14distribution of the software without specific, written prior
15permission.
Guido van Rossumb6775db1994-08-01 11:34:53 +000016
Guido van Rossumd266eb41996-10-25 14:44:06 +000017While CWI is the initial source for this software, a modified version
18is made available by the Corporation for National Research Initiatives
19(CNRI) at the Internet address ftp://ftp.python.org.
20
21STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
22REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
23MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
24CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
25DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
26PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
27TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28PERFORMANCE OF THIS SOFTWARE.
Guido van Rossumb6775db1994-08-01 11:34:53 +000029
30******************************************************************/
31
Guido van Rossuma3309961993-07-28 09:05:47 +000032#ifndef Py_YUV_H
33#define Py_YUV_H
34#ifdef __cplusplus
35extern "C" {
36#endif
37
Sjoerd Mullender6b517fd1993-03-16 12:25:30 +000038/*
39 * SVideo YUV 4:1:1 format.
40 *
41 * 4 consecutive quadwords describe 8 pixels on 2 lines, as depicted
42 * below. An array of (width/4) of the below structure describes 2
43 * scan lines.
44 *
45 * +-------------------+
46 * | 00 | 01 | 02 | 03 | . . .
47 * +-------------------+
48 * | 10 | 11 | 12 | 13 | . . .
49 * +-------------------+
50 */
51struct yuv411 {
52 struct {
53 unsigned int dummy:8;
54 unsigned int y0:8;
55 unsigned int u0:2;
56 unsigned int v0:2;
57 unsigned int y1:8;
58 unsigned int u1:2;
59 unsigned int v1:2;
60 } v[4];
61};
62
63#define YUV411_Y00(y) (y).v[0].y0
64#define YUV411_Y01(y) (y).v[1].y0
65#define YUV411_Y02(y) (y).v[2].y0
66#define YUV411_Y03(y) (y).v[3].y0
67#define YUV411_Y10(y) (y).v[0].y1
68#define YUV411_Y11(y) (y).v[1].y1
69#define YUV411_Y12(y) (y).v[2].y1
70#define YUV411_Y13(y) (y).v[3].y1
71#define YUV411_U00(y) ((y).v[0].u0<<6|(y).v[1].u0<<4|(y).v[2].u0<<2|(y).v[3].u0)
72#define YUV411_U01(y) YUV411_U00(y)
73#define YUV411_U02(y) YUV411_U00(y)
74#define YUV411_U03(y) YUV411_U00(y)
75#define YUV411_U10(y) ((y).v[0].u1<<6|(y).v[1].u1<<4|(y).v[2].u1<<2|(y).v[3].u1)
76#define YUV411_U11(y) YUV411_U10(y)
77#define YUV411_U12(y) YUV411_U10(y)
78#define YUV411_U13(y) YUV411_U10(y)
79#define YUV411_V00(y) ((y).v[0].v0<<6|(y).v[1].v0<<4|(y).v[2].v0<<2|(y).v[3].v0)
80#define YUV411_V01(y) YUV411_V00(y)
81#define YUV411_V02(y) YUV411_V00(y)
82#define YUV411_V03(y) YUV411_V00(y)
83#define YUV411_V10(y) ((y).v[0].v1<<6|(y).v[1].v1<<4|(y).v[2].v1<<2|(y).v[3].v1)
84#define YUV411_V11(y) YUV411_V10(y)
85#define YUV411_V12(y) YUV411_V10(y)
86#define YUV411_V13(y) YUV411_V10(y)
87
88/*
89 * Compression Library YUV 4:2:2 format.
90 *
91 * 1 longword describes 2 pixels.
92 *
93 * +-------+
94 * | 0 | 1 |
95 * +-------+
96 */
97struct yuv422 {
98 unsigned int u:8;
99 unsigned int y0:8;
100 unsigned int v:8;
101 unsigned int y1:8;
102};
103#define YUV422_Y0(y) (y).y0
104#define YUV422_Y1(y) (y).y1
105#define YUV422_U0(y) (y).u
106#define YUV422_U1(y) (y).u
107#define YUV422_V0(y) (y).v
108#define YUV422_V1(y) (y).v
109
110/*
111 * Compression library YUV 4:2:2 Duplicate Chroma format.
112 *
113 * This is like the previous format, but the U and V values are
114 * duplicated vertically (and hence there is some redundancy in the
115 * data). With other words, lines 2*n and 2*n+1 have the same U and V
116 * values but different Y values.
117 */
118
119/*
120 * Conversion functions.
121 */
122void yuv_sv411_to_cl422dc(int, void *, void *, int, int);
123void yuv_sv411_to_cl422dc_quartersize(int, void *, void *, int, int);
124void yuv_sv411_to_cl422dc_sixteenthsize(int, void *, void *, int, int);
Guido van Rossuma3309961993-07-28 09:05:47 +0000125
126#ifdef __cplusplus
127}
128#endif
129#endif /* !Py_YUV_H */