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.13 2002-11-08 10:10:48 suxen_drol Exp $ |
* $Id: xvid.c,v 1.33.2.18 2002-12-19 00:37:56 Isibaar Exp $ |
41 |
* |
* |
42 |
****************************************************************************/ |
****************************************************************************/ |
43 |
|
|
49 |
#include "dct/fdct.h" |
#include "dct/fdct.h" |
50 |
#include "image/colorspace.h" |
#include "image/colorspace.h" |
51 |
#include "image/interpolate8x8.h" |
#include "image/interpolate8x8.h" |
52 |
|
#include "image/reduced.h" |
53 |
#include "utils/mem_transfer.h" |
#include "utils/mem_transfer.h" |
54 |
#include "utils/mbfunctions.h" |
#include "utils/mbfunctions.h" |
55 |
#include "quant/quant_h263.h" |
#include "quant/quant_h263.h" |
235 |
interpolate8x8_avg2 = interpolate8x8_avg2_c; |
interpolate8x8_avg2 = interpolate8x8_avg2_c; |
236 |
interpolate8x8_avg4 = interpolate8x8_avg4_c; |
interpolate8x8_avg4 = interpolate8x8_avg4_c; |
237 |
|
|
238 |
|
/* reduced resoltuion */ |
239 |
|
|
240 |
|
copy_upsampled_8x8_16to8 = xvid_Copy_Upsampled_8x8_16To8_C; |
241 |
|
add_upsampled_8x8_16to8 = xvid_Add_Upsampled_8x8_16To8_C; |
242 |
|
#ifdef ARCH_X86 |
243 |
|
vfilter_31 = xvid_VFilter_31_x86; |
244 |
|
hfilter_31 = xvid_HFilter_31_x86; |
245 |
|
#else |
246 |
|
vfilter_31 = xvid_VFilter_31_C; |
247 |
|
hfilter_31 = xvid_HFilter_31_C; |
248 |
|
#endif |
249 |
|
filter_18x18_to_8x8 = xvid_Filter_18x18_To_8x8_C; |
250 |
|
filter_diff_18x18_to_8x8 = xvid_Filter_Diff_18x18_To_8x8_C; |
251 |
|
|
252 |
/* Initialize internal colorspace transformation tables */ |
/* Initialize internal colorspace transformation tables */ |
253 |
colorspace_init(); |
colorspace_init(); |
254 |
|
|
349 |
interpolate8x8_6tap_lowpass_h = interpolate8x8_6tap_lowpass_h_mmx; |
interpolate8x8_6tap_lowpass_h = interpolate8x8_6tap_lowpass_h_mmx; |
350 |
interpolate8x8_6tap_lowpass_v = interpolate8x8_6tap_lowpass_v_mmx; |
interpolate8x8_6tap_lowpass_v = interpolate8x8_6tap_lowpass_v_mmx; |
351 |
|
|
352 |
// interpolate8x8_avg2 = interpolate8x8_avg2_mmx; |
interpolate8x8_avg2 = interpolate8x8_avg2_mmx; |
353 |
interpolate8x8_avg4 = interpolate8x8_avg4_mmx; |
interpolate8x8_avg4 = interpolate8x8_avg4_mmx; |
354 |
|
|
355 |
|
/* reduced resolution */ |
356 |
|
copy_upsampled_8x8_16to8 = xvid_Copy_Upsampled_8x8_16To8_mmx; |
357 |
|
add_upsampled_8x8_16to8 = xvid_Add_Upsampled_8x8_16To8_mmx; |
358 |
|
hfilter_31 = xvid_HFilter_31_mmx; |
359 |
|
filter_18x18_to_8x8 = xvid_Filter_18x18_To_8x8_mmx; |
360 |
|
filter_diff_18x18_to_8x8 = xvid_Filter_Diff_18x18_To_8x8_mmx; |
361 |
|
|
362 |
/* image input xxx_to_yv12 related functions */ |
/* image input xxx_to_yv12 related functions */ |
363 |
yv12_to_yv12 = yv12_to_yv12_mmx; |
yv12_to_yv12 = yv12_to_yv12_mmx; |
364 |
bgr_to_yv12 = bgr_to_yv12_mmx; |
bgr_to_yv12 = bgr_to_yv12_mmx; |
408 |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; |
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_xmm; |
409 |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_xmm; |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_xmm; |
410 |
|
|
411 |
|
/* reduced resolution */ |
412 |
|
copy_upsampled_8x8_16to8 = xvid_Copy_Upsampled_8x8_16To8_xmm; |
413 |
|
add_upsampled_8x8_16to8 = xvid_Add_Upsampled_8x8_16To8_xmm; |
414 |
|
|
415 |
/* Quantization */ |
/* Quantization */ |
416 |
|
quant4_intra = quant4_intra_xmm; |
417 |
|
quant4_inter = quant4_inter_xmm; |
418 |
|
|
419 |
dequant_intra = dequant_intra_xmm; |
dequant_intra = dequant_intra_xmm; |
420 |
dequant_inter = dequant_inter_xmm; |
dequant_inter = dequant_inter_xmm; |
421 |
|
|
444 |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dn; |
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dn; |
445 |
} |
} |
446 |
|
|
447 |
|
if ((cpu_flags & XVID_CPU_3DNOWEXT) > 0) { |
448 |
|
|
449 |
|
/* Inverse DCT */ |
450 |
|
idct = idct_3dne; |
451 |
|
|
452 |
|
/* Buffer transfer */ |
453 |
|
transfer_8to16copy = transfer_8to16copy_3dne; |
454 |
|
transfer_16to8copy = transfer_16to8copy_3dne; |
455 |
|
transfer_8to16sub = transfer_8to16sub_3dne; |
456 |
|
transfer_8to16sub2 = transfer_8to16sub2_3dne; |
457 |
|
transfer_16to8add = transfer_16to8add_3dne; |
458 |
|
transfer8x8_copy = transfer8x8_copy_3dne; |
459 |
|
|
460 |
|
/* Quantization */ |
461 |
|
dequant4_intra = dequant4_intra_3dne; |
462 |
|
dequant4_inter = dequant4_inter_3dne; |
463 |
|
quant_intra = quant_intra_3dne; |
464 |
|
quant_inter = quant_inter_3dne; |
465 |
|
dequant_intra = dequant_intra_3dne; |
466 |
|
dequant_inter = dequant_inter_3dne; |
467 |
|
|
468 |
|
/* ME functions */ |
469 |
|
calc_cbp = calc_cbp_3dne; |
470 |
|
sad16 = sad16_3dne; |
471 |
|
sad8 = sad8_3dne; |
472 |
|
sad16bi = sad16bi_3dne; |
473 |
|
sad8bi = sad8bi_3dne; |
474 |
|
dev16 = dev16_3dne; |
475 |
|
|
476 |
|
/* Interpolation */ |
477 |
|
interpolate8x8_halfpel_h = interpolate8x8_halfpel_h_3dne; |
478 |
|
interpolate8x8_halfpel_v = interpolate8x8_halfpel_v_3dne; |
479 |
|
interpolate8x8_halfpel_hv = interpolate8x8_halfpel_hv_3dne; |
480 |
|
} |
481 |
|
|
482 |
|
|
483 |
if ((cpu_flags & XVID_CPU_SSE2) > 0) { |
if ((cpu_flags & XVID_CPU_SSE2) > 0) { |
484 |
#ifdef EXPERIMENTAL_SSE2_CODE |
#ifdef EXPERIMENTAL_SSE2_CODE |
485 |
|
|
552 |
static int |
static int |
553 |
xvid_init_convert(XVID_INIT_CONVERTINFO* convert) |
xvid_init_convert(XVID_INIT_CONVERTINFO* convert) |
554 |
{ |
{ |
555 |
const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP); |
// const int flip1 = (convert->input.colorspace & XVID_CSP_VFLIP) ^ (convert->output.colorspace & XVID_CSP_VFLIP); |
556 |
const int width = convert->width; |
const int width = convert->width; |
557 |
const int height = convert->height; |
const int height = convert->height; |
558 |
const int width2 = convert->width/2; |
const int width2 = convert->width/2; |