source: svn/trunk/newcon3bcm2_21bu/magnum/commonutils/pxl/bpxl.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 37.1 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2011, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bpxl.h $
11 * $brcm_Revision: Hydra_Software_Devel/51 $
12 * $brcm_Date: 9/23/11 7:21p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/commonutils/pxl/bpxl.h $
19 *
20 * Hydra_Software_Devel/51   9/23/11 7:21p nissen
21 * SW7425-1078: Added A0 and P0 pixel formats.
22 *
23 * Hydra_Software_Devel/50   4/25/11 5:06p nissen
24 * SW7630-104: Added Cr and Cb format.
25 *
26 * Hydra_Software_Devel/49   4/20/11 1:19p nissen
27 * SW7630-104: Added A8_Y8 pixel format.
28 *
29 * Hydra_Software_Devel/48   1/17/11 7:24p nissen
30 * SW7405-3671: Fixed luma format.
31 *
32 * Hydra_Software_Devel/47   1/17/11 6:51p nissen
33 * SW7405-3671: Removed luma format.
34 *
35 * Hydra_Software_Devel/46   1/17/11 5:57p nissen
36 * SW7405-3671: Defined more luma formats.
37 *
38 * Hydra_Software_Devel/45   1/19/10 12:59p nissen
39 * SW7405-3671: Fixed CbCr format defines.
40 *
41 * Hydra_Software_Devel/44   12/14/09 11:14a nissen
42 * SW7405-3590: Fixed converting RGB to 10-bit YCbCr.
43 *
44 * Hydra_Software_Devel/43   12/14/09 10:46a nissen
45 * SW7405-3590: Fixed 24-bit packed RGB definitions.
46 *
47 * Hydra_Software_Devel/42   10/1/08 5:23p nissen
48 * PR 47303: Added macro to determine if format is YCbCr444.
49 *
50 * Hydra_Software_Devel/41   4/4/08 10:11a nissen
51 * PR 40122: Added more support for 10-bit 422 40-bit packed formats.
52 *
53 * Hydra_Software_Devel/40   3/27/08 4:49p nissen
54 * PR 40122: Added 10-bit 422 40-bit packed formats.
55 *
56 * Hydra_Software_Devel/39   9/14/07 10:57a syang
57 * PR 33575: merge from 7401
58 *
59 * Hydra_Software_Devel/Refsw_Dedicated_vdc_7401/1   9/7/07 5:13p jessem
60 * PR 34592: Added BPXL_P_Format_Info  table and BPXL_ConvertFmtToStr to
61 * help convert pixel format to a string literal.
62 *
63 * Hydra_Software_Devel/36   11/29/06 10:42a nissen
64 * PR 26250: Added more YCbCr 444 formats.
65 *
66 * Hydra_Software_Devel/35   10/24/06 7:53p nissen
67 * PR 24648: Fixed macro that returns bits per pixel for YCbCr 420 format.
68 *
69 * Hydra_Software_Devel/34   8/25/06 10:43a nissen
70 * PR 20763: Added support for 10-bit versions of YCbCr 444 and 422.
71 *
72 * Hydra_Software_Devel/33   3/15/06 12:00p nissen
73 * PR 15840: Added support for YCbCr 420 formats.
74 *
75 * Hydra_Software_Devel/32   11/28/05 3:44p syang
76 * PR 12762: separate little endian and big endian when gfx sur goes to
77 * mgd; mute for bad gfx sur; add 4 more pxl fmts to fully use HW
78 *
79 * Hydra_Software_Devel/31   3/16/05 12:16p nissen
80 * PR 14329: Added Y8 and YP88 formats.
81 *
82 * Hydra_Software_Devel/30   9/29/04 1:06p nissen
83 * PR 12728: Eliminated -pendantic errors.
84 *
85 * Hydra_Software_Devel/29   9/24/04 4:34p nissen
86 * PR 12598: Added macro to determine if format is YCbCr422.
87 *
88 * Hydra_Software_Devel/28   7/2/04 12:45p nissen
89 * PR 11789: Fixed definition of A8_P8 format.
90 *
91 * Hydra_Software_Devel/27   6/17/04 11:19a nissen
92 * PR 11576: Reversed channel location define for CrCbYA.
93 *
94 * Hydra_Software_Devel/26   5/3/04 10:42p nissen
95 * PR 9635: Fixed macro that checks if format has masked alpha.
96 *
97 * Hydra_Software_Devel/25   2/20/04 4:49p nissen
98 * PR 9635: Added masked alpha "X" formats which are supported by M2MC B0.
99 *
100 * Hydra_Software_Devel/24   1/21/04 1:40p nissen
101 * PR 9132: Added macros to check for luma and depth surfaces used by P3D
102 * module.
103 *
104 * Hydra_Software_Devel/23   12/21/03 8:43p nissen
105 * PR 9034: Fixed 24 bpp RGB pixel format enums.
106 *
107 * Hydra_Software_Devel/22   9/26/03 1:22p jasonh
108 * Fixed documentation with in/out tags and in-line argument description.
109 *
110 * Hydra_Software_Devel/21   8/26/03 4:19p nissen
111 * Renamed YCrCb to YCbCr.  Removed X formats.
112 *
113 * Hydra_Software_Devel/20   8/19/03 10:02a nissen
114 * Added YCbCr enums.
115 *
116 * Hydra_Software_Devel/19   8/12/03 12:38p nissen
117 * Updated macros that set component positions.
118 *
119 * Hydra_Software_Devel/18   8/12/03 11:09a syang
120 * corrected the error in the definition of BPXL_P_LOC_AYCrCb (loc of
121 * component Cb and Cr were swaped)
122 *
123 * Hydra_Software_Devel/17   8/12/03 11:01a syang
124 * changed the parameter name of BPXL_P_LOC, BPXL_P_COMP_LOC, and
125 * BPXL_P_COMP_SIZE for better readability
126 *
127 * Hydra_Software_Devel/16   8/12/03 10:26a nissen
128 * Added enums for W1 and WRGB1555 formats.
129 *
130 * Hydra_Software_Devel/15   8/6/03 2:18p nissen
131 * Fixed problem with YCrCb and Palette pixel component positions.
132 *
133 * Hydra_Software_Devel/14   6/9/03 3:30p nissen
134 * Fixed problem with macro parameter.
135 *
136 * Hydra_Software_Devel/13   6/9/03 3:02p nissen
137 * Added pixel and component conversion functions.
138 *
139 * Hydra_Software_Devel/12   6/5/03 11:33a nissen
140 * Fixed and added pixel manipulation macros.
141 *
142 * Hydra_Software_Devel/11   5/29/03 10:07a nissen
143 * Updated comments.
144 *
145 * Hydra_Software_Devel/10   5/28/03 6:57p nissen
146 * Update comments.
147 *
148 * Hydra_Software_Devel/9   5/28/03 4:31p nissen
149 * Fixed comment for macro.
150 *
151 * Hydra_Software_Devel/8   5/28/03 3:35p nissen
152 * Modified internal definition of pixel formats. Added macros for
153 * converting pixel components. Added function definitions for converting
154 * pixels.
155 *
156 * Hydra_Software_Devel/7   4/14/03 8:32a jasonh
157 * Added function to get the number of bytes per row of pixels.
158 *
159 * Hydra_Software_Devel/6   4/4/03 2:38p jasonh
160 * Added BPXL_eA8_Y8_Cr8_Cb8 to support palette type.
161 *
162 * Hydra_Software_Devel/5   3/21/03 1:15p jasonh
163 * Fixed module overview section of documentation.
164 *
165 * Hydra_Software_Devel/4   3/19/03 5:22p jasonh
166 * Completed list of changes from initial internal code review.
167 *
168 * Hydra_Software_Devel/3   3/17/03 3:43p jasonh
169 * Turned bit fields into private. Created BGR and num palette entries
170 * field. Added comment on private fields. Reformatted to fit 80 columns.
171 * Turned num palette entries and bits per pixel into macro.
172 *
173 ***************************************************************************/
174#ifndef BPXL_H__
175#define BPXL_H__
176
177#ifdef __cplusplus
178extern "C" {
179#endif
180
181/*=Module Overview: ********************************************************
182This module provides a list of arbitrary pixel formats usable by multiple
183kinds of modules. This module will provide information about the listed
184formats through macros and functions. This module will also contain utility
185functions used to convert from one format to another.
186
187Supported features:
188o TODO: Complete list of specific features that are supported and unit
189  tested for this module.
190****************************************************************************/
191
192/***************************************************************************
193 * Header bits:
194 * Combined together, these bits create unique pixel values.
195 * When extracted, these bits can be used to determine
196 * basic information about a pixel, allowing for quick
197 * processing.
198 ***************************************************************************/
199
200/* Private pixel format types */
201#define BPXL_P_ALPHA           0x01000000
202#define BPXL_P_COLOR           0x02000000
203#define BPXL_P_RGB             0x04000000
204#define BPXL_P_YCbCr           0x08000000
205#define BPXL_P_PALETTE         0x10000000
206#define BPXL_P_SPECIAL         0x20000000
207#define BPXL_P_WINDOW          0x40000000
208#define BPXL_P_TYPE_MASK       0x7F000000
209
210/* Private pixel component information */
211#define BPXL_P_COMP_SIZE_MASK  0xF
212#define BPXL_P_COMP_SIZE_SHIFT 4
213#define BPXL_P_COMP_LOC_MASK   0x3
214#define BPXL_P_COMP_LOC_SHIFT  16
215
216/* Private pixel component locations */
217#define BPXL_P_LOC_A(p)        ((p) << (BPXL_P_COMP_LOC_SHIFT + 3 * 2))
218#define BPXL_P_LOC_R(p)        ((p) << (BPXL_P_COMP_LOC_SHIFT + 2 * 2))
219#define BPXL_P_LOC_G(p)        ((p) << (BPXL_P_COMP_LOC_SHIFT + 1 * 2))
220#define BPXL_P_LOC_B(p)        ((p) << (BPXL_P_COMP_LOC_SHIFT + 0 * 2))
221#define BPXL_P_LOC_Y0(p)       ((p) << (BPXL_P_COMP_LOC_SHIFT + 3 * 2))
222#define BPXL_P_LOC_Y1(p)       ((p) << (BPXL_P_COMP_LOC_SHIFT + 2 * 2))
223#define BPXL_P_LOC_Y(p)        ((p) << (BPXL_P_COMP_LOC_SHIFT + 2 * 2))
224#define BPXL_P_LOC_Cb(p)       ((p) << (BPXL_P_COMP_LOC_SHIFT + 1 * 2))
225#define BPXL_P_LOC_Cr(p)       ((p) << (BPXL_P_COMP_LOC_SHIFT + 0 * 2))
226#define BPXL_P_LOC_P(p)        ((p) << (BPXL_P_COMP_LOC_SHIFT + 0 * 2))
227#define BPXL_P_LOC_L(p)        ((p) << (BPXL_P_COMP_LOC_SHIFT + 0 * 2))
228
229#define BPXL_P_LOC_ARGB        (BPXL_P_LOC_A(3)  | BPXL_P_LOC_R(2)  | BPXL_P_LOC_G(1)  | BPXL_P_LOC_B(0))
230#define BPXL_P_LOC_ABGR        (BPXL_P_LOC_A(3)  | BPXL_P_LOC_R(0)  | BPXL_P_LOC_G(1)  | BPXL_P_LOC_B(2))
231#define BPXL_P_LOC_RGBA        (BPXL_P_LOC_A(0)  | BPXL_P_LOC_R(3)  | BPXL_P_LOC_G(2)  | BPXL_P_LOC_B(1))
232#define BPXL_P_LOC_BGRA        (BPXL_P_LOC_A(0)  | BPXL_P_LOC_R(1)  | BPXL_P_LOC_G(2)  | BPXL_P_LOC_B(3))
233#define BPXL_P_LOC_RGB         (                   BPXL_P_LOC_R(2)  | BPXL_P_LOC_G(1)  | BPXL_P_LOC_B(0))
234#define BPXL_P_LOC_BGR         (                   BPXL_P_LOC_R(0)  | BPXL_P_LOC_G(1)  | BPXL_P_LOC_B(2))
235#define BPXL_P_LOC_AYCbCr      (BPXL_P_LOC_A(3)  | BPXL_P_LOC_Y(2)  | BPXL_P_LOC_Cb(1) | BPXL_P_LOC_Cr(0))
236#define BPXL_P_LOC_CrCbYA      (BPXL_P_LOC_A(0)  | BPXL_P_LOC_Y(1)  | BPXL_P_LOC_Cb(2) | BPXL_P_LOC_Cr(3))
237#define BPXL_P_LOC_YCbCrA      (BPXL_P_LOC_A(0)  | BPXL_P_LOC_Y(3)  | BPXL_P_LOC_Cb(2) | BPXL_P_LOC_Cr(1))
238#define BPXL_P_LOC_ACrCbY      (BPXL_P_LOC_A(3)  | BPXL_P_LOC_Y(0)  | BPXL_P_LOC_Cb(1) | BPXL_P_LOC_Cr(2))
239#define BPXL_P_LOC_CrY1CbY0    (BPXL_P_LOC_Y0(0) | BPXL_P_LOC_Y1(2) | BPXL_P_LOC_Cb(1) | BPXL_P_LOC_Cr(3))
240#define BPXL_P_LOC_Y1CrY0Cb    (BPXL_P_LOC_Y0(1) | BPXL_P_LOC_Y1(3) | BPXL_P_LOC_Cb(0) | BPXL_P_LOC_Cr(2))
241#define BPXL_P_LOC_Y0CbY1Cr    (BPXL_P_LOC_Y0(3) | BPXL_P_LOC_Y1(1) | BPXL_P_LOC_Cb(2) | BPXL_P_LOC_Cr(0))
242#define BPXL_P_LOC_CbY0CrY1    (BPXL_P_LOC_Y0(2) | BPXL_P_LOC_Y1(0) | BPXL_P_LOC_Cb(3) | BPXL_P_LOC_Cr(1))
243#define BPXL_P_LOC_CbY1CrY0    (BPXL_P_LOC_Y0(0) | BPXL_P_LOC_Y1(2) | BPXL_P_LOC_Cb(3) | BPXL_P_LOC_Cr(1))
244#define BPXL_P_LOC_Y1CbY0Cr    (BPXL_P_LOC_Y0(1) | BPXL_P_LOC_Y1(3) | BPXL_P_LOC_Cb(2) | BPXL_P_LOC_Cr(0))
245#define BPXL_P_LOC_Y0CrY1Cb    (BPXL_P_LOC_Y0(3) | BPXL_P_LOC_Y1(1) | BPXL_P_LOC_Cb(0) | BPXL_P_LOC_Cr(2))
246#define BPXL_P_LOC_CrY0CbY1    (BPXL_P_LOC_Y0(2) | BPXL_P_LOC_Y1(0) | BPXL_P_LOC_Cb(1) | BPXL_P_LOC_Cr(3))
247#define BPXL_P_LOC_CbCr        (BPXL_P_LOC_A(3)  | BPXL_P_LOC_Y(2)  | BPXL_P_LOC_Cb(1) | BPXL_P_LOC_Cr(0))
248#define BPXL_P_LOC_CrCb        (BPXL_P_LOC_A(3)  | BPXL_P_LOC_Y(2)  | BPXL_P_LOC_Cb(0) | BPXL_P_LOC_Cr(1))
249#define BPXL_P_LOC_ACrYCb      (BPXL_P_LOC_A(3)  | BPXL_P_LOC_Y(1)  | BPXL_P_LOC_Cb(0) | BPXL_P_LOC_Cr(2))
250#define BPXL_P_LOC_AP          (BPXL_P_LOC_A(1)  |                                       BPXL_P_LOC_P(0))
251#define BPXL_P_LOC_LA          (BPXL_P_LOC_A(0)  |                                       BPXL_P_LOC_L(1))
252
253/* Private macro to retrieve location of component */
254#define BPXL_P_COMP_LOC(f,c) \
255        (((f) >> (BPXL_P_COMP_LOC_SHIFT + (c) * 2)) & BPXL_P_COMP_LOC_MASK)
256
257/* Private macro to retrieve size of component */
258#define BPXL_P_COMP_SIZE(f,c) \
259        (((f) >> (c * BPXL_P_COMP_SIZE_SHIFT)) & BPXL_P_COMP_SIZE_MASK)
260
261/***************************************************************************
262Summary:
263        List of all possible pixel formats.
264
265Description:
266        A pixel may contain one or more of the following components:
267
268        A -  Alpha component.
269        B -  Blue component
270        Cb - Color component for YCbCr
271        Cr - Color component for YCbCr
272        G -  Green component
273        L -  Luma component (where red, green, and blue = L) (used in 3D core)
274        P -  Palette index
275        R -  Red component
276        W -  Special window alpha
277        X -  Used to block out unused components in a format
278        Y -  Luma component for YUV and YCbCr
279        Z -  Fixed point Z-value (used for 3D)
280
281        Each format identifier will contain one or more of those components
282        combined with the number of bits used for that component. The order
283        specified will describe what order the components take with respect
284        to each other. For example:
285
286        o  BPXL_eR5_G6_B5:  16 bit value. 5 bits of red, 6 bits of green,
287           and 5 bits of blue. High bits are red. Low bits are green.
288        o  BPXL_eX8_R8_G8_B8:  32 bit value. 8 bits of red, 8 bits of green,
289           8 bits of blue. Top 8 bits are unused. Next bits are red, then
290           green, then blue in the low bits.
291        o  BPXL_eZ16:  16 bit fixed point Z-value
292        o  BPXL_eY08_Cb8_Y18_Cr8:  32 bit value. 4:2:2 format.
293
294        In order to keep the component order consistent on little and
295        big endian systems, access to the pixels should be done with a
296        unsigned type that contains the same number of bits as the pixel.
297        For 32 bit values, use uint32_t, for 16 bit value use uint16_t,
298        for 8 bit values use uint8_t. For those pixels that are packed,
299        such as 24 bit pixels, access will be done using bytes (uint8_t)
300        and the first component listed will be the first byte found. For
301        example BPXL_eR8_G8_B8 (24 bit packed value) will be accessed with a
302        uint8_t and the bytes will be ordered red, then green, then blue.
303
304        Private values used to build up actual format values are private
305        and should not be used directly since they may change at any time.
306
307        This is not a fixed list. Many more formats are available and
308        can be enumerated on request.
309****************************************************************************/
310
311typedef enum BPXL_Format
312{
313        /* YCbCr 444 */
314        BPXL_eA8_Y8_Cb8_Cr8    = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_AYCbCr | 0x8888,
315        BPXL_eCr8_Cb8_Y8_A8    = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CrCbYA | 0x8888,
316        BPXL_eY8_Cb8_Cr8_A8    = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_YCbCrA | 0x8888,
317        BPXL_eA8_Cr8_Cb8_Y8    = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_ACrCbY | 0x8888,
318
319        /* YCbCr 422 */
320        BPXL_eCr8_Y18_Cb8_Y08  = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CrY1CbY0 | 0x8888,
321        BPXL_eY18_Cr8_Y08_Cb8  = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_Y1CrY0Cb | 0x8888,
322        BPXL_eY08_Cb8_Y18_Cr8  = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_Y0CbY1Cr | 0x8888,
323        BPXL_eCb8_Y08_Cr8_Y18  = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CbY0CrY1 | 0x8888,
324        BPXL_eCb8_Y18_Cr8_Y08  = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CbY1CrY0 | 0x8888,
325        BPXL_eY18_Cb8_Y08_Cr8  = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_Y1CbY0Cr | 0x8888,
326        BPXL_eY08_Cr8_Y18_Cb8  = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_Y0CrY1Cb | 0x8888,
327        BPXL_eCr8_Y08_Cb8_Y18  = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CrY0CbY1 | 0x8888,
328
329        /* YCbCr 420 */
330        BPXL_eY8               = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_ARGB | 0x0800,
331        BPXL_eA8_Y8            = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_ARGB | 0x8800,
332        BPXL_eCb8_Cr8          = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CbCr | 0x0088,
333        BPXL_eCr8_Cb8          = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CrCb | 0x0088,
334        BPXL_eCb8              = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CbCr | 0x0080,
335        BPXL_eCr8              = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CbCr | 0x0008,
336
337        /* YCbCr 444 10-bit */
338        BPXL_eX2_Cr10_Y10_Cb10 = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_ACrYCb | 0x2AAA,
339
340        /* YCbCr 422 10-bit (Special) */
341        BPXL_eX2_Y010_Cb10_Y110_X2_Cr10_Y010_Cb10_X2_Y110_Cr10_Y010_X2_Cb10_Y110_Cr10 =
342                                 BPXL_P_SPECIAL | BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_Y0CbY1Cr | 0xAAAA,
343
344        /* YCbCr 422 10-bit (Packed 40-bit pixel)*/
345        BPXL_eCr10_Y110_Cb10_Y010 = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CrY1CbY0 | 0xAAAA,
346        BPXL_eY110_Cr10_Y010_Cb10 = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_Y1CrY0Cb | 0xAAAA,
347        BPXL_eY010_Cb10_Y110_Cr10 = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_Y0CbY1Cr | 0xAAAA,
348        BPXL_eCb10_Y010_Cr10_Y110 = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CbY0CrY1 | 0xAAAA,
349        BPXL_eCb10_Y110_Cr10_Y010 = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CbY1CrY0 | 0xAAAA,
350        BPXL_eY110_Cb10_Y010_Cr10 = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_Y1CbY0Cr | 0xAAAA,
351        BPXL_eY010_Cr10_Y110_Cb10 = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_Y0CrY1Cb | 0xAAAA,
352        BPXL_eCr10_Y010_Cb10_Y110 = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_LOC_CrY0CbY1 | 0xAAAA,
353
354        /* RGB */
355        BPXL_eA8_R8_G8_B8      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ARGB | 0x8888,
356        BPXL_eA8_B8_G8_R8      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ABGR | 0x8888,
357        BPXL_eR8_G8_B8_A8      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGBA | 0x8888,
358        BPXL_eB8_G8_R8_A8      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_BGRA | 0x8888,
359
360        BPXL_eX8_R8_G8_B8      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ARGB | 0x8888,
361        BPXL_eX8_B8_G8_R8      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ABGR | 0x8888,
362        BPXL_eR8_G8_B8_X8      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGBA | 0x8888,
363        BPXL_eB8_G8_R8_X8      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_BGRA | 0x8888,
364
365        BPXL_eR8_G8_B8         = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGB | 0x0888,
366        BPXL_eB8_G8_R8         = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_BGR | 0x0888,
367
368        BPXL_eR5_G6_B5         = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ARGB | 0x0565,
369        BPXL_eB5_G6_R5         = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ABGR | 0x0565,
370
371        BPXL_eA1_R5_G5_B5      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ARGB | 0x1555,
372        BPXL_eA1_B5_G5_R5      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ABGR | 0x1555,
373        BPXL_eR5_G5_B5_A1      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGBA | 0x5551,
374        BPXL_eB5_G5_R5_A1      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_BGRA | 0x5551,
375
376        BPXL_eX1_R5_G5_B5      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ARGB | 0x1555,
377        BPXL_eX1_B5_G5_R5      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ABGR | 0x1555,
378        BPXL_eR5_G5_B5_X1      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGBA | 0x5551,
379        BPXL_eB5_G5_R5_X1      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_BGRA | 0x5551,
380
381        BPXL_eW1_R5_G5_B5      = BPXL_P_WINDOW | BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ARGB | 0x1555,
382        BPXL_eW1_B5_G5_R5      = BPXL_P_WINDOW | BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ABGR | 0x1555,
383        BPXL_eR5_G5_B5_W1      = BPXL_P_WINDOW | BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGBA | 0x5551,
384        BPXL_eB5_G5_R5_W1      = BPXL_P_WINDOW | BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_BGRA | 0x5551,
385
386        BPXL_eA4_R4_G4_B4      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ARGB | 0x4444,
387        BPXL_eA4_B4_G4_R4      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ABGR | 0x4444,
388        BPXL_eR4_G4_B4_A4      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGBA | 0x4444,
389        BPXL_eB4_G4_R4_A4      = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_BGRA | 0x4444,
390
391        BPXL_eX4_R4_G4_B4      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ARGB | 0x4444,
392        BPXL_eX4_B4_G4_R4      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_ABGR | 0x4444,
393        BPXL_eR4_G4_B4_X4      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGBA | 0x4444,
394        BPXL_eB4_G4_R4_X4      = BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_BGRA | 0x4444,
395
396        /* Palette */
397        BPXL_eP0               = BPXL_P_COLOR | BPXL_P_PALETTE | BPXL_P_LOC_ARGB | 0x0000,
398        BPXL_eP1               = BPXL_P_COLOR | BPXL_P_PALETTE | BPXL_P_LOC_ARGB | 0x0001,
399        BPXL_eP2               = BPXL_P_COLOR | BPXL_P_PALETTE | BPXL_P_LOC_ARGB | 0x0002,
400        BPXL_eP4               = BPXL_P_COLOR | BPXL_P_PALETTE | BPXL_P_LOC_ARGB | 0x0004,
401        BPXL_eP8               = BPXL_P_COLOR | BPXL_P_PALETTE | BPXL_P_LOC_ARGB | 0x0008,
402        BPXL_eA8_P8            = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_PALETTE | BPXL_P_LOC_ARGB | 0x8008,
403        BPXL_eY8_P8            = BPXL_P_COLOR | BPXL_P_YCbCr | BPXL_P_PALETTE | BPXL_P_LOC_ARGB | 0x0808,
404
405        /* Alpha */
406        BPXL_eA0               = BPXL_P_ALPHA | BPXL_P_LOC_RGBA | 0x0000,
407        BPXL_eA1               = BPXL_P_ALPHA | BPXL_P_LOC_RGBA | 0x0001,
408        BPXL_eA2               = BPXL_P_ALPHA | BPXL_P_LOC_RGBA | 0x0002,
409        BPXL_eA4               = BPXL_P_ALPHA | BPXL_P_LOC_RGBA | 0x0004,
410        BPXL_eA8               = BPXL_P_ALPHA | BPXL_P_LOC_RGBA | 0x0008,
411        BPXL_eW1               = BPXL_P_WINDOW | BPXL_P_ALPHA | BPXL_P_LOC_RGBA | 0x0001,
412
413        /* 3D (Special) */
414        BPXL_eL8               = BPXL_P_COLOR | BPXL_P_SPECIAL | BPXL_P_LOC_ARGB | 0x0008,
415        BPXL_eL8_A8            = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGBA | 0x0088,
416        BPXL_eZ16              = BPXL_P_SPECIAL | 0x0088,
417
418        BPXL_eL4_A4            = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGBA | 0x0044,
419        BPXL_eL15_L05_A6       = BPXL_P_ALPHA | BPXL_P_COLOR | BPXL_P_RGB | BPXL_P_LOC_RGBA | 0x0556,
420
421        BPXL_INVALID           = 0
422}
423
424BPXL_Format;
425
426/***************************************************************************
427Summary:
428        Determines if a format contains an alpha component.
429
430Description:
431        This macro will determine if the specified format has a alpha component.
432
433Input:
434        x - Pixel format.
435
436Returns:
437        0 - Format has no alpha component.
438        1 - Format has alpha component.
439****************************************************************************/
440#define BPXL_HAS_ALPHA(x) \
441        ((((uint32_t)(x)) & BPXL_P_ALPHA) ? 1 : 0)
442
443/***************************************************************************
444Summary:
445        Determines if a format contains a masked alpha component.
446
447Description:
448        This macro will determine if the specified format has a masked
449        alpha component. eg. BPXL_eX8_R8_G8_B8
450
451Input:
452        x - Pixel format.
453
454Returns:
455        0 - Format has no masked alpha component.
456        1 - Format has masked alpha component.
457****************************************************************************/
458#define BPXL_HAS_MASKED_ALPHA(x) \
459        (BPXL_IS_RGB_FORMAT(x) && (BPXL_HAS_ALPHA(x) == 0) && (BPXL_COMPONENT_SIZE(x, 3)) ? 1 : 0)
460
461/***************************************************************************
462Summary:
463        Determines if a format contains color components.
464
465Description:
466        This macro will determine if the specified format has one or more
467        color components.
468
469Input:
470        x - Pixel format.
471
472Returns:
473        0 - Format has no color components.
474        1 - Format has one or more components.
475****************************************************************************/
476#define BPXL_HAS_COLOR(x) \
477        ((((uint32_t)(x)) & BPXL_P_COLOR) ? 1 : 0)
478
479/***************************************************************************
480Summary:
481        Determines if a format only has an alpha component.
482
483Description:
484        This macro will determine if the specified format only has an
485        alpha component.
486
487Input:
488        x - Pixel format.
489
490Returns:
491        0 - Format is not alpha only.
492        1 - Format is alpha only.
493****************************************************************************/
494#define BPXL_IS_ALPHA_ONLY_FORMAT(x) \
495        (((((uint32_t)(x)) & BPXL_P_TYPE_MASK) == BPXL_P_ALPHA) ? 1 : 0)
496
497/***************************************************************************
498Summary:
499        Determines if a format is RGB.
500
501Description:
502        This macro will determine if the specified format is an RGB format.
503
504Input:
505        x - Pixel format.
506
507Returns:
508        0 - Format is not RGB.
509        1 - Format is RGB.
510****************************************************************************/
511#define BPXL_IS_RGB_FORMAT(x) \
512        ((((uint32_t)(x)) & BPXL_P_RGB) ? 1 : 0)
513
514/***************************************************************************
515Summary:
516        Determines if a format is YCbCr.
517
518Description:
519        This macro will determine if the specified format is a YCbCr format.
520
521Input:
522        x - Pixel format.
523
524Returns:
525        0 - Format is not YCbCr.
526        1 - Format is YCbCr.
527****************************************************************************/
528#define BPXL_IS_YCbCr_FORMAT(x) \
529        ((((uint32_t)(x)) & BPXL_P_YCbCr) ? 1 : 0)
530
531/***************************************************************************
532Summary:
533        Determines if a format is special.
534
535Description:
536        This macro will determine if the specified format is a special format.
537
538Input:
539        x - Pixel format.
540
541Returns:
542        0 - Format is not special.
543        1 - Format is special.
544****************************************************************************/
545#define BPXL_IS_SPECIAL_FORMAT(x) \
546        ((((uint32_t)(x)) & BPXL_P_SPECIAL) ? 1 : 0)
547
548/***************************************************************************
549Summary:
550        Determines if a format is YCbCr422, YCbCr420 or 10 bit YCbCr.
551
552Description:
553        This macro will determine if the specified format is a YCbCr42x format.
554
555Input:
556        x - Pixel format.
557
558Returns:
559        0 - Format is not YCbCr42x.
560        1 - Format is YCbCr42x.
561****************************************************************************/
562#define BPXL_IS_YCbCr422_FORMAT(x) \
563        ((BPXL_IS_YCbCr_FORMAT(x) && (BPXL_HAS_ALPHA(x) == 0) && (((x) & 0xFFFF) == 0x8888)) ? 1 : 0)
564
565#define BPXL_IS_YCbCr420_LUMA_FORMAT(x) \
566        ((BPXL_IS_YCbCr_FORMAT(x) && ((((x) & 0xFFFF) == 0x0800) || (((x) & 0xFFFF) == 0x8800))) ? 1 : 0)
567
568#define BPXL_IS_YCbCr420_CHROMA_FORMAT(x) \
569        ((BPXL_IS_YCbCr_FORMAT(x) && (((x) & 0xFFFF) == 0x0088)) ? 1 : 0)
570
571#define BPXL_IS_YCbCr420_FORMAT(x) \
572        ((BPXL_IS_YCbCr420_LUMA_FORMAT(x) || BPXL_IS_YCbCr420_CHROMA_FORMAT(x)) ? 1 : 0)
573
574#define BPXL_IS_YCbCr444_FORMAT(x) \
575        ((BPXL_IS_YCbCr_FORMAT(x) && BPXL_HAS_ALPHA(x)) ? 1 : 0)
576
577#define BPXL_IS_YCbCr444_10BIT_FORMAT(x) \
578        ((BPXL_IS_YCbCr_FORMAT(x) && (((x) & 0xFFFF) == 0x2AAA)) ? 1 : 0)
579
580#define BPXL_IS_YCbCr422_10BIT_FORMAT(x) \
581        ((BPXL_IS_SPECIAL_FORMAT(x) && BPXL_IS_YCbCr_FORMAT(x) && (((x) & 0xFFFF) == 0xAAAA)) ? 1 : 0)
582
583#define BPXL_IS_YCbCr422_10BIT_PACKED_FORMAT(x) \
584        ((BPXL_IS_YCbCr_FORMAT(x) && (((x) & 0xFFFF) == 0xAAAA)) ? 1 : 0)
585
586/***************************************************************************
587Summary:
588        Determines if a format is a palette.
589
590Description:
591        This macro will determine if the specified format is a palette format.
592
593Input:
594        x - Pixel format.
595
596Returns:
597        0 - Format is not palette.
598        1 - Format is palette.
599****************************************************************************/
600#define BPXL_IS_PALETTE_FORMAT(x) \
601        ((((uint32_t)(x)) & BPXL_P_PALETTE) ? 1 : 0)
602
603/***************************************************************************
604Summary:
605        Determines if a format contains a window alpha.
606
607Description:
608        This macro will determine if the specified format has a window alpha.
609
610Input:
611        x - Pixel format.
612
613Returns:
614        0 - Format has no window alpha.
615        1 - Format has window alpha.
616****************************************************************************/
617#define BPXL_IS_WINDOW_FORMAT(x) \
618        ((((uint32_t)(x)) & BPXL_P_WINDOW) ? 1 : 0)
619
620/***************************************************************************
621Summary:
622        Determines if a format is luma.
623
624Description:
625        This macro will determine if the specified format is a luma format.
626        Luma formats have one color channel which is replicated across the RGB
627        color channels. These formats are supported by PX3D device.
628
629Input:
630        x - Pixel format.
631
632Returns:
633        0 - Format is not luma.
634        1 - Format is luma.
635****************************************************************************/
636#define BPXL_IS_LUMA_FORMAT(x) \
637        ((BPXL_IS_SPECIAL_FORMAT(x) && BPXL_HAS_COLOR(x) && (BPXL_IS_RGB_FORMAT(x) == 0) && (BPXL_IS_YCbCr_FORMAT(x) == 0)) ? 1 : 0)
638
639/***************************************************************************
640Summary:
641        Determines if a format is depth.
642
643Description:
644        This macro will determine if the specified format is a depth format
645        which is supported by the PX3D device.
646
647Input:
648        x - Pixel format.
649
650Returns:
651        0 - Format is not depth.
652        1 - Format is depth.
653****************************************************************************/
654#define BPXL_IS_DEPTH_FORMAT(x) \
655        ((BPXL_IS_SPECIAL_FORMAT(x) && (BPXL_HAS_ALPHA(x) == 0) && (BPXL_HAS_COLOR(x) == 0)) ? 1 : 0)
656
657/***************************************************************************
658Summary:
659        Returns the format's bits per pixel.
660
661Description:
662        This macro will retrieve the bits per pixel for a specified format,
663        except for the YCbCr 422 10-bit special format.
664
665Input:
666        x - Pixel format.
667
668Returns:
669        Format's bits per pixel.
670****************************************************************************/
671#define BPXL_BITS_PER_PIXEL(x) ((\
672        (((x) & BPXL_P_COMP_SIZE_MASK) + \
673        (((x) >> BPXL_P_COMP_SIZE_SHIFT) & BPXL_P_COMP_SIZE_MASK) + \
674        (((x) >> (BPXL_P_COMP_SIZE_SHIFT * 2)) & BPXL_P_COMP_SIZE_MASK) + \
675        (((x) >> (BPXL_P_COMP_SIZE_SHIFT * 3)) & BPXL_P_COMP_SIZE_MASK))) / \
676        (BPXL_IS_YCbCr422_FORMAT(x) ? 2 : 1))
677
678/***************************************************************************
679Summary:
680        Returns a format's pixel mask.
681
682Description:
683        This macro will retrieve the pixel mask for a specified format.
684
685Input:
686        x - Pixel format.
687
688Returns:
689        Format's pixel mask.
690****************************************************************************/
691#define BPXL_PIXEL_MASK(x) \
692        ((1 << BPXL_BITS_PER_PIXEL(x)) - 1)
693
694/***************************************************************************
695Summary:
696        Returns the format's number of palette entries.
697
698Description:
699        This macro will retrieve the number of palette entries for the
700        specified format.
701
702Input:
703        x - Pixel format.
704
705Returns:
706        Format's number of palette entries.
707****************************************************************************/
708#define BPXL_NUM_PALETTE_ENTRIES(x) \
709        (((x) & BPXL_P_PALETTE) ? 1 << ((x) & BPXL_P_COMP_SIZE_MASK) : 0)
710
711/***************************************************************************
712Summary:
713        Returns a format's pixel component size.
714
715Description:
716        This macro will retrieve the number of bits in a specified pixel
717        component for a specified format.
718
719Input:
720        x - Pixel format.
721        n - Component number (3=A/Y0, 2=R/Y1/Y, 1=G/Cb, 0=B/Cr/P/L).
722
723Returns:
724        Format's pixel component size.
725****************************************************************************/
726#define BPXL_COMPONENT_SIZE(x,n) \
727        (((x) >> (BPXL_P_COMP_LOC(x,n) * BPXL_P_COMP_SIZE_SHIFT)) & BPXL_P_COMP_SIZE_MASK)
728
729/***************************************************************************
730Summary:
731        Returns a format's pixel component mask.
732
733Description:
734        This macro will retrieve the mask for a specified pixel component for
735        a specified format shifted to the least significant bits.
736
737Input:
738        x - Pixel format.
739        n - Component number (3=A/Y0, 2=R/Y1/Y, 1=G/Cb, 0=B/Cr/P/L).
740
741Returns:
742        Format's pixel component mask.
743****************************************************************************/
744#define BPXL_COMPONENT_MASK(x,n) \
745        ((1 << BPXL_COMPONENT_SIZE(x,n)) - 1)
746
747/***************************************************************************
748Summary:
749        Returns a format's pixel component position.
750
751Description:
752        This macro will retrieve the position (in bits) for a specified pixel
753        component for a specified format.
754
755Input:
756        x - Pixel format.
757        n - Component number (3=A/Y0, 2=R/Y1/Y, 1=G/Cb, 0=B/Cr/P/L).
758
759Returns:
760        Format's pixel component position.
761****************************************************************************/
762#define BPXL_COMPONENT_POS(x,n) \
763        ((BPXL_COMPONENT_SIZE(x,n) == 0) ? 0 : \
764        ((BPXL_P_COMP_LOC(x,n) == 0) ? 0 : \
765        ((BPXL_P_COMP_LOC(x,n) == 1) ? BPXL_P_COMP_SIZE(x,0) : \
766        ((BPXL_P_COMP_LOC(x,n) == 2) ? BPXL_P_COMP_SIZE(x,0) + BPXL_P_COMP_SIZE(x,1) : \
767        (BPXL_P_COMP_SIZE(x,0) + BPXL_P_COMP_SIZE(x,1) + BPXL_P_COMP_SIZE(x,2))))))
768
769/***************************************************************************
770Summary:
771        Gets pixel component.
772
773Description:
774        This macro will get the pixel component of a pixel shifted into the
775        low position using the specified format.
776
777Input:
778        x - Pixel format.
779        p - Pixel.
780        n - Component number (3=A/Y0, 2=R/Y1/Y, 1=G/Cb, 0=B/Cr/P/L).
781
782Returns:
783        Pixel component.
784****************************************************************************/
785#define BPXL_GET_COMPONENT(x,p,n) \
786        (((p) >> BPXL_COMPONENT_POS(x,n)) & BPXL_COMPONENT_MASK(x,n))
787
788/***************************************************************************
789Summary:
790        Makes RGB or YCbCr pixel from 8-bit components.
791
792Description:
793        This macro will shift 8-bit pixel components into position and combine
794        them to create a pixel of the specified format.
795
796Input:
797        x  - Pixel format.
798        c3 - Component 3 (A/Y0).
799        c2 - Component 2 (R/Y1/Y).
800        c1 - Component 1 (G/Cb).
801        c0 - Component 0 (B/Cr/P/L).
802
803Returns:
804        Pixel in specified format.
805****************************************************************************/
806#define BPXL_MAKE_PIXEL(x,c3,c2,c1,c0) ( \
807        (((c3) >> (8 - BPXL_COMPONENT_SIZE(x,3))) << BPXL_COMPONENT_POS(x,3)) | \
808        (((c2) >> (8 - BPXL_COMPONENT_SIZE(x,2))) << BPXL_COMPONENT_POS(x,2)) | \
809        (((c1) >> (8 - BPXL_COMPONENT_SIZE(x,1))) << BPXL_COMPONENT_POS(x,1)) | \
810        (((c0) >> (8 - BPXL_COMPONENT_SIZE(x,0))) << BPXL_COMPONENT_POS(x,0)))
811
812#define BPXL_MAKE_PIXEL_10BIT(x,c2,c1,c0) ( \
813        ((c2) << BPXL_COMPONENT_POS(x,2)) | \
814        ((c1) << BPXL_COMPONENT_POS(x,1)) | \
815        ((c0) << BPXL_COMPONENT_POS(x,0)))
816
817/***************************************************************************
818Summary:
819        Converts pixel component from one format to another.
820
821Description:
822        This function will resize and reposition a pixel component from the
823        source format to the destination format and put in the low position.
824        This macro does not support color space conversion, eg. RGB to YCbCr.
825
826Returns:
827        BERR_SUCCESS - The source pixel componment was converted to the
828                       destination format.
829        BERR_INVALID_PARAMETER - An invalid parameter was supplied.
830
831****************************************************************************/
832BERR_Code BPXL_ConvertComponent(
833        BPXL_Format eDstFormat,   /* [in] Destination format. */
834        BPXL_Format eSrcFormat,   /* [in] Source format. */
835        unsigned int uiSrcPixel,  /* [in] Source pixel. */
836        unsigned int uiCompNum,   /* [in] Component number (3=A/Y0,
837                                                             2=R/Y1/Y, 1=G/Cb, 0=B/Cr/P/L) */
838        unsigned int *puiDstComp  /* [out] Pointer to converted pixel. */
839);
840
841/***************************************************************************
842Summary:
843        Converts pixel from one format to another.
844
845Description:
846        This function will resize and reposition pixel components from the source
847        format to the destination format. This macro does not support color
848        space conversion, eg. RGB to YCbCr.
849
850Returns:
851        BERR_SUCCESS - The source pixel was converted to the destination format.
852        BERR_INVALID_PARAMETER - An invalid parameter was supplied.
853
854****************************************************************************/
855BERR_Code BPXL_ConvertPixel(
856        BPXL_Format eDstFormat,    /* [in] Destination format */
857        BPXL_Format eSrcFormat,    /* [in] Source format */
858        unsigned int uiSrcPixel,   /* [in] Source pixel */
859        unsigned int *puiDstPixel  /* [out] Pointer to returned destination
860                                      pixel */
861);
862
863/***************************************************************************
864Summary:
865        Converts pixel from RGB format to YCbCr format.
866
867Description:
868        This function converts a pixel of any RGB format to a pixel of any
869        YCbCr format.
870
871Returns:
872        BERR_SUCCESS - The source pixel was converted to the destination format.
873        BERR_INVALID_PARAMETER - An invalid parameter was supplied.
874
875****************************************************************************/
876BERR_Code BPXL_ConvertPixel_RGBtoYCbCr(
877        BPXL_Format eDstFormat,    /* [in] Destination format */
878        BPXL_Format eSrcFormat,    /* [in] Source format */
879        unsigned int uiSrcPixel,   /* [in] Source pixel */
880        unsigned int *puiDstPixel  /* [out] Pointer to returned destination
881                                      pixel */
882);
883
884/***************************************************************************
885Summary:
886        Converts pixel from YCbCr format to RGB format.
887
888Description:
889        This function converts a pixel of any YCbCr format to a pixel of any
890        RGB format. If the YCbCr format has no alpha, then the uiSrcAlpha
891        parameter will be used for the alpha component.
892
893Returns:
894        BERR_SUCCESS - The source pixel was converted to the destination format.
895        BERR_INVALID_PARAMETER - An invalid parameter was supplied.
896
897****************************************************************************/
898BERR_Code BPXL_ConvertPixel_YCbCrtoRGB(
899        BPXL_Format eDstFormat,       /* [in] Destination format. */
900        BPXL_Format eSrcFormat,       /* [in] Source format. */
901        unsigned int uiSrcPixel,      /* [in] Source pixel. */
902        unsigned int uiSrcAlign,      /* [in] Source alignment (even or odd). */
903        unsigned int uiSrcAlpha,      /* [in] Constant alpha when source format
904                                         has no alpha. */
905        unsigned int *puiDstPixel     /* [out] Pointer to returned destination
906                                         pixel. */
907);
908
909/***************************************************************************
910Summary:
911        Returns the number of bytes for a specific number of pixels.
912
913Description:
914        This function should be used whenever the user needs to know
915        how many bytes are required for a row of pixels.
916
917        This requires a special function since the value is not always
918        the number of bits per pixel * the number of pixels. In the case
919        of compressed formats, such as BPXL_eY08_Cb8_Y18_Cr8, there
920        may be some rounding involved.
921
922Returns:
923        BERR_SUCCESS - The number of bytes was calculated.
924        BERR_INVALID_PARAMETER - An invalid parameter was supplied.
925
926****************************************************************************/
927BERR_Code BPXL_GetBytesPerNPixels(
928        BPXL_Format eFormat,          /* [in] Pixel format. */
929        unsigned int uiNPixels,       /* [in] Number of pixels in row. */
930        unsigned int *puiBytes        /* [out] The number of bytes required to
931                                                                     store the number of pixels of the
932                                                                         given format. */
933);
934
935/***************************************************************************
936Summary:
937        Gets the literal string of a pixel format.
938
939Description:
940        This gets the literal string of a pixel format.
941
942Input:
943        eFormat - Pixel format.
944
945Returns:
946        The literal string of the given pixel format
947****************************************************************************/
948const char* BPXL_ConvertFmtToStr(
949        BPXL_Format eFormat
950);
951
952
953#ifdef __cplusplus
954}
955#endif
956
957#endif /* #ifndef BPXL_H__ */
958
959/* end of file */
960
961
Note: See TracBrowser for help on using the repository browser.