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 | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame^] | 7 | Copyright (c) 2000, BeOpen.com. |
| 8 | Copyright (c) 1995-2000, Corporation for National Research Initiatives. |
| 9 | Copyright (c) 1990-1995, Stichting Mathematisch Centrum. |
| 10 | All rights reserved. |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 11 | |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame^] | 12 | See the file "Misc/COPYRIGHT" for information on usage and |
| 13 | redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 14 | |
| 15 | ******************************************************************/ |
| 16 | |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 17 | #ifndef Py_YUV_H |
| 18 | #define Py_YUV_H |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
Sjoerd Mullender | 6b517fd | 1993-03-16 12:25:30 +0000 | [diff] [blame] | 23 | /* |
| 24 | * SVideo YUV 4:1:1 format. |
| 25 | * |
| 26 | * 4 consecutive quadwords describe 8 pixels on 2 lines, as depicted |
| 27 | * below. An array of (width/4) of the below structure describes 2 |
| 28 | * scan lines. |
| 29 | * |
| 30 | * +-------------------+ |
| 31 | * | 00 | 01 | 02 | 03 | . . . |
| 32 | * +-------------------+ |
| 33 | * | 10 | 11 | 12 | 13 | . . . |
| 34 | * +-------------------+ |
| 35 | */ |
| 36 | struct yuv411 { |
| 37 | struct { |
| 38 | unsigned int dummy:8; |
| 39 | unsigned int y0:8; |
| 40 | unsigned int u0:2; |
| 41 | unsigned int v0:2; |
| 42 | unsigned int y1:8; |
| 43 | unsigned int u1:2; |
| 44 | unsigned int v1:2; |
| 45 | } v[4]; |
| 46 | }; |
| 47 | |
| 48 | #define YUV411_Y00(y) (y).v[0].y0 |
| 49 | #define YUV411_Y01(y) (y).v[1].y0 |
| 50 | #define YUV411_Y02(y) (y).v[2].y0 |
| 51 | #define YUV411_Y03(y) (y).v[3].y0 |
| 52 | #define YUV411_Y10(y) (y).v[0].y1 |
| 53 | #define YUV411_Y11(y) (y).v[1].y1 |
| 54 | #define YUV411_Y12(y) (y).v[2].y1 |
| 55 | #define YUV411_Y13(y) (y).v[3].y1 |
| 56 | #define YUV411_U00(y) ((y).v[0].u0<<6|(y).v[1].u0<<4|(y).v[2].u0<<2|(y).v[3].u0) |
| 57 | #define YUV411_U01(y) YUV411_U00(y) |
| 58 | #define YUV411_U02(y) YUV411_U00(y) |
| 59 | #define YUV411_U03(y) YUV411_U00(y) |
| 60 | #define YUV411_U10(y) ((y).v[0].u1<<6|(y).v[1].u1<<4|(y).v[2].u1<<2|(y).v[3].u1) |
| 61 | #define YUV411_U11(y) YUV411_U10(y) |
| 62 | #define YUV411_U12(y) YUV411_U10(y) |
| 63 | #define YUV411_U13(y) YUV411_U10(y) |
| 64 | #define YUV411_V00(y) ((y).v[0].v0<<6|(y).v[1].v0<<4|(y).v[2].v0<<2|(y).v[3].v0) |
| 65 | #define YUV411_V01(y) YUV411_V00(y) |
| 66 | #define YUV411_V02(y) YUV411_V00(y) |
| 67 | #define YUV411_V03(y) YUV411_V00(y) |
| 68 | #define YUV411_V10(y) ((y).v[0].v1<<6|(y).v[1].v1<<4|(y).v[2].v1<<2|(y).v[3].v1) |
| 69 | #define YUV411_V11(y) YUV411_V10(y) |
| 70 | #define YUV411_V12(y) YUV411_V10(y) |
| 71 | #define YUV411_V13(y) YUV411_V10(y) |
| 72 | |
| 73 | /* |
| 74 | * Compression Library YUV 4:2:2 format. |
| 75 | * |
| 76 | * 1 longword describes 2 pixels. |
| 77 | * |
| 78 | * +-------+ |
| 79 | * | 0 | 1 | |
| 80 | * +-------+ |
| 81 | */ |
| 82 | struct yuv422 { |
| 83 | unsigned int u:8; |
| 84 | unsigned int y0:8; |
| 85 | unsigned int v:8; |
| 86 | unsigned int y1:8; |
| 87 | }; |
| 88 | #define YUV422_Y0(y) (y).y0 |
| 89 | #define YUV422_Y1(y) (y).y1 |
| 90 | #define YUV422_U0(y) (y).u |
| 91 | #define YUV422_U1(y) (y).u |
| 92 | #define YUV422_V0(y) (y).v |
| 93 | #define YUV422_V1(y) (y).v |
| 94 | |
| 95 | /* |
| 96 | * Compression library YUV 4:2:2 Duplicate Chroma format. |
| 97 | * |
| 98 | * This is like the previous format, but the U and V values are |
| 99 | * duplicated vertically (and hence there is some redundancy in the |
| 100 | * data). With other words, lines 2*n and 2*n+1 have the same U and V |
| 101 | * values but different Y values. |
| 102 | */ |
| 103 | |
| 104 | /* |
| 105 | * Conversion functions. |
| 106 | */ |
| 107 | void yuv_sv411_to_cl422dc(int, void *, void *, int, int); |
| 108 | void yuv_sv411_to_cl422dc_quartersize(int, void *, void *, int, int); |
| 109 | void yuv_sv411_to_cl422dc_sixteenthsize(int, void *, void *, int, int); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 110 | |
| 111 | #ifdef __cplusplus |
| 112 | } |
| 113 | #endif |
| 114 | #endif /* !Py_YUV_H */ |