37 |
* - 22.12.2001 API change: added xvid_init() - Isibaar |
* - 22.12.2001 API change: added xvid_init() - Isibaar |
38 |
* - 16.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
* - 16.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
39 |
* |
* |
40 |
* $Id: xvid.c,v 1.33.2.10 2002-11-02 16:11:07 chl Exp $ |
* $Id: xvid.c,v 1.33.2.11 2002-11-07 10:28:15 suxen_drol Exp $ |
41 |
* |
* |
42 |
****************************************************************************/ |
****************************************************************************/ |
43 |
|
|
243 |
colorspace_init(); |
colorspace_init(); |
244 |
|
|
245 |
/* All colorspace transformation functions User Format->YV12 */ |
/* All colorspace transformation functions User Format->YV12 */ |
246 |
|
yv12_to_yv12 = yv12_to_yv12_c; |
247 |
rgb555_to_yv12 = rgb555_to_yv12_c; |
rgb555_to_yv12 = rgb555_to_yv12_c; |
248 |
rgb565_to_yv12 = rgb565_to_yv12_c; |
rgb565_to_yv12 = rgb565_to_yv12_c; |
249 |
rgb24_to_yv12 = rgb24_to_yv12_c; |
bgr_to_yv12 = bgr_to_yv12_c; |
250 |
rgb32_to_yv12 = rgb32_to_yv12_c; |
bgra_to_yv12 = bgra_to_yv12_c; |
251 |
yuv_to_yv12 = yuv_to_yv12_c; |
abgr_to_yv12 = abgr_to_yv12_c; |
252 |
|
rgba_to_yv12 = rgba_to_yv12_c; |
253 |
yuyv_to_yv12 = yuyv_to_yv12_c; |
yuyv_to_yv12 = yuyv_to_yv12_c; |
254 |
uyvy_to_yv12 = uyvy_to_yv12_c; |
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 |
|
|
266 |
/* All colorspace transformation functions YV12->User format */ |
/* All colorspace transformation functions YV12->User format */ |
267 |
yv12_to_rgb555 = yv12_to_rgb555_c; |
yv12_to_rgb555 = yv12_to_rgb555_c; |
268 |
yv12_to_rgb565 = yv12_to_rgb565_c; |
yv12_to_rgb565 = yv12_to_rgb565_c; |
269 |
yv12_to_rgb24 = yv12_to_rgb24_c; |
yv12_to_bgr = yv12_to_bgr_c; |
270 |
yv12_to_rgb32 = yv12_to_rgb32_c; |
yv12_to_bgra = yv12_to_bgra_c; |
271 |
yv12_to_abgr = yv12_to_abgr_c; |
yv12_to_abgr = yv12_to_abgr_c; |
272 |
yv12_to_rgba = yv12_to_rgba_c; |
yv12_to_rgba = yv12_to_rgba_c; |
|
yv12_to_yuv = yv12_to_yuv_c; |
|
273 |
yv12_to_yuyv = yv12_to_yuyv_c; |
yv12_to_yuyv = yv12_to_yuyv_c; |
274 |
yv12_to_uyvy = yv12_to_uyvy_c; |
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 |
|
|
285 |
/* Functions used in motion estimation algorithms */ |
/* Functions used in motion estimation algorithms */ |
286 |
calc_cbp = calc_cbp_c; |
calc_cbp = calc_cbp_c; |
287 |
sad16 = sad16_c; |
sad16 = sad16_c; |
294 |
// Halfpel8_Refine = Halfpel8_Refine_c; |
// Halfpel8_Refine = Halfpel8_Refine_c; |
295 |
|
|
296 |
#ifdef ARCH_X86 |
#ifdef ARCH_X86 |
297 |
|
|
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 |
if ((cpu_flags & XVID_CPU_MMX) > 0) { |
if ((cpu_flags & XVID_CPU_MMX) > 0) { |
307 |
|
|
308 |
/* Forward and Inverse Discrete Cosine Transformation functions */ |
/* Forward and Inverse Discrete Cosine Transformation functions */ |
309 |
fdct = fdct_mmx; |
fdct = fdct_mmx; |
310 |
idct = idct_mmx; |
idct = idct_mmx; |
311 |
|
|
|
/* To restore FPU context after mmx use */ |
|
|
emms = emms_mmx; |
|
|
|
|
312 |
/* Quantization related functions */ |
/* Quantization related functions */ |
313 |
quant_intra = quant_intra_mmx; |
quant_intra = quant_intra_mmx; |
314 |
dequant_intra = dequant_intra_mmx; |
dequant_intra = dequant_intra_mmx; |
342 |
// interpolate8x8_avg2 = interpolate8x8_avg2_mmx; |
// interpolate8x8_avg2 = interpolate8x8_avg2_mmx; |
343 |
interpolate8x8_avg4 = interpolate8x8_avg4_mmx; |
interpolate8x8_avg4 = interpolate8x8_avg4_mmx; |
344 |
|
|
345 |
/* Image RGB->YV12 related functions */ |
/* image input xxx_to_yv12 related functions */ |
346 |
rgb24_to_yv12 = rgb24_to_yv12_mmx; |
yv12_to_yv12 = yv12_to_yv12_mmx; |
347 |
rgb32_to_yv12 = rgb32_to_yv12_mmx; |
bgr_to_yv12 = bgr_to_yv12_mmx; |
348 |
yuv_to_yv12 = yuv_to_yv12_mmx; |
bgra_to_yv12 = bgra_to_yv12_mmx; |
349 |
yuyv_to_yv12 = yuyv_to_yv12_mmx; |
yuyv_to_yv12 = yuyv_to_yv12_mmx; |
350 |
uyvy_to_yv12 = uyvy_to_yv12_mmx; |
uyvy_to_yv12 = uyvy_to_yv12_mmx; |
351 |
|
|
352 |
/* Image YV12->RGB related functions */ |
/* image output yv12_to_xxx related functions */ |
353 |
yv12_to_rgb24 = yv12_to_rgb24_mmx; |
yv12_to_bgr = yv12_to_bgr_mmx; |
354 |
yv12_to_rgb32 = yv12_to_rgb32_mmx; |
yv12_to_bgra = yv12_to_bgra_mmx; |
355 |
yv12_to_yuyv = yv12_to_yuyv_mmx; |
yv12_to_yuyv = yv12_to_yuyv_mmx; |
356 |
yv12_to_uyvy = yv12_to_uyvy_mmx; |
yv12_to_uyvy = yv12_to_uyvy_mmx; |
357 |
|
|
358 |
|
yv12_to_yuyvi = yv12_to_yuyvi_mmx; |
359 |
|
yv12_to_uyvyi = yv12_to_uyvyi_mmx; |
360 |
|
|
361 |
/* Motion estimation related functions */ |
/* Motion estimation related functions */ |
362 |
calc_cbp = calc_cbp_mmx; |
calc_cbp = calc_cbp_mmx; |
363 |
sad16 = sad16_mmx; |
sad16 = sad16_mmx; |
375 |
/* ME functions */ |
/* ME functions */ |
376 |
sad16bi = sad16bi_3dn; |
sad16bi = sad16bi_3dn; |
377 |
sad8bi = sad8bi_3dn; |
sad8bi = sad8bi_3dn; |
378 |
|
|
379 |
|
yuyv_to_yv12 = yuyv_to_yv12_3dn; |
380 |
|
uyvy_to_yv12 = uyvy_to_yv12_3dn; |
381 |
} |
} |
382 |
|
|
383 |
|
|
399 |
transfer_8to16sub2 = transfer_8to16sub2_xmm; |
transfer_8to16sub2 = transfer_8to16sub2_xmm; |
400 |
|
|
401 |
/* Colorspace transformation */ |
/* Colorspace transformation */ |
402 |
yuv_to_yv12 = yuv_to_yv12_xmm; |
yv12_to_yv12 = yv12_to_yv12_xmm; |
403 |
|
yuyv_to_yv12 = yuyv_to_yv12_xmm; |
404 |
|
uyvy_to_yv12 = yuyv_to_yv12_xmm; |
405 |
|
|
406 |
/* ME functions */ |
/* ME functions */ |
407 |
sad16 = sad16_xmm; |
sad16 = sad16_xmm; |
505 |
{ |
{ |
506 |
switch (opt) { |
switch (opt) { |
507 |
case XVID_DEC_DECODE: |
case XVID_DEC_DECODE: |
508 |
return decoder_decode((DECODER *) handle, (XVID_DEC_FRAME *) param1); |
return decoder_decode((DECODER *) handle, (XVID_DEC_FRAME *) param1, (XVID_DEC_STATS*) param2); |
509 |
|
|
510 |
case XVID_DEC_CREATE: |
case XVID_DEC_CREATE: |
511 |
return decoder_create((XVID_DEC_PARAM *) param1); |
return decoder_create((XVID_DEC_PARAM *) param1); |