|
/***************************************************************************** |
|
|
* |
|
|
* XVID MPEG4 Codec |
|
|
* - Colorspace functions - header files |
|
|
* |
|
|
* This file is part of XviD, a free MPEG-4 video encoder/decoder |
|
|
* |
|
|
* XviD is free software; you can redistribute it and/or modify it |
|
|
* under the terms of the GNU General Public License as published by |
|
|
* the Free Software Foundation; either version 2 of the License, or |
|
|
* (at your option) any later version. |
|
|
* |
|
|
* This program is distributed in the hope that it will be useful, |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
* GNU General Public License for more details. |
|
|
* |
|
|
* You should have received a copy of the GNU General Public License |
|
|
* along with this program; if not, write to the Free Software |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
* |
|
|
* Under section 8 of the GNU General Public License, the copyright |
|
|
* holders of XVID explicitly forbid distribution in the following |
|
|
* countries: |
|
|
* |
|
|
* - Japan |
|
|
* - United States of America |
|
|
* |
|
|
* Linking XviD statically or dynamically with other modules is making a |
|
|
* combined work based on XviD. Thus, the terms and conditions of the |
|
|
* GNU General Public License cover the whole combination. |
|
|
* |
|
|
* As a special exception, the copyright holders of XviD give you |
|
|
* permission to link XviD with independent modules that communicate with |
|
|
* XviD solely through the VFW1.1 and DShow interfaces, regardless of the |
|
|
* license terms of these independent modules, and to copy and distribute |
|
|
* the resulting combined work under terms of your choice, provided that |
|
|
* every copy of the combined work is accompanied by a complete copy of |
|
|
* the source code of XviD (the version of XviD used to produce the |
|
|
* combined work), being distributed under the terms of the GNU General |
|
|
* Public License plus this exception. An independent module is a module |
|
|
* which is not derived from or based on XviD. |
|
|
* |
|
|
* Note that people who make modified versions of XviD are not obligated |
|
|
* to grant this special exception for their modified versions; it is |
|
|
* their choice whether to do so. The GNU General Public License gives |
|
|
* permission to release a modified version without this exception; this |
|
|
* exception also makes it possible to release a modified version which |
|
|
* carries forward this exception. |
|
|
* |
|
|
* $Id$ |
|
|
* |
|
|
****************************************************************************/ |
|
|
|
|
1 |
#ifndef _COLORSPACE_H |
#ifndef _COLORSPACE_H |
|
|
|
2 |
#define _COLORSPACE_H |
#define _COLORSPACE_H |
3 |
|
|
4 |
#include "../portab.h" |
#include "../portab.h" |
|
#include "../divx4.h" |
|
5 |
|
|
6 |
/* initialize tables */ |
/* initialize tables */ |
7 |
|
|
8 |
void colorspace_init(void); |
void colorspace_init(void); |
9 |
|
|
10 |
|
|
|
/* input color conversion functions (encoder) */ |
|
11 |
|
|
12 |
typedef void (color_inputFunc) (uint8_t * y_out, |
/* colorspace conversion function (encoder) */ |
13 |
uint8_t * u_out, |
|
14 |
uint8_t * v_out, |
typedef void (packedFunc) (uint8_t * x_ptr, |
15 |
uint8_t * src, |
int x_stride, |
16 |
|
uint8_t * y_src, |
17 |
|
uint8_t * v_src, |
18 |
|
uint8_t * u_src, |
19 |
|
int y_stride, |
20 |
|
int uv_stride, |
21 |
int width, |
int width, |
22 |
int height, |
int height, |
23 |
int stride); |
int vflip); |
24 |
|
|
25 |
|
typedef packedFunc *packedFuncPtr; |
26 |
|
|
|
typedef color_inputFunc *color_inputFuncPtr; |
|
27 |
|
|
28 |
extern color_inputFuncPtr rgb555_to_yv12; |
/* xxx_to_yv12 colorspace conversion functions (encoder) */ |
29 |
extern color_inputFuncPtr rgb565_to_yv12; |
|
30 |
extern color_inputFuncPtr rgb24_to_yv12; |
extern packedFuncPtr rgb555_to_yv12; |
31 |
extern color_inputFuncPtr rgb32_to_yv12; |
extern packedFuncPtr rgb565_to_yv12; |
32 |
extern color_inputFuncPtr yuv_to_yv12; |
extern packedFuncPtr bgr_to_yv12; |
33 |
extern color_inputFuncPtr yuyv_to_yv12; |
extern packedFuncPtr bgra_to_yv12; |
34 |
extern color_inputFuncPtr uyvy_to_yv12; |
extern packedFuncPtr abgr_to_yv12; |
35 |
|
extern packedFuncPtr rgba_to_yv12; |
36 |
|
extern packedFuncPtr yuyv_to_yv12; |
37 |
|
extern packedFuncPtr uyvy_to_yv12; |
38 |
|
|
39 |
|
extern packedFuncPtr rgb555i_to_yv12; |
40 |
|
extern packedFuncPtr rgb565i_to_yv12; |
41 |
|
extern packedFuncPtr bgri_to_yv12; |
42 |
|
extern packedFuncPtr bgrai_to_yv12; |
43 |
|
extern packedFuncPtr abgri_to_yv12; |
44 |
|
extern packedFuncPtr rgbai_to_yv12; |
45 |
|
extern packedFuncPtr yuyvi_to_yv12; |
46 |
|
extern packedFuncPtr uyvyi_to_yv12; |
47 |
|
|
48 |
|
|
49 |
/* plain c */ |
/* plain c */ |
50 |
color_inputFunc rgb555_to_yv12_c; |
packedFunc rgb555_to_yv12_c; |
51 |
color_inputFunc rgb565_to_yv12_c; |
packedFunc rgb565_to_yv12_c; |
52 |
color_inputFunc rgb24_to_yv12_c; |
packedFunc bgr_to_yv12_c; |
53 |
color_inputFunc rgb32_to_yv12_c; |
packedFunc bgra_to_yv12_c; |
54 |
color_inputFunc yuv_to_yv12_c; |
packedFunc abgr_to_yv12_c; |
55 |
color_inputFunc yuyv_to_yv12_c; |
packedFunc rgba_to_yv12_c; |
56 |
color_inputFunc uyvy_to_yv12_c; |
packedFunc yuyv_to_yv12_c; |
57 |
|
packedFunc uyvy_to_yv12_c; |
58 |
|
|
59 |
|
packedFunc rgb555i_to_yv12_c; |
60 |
|
packedFunc rgb565i_to_yv12_c; |
61 |
|
packedFunc bgri_to_yv12_c; |
62 |
|
packedFunc bgrai_to_yv12_c; |
63 |
|
packedFunc abgri_to_yv12_c; |
64 |
|
packedFunc rgbai_to_yv12_c; |
65 |
|
packedFunc yuyvi_to_yv12_c; |
66 |
|
packedFunc uyvyi_to_yv12_c; |
67 |
|
|
68 |
|
|
69 |
/* mmx */ |
/* mmx */ |
70 |
color_inputFunc rgb24_to_yv12_mmx; |
packedFunc bgr_to_yv12_mmx; |
71 |
color_inputFunc rgb32_to_yv12_mmx; |
packedFunc bgra_to_yv12_mmx; |
72 |
color_inputFunc yuv_to_yv12_mmx; |
packedFunc yuyv_to_yv12_mmx; |
73 |
color_inputFunc yuyv_to_yv12_mmx; |
packedFunc uyvy_to_yv12_mmx; |
74 |
color_inputFunc uyvy_to_yv12_mmx; |
|
75 |
|
/* 3dnow */ |
76 |
|
packedFunc yuyv_to_yv12_3dn; |
77 |
|
packedFunc uyvy_to_yv12_3dn; |
78 |
|
|
79 |
/* xmm */ |
/* xmm */ |
80 |
color_inputFunc yuv_to_yv12_xmm; |
packedFunc yuyv_to_yv12_xmm; |
81 |
|
packedFunc uyvy_to_yv12_xmm; |
82 |
|
|
83 |
|
|
84 |
/* output color conversion functions (decoder) */ |
/* yv12_to_xxx colorspace conversion functions (decoder) */ |
85 |
|
|
86 |
typedef void (color_outputFunc) (uint8_t * dst, |
extern packedFuncPtr yv12_to_rgb555; |
87 |
int dst_stride, |
extern packedFuncPtr yv12_to_rgb565; |
88 |
uint8_t * y_src, |
extern packedFuncPtr yv12_to_bgr; |
89 |
uint8_t * v_src, |
extern packedFuncPtr yv12_to_bgra; |
90 |
uint8_t * u_src, |
extern packedFuncPtr yv12_to_abgr; |
91 |
int y_stride, |
extern packedFuncPtr yv12_to_rgba; |
92 |
int uv_stride, |
extern packedFuncPtr yv12_to_yuyv; |
93 |
int width, |
extern packedFuncPtr yv12_to_uyvy; |
94 |
int height); |
|
95 |
|
extern packedFuncPtr yv12_to_rgb555i; |
96 |
typedef color_outputFunc *color_outputFuncPtr; |
extern packedFuncPtr yv12_to_rgb565i; |
97 |
|
extern packedFuncPtr yv12_to_bgri; |
98 |
extern color_outputFuncPtr yv12_to_rgb555; |
extern packedFuncPtr yv12_to_bgrai; |
99 |
extern color_outputFuncPtr yv12_to_rgb565; |
extern packedFuncPtr yv12_to_abgri; |
100 |
extern color_outputFuncPtr yv12_to_rgb24; |
extern packedFuncPtr yv12_to_rgbai; |
101 |
extern color_outputFuncPtr yv12_to_rgb32; |
extern packedFuncPtr yv12_to_yuyvi; |
102 |
extern color_outputFuncPtr yv12_to_yuv; |
extern packedFuncPtr yv12_to_uyvyi; |
|
extern color_outputFuncPtr yv12_to_yuyv; |
|
|
extern color_outputFuncPtr yv12_to_uyvy; |
|
103 |
|
|
104 |
/* plain c */ |
/* plain c */ |
105 |
void init_yuv_to_rgb(void); |
packedFunc yv12_to_rgb555_c; |
106 |
|
packedFunc yv12_to_rgb565_c; |
107 |
color_outputFunc yv12_to_rgb555_c; |
packedFunc yv12_to_bgr_c; |
108 |
color_outputFunc yv12_to_rgb565_c; |
packedFunc yv12_to_bgra_c; |
109 |
color_outputFunc yv12_to_rgb24_c; |
packedFunc yv12_to_abgr_c; |
110 |
color_outputFunc yv12_to_rgb32_c; |
packedFunc yv12_to_rgba_c; |
111 |
color_outputFunc yv12_to_yuv_c; |
packedFunc yv12_to_yuyv_c; |
112 |
color_outputFunc yv12_to_yuyv_c; |
packedFunc yv12_to_uyvy_c; |
113 |
color_outputFunc yv12_to_uyvy_c; |
|
114 |
|
packedFunc yv12_to_rgb555i_c; |
115 |
|
packedFunc yv12_to_rgb565i_c; |
116 |
|
packedFunc yv12_to_bgri_c; |
117 |
|
packedFunc yv12_to_bgrai_c; |
118 |
|
packedFunc yv12_to_abgri_c; |
119 |
|
packedFunc yv12_to_rgbai_c; |
120 |
|
packedFunc yv12_to_yuyvi_c; |
121 |
|
packedFunc yv12_to_uyvyi_c; |
122 |
|
|
123 |
/* mmx */ |
/* mmx */ |
124 |
color_outputFunc yv12_to_rgb24_mmx; |
packedFunc yv12_to_bgr_mmx; |
125 |
color_outputFunc yv12_to_rgb32_mmx; |
packedFunc yv12_to_bgra_mmx; |
126 |
color_outputFunc yv12_to_yuyv_mmx; |
packedFunc yv12_to_yuyv_mmx; |
127 |
color_outputFunc yv12_to_uyvy_mmx; |
packedFunc yv12_to_uyvy_mmx; |
128 |
|
|
129 |
|
packedFunc yv12_to_yuyvi_mmx; |
130 |
|
packedFunc yv12_to_uyvyi_mmx; |
131 |
|
|
132 |
|
|
133 |
|
typedef void (planarFunc) ( |
134 |
|
uint8_t * y_dst, uint8_t * u_dst, uint8_t * v_dst, |
135 |
|
int y_dst_stride, int uv_dst_stride, |
136 |
|
uint8_t * y_src, uint8_t * u_src, uint8_t * v_src, |
137 |
|
int y_src_stride, int uv_src_stride, |
138 |
|
int width, int height, int vflip); |
139 |
|
typedef planarFunc *planarFuncPtr; |
140 |
|
|
141 |
|
extern planarFuncPtr yv12_to_yv12; |
142 |
|
|
143 |
|
planarFunc yv12_to_yv12_c; |
144 |
|
planarFunc yv12_to_yv12_mmx; |
145 |
|
planarFunc yv12_to_yv12_xmm; |
146 |
|
|
147 |
|
|
|
void user_to_yuv_c(uint8_t * y_out, |
|
|
uint8_t * u_out, |
|
|
uint8_t * v_out, |
|
|
int stride, |
|
|
DEC_PICTURE * picture, |
|
|
int width, |
|
|
int height); |
|
|
|
|
148 |
#endif /* _COLORSPACE_H_ */ |
#endif /* _COLORSPACE_H_ */ |