Parent Directory
|
Revision Log
Revision 1.1 - (view) (download)
1 : | Isibaar | 1.1 | /************************************************************************** |
2 : | * | ||
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | * native api | ||
5 : | * | ||
6 : | * This program is an implementation of a part of one or more MPEG-4 | ||
7 : | * Video tools as specified in ISO/IEC 14496-2 standard. Those intending | ||
8 : | * to use this software module in hardware or software products are | ||
9 : | * advised that its use may infringe existing patents or copyrights, and | ||
10 : | * any such use would be at such party's own risk. The original | ||
11 : | * developer of this software module and his/her company, and subsequent | ||
12 : | * editors and their companies, will have no liability for use of this | ||
13 : | * software or modifications or derivatives thereof. | ||
14 : | * | ||
15 : | * This program is free software; you can redistribute it and/or modify | ||
16 : | * it under the terms of the GNU General Public License as published by | ||
17 : | * the Free Software Foundation; either version 2 of the License, or | ||
18 : | * (at your option) any later version. | ||
19 : | * | ||
20 : | * This program is distributed in the hope that it will be useful, | ||
21 : | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 : | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 : | * GNU General Public License for more details. | ||
24 : | * | ||
25 : | * You should have received a copy of the GNU General Public License | ||
26 : | * along with this program; if not, write to the Free Software | ||
27 : | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 : | * | ||
29 : | *************************************************************************/ | ||
30 : | |||
31 : | /************************************************************************** | ||
32 : | * | ||
33 : | * History: | ||
34 : | * | ||
35 : | * 22.12.2001 API change: added xvid_init() - Isibaar | ||
36 : | * 16.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> | ||
37 : | * | ||
38 : | *************************************************************************/ | ||
39 : | |||
40 : | |||
41 : | #include "xvid.h" | ||
42 : | #include "decoder.h" | ||
43 : | #include "encoder.h" | ||
44 : | #include "bitstream/cbp.h" | ||
45 : | #include "dct/idct.h" | ||
46 : | #include "dct/fdct.h" | ||
47 : | #include "image/colorspace.h" | ||
48 : | #include "image/interpolate8x8.h" | ||
49 : | #include "utils/mem_transfer.h" | ||
50 : | #include "quant/quant_h263.h" | ||
51 : | #include "quant/quant_mpeg4.h" | ||
52 : | #include "motion/sad.h" | ||
53 : | #include "utils/emms.h" | ||
54 : | #include "utils/timer.h" | ||
55 : | |||
56 : | int xvid_init(void *handle, int opt, void *param1, void *param2) | ||
57 : | { | ||
58 : | int cpu_flags; | ||
59 : | XVID_INIT_PARAM *init_param; | ||
60 : | |||
61 : | init_param = (XVID_INIT_PARAM *) param1; | ||
62 : | |||
63 : | // force specific cpu settings? | ||
64 : | if((init_param->cpu_flags & XVID_CPU_FORCE) > 0) | ||
65 : | cpu_flags = init_param->cpu_flags; | ||
66 : | else { | ||
67 : | |||
68 : | #ifdef ARCH_X86 | ||
69 : | cpu_flags = check_cpu_features(); | ||
70 : | #else | ||
71 : | cpu_flags = 0; | ||
72 : | #endif | ||
73 : | init_param->cpu_flags = cpu_flags; | ||
74 : | } | ||
75 : | |||
76 : | // initialize the function pointers | ||
77 : | idct_int32_init(); | ||
78 : | |||
79 : | init_timer(); | ||
80 : | |||
81 : | fdct = fdct_int32; | ||
82 : | idct = idct_int32; | ||
83 : | |||
84 : | emms = emms_c; | ||
85 : | |||
86 : | quant_intra = quant_intra_c; | ||
87 : | dequant_intra = dequant_intra_c; | ||
88 : | quant_inter = quant_inter_c; | ||
89 : | dequant_inter = dequant_inter_c; | ||
90 : | |||
91 : | quant4_intra = quant4_intra_c; | ||
92 : | dequant4_intra = dequant4_intra_c; | ||
93 : | quant4_inter = quant4_inter_c; | ||
94 : | dequant4_inter = dequant4_inter_c; | ||
95 : | |||
96 : | transfer_8to16copy = transfer_8to16copy_c; | ||
97 : | transfer_16to8copy = transfer_16to8copy_c; | ||
98 : | transfer_8to16sub = transfer_8to16sub_c; | ||
99 : | transfer_16to8add = transfer_16to8add_c; | ||
100 : | transfer8x8_copy = transfer8x8_copy_c; | ||
101 : | |||
102 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_c; | ||
103 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_c; | ||
104 : | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_c; | ||
105 : | |||
106 : | colorspace_init(); | ||
107 : | |||
108 : | rgb555_to_yv12 = rgb555_to_yv12_c; | ||
109 : | rgb565_to_yv12 = rgb565_to_yv12_c; | ||
110 : | rgb24_to_yv12 = rgb24_to_yv12_c; | ||
111 : | rgb32_to_yv12 = rgb32_to_yv12_c; | ||
112 : | yuv_to_yv12 = yuv_to_yv12_c; | ||
113 : | yuyv_to_yv12 = yuyv_to_yv12_c; | ||
114 : | uyvy_to_yv12 = uyvy_to_yv12_c; | ||
115 : | |||
116 : | yv12_to_rgb555 = yv12_to_rgb555_c; | ||
117 : | yv12_to_rgb565 = yv12_to_rgb565_c; | ||
118 : | yv12_to_rgb24 = yv12_to_rgb24_c; | ||
119 : | yv12_to_rgb32 = yv12_to_rgb32_c; | ||
120 : | yv12_to_yuv = yv12_to_yuv_c; | ||
121 : | yv12_to_yuyv = yv12_to_yuyv_c; | ||
122 : | yv12_to_uyvy = yv12_to_uyvy_c; | ||
123 : | |||
124 : | calc_cbp = calc_cbp_c; | ||
125 : | sad16 = sad16_c; | ||
126 : | sad8 = sad8_c; | ||
127 : | dev16 = dev16_c; | ||
128 : | |||
129 : | #ifdef ARCH_X86 | ||
130 : | if((cpu_flags & XVID_CPU_MMX) > 0) { | ||
131 : | fdct = fdct_mmx; | ||
132 : | idct = idct_mmx; | ||
133 : | |||
134 : | emms = emms_mmx; | ||
135 : | |||
136 : | quant_intra = quant_intra_mmx; | ||
137 : | dequant_intra = dequant_intra_mmx; | ||
138 : | quant_inter = quant_inter_mmx; | ||
139 : | dequant_inter = dequant_inter_mmx; | ||
140 : | |||
141 : | quant4_intra = quant4_intra_mmx; | ||
142 : | dequant4_intra = dequant4_intra_mmx; | ||
143 : | quant4_inter = quant4_inter_mmx; | ||
144 : | dequant4_inter = dequant4_inter_mmx; | ||
145 : | |||
146 : | transfer_8to16copy = transfer_8to16copy_mmx; | ||
147 : | transfer_16to8copy = transfer_16to8copy_mmx; | ||
148 : | transfer_8to16sub = transfer_8to16sub_mmx; | ||
149 : | transfer_16to8add = transfer_16to8add_mmx; | ||
150 : | transfer8x8_copy = transfer8x8_copy_mmx; | ||
151 : | |||
152 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_mmx; | ||
153 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_mmx; | ||
154 : | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_mmx; | ||
155 : | |||
156 : | rgb24_to_yv12 = rgb24_to_yv12_mmx; | ||
157 : | rgb32_to_yv12 = rgb32_to_yv12_mmx; | ||
158 : | yuv_to_yv12 = yuv_to_yv12_mmx; | ||
159 : | yuyv_to_yv12 = yuyv_to_yv12_mmx; | ||
160 : | uyvy_to_yv12 = uyvy_to_yv12_mmx; | ||
161 : | |||
162 : | yv12_to_rgb24 = yv12_to_rgb24_mmx; | ||
163 : | yv12_to_rgb32 = yv12_to_rgb32_mmx; | ||
164 : | yv12_to_yuyv = yv12_to_yuyv_mmx; | ||
165 : | yv12_to_uyvy = yv12_to_uyvy_mmx; | ||
166 : | |||
167 : | calc_cbp = calc_cbp_mmx; | ||
168 : | sad16 = sad16_mmx; | ||
169 : | sad8 = sad8_mmx; | ||
170 : | dev16 = dev16_mmx; | ||
171 : | |||
172 : | } | ||
173 : | |||
174 : | if((cpu_flags & XVID_CPU_MMXEXT) > 0) { | ||
175 : | idct = idct_xmm; | ||
176 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_xmm; | ||
177 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; | ||
178 : | yuv_to_yv12 = yuv_to_yv12_xmm; | ||
179 : | |||
180 : | sad16 = sad16_xmm; | ||
181 : | sad8 = sad8_xmm; | ||
182 : | dev16 = dev16_xmm; | ||
183 : | |||
184 : | } | ||
185 : | |||
186 : | if((cpu_flags & XVID_CPU_3DNOW) > 0) { | ||
187 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_3dn; | ||
188 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_3dn; | ||
189 : | } | ||
190 : | |||
191 : | #endif | ||
192 : | |||
193 : | // API version | ||
194 : | init_param->api_version = API_VERSION; | ||
195 : | |||
196 : | // something clever has to be done for this | ||
197 : | init_param->core_build = 1000; | ||
198 : | |||
199 : | init_timer(); | ||
200 : | |||
201 : | return XVID_ERR_OK; | ||
202 : | } | ||
203 : | |||
204 : | int xvid_decore(void * handle, int opt, void * param1, void * param2) | ||
205 : | { | ||
206 : | switch (opt) | ||
207 : | { | ||
208 : | case XVID_DEC_DECODE : | ||
209 : | return decoder_decode((DECODER *) handle, (XVID_DEC_FRAME *) param1); | ||
210 : | |||
211 : | case XVID_DEC_CREATE : | ||
212 : | return decoder_create((XVID_DEC_PARAM *) param1); | ||
213 : | |||
214 : | case XVID_DEC_DESTROY : | ||
215 : | return decoder_destroy((DECODER *) handle); | ||
216 : | |||
217 : | default: | ||
218 : | return XVID_ERR_FAIL; | ||
219 : | } | ||
220 : | } | ||
221 : | |||
222 : | |||
223 : | int xvid_encore(void * handle, int opt, void * param1, void * param2) | ||
224 : | { | ||
225 : | switch (opt) | ||
226 : | { | ||
227 : | case XVID_ENC_ENCODE : | ||
228 : | return encoder_encode((Encoder *) handle, (XVID_ENC_FRAME *) param1, (XVID_ENC_STATS *) param2); | ||
229 : | |||
230 : | case XVID_ENC_CREATE : | ||
231 : | return encoder_create((XVID_ENC_PARAM *) param1); | ||
232 : | |||
233 : | case XVID_ENC_DESTROY : | ||
234 : | return encoder_destroy((Encoder *) handle); | ||
235 : | |||
236 : | default: | ||
237 : | return XVID_ERR_FAIL; | ||
238 : | } | ||
239 : | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |