Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 1 | /*********************************************************** |
Guido van Rossum | 524b588 | 1995-01-04 19:10:35 +0000 | [diff] [blame] | 2 | Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
| 3 | The Netherlands. |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 4 | |
| 5 | All Rights Reserved |
| 6 | |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame^] | 7 | Permission to use, copy, modify, and distribute this software and its |
| 8 | documentation for any purpose and without fee is hereby granted, |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 9 | provided that the above copyright notice appear in all copies and that |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame^] | 10 | both that copyright notice and this permission notice appear in |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 11 | supporting documentation, and that the names of Stichting Mathematisch |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame^] | 12 | Centrum or CWI or Corporation for National Research Initiatives or |
| 13 | CNRI not be used in advertising or publicity pertaining to |
| 14 | distribution of the software without specific, written prior |
| 15 | permission. |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 16 | |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame^] | 17 | While CWI is the initial source for this software, a modified version |
| 18 | is made available by the Corporation for National Research Initiatives |
| 19 | (CNRI) at the Internet address ftp://ftp.python.org. |
| 20 | |
| 21 | STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
| 22 | REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
| 23 | MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
| 24 | CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
| 25 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 26 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 27 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 28 | PERFORMANCE OF THIS SOFTWARE. |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 29 | |
| 30 | ******************************************************************/ |
| 31 | |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 32 | #ifndef Py_YUV_H |
| 33 | #define Py_YUV_H |
| 34 | #ifdef __cplusplus |
| 35 | extern "C" { |
| 36 | #endif |
| 37 | |
Sjoerd Mullender | 6b517fd | 1993-03-16 12:25:30 +0000 | [diff] [blame] | 38 | /* |
| 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 | */ |
| 51 | struct 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 | */ |
| 97 | struct 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 | */ |
| 122 | void yuv_sv411_to_cl422dc(int, void *, void *, int, int); |
| 123 | void yuv_sv411_to_cl422dc_quartersize(int, void *, void *, int, int); |
| 124 | void yuv_sv411_to_cl422dc_sixteenthsize(int, void *, void *, int, int); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 125 | |
| 126 | #ifdef __cplusplus |
| 127 | } |
| 128 | #endif |
| 129 | #endif /* !Py_YUV_H */ |