Parent Directory
|
Revision Log
Revision 1.33.2.12 - (view) (download)
1 : | edgomez | 1.16 | /***************************************************************************** |
2 : | edgomez | 1.17 | * |
3 : | * XVID MPEG-4 VIDEO CODEC | ||
4 : | * - Native API implementation - | ||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
28 : | * | ||
29 : | ****************************************************************************/ | ||
30 : | chenm001 | 1.29 | |
31 : | edgomez | 1.16 | /***************************************************************************** |
32 : | edgomez | 1.17 | * |
33 : | * History | ||
34 : | * | ||
35 : | suxen_drol | 1.21 | * - 23.06.2002 added XVID_CPU_CHKONLY |
36 : | edgomez | 1.17 | * - 17.03.2002 Added interpolate8x8_halfpel_hv_xmm |
37 : | * - 22.12.2001 API change: added xvid_init() - Isibaar | ||
38 : | * - 16.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> | ||
39 : | * | ||
40 : | Isibaar | 1.33.2.12 | * $Id: xvid.c,v 1.33.2.11 2002/11/07 10:28:15 suxen_drol Exp $ |
41 : | edgomez | 1.17 | * |
42 : | ****************************************************************************/ | ||
43 : | Isibaar | 1.1 | |
44 : | #include "xvid.h" | ||
45 : | #include "decoder.h" | ||
46 : | #include "encoder.h" | ||
47 : | #include "bitstream/cbp.h" | ||
48 : | #include "dct/idct.h" | ||
49 : | #include "dct/fdct.h" | ||
50 : | #include "image/colorspace.h" | ||
51 : | #include "image/interpolate8x8.h" | ||
52 : | #include "utils/mem_transfer.h" | ||
53 : | h | 1.33.2.5 | #include "utils/mbfunctions.h" |
54 : | Isibaar | 1.1 | #include "quant/quant_h263.h" |
55 : | #include "quant/quant_mpeg4.h" | ||
56 : | ia64p | 1.30 | #include "motion/motion.h" |
57 : | Isibaar | 1.1 | #include "motion/sad.h" |
58 : | #include "utils/emms.h" | ||
59 : | #include "utils/timer.h" | ||
60 : | Isibaar | 1.9 | #include "bitstream/mbcoding.h" |
61 : | Isibaar | 1.1 | |
62 : | suxen_drol | 1.31 | #if defined(ARCH_X86) && defined(EXPERIMENTAL_SSE2_CODE) |
63 : | |||
64 : | #ifdef WIN32 | ||
65 : | #include <windows.h> | ||
66 : | #else | ||
67 : | #include <signal.h> | ||
68 : | #include <setjmp.h> | ||
69 : | #endif | ||
70 : | |||
71 : | |||
72 : | #ifndef WIN32 | ||
73 : | |||
74 : | static jmp_buf mark; | ||
75 : | |||
76 : | static void | ||
77 : | sigill_handler(int signal) | ||
78 : | { | ||
79 : | longjmp(mark, 1); | ||
80 : | } | ||
81 : | #endif | ||
82 : | |||
83 : | |||
84 : | /* | ||
85 : | calls the funcptr, and returns whether SIGILL (illegal instruction) was signalled | ||
86 : | return values: | ||
87 : | -1 : could not determine | ||
88 : | 0 : SIGILL was *not* signalled | ||
89 : | 1 : SIGILL was signalled | ||
90 : | */ | ||
91 : | |||
92 : | int | ||
93 : | sigill_check(void (*func)()) | ||
94 : | { | ||
95 : | #ifdef WIN32 | ||
96 : | _try { | ||
97 : | func(); | ||
98 : | } | ||
99 : | _except(EXCEPTION_EXECUTE_HANDLER) { | ||
100 : | |||
101 : | if (_exception_code() == STATUS_ILLEGAL_INSTRUCTION) | ||
102 : | return 1; | ||
103 : | } | ||
104 : | return 0; | ||
105 : | #else | ||
106 : | void * old_handler; | ||
107 : | int jmpret; | ||
108 : | |||
109 : | |||
110 : | old_handler = signal(SIGILL, sigill_handler); | ||
111 : | if (old_handler == SIG_ERR) | ||
112 : | { | ||
113 : | return -1; | ||
114 : | } | ||
115 : | |||
116 : | jmpret = setjmp(mark); | ||
117 : | if (jmpret == 0) | ||
118 : | { | ||
119 : | func(); | ||
120 : | } | ||
121 : | |||
122 : | signal(SIGILL, old_handler); | ||
123 : | |||
124 : | return jmpret; | ||
125 : | #endif | ||
126 : | } | ||
127 : | #endif | ||
128 : | |||
129 : | edgomez | 1.16 | /***************************************************************************** |
130 : | * XviD Init Entry point | ||
131 : | * | ||
132 : | * Well this function initialize all internal function pointers according | ||
133 : | * to the CPU features forced by the library client or autodetected (depending | ||
134 : | * on the XVID_CPU_FORCE flag). It also initializes vlc coding tables and all | ||
135 : | * image colorspace transformation tables. | ||
136 : | * | ||
137 : | * Returned value : XVID_ERR_OK | ||
138 : | * + API_VERSION in the input XVID_INIT_PARAM structure | ||
139 : | * + core build " " " " " | ||
140 : | * | ||
141 : | ****************************************************************************/ | ||
142 : | |||
143 : | edgomez | 1.15 | int |
144 : | xvid_init(void *handle, | ||
145 : | int opt, | ||
146 : | void *param1, | ||
147 : | void *param2) | ||
148 : | Isibaar | 1.1 | { |
149 : | int cpu_flags; | ||
150 : | XVID_INIT_PARAM *init_param; | ||
151 : | |||
152 : | init_param = (XVID_INIT_PARAM *) param1; | ||
153 : | |||
154 : | suxen_drol | 1.21 | /* Inform the client the API version */ |
155 : | init_param->api_version = API_VERSION; | ||
156 : | |||
157 : | /* Inform the client the core build - unused because we're still alpha */ | ||
158 : | init_param->core_build = 1000; | ||
159 : | |||
160 : | suxen_drol | 1.31 | /* Do we have to force CPU features ? */ |
161 : | if ((init_param->cpu_flags & XVID_CPU_FORCE)) { | ||
162 : | suxen_drol | 1.21 | |
163 : | Isibaar | 1.1 | cpu_flags = init_param->cpu_flags; |
164 : | suxen_drol | 1.31 | |
165 : | edgomez | 1.16 | } else { |
166 : | Isibaar | 1.1 | |
167 : | chenm001 | 1.29 | cpu_flags = check_cpu_features(); |
168 : | suxen_drol | 1.31 | |
169 : | #if defined(ARCH_X86) && defined(EXPERIMENTAL_SSE2_CODE) | ||
170 : | if ((cpu_flags & XVID_CPU_SSE) && sigill_check(sse_os_trigger)) | ||
171 : | cpu_flags &= ~XVID_CPU_SSE; | ||
172 : | |||
173 : | if ((cpu_flags & XVID_CPU_SSE2) && sigill_check(sse2_os_trigger)) | ||
174 : | cpu_flags &= ~XVID_CPU_SSE2; | ||
175 : | #endif | ||
176 : | } | ||
177 : | |||
178 : | if ((init_param->cpu_flags & XVID_CPU_CHKONLY)) | ||
179 : | { | ||
180 : | Isibaar | 1.1 | init_param->cpu_flags = cpu_flags; |
181 : | suxen_drol | 1.31 | return XVID_ERR_OK; |
182 : | Isibaar | 1.1 | } |
183 : | suxen_drol | 1.31 | |
184 : | init_param->cpu_flags = cpu_flags; | ||
185 : | |||
186 : | Isibaar | 1.1 | |
187 : | edgomez | 1.16 | /* Initialize the function pointers */ |
188 : | Isibaar | 1.1 | idct_int32_init(); |
189 : | Isibaar | 1.9 | init_vlc_tables(); |
190 : | |||
191 : | edgomez | 1.16 | /* Fixed Point Forward/Inverse DCT transformations */ |
192 : | Isibaar | 1.1 | fdct = fdct_int32; |
193 : | idct = idct_int32; | ||
194 : | |||
195 : | edgomez | 1.16 | /* Only needed on PPC Altivec archs */ |
196 : | canard | 1.10 | sadInit = 0; |
197 : | edgomez | 1.15 | |
198 : | edgomez | 1.16 | /* Restore FPU context : emms_c is a nop functions */ |
199 : | Isibaar | 1.1 | emms = emms_c; |
200 : | |||
201 : | edgomez | 1.16 | /* Quantization functions */ |
202 : | quant_intra = quant_intra_c; | ||
203 : | Isibaar | 1.1 | dequant_intra = dequant_intra_c; |
204 : | edgomez | 1.16 | quant_inter = quant_inter_c; |
205 : | Isibaar | 1.1 | dequant_inter = dequant_inter_c; |
206 : | |||
207 : | edgomez | 1.16 | quant4_intra = quant4_intra_c; |
208 : | Isibaar | 1.1 | dequant4_intra = dequant4_intra_c; |
209 : | edgomez | 1.16 | quant4_inter = quant4_inter_c; |
210 : | Isibaar | 1.1 | dequant4_inter = dequant4_inter_c; |
211 : | |||
212 : | edgomez | 1.16 | /* Block transfer related functions */ |
213 : | Isibaar | 1.1 | transfer_8to16copy = transfer_8to16copy_c; |
214 : | transfer_16to8copy = transfer_16to8copy_c; | ||
215 : | edgomez | 1.16 | transfer_8to16sub = transfer_8to16sub_c; |
216 : | suxen_drol | 1.11 | transfer_8to16sub2 = transfer_8to16sub2_c; |
217 : | edgomez | 1.16 | transfer_16to8add = transfer_16to8add_c; |
218 : | transfer8x8_copy = transfer8x8_copy_c; | ||
219 : | Isibaar | 1.1 | |
220 : | h | 1.33.2.5 | /* Interlacing functions */ |
221 : | MBFieldTest = MBFieldTest_c; | ||
222 : | |||
223 : | edgomez | 1.16 | /* Image interpolation related functions */ |
224 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_c; | ||
225 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_c; | ||
226 : | Isibaar | 1.1 | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_c; |
227 : | Isibaar | 1.33.2.8 | |
228 : | interpolate16x16_lowpass_h = interpolate16x16_lowpass_h_c; | ||
229 : | interpolate16x16_lowpass_v = interpolate16x16_lowpass_v_c; | ||
230 : | interpolate16x16_lowpass_hv = interpolate16x16_lowpass_hv_c; | ||
231 : | Isibaar | 1.1 | |
232 : | Isibaar | 1.33.2.6 | interpolate8x8_lowpass_h = interpolate8x8_lowpass_h_c; |
233 : | interpolate8x8_lowpass_v = interpolate8x8_lowpass_v_c; | ||
234 : | interpolate8x8_lowpass_hv = interpolate8x8_lowpass_hv_c; | ||
235 : | |||
236 : | interpolate8x8_6tap_lowpass_h = interpolate8x8_6tap_lowpass_h_c; | ||
237 : | interpolate8x8_6tap_lowpass_v = interpolate8x8_6tap_lowpass_v_c; | ||
238 : | |||
239 : | interpolate8x8_avg2 = interpolate8x8_avg2_c; | ||
240 : | interpolate8x8_avg4 = interpolate8x8_avg4_c; | ||
241 : | |||
242 : | edgomez | 1.16 | /* Initialize internal colorspace transformation tables */ |
243 : | Isibaar | 1.1 | colorspace_init(); |
244 : | |||
245 : | edgomez | 1.16 | /* All colorspace transformation functions User Format->YV12 */ |
246 : | suxen_drol | 1.33.2.11 | yv12_to_yv12 = yv12_to_yv12_c; |
247 : | rgb555_to_yv12 = rgb555_to_yv12_c; | ||
248 : | rgb565_to_yv12 = rgb565_to_yv12_c; | ||
249 : | bgr_to_yv12 = bgr_to_yv12_c; | ||
250 : | bgra_to_yv12 = bgra_to_yv12_c; | ||
251 : | abgr_to_yv12 = abgr_to_yv12_c; | ||
252 : | rgba_to_yv12 = rgba_to_yv12_c; | ||
253 : | yuyv_to_yv12 = yuyv_to_yv12_c; | ||
254 : | uyvy_to_yv12 = uyvy_to_yv12_c; | ||
255 : | |||
256 : | rgb555i_to_yv12 = rgb555i_to_yv12_c; | ||
257 : | rgb565i_to_yv12 = rgb565i_to_yv12_c; | ||
258 : | bgri_to_yv12 = bgri_to_yv12_c; | ||
259 : | bgrai_to_yv12 = bgrai_to_yv12_c; | ||
260 : | abgri_to_yv12 = abgri_to_yv12_c; | ||
261 : | rgbai_to_yv12 = rgbai_to_yv12_c; | ||
262 : | yuyvi_to_yv12 = yuyvi_to_yv12_c; | ||
263 : | uyvyi_to_yv12 = uyvyi_to_yv12_c; | ||
264 : | |||
265 : | Isibaar | 1.1 | |
266 : | edgomez | 1.16 | /* All colorspace transformation functions YV12->User format */ |
267 : | suxen_drol | 1.33.2.11 | yv12_to_rgb555 = yv12_to_rgb555_c; |
268 : | yv12_to_rgb565 = yv12_to_rgb565_c; | ||
269 : | yv12_to_bgr = yv12_to_bgr_c; | ||
270 : | yv12_to_bgra = yv12_to_bgra_c; | ||
271 : | yv12_to_abgr = yv12_to_abgr_c; | ||
272 : | yv12_to_rgba = yv12_to_rgba_c; | ||
273 : | yv12_to_yuyv = yv12_to_yuyv_c; | ||
274 : | yv12_to_uyvy = yv12_to_uyvy_c; | ||
275 : | |||
276 : | yv12_to_rgb555i = yv12_to_rgb555i_c; | ||
277 : | yv12_to_rgb565i = yv12_to_rgb565i_c; | ||
278 : | yv12_to_bgri = yv12_to_bgri_c; | ||
279 : | yv12_to_bgrai = yv12_to_bgrai_c; | ||
280 : | yv12_to_abgri = yv12_to_abgri_c; | ||
281 : | yv12_to_rgbai = yv12_to_rgbai_c; | ||
282 : | yv12_to_yuyvi = yv12_to_yuyvi_c; | ||
283 : | yv12_to_uyvyi = yv12_to_uyvyi_c; | ||
284 : | Isibaar | 1.1 | |
285 : | edgomez | 1.16 | /* Functions used in motion estimation algorithms */ |
286 : | Isibaar | 1.1 | calc_cbp = calc_cbp_c; |
287 : | edgomez | 1.16 | sad16 = sad16_c; |
288 : | suxen_drol | 1.33 | sad8 = sad8_c; |
289 : | edgomez | 1.16 | sad16bi = sad16bi_c; |
290 : | suxen_drol | 1.33 | sad8bi = sad8bi_c; |
291 : | edgomez | 1.16 | dev16 = dev16_c; |
292 : | chl | 1.33.2.1 | sad16v = sad16v_c; |
293 : | suxen_drol | 1.33 | |
294 : | chl | 1.33.2.1 | // Halfpel8_Refine = Halfpel8_Refine_c; |
295 : | Isibaar | 1.1 | |
296 : | #ifdef ARCH_X86 | ||
297 : | suxen_drol | 1.33.2.11 | |
298 : | if ((cpu_flags & XVID_CPU_MMX) || (cpu_flags & XVID_CPU_MMXEXT) || | ||
299 : | (cpu_flags & XVID_CPU_3DNOW) || (cpu_flags & XVID_CPU_3DNOWEXT) || | ||
300 : | (cpu_flags & XVID_CPU_SSE) || (cpu_flags & XVID_CPU_SSE2)) | ||
301 : | { | ||
302 : | /* Restore FPU context : emms_c is a nop functions */ | ||
303 : | emms = emms_mmx; | ||
304 : | } | ||
305 : | |||
306 : | edgomez | 1.15 | if ((cpu_flags & XVID_CPU_MMX) > 0) { |
307 : | edgomez | 1.16 | |
308 : | /* Forward and Inverse Discrete Cosine Transformation functions */ | ||
309 : | Isibaar | 1.1 | fdct = fdct_mmx; |
310 : | idct = idct_mmx; | ||
311 : | |||
312 : | edgomez | 1.16 | /* Quantization related functions */ |
313 : | quant_intra = quant_intra_mmx; | ||
314 : | Isibaar | 1.1 | dequant_intra = dequant_intra_mmx; |
315 : | edgomez | 1.16 | quant_inter = quant_inter_mmx; |
316 : | Isibaar | 1.1 | dequant_inter = dequant_inter_mmx; |
317 : | |||
318 : | edgomez | 1.16 | quant4_intra = quant4_intra_mmx; |
319 : | Isibaar | 1.1 | dequant4_intra = dequant4_intra_mmx; |
320 : | edgomez | 1.16 | quant4_inter = quant4_inter_mmx; |
321 : | Isibaar | 1.1 | dequant4_inter = dequant4_inter_mmx; |
322 : | |||
323 : | edgomez | 1.16 | /* Block related functions */ |
324 : | Isibaar | 1.1 | transfer_8to16copy = transfer_8to16copy_mmx; |
325 : | transfer_16to8copy = transfer_16to8copy_mmx; | ||
326 : | edgomez | 1.16 | transfer_8to16sub = transfer_8to16sub_mmx; |
327 : | edgomez | 1.22 | transfer_8to16sub2 = transfer_8to16sub2_mmx; |
328 : | edgomez | 1.16 | transfer_16to8add = transfer_16to8add_mmx; |
329 : | transfer8x8_copy = transfer8x8_copy_mmx; | ||
330 : | edgomez | 1.22 | |
331 : | h | 1.33.2.5 | /* Interlacing Functions */ |
332 : | MBFieldTest = MBFieldTest_mmx; | ||
333 : | edgomez | 1.16 | |
334 : | /* Image Interpolation related functions */ | ||
335 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_mmx; | ||
336 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_mmx; | ||
337 : | Isibaar | 1.1 | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_mmx; |
338 : | Isibaar | 1.33.2.6 | |
339 : | interpolate8x8_6tap_lowpass_h = interpolate8x8_6tap_lowpass_h_mmx; | ||
340 : | interpolate8x8_6tap_lowpass_v = interpolate8x8_6tap_lowpass_v_mmx; | ||
341 : | |||
342 : | Isibaar | 1.33.2.9 | // interpolate8x8_avg2 = interpolate8x8_avg2_mmx; |
343 : | Isibaar | 1.33.2.6 | interpolate8x8_avg4 = interpolate8x8_avg4_mmx; |
344 : | Isibaar | 1.1 | |
345 : | suxen_drol | 1.33.2.11 | /* image input xxx_to_yv12 related functions */ |
346 : | yv12_to_yv12 = yv12_to_yv12_mmx; | ||
347 : | bgr_to_yv12 = bgr_to_yv12_mmx; | ||
348 : | bgra_to_yv12 = bgra_to_yv12_mmx; | ||
349 : | edgomez | 1.16 | yuyv_to_yv12 = yuyv_to_yv12_mmx; |
350 : | uyvy_to_yv12 = uyvy_to_yv12_mmx; | ||
351 : | Isibaar | 1.1 | |
352 : | suxen_drol | 1.33.2.11 | /* image output yv12_to_xxx related functions */ |
353 : | yv12_to_bgr = yv12_to_bgr_mmx; | ||
354 : | yv12_to_bgra = yv12_to_bgra_mmx; | ||
355 : | edgomez | 1.16 | yv12_to_yuyv = yv12_to_yuyv_mmx; |
356 : | yv12_to_uyvy = yv12_to_uyvy_mmx; | ||
357 : | suxen_drol | 1.33.2.11 | |
358 : | yv12_to_yuyvi = yv12_to_yuyvi_mmx; | ||
359 : | yv12_to_uyvyi = yv12_to_uyvyi_mmx; | ||
360 : | Isibaar | 1.1 | |
361 : | edgomez | 1.16 | /* Motion estimation related functions */ |
362 : | Isibaar | 1.1 | calc_cbp = calc_cbp_mmx; |
363 : | edgomez | 1.16 | sad16 = sad16_mmx; |
364 : | sad8 = sad8_mmx; | ||
365 : | suxen_drol | 1.33 | sad16bi = sad16bi_mmx; |
366 : | sad8bi = sad8bi_mmx; | ||
367 : | edgomez | 1.16 | dev16 = dev16_mmx; |
368 : | Isibaar | 1.33.2.2 | sad16v = sad16v_mmx; |
369 : | Isibaar | 1.1 | |
370 : | } | ||
371 : | |||
372 : | suxen_drol | 1.33 | /* these 3dnow functions are faster than mmx, but slower than xmm. */ |
373 : | if ((cpu_flags & XVID_CPU_3DNOW) > 0) { | ||
374 : | |||
375 : | /* ME functions */ | ||
376 : | sad16bi = sad16bi_3dn; | ||
377 : | sad8bi = sad8bi_3dn; | ||
378 : | suxen_drol | 1.33.2.11 | |
379 : | yuyv_to_yv12 = yuyv_to_yv12_3dn; | ||
380 : | uyvy_to_yv12 = uyvy_to_yv12_3dn; | ||
381 : | suxen_drol | 1.33 | } |
382 : | |||
383 : | |||
384 : | edgomez | 1.15 | if ((cpu_flags & XVID_CPU_MMXEXT) > 0) { |
385 : | edgomez | 1.16 | |
386 : | /* Inverse DCT */ | ||
387 : | Isibaar | 1.1 | idct = idct_xmm; |
388 : | edgomez | 1.16 | |
389 : | /* Interpolation */ | ||
390 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_xmm; | ||
391 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; | ||
392 : | h | 1.3 | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_xmm; |
393 : | Isibaar | 1.25 | |
394 : | chenm001 | 1.29 | /* Quantization */ |
395 : | dequant_intra = dequant_intra_xmm; | ||
396 : | dequant_inter = dequant_inter_xmm; | ||
397 : | |||
398 : | edgomez | 1.19 | /* Buffer transfer */ |
399 : | transfer_8to16sub2 = transfer_8to16sub2_xmm; | ||
400 : | edgomez | 1.16 | |
401 : | /* Colorspace transformation */ | ||
402 : | suxen_drol | 1.33.2.11 | yv12_to_yv12 = yv12_to_yv12_xmm; |
403 : | yuyv_to_yv12 = yuyv_to_yv12_xmm; | ||
404 : | Isibaar | 1.33.2.12 | uyvy_to_yv12 = uyvy_to_yv12_xmm; |
405 : | Isibaar | 1.1 | |
406 : | edgomez | 1.16 | /* ME functions */ |
407 : | Isibaar | 1.1 | sad16 = sad16_xmm; |
408 : | suxen_drol | 1.33 | sad8 = sad8_xmm; |
409 : | chenm001 | 1.29 | sad16bi = sad16bi_xmm; |
410 : | suxen_drol | 1.33 | sad8bi = sad8bi_xmm; |
411 : | Isibaar | 1.1 | dev16 = dev16_xmm; |
412 : | chl | 1.33.2.1 | sad16v = sad16v_xmm; |
413 : | Isibaar | 1.1 | } |
414 : | |||
415 : | edgomez | 1.15 | if ((cpu_flags & XVID_CPU_3DNOW) > 0) { |
416 : | edgomez | 1.16 | |
417 : | /* Interpolation */ | ||
418 : | Isibaar | 1.1 | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_3dn; |
419 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_3dn; | ||
420 : | h | 1.4 | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dn; |
421 : | Isibaar | 1.1 | } |
422 : | |||
423 : | edgomez | 1.15 | if ((cpu_flags & XVID_CPU_SSE2) > 0) { |
424 : | Isibaar | 1.14 | #ifdef EXPERIMENTAL_SSE2_CODE |
425 : | edgomez | 1.16 | |
426 : | chenm001 | 1.29 | calc_cbp = calc_cbp_sse2; |
427 : | |||
428 : | edgomez | 1.16 | /* Quantization */ |
429 : | quant_intra = quant_intra_sse2; | ||
430 : | Isibaar | 1.14 | dequant_intra = dequant_intra_sse2; |
431 : | edgomez | 1.16 | quant_inter = quant_inter_sse2; |
432 : | Isibaar | 1.14 | dequant_inter = dequant_inter_sse2; |
433 : | h | 1.13 | |
434 : | edgomez | 1.16 | /* ME */ |
435 : | sad16 = sad16_sse2; | ||
436 : | dev16 = dev16_sse2; | ||
437 : | |||
438 : | /* Forward and Inverse DCT */ | ||
439 : | idct = idct_sse2; | ||
440 : | Isibaar | 1.14 | fdct = fdct_sse2; |
441 : | #endif | ||
442 : | h | 1.12 | } |
443 : | edgomez | 1.16 | |
444 : | Isibaar | 1.1 | #endif |
445 : | Isibaar | 1.18 | |
446 : | #ifdef ARCH_IA64 | ||
447 : | if ((cpu_flags & XVID_CPU_IA64) > 0) { //use assembler routines? | ||
448 : | idct_ia64_init(); | ||
449 : | fdct = fdct_ia64; | ||
450 : | idct = idct_ia64; //not yet working, crashes | ||
451 : | interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_ia64; | ||
452 : | interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_ia64; | ||
453 : | interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_ia64; | ||
454 : | sad16 = sad16_ia64; | ||
455 : | sad16bi = sad16bi_ia64; | ||
456 : | sad8 = sad8_ia64; | ||
457 : | dev16 = dev16_ia64; | ||
458 : | chl | 1.33.2.1 | // Halfpel8_Refine = Halfpel8_Refine_ia64; |
459 : | Isibaar | 1.18 | quant_intra = quant_intra_ia64; |
460 : | dequant_intra = dequant_intra_ia64; | ||
461 : | quant_inter = quant_inter_ia64; | ||
462 : | dequant_inter = dequant_inter_ia64; | ||
463 : | transfer_8to16copy = transfer_8to16copy_ia64; | ||
464 : | transfer_16to8copy = transfer_16to8copy_ia64; | ||
465 : | transfer_8to16sub = transfer_8to16sub_ia64; | ||
466 : | transfer_8to16sub2 = transfer_8to16sub2_ia64; | ||
467 : | transfer_16to8add = transfer_16to8add_ia64; | ||
468 : | transfer8x8_copy = transfer8x8_copy_ia64; | ||
469 : | DEBUG("Using IA-64 assembler routines.\n"); | ||
470 : | } | ||
471 : | #endif | ||
472 : | edgomez | 1.16 | |
473 : | canard | 1.5 | #ifdef ARCH_PPC |
474 : | canard | 1.6 | #ifdef ARCH_PPC_ALTIVEC |
475 : | calc_cbp = calc_cbp_altivec; | ||
476 : | canard | 1.7 | fdct = fdct_altivec; |
477 : | idct = idct_altivec; | ||
478 : | canard | 1.10 | sadInit = sadInit_altivec; |
479 : | canard | 1.8 | sad16 = sad16_altivec; |
480 : | sad8 = sad8_altivec; | ||
481 : | dev16 = dev16_altivec; | ||
482 : | canard | 1.6 | #else |
483 : | canard | 1.5 | calc_cbp = calc_cbp_ppc; |
484 : | canard | 1.6 | #endif |
485 : | canard | 1.5 | #endif |
486 : | Isibaar | 1.1 | |
487 : | return XVID_ERR_OK; | ||
488 : | } | ||
489 : | |||
490 : | edgomez | 1.16 | /***************************************************************************** |
491 : | * XviD Native decoder entry point | ||
492 : | * | ||
493 : | * This function is just a wrapper to all the option cases. | ||
494 : | * | ||
495 : | * Returned values : XVID_ERR_FAIL when opt is invalid | ||
496 : | * else returns the wrapped function result | ||
497 : | * | ||
498 : | ****************************************************************************/ | ||
499 : | |||
500 : | edgomez | 1.15 | int |
501 : | xvid_decore(void *handle, | ||
502 : | int opt, | ||
503 : | void *param1, | ||
504 : | void *param2) | ||
505 : | Isibaar | 1.1 | { |
506 : | edgomez | 1.15 | switch (opt) { |
507 : | case XVID_DEC_DECODE: | ||
508 : | suxen_drol | 1.33.2.11 | return decoder_decode((DECODER *) handle, (XVID_DEC_FRAME *) param1, (XVID_DEC_STATS*) param2); |
509 : | edgomez | 1.15 | |
510 : | case XVID_DEC_CREATE: | ||
511 : | chenm001 | 1.29 | return decoder_create((XVID_DEC_PARAM *) param1); |
512 : | edgomez | 1.15 | |
513 : | case XVID_DEC_DESTROY: | ||
514 : | return decoder_destroy((DECODER *) handle); | ||
515 : | Isibaar | 1.1 | |
516 : | default: | ||
517 : | edgomez | 1.15 | return XVID_ERR_FAIL; |
518 : | } | ||
519 : | Isibaar | 1.1 | } |
520 : | |||
521 : | edgomez | 1.16 | |
522 : | /***************************************************************************** | ||
523 : | * XviD Native encoder entry point | ||
524 : | * | ||
525 : | * This function is just a wrapper to all the option cases. | ||
526 : | * | ||
527 : | * Returned values : XVID_ERR_FAIL when opt is invalid | ||
528 : | * else returns the wrapped function result | ||
529 : | * | ||
530 : | ****************************************************************************/ | ||
531 : | Isibaar | 1.1 | |
532 : | edgomez | 1.15 | int |
533 : | xvid_encore(void *handle, | ||
534 : | int opt, | ||
535 : | void *param1, | ||
536 : | void *param2) | ||
537 : | Isibaar | 1.1 | { |
538 : | edgomez | 1.15 | switch (opt) { |
539 : | case XVID_ENC_ENCODE: | ||
540 : | chl | 1.33.2.10 | |
541 : | suxen_drol | 1.20 | if (((Encoder *) handle)->mbParam.max_bframes >= 0) |
542 : | return encoder_encode_bframes((Encoder *) handle, (XVID_ENC_FRAME *) param1, | ||
543 : | (XVID_ENC_STATS *) param2); | ||
544 : | else | ||
545 : | edgomez | 1.15 | return encoder_encode((Encoder *) handle, (XVID_ENC_FRAME *) param1, |
546 : | (XVID_ENC_STATS *) param2); | ||
547 : | |||
548 : | case XVID_ENC_CREATE: | ||
549 : | return encoder_create((XVID_ENC_PARAM *) param1); | ||
550 : | |||
551 : | case XVID_ENC_DESTROY: | ||
552 : | return encoder_destroy((Encoder *) handle); | ||
553 : | Isibaar | 1.1 | |
554 : | default: | ||
555 : | edgomez | 1.15 | return XVID_ERR_FAIL; |
556 : | } | ||
557 : | Isibaar | 1.1 | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |