1 |
|
/***************************************************************************** |
2 |
|
* |
3 |
|
* XVID MPEG-4 VIDEO CODEC |
4 |
|
* - Colorspace related header - |
5 |
|
* |
6 |
|
* Copyright(C) 2001-2003 Peter Ross <pross@xvid.org> |
7 |
|
* |
8 |
|
* This program is free software ; you can redistribute it and/or modify |
9 |
|
* it under the terms of the GNU General Public License as published by |
10 |
|
* the Free Software Foundation ; either version 2 of the License, or |
11 |
|
* (at your option) any later version. |
12 |
|
* |
13 |
|
* This program is distributed in the hope that it will be useful, |
14 |
|
* but WITHOUT ANY WARRANTY ; without even the implied warranty of |
15 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
* GNU General Public License for more details. |
17 |
|
* |
18 |
|
* You should have received a copy of the GNU General Public License |
19 |
|
* along with this program ; if not, write to the Free Software |
20 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
|
* |
22 |
|
* $Id$ |
23 |
|
* |
24 |
|
****************************************************************************/ |
25 |
|
|
26 |
#ifndef _COLORSPACE_H |
#ifndef _COLORSPACE_H |
27 |
#define _COLORSPACE_H |
#define _COLORSPACE_H |
28 |
|
|
29 |
#include "../portab.h" |
#include "../portab.h" |
|
#include "../divx4.h" |
|
30 |
|
|
31 |
/* initialize tables */ |
/* initialize tables */ |
32 |
|
|
33 |
void colorspace_init(void); |
void colorspace_init(void); |
34 |
|
|
35 |
|
|
|
/* input color conversion functions (encoder) */ |
|
|
|
|
|
typedef void (color_inputFunc)(uint8_t *y_out, uint8_t *u_out, uint8_t *v_out, |
|
|
uint8_t *src, int width, int height, int stride); |
|
36 |
|
|
37 |
typedef color_inputFunc *color_inputFuncPtr; |
/* colorspace conversion function (encoder) */ |
38 |
|
|
39 |
extern color_inputFuncPtr rgb555_to_yv12; |
typedef void (packedFunc) (uint8_t * x_ptr, |
40 |
extern color_inputFuncPtr rgb565_to_yv12; |
int x_stride, |
41 |
extern color_inputFuncPtr rgb24_to_yv12; |
uint8_t * y_src, |
42 |
extern color_inputFuncPtr rgb32_to_yv12; |
uint8_t * v_src, |
43 |
extern color_inputFuncPtr yuv_to_yv12; |
uint8_t * u_src, |
44 |
extern color_inputFuncPtr yuyv_to_yv12; |
int y_stride, |
45 |
extern color_inputFuncPtr uyvy_to_yv12; |
int uv_stride, |
46 |
|
int width, |
47 |
|
int height, |
48 |
|
int vflip); |
49 |
|
|
50 |
|
typedef packedFunc *packedFuncPtr; |
51 |
|
|
52 |
|
|
53 |
|
/* xxx_to_yv12 colorspace conversion functions (encoder) */ |
54 |
|
|
55 |
|
extern packedFuncPtr rgb555_to_yv12; |
56 |
|
extern packedFuncPtr rgb565_to_yv12; |
57 |
|
extern packedFuncPtr bgr_to_yv12; |
58 |
|
extern packedFuncPtr bgra_to_yv12; |
59 |
|
extern packedFuncPtr abgr_to_yv12; |
60 |
|
extern packedFuncPtr rgba_to_yv12; |
61 |
|
extern packedFuncPtr argb_to_yv12; |
62 |
|
extern packedFuncPtr yuyv_to_yv12; |
63 |
|
extern packedFuncPtr uyvy_to_yv12; |
64 |
|
|
65 |
|
extern packedFuncPtr rgb555i_to_yv12; |
66 |
|
extern packedFuncPtr rgb565i_to_yv12; |
67 |
|
extern packedFuncPtr bgri_to_yv12; |
68 |
|
extern packedFuncPtr bgrai_to_yv12; |
69 |
|
extern packedFuncPtr abgri_to_yv12; |
70 |
|
extern packedFuncPtr rgbai_to_yv12; |
71 |
|
extern packedFuncPtr argbi_to_yv12; |
72 |
|
extern packedFuncPtr yuyvi_to_yv12; |
73 |
|
extern packedFuncPtr uyvyi_to_yv12; |
74 |
|
|
75 |
/* plain c */ |
/* plain c */ |
76 |
color_inputFunc rgb555_to_yv12_c; |
packedFunc rgb555_to_yv12_c; |
77 |
color_inputFunc rgb565_to_yv12_c; |
packedFunc rgb565_to_yv12_c; |
78 |
color_inputFunc rgb24_to_yv12_c; |
packedFunc bgr_to_yv12_c; |
79 |
color_inputFunc rgb32_to_yv12_c; |
packedFunc bgra_to_yv12_c; |
80 |
color_inputFunc yuv_to_yv12_c; |
packedFunc abgr_to_yv12_c; |
81 |
color_inputFunc yuyv_to_yv12_c; |
packedFunc rgba_to_yv12_c; |
82 |
color_inputFunc uyvy_to_yv12_c; |
packedFunc argb_to_yv12_c; |
83 |
|
packedFunc yuyv_to_yv12_c; |
84 |
|
packedFunc uyvy_to_yv12_c; |
85 |
|
|
86 |
|
packedFunc rgb555i_to_yv12_c; |
87 |
|
packedFunc rgb565i_to_yv12_c; |
88 |
|
packedFunc bgri_to_yv12_c; |
89 |
|
packedFunc bgrai_to_yv12_c; |
90 |
|
packedFunc abgri_to_yv12_c; |
91 |
|
packedFunc rgbai_to_yv12_c; |
92 |
|
packedFunc argbi_to_yv12_c; |
93 |
|
packedFunc yuyvi_to_yv12_c; |
94 |
|
packedFunc uyvyi_to_yv12_c; |
95 |
|
|
96 |
|
#ifdef ARCH_IS_IA32 |
97 |
/* mmx */ |
/* mmx */ |
98 |
color_inputFunc rgb24_to_yv12_mmx; |
packedFunc bgr_to_yv12_mmx; |
99 |
color_inputFunc rgb32_to_yv12_mmx; |
packedFunc bgra_to_yv12_mmx; |
100 |
color_inputFunc yuv_to_yv12_mmx; |
packedFunc yuyv_to_yv12_mmx; |
101 |
color_inputFunc yuyv_to_yv12_mmx; |
packedFunc uyvy_to_yv12_mmx; |
102 |
color_inputFunc uyvy_to_yv12_mmx; |
|
103 |
|
/* 3dnow */ |
104 |
|
packedFunc yuyv_to_yv12_3dn; |
105 |
|
packedFunc uyvy_to_yv12_3dn; |
106 |
|
|
107 |
/* xmm */ |
/* xmm */ |
108 |
color_inputFunc yuv_to_yv12_xmm; |
packedFunc yuyv_to_yv12_xmm; |
109 |
|
packedFunc uyvy_to_yv12_xmm; |
110 |
|
#endif |
111 |
/* output color conversion functions (decoder) */ |
|
112 |
|
#ifdef ARCH_IS_PPC |
113 |
typedef void (color_outputFunc)(uint8_t *dst, int dst_stride, |
packedFunc bgra_to_yv12_altivec_c; |
114 |
uint8_t *y_src, uint8_t *v_src, |
packedFunc abgr_to_yv12_altivec_c; |
115 |
uint8_t * u_src, int y_stride, |
packedFunc rgba_to_yv12_altivec_c; |
116 |
int uv_stride, int width, int height); |
packedFunc argb_to_yv12_altivec_c; |
117 |
|
|
118 |
typedef color_outputFunc* color_outputFuncPtr; |
packedFunc yuyv_to_yv12_altivec_c; |
119 |
|
packedFunc uyvy_to_yv12_altivec_c; |
120 |
extern color_outputFuncPtr yv12_to_rgb555; |
#endif |
121 |
extern color_outputFuncPtr yv12_to_rgb565; |
|
122 |
extern color_outputFuncPtr yv12_to_rgb24; |
/* yv12_to_xxx colorspace conversion functions (decoder) */ |
123 |
extern color_outputFuncPtr yv12_to_rgb32; |
|
124 |
extern color_outputFuncPtr yv12_to_yuv; |
extern packedFuncPtr yv12_to_rgb555; |
125 |
extern color_outputFuncPtr yv12_to_yuyv; |
extern packedFuncPtr yv12_to_rgb565; |
126 |
extern color_outputFuncPtr yv12_to_uyvy; |
extern packedFuncPtr yv12_to_bgr; |
127 |
|
extern packedFuncPtr yv12_to_bgra; |
128 |
|
extern packedFuncPtr yv12_to_abgr; |
129 |
|
extern packedFuncPtr yv12_to_rgba; |
130 |
|
extern packedFuncPtr yv12_to_argb; |
131 |
|
extern packedFuncPtr yv12_to_yuyv; |
132 |
|
extern packedFuncPtr yv12_to_uyvy; |
133 |
|
|
134 |
|
extern packedFuncPtr yv12_to_rgb555i; |
135 |
|
extern packedFuncPtr yv12_to_rgb565i; |
136 |
|
extern packedFuncPtr yv12_to_bgri; |
137 |
|
extern packedFuncPtr yv12_to_bgrai; |
138 |
|
extern packedFuncPtr yv12_to_abgri; |
139 |
|
extern packedFuncPtr yv12_to_rgbai; |
140 |
|
extern packedFuncPtr yv12_to_argbi; |
141 |
|
extern packedFuncPtr yv12_to_yuyvi; |
142 |
|
extern packedFuncPtr yv12_to_uyvyi; |
143 |
|
|
144 |
/* plain c */ |
/* plain c */ |
145 |
void init_yuv_to_rgb(void); |
packedFunc yv12_to_rgb555_c; |
146 |
|
packedFunc yv12_to_rgb565_c; |
147 |
color_outputFunc yv12_to_rgb555_c; |
packedFunc yv12_to_bgr_c; |
148 |
color_outputFunc yv12_to_rgb565_c; |
packedFunc yv12_to_bgra_c; |
149 |
color_outputFunc yv12_to_rgb24_c; |
packedFunc yv12_to_abgr_c; |
150 |
color_outputFunc yv12_to_rgb32_c; |
packedFunc yv12_to_rgba_c; |
151 |
color_outputFunc yv12_to_yuv_c; |
packedFunc yv12_to_argb_c; |
152 |
color_outputFunc yv12_to_yuyv_c; |
packedFunc yv12_to_yuyv_c; |
153 |
color_outputFunc yv12_to_uyvy_c; |
packedFunc yv12_to_uyvy_c; |
154 |
|
|
155 |
|
packedFunc yv12_to_rgb555i_c; |
156 |
|
packedFunc yv12_to_rgb565i_c; |
157 |
|
packedFunc yv12_to_bgri_c; |
158 |
|
packedFunc yv12_to_bgrai_c; |
159 |
|
packedFunc yv12_to_abgri_c; |
160 |
|
packedFunc yv12_to_rgbai_c; |
161 |
|
packedFunc yv12_to_argbi_c; |
162 |
|
packedFunc yv12_to_yuyvi_c; |
163 |
|
packedFunc yv12_to_uyvyi_c; |
164 |
|
|
165 |
|
#ifdef ARCH_IS_IA32 |
166 |
/* mmx */ |
/* mmx */ |
167 |
color_outputFunc yv12_to_rgb24_mmx; |
packedFunc yv12_to_bgr_mmx; |
168 |
color_outputFunc yv12_to_rgb32_mmx; |
packedFunc yv12_to_bgra_mmx; |
169 |
color_outputFunc yv12_to_yuyv_mmx; |
packedFunc yv12_to_yuyv_mmx; |
170 |
color_outputFunc yv12_to_uyvy_mmx; |
packedFunc yv12_to_uyvy_mmx; |
171 |
|
|
172 |
|
packedFunc yv12_to_yuyvi_mmx; |
173 |
|
packedFunc yv12_to_uyvyi_mmx; |
174 |
|
#endif |
175 |
|
|
176 |
|
#ifdef ARCH_IS_PPC |
177 |
|
packedFunc yv12_to_yuyv_altivec_c; |
178 |
|
packedFunc yv12_to_uyvy_altivec_c; |
179 |
|
#endif |
180 |
|
|
181 |
|
typedef void (planarFunc) ( |
182 |
|
uint8_t * y_dst, uint8_t * u_dst, uint8_t * v_dst, |
183 |
|
int y_dst_stride, int uv_dst_stride, |
184 |
|
uint8_t * y_src, uint8_t * u_src, uint8_t * v_src, |
185 |
|
int y_src_stride, int uv_src_stride, |
186 |
|
int width, int height, int vflip); |
187 |
|
typedef planarFunc *planarFuncPtr; |
188 |
|
|
189 |
|
extern planarFuncPtr yv12_to_yv12; |
190 |
|
|
191 |
|
planarFunc yv12_to_yv12_c; |
192 |
|
|
193 |
|
#ifdef ARCH_IS_IA32 |
194 |
|
planarFunc yv12_to_yv12_mmx; |
195 |
|
planarFunc yv12_to_yv12_xmm; |
196 |
|
#endif |
197 |
|
|
|
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); |
|
198 |
|
|
199 |
#endif /* _COLORSPACE_H_ */ |
#endif /* _COLORSPACE_H_ */ |