1 |
/***************************************************************************** |
/***************************************************************************** |
2 |
* |
* |
3 |
* XVID MPEG4 Codec |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - Colorspace functions - header files |
* - Colorspace related header - |
5 |
* |
* |
6 |
* This file is part of XviD, a free MPEG-4 video encoder/decoder |
* Copyright(C) 2001-2003 Peter Ross <pross@xvid.org> |
7 |
* |
* |
8 |
* XviD is free software; you can redistribute it and/or modify it |
* This program is free software ; you can redistribute it and/or modify |
9 |
* under the terms of the GNU General Public License as published by |
* 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 |
* the Free Software Foundation; either version 2 of the License, or |
11 |
* (at your option) any later version. |
* (at your option) any later version. |
12 |
* |
* |
19 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
|
* 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. |
|
|
* |
|
22 |
* $Id$ |
* $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) */ |
|
36 |
|
|
37 |
typedef void (color_inputFunc) (uint8_t * y_out, |
/* colorspace conversion function (encoder) */ |
38 |
uint8_t * u_out, |
|
39 |
uint8_t * v_out, |
typedef void (packedFunc) (uint8_t * x_ptr, |
40 |
uint8_t * src, |
int x_stride, |
41 |
|
uint8_t * y_src, |
42 |
|
uint8_t * v_src, |
43 |
|
uint8_t * u_src, |
44 |
|
int y_stride, |
45 |
|
int uv_stride, |
46 |
int width, |
int width, |
47 |
int height, |
int height, |
48 |
int stride); |
int vflip); |
49 |
|
|
50 |
|
typedef packedFunc *packedFuncPtr; |
51 |
|
|
|
typedef color_inputFunc *color_inputFuncPtr; |
|
52 |
|
|
53 |
extern color_inputFuncPtr rgb555_to_yv12; |
/* xxx_to_yv12 colorspace conversion functions (encoder) */ |
54 |
extern color_inputFuncPtr rgb565_to_yv12; |
|
55 |
extern color_inputFuncPtr rgb24_to_yv12; |
extern packedFuncPtr rgb555_to_yv12; |
56 |
extern color_inputFuncPtr rgb32_to_yv12; |
extern packedFuncPtr rgb565_to_yv12; |
57 |
extern color_inputFuncPtr yuv_to_yv12; |
extern packedFuncPtr bgr_to_yv12; |
58 |
extern color_inputFuncPtr yuyv_to_yv12; |
extern packedFuncPtr bgra_to_yv12; |
59 |
extern color_inputFuncPtr uyvy_to_yv12; |
extern packedFuncPtr abgr_to_yv12; |
60 |
|
extern packedFuncPtr rgba_to_yv12; |
61 |
|
extern packedFuncPtr yuyv_to_yv12; |
62 |
|
extern packedFuncPtr uyvy_to_yv12; |
63 |
|
|
64 |
|
extern packedFuncPtr rgb555i_to_yv12; |
65 |
|
extern packedFuncPtr rgb565i_to_yv12; |
66 |
|
extern packedFuncPtr bgri_to_yv12; |
67 |
|
extern packedFuncPtr bgrai_to_yv12; |
68 |
|
extern packedFuncPtr abgri_to_yv12; |
69 |
|
extern packedFuncPtr rgbai_to_yv12; |
70 |
|
extern packedFuncPtr yuyvi_to_yv12; |
71 |
|
extern packedFuncPtr uyvyi_to_yv12; |
72 |
|
|
73 |
|
|
74 |
/* plain c */ |
/* plain c */ |
75 |
color_inputFunc rgb555_to_yv12_c; |
packedFunc rgb555_to_yv12_c; |
76 |
color_inputFunc rgb565_to_yv12_c; |
packedFunc rgb565_to_yv12_c; |
77 |
color_inputFunc rgb24_to_yv12_c; |
packedFunc bgr_to_yv12_c; |
78 |
color_inputFunc rgb32_to_yv12_c; |
packedFunc bgra_to_yv12_c; |
79 |
color_inputFunc yuv_to_yv12_c; |
packedFunc abgr_to_yv12_c; |
80 |
color_inputFunc yuyv_to_yv12_c; |
packedFunc rgba_to_yv12_c; |
81 |
color_inputFunc uyvy_to_yv12_c; |
packedFunc yuyv_to_yv12_c; |
82 |
|
packedFunc uyvy_to_yv12_c; |
83 |
|
|
84 |
|
packedFunc rgb555i_to_yv12_c; |
85 |
|
packedFunc rgb565i_to_yv12_c; |
86 |
|
packedFunc bgri_to_yv12_c; |
87 |
|
packedFunc bgrai_to_yv12_c; |
88 |
|
packedFunc abgri_to_yv12_c; |
89 |
|
packedFunc rgbai_to_yv12_c; |
90 |
|
packedFunc yuyvi_to_yv12_c; |
91 |
|
packedFunc uyvyi_to_yv12_c; |
92 |
|
|
93 |
|
|
94 |
/* mmx */ |
/* mmx */ |
95 |
color_inputFunc rgb24_to_yv12_mmx; |
packedFunc bgr_to_yv12_mmx; |
96 |
color_inputFunc rgb32_to_yv12_mmx; |
packedFunc bgra_to_yv12_mmx; |
97 |
color_inputFunc yuv_to_yv12_mmx; |
packedFunc yuyv_to_yv12_mmx; |
98 |
color_inputFunc yuyv_to_yv12_mmx; |
packedFunc uyvy_to_yv12_mmx; |
99 |
color_inputFunc uyvy_to_yv12_mmx; |
|
100 |
|
/* 3dnow */ |
101 |
|
packedFunc yuyv_to_yv12_3dn; |
102 |
|
packedFunc uyvy_to_yv12_3dn; |
103 |
|
|
104 |
/* xmm */ |
/* xmm */ |
105 |
color_inputFunc yuv_to_yv12_xmm; |
packedFunc yuyv_to_yv12_xmm; |
106 |
|
packedFunc uyvy_to_yv12_xmm; |
107 |
|
|
108 |
|
|
109 |
/* output color conversion functions (decoder) */ |
/* yv12_to_xxx colorspace conversion functions (decoder) */ |
110 |
|
|
111 |
typedef void (color_outputFunc) (uint8_t * dst, |
extern packedFuncPtr yv12_to_rgb555; |
112 |
int dst_stride, |
extern packedFuncPtr yv12_to_rgb565; |
113 |
uint8_t * y_src, |
extern packedFuncPtr yv12_to_bgr; |
114 |
uint8_t * v_src, |
extern packedFuncPtr yv12_to_bgra; |
115 |
uint8_t * u_src, |
extern packedFuncPtr yv12_to_abgr; |
116 |
int y_stride, |
extern packedFuncPtr yv12_to_rgba; |
117 |
int uv_stride, |
extern packedFuncPtr yv12_to_yuyv; |
118 |
int width, |
extern packedFuncPtr yv12_to_uyvy; |
119 |
int height); |
|
120 |
|
extern packedFuncPtr yv12_to_rgb555i; |
121 |
typedef color_outputFunc *color_outputFuncPtr; |
extern packedFuncPtr yv12_to_rgb565i; |
122 |
|
extern packedFuncPtr yv12_to_bgri; |
123 |
extern color_outputFuncPtr yv12_to_rgb555; |
extern packedFuncPtr yv12_to_bgrai; |
124 |
extern color_outputFuncPtr yv12_to_rgb565; |
extern packedFuncPtr yv12_to_abgri; |
125 |
extern color_outputFuncPtr yv12_to_rgb24; |
extern packedFuncPtr yv12_to_rgbai; |
126 |
extern color_outputFuncPtr yv12_to_rgb32; |
extern packedFuncPtr yv12_to_yuyvi; |
127 |
extern color_outputFuncPtr yv12_to_yuv; |
extern packedFuncPtr yv12_to_uyvyi; |
|
extern color_outputFuncPtr yv12_to_yuyv; |
|
|
extern color_outputFuncPtr yv12_to_uyvy; |
|
128 |
|
|
129 |
/* plain c */ |
/* plain c */ |
130 |
void init_yuv_to_rgb(void); |
packedFunc yv12_to_rgb555_c; |
131 |
|
packedFunc yv12_to_rgb565_c; |
132 |
color_outputFunc yv12_to_rgb555_c; |
packedFunc yv12_to_bgr_c; |
133 |
color_outputFunc yv12_to_rgb565_c; |
packedFunc yv12_to_bgra_c; |
134 |
color_outputFunc yv12_to_rgb24_c; |
packedFunc yv12_to_abgr_c; |
135 |
color_outputFunc yv12_to_rgb32_c; |
packedFunc yv12_to_rgba_c; |
136 |
color_outputFunc yv12_to_yuv_c; |
packedFunc yv12_to_yuyv_c; |
137 |
color_outputFunc yv12_to_yuyv_c; |
packedFunc yv12_to_uyvy_c; |
138 |
color_outputFunc yv12_to_uyvy_c; |
|
139 |
|
packedFunc yv12_to_rgb555i_c; |
140 |
|
packedFunc yv12_to_rgb565i_c; |
141 |
|
packedFunc yv12_to_bgri_c; |
142 |
|
packedFunc yv12_to_bgrai_c; |
143 |
|
packedFunc yv12_to_abgri_c; |
144 |
|
packedFunc yv12_to_rgbai_c; |
145 |
|
packedFunc yv12_to_yuyvi_c; |
146 |
|
packedFunc yv12_to_uyvyi_c; |
147 |
|
|
148 |
/* mmx */ |
/* mmx */ |
149 |
color_outputFunc yv12_to_rgb24_mmx; |
packedFunc yv12_to_bgr_mmx; |
150 |
color_outputFunc yv12_to_rgb32_mmx; |
packedFunc yv12_to_bgra_mmx; |
151 |
color_outputFunc yv12_to_yuyv_mmx; |
packedFunc yv12_to_yuyv_mmx; |
152 |
color_outputFunc yv12_to_uyvy_mmx; |
packedFunc yv12_to_uyvy_mmx; |
153 |
|
|
154 |
|
packedFunc yv12_to_yuyvi_mmx; |
155 |
|
packedFunc yv12_to_uyvyi_mmx; |
156 |
|
|
157 |
|
|
158 |
|
typedef void (planarFunc) ( |
159 |
|
uint8_t * y_dst, uint8_t * u_dst, uint8_t * v_dst, |
160 |
|
int y_dst_stride, int uv_dst_stride, |
161 |
|
uint8_t * y_src, uint8_t * u_src, uint8_t * v_src, |
162 |
|
int y_src_stride, int uv_src_stride, |
163 |
|
int width, int height, int vflip); |
164 |
|
typedef planarFunc *planarFuncPtr; |
165 |
|
|
166 |
|
extern planarFuncPtr yv12_to_yv12; |
167 |
|
|
168 |
|
planarFunc yv12_to_yv12_c; |
169 |
|
planarFunc yv12_to_yv12_mmx; |
170 |
|
planarFunc yv12_to_yv12_xmm; |
171 |
|
|
172 |
|
|
|
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); |
|
|
|
|
173 |
#endif /* _COLORSPACE_H_ */ |
#endif /* _COLORSPACE_H_ */ |