comparison dsputil.c @ 8590:7a463923ecd1 libavcodec

Change semantic of CONFIG_*, HAVE_* and ARCH_*. They are now always defined to either 0 or 1.
author aurel
date Tue, 13 Jan 2009 23:44:16 +0000
parents 19e2f1a50aa7
children 68e959302527
comparison
equal deleted inserted replaced
8589:a29b5b5c3c9d 8590:7a463923ecd1
167 167
168 for(i=0; i<64; i++){ 168 for(i=0; i<64; i++){
169 int j; 169 int j;
170 j = src_scantable[i]; 170 j = src_scantable[i];
171 st->permutated[i] = permutation[j]; 171 st->permutated[i] = permutation[j];
172 #ifdef ARCH_PPC 172 #if ARCH_PPC
173 st->inverse[j] = i; 173 st->inverse[j] = i;
174 #endif 174 #endif
175 } 175 }
176 176
177 end=-1; 177 end=-1;
338 } 338 }
339 return s; 339 return s;
340 } 340 }
341 341
342 342
343 #ifdef CONFIG_SNOW_ENCODER //dwt is in snow.c 343 #if CONFIG_SNOW_ENCODER //dwt is in snow.c
344 static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){ 344 static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){
345 int s, i, j; 345 int s, i, j;
346 const int dec_count= w==8 ? 3 : 4; 346 const int dec_count= w==8 ? 3 : 4;
347 int tmp[32*32]; 347 int tmp[32*32];
348 int level, ori; 348 int level, ori;
2709 dst+=dstStride; 2709 dst+=dstStride;
2710 src+=srcStride; 2710 src+=srcStride;
2711 } 2711 }
2712 } 2712 }
2713 2713
2714 #ifdef CONFIG_CAVS_DECODER 2714 #if CONFIG_CAVS_DECODER
2715 /* AVS specific */ 2715 /* AVS specific */
2716 void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx); 2716 void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx);
2717 2717
2718 void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) { 2718 void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
2719 put_pixels8_c(dst, src, stride, 8); 2719 put_pixels8_c(dst, src, stride, 8);
2727 void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) { 2727 void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
2728 avg_pixels16_c(dst, src, stride, 16); 2728 avg_pixels16_c(dst, src, stride, 16);
2729 } 2729 }
2730 #endif /* CONFIG_CAVS_DECODER */ 2730 #endif /* CONFIG_CAVS_DECODER */
2731 2731
2732 #if defined(CONFIG_VC1_DECODER) || defined(CONFIG_WMV3_DECODER) 2732 #if CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER
2733 /* VC-1 specific */ 2733 /* VC-1 specific */
2734 void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx); 2734 void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx);
2735 2735
2736 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, uint8_t *src, int stride, int rnd) { 2736 void ff_put_vc1_mspel_mc00_c(uint8_t *dst, uint8_t *src, int stride, int rnd) {
2737 put_pixels8_c(dst, src, stride, 8); 2737 put_pixels8_c(dst, src, stride, 8);
2741 void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx); 2741 void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx);
2742 2742
2743 /* H264 specific */ 2743 /* H264 specific */
2744 void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx); 2744 void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx);
2745 2745
2746 #if defined(CONFIG_RV30_DECODER) 2746 #if CONFIG_RV30_DECODER
2747 void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx); 2747 void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx);
2748 #endif /* CONFIG_RV30_DECODER */ 2748 #endif /* CONFIG_RV30_DECODER */
2749 2749
2750 #if defined(CONFIG_RV40_DECODER) 2750 #if CONFIG_RV40_DECODER
2751 static void put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){ 2751 static void put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
2752 put_pixels16_xy2_c(dst, src, stride, 16); 2752 put_pixels16_xy2_c(dst, src, stride, 16);
2753 } 2753 }
2754 static void avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){ 2754 static void avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
2755 avg_pixels16_xy2_c(dst, src, stride, 16); 2755 avg_pixels16_xy2_c(dst, src, stride, 16);
3465 cmp[i]= zero_cmp; 3465 cmp[i]= zero_cmp;
3466 break; 3466 break;
3467 case FF_CMP_NSSE: 3467 case FF_CMP_NSSE:
3468 cmp[i]= c->nsse[i]; 3468 cmp[i]= c->nsse[i];
3469 break; 3469 break;
3470 #ifdef CONFIG_SNOW_ENCODER 3470 #if CONFIG_SNOW_ENCODER
3471 case FF_CMP_W53: 3471 case FF_CMP_W53:
3472 cmp[i]= c->w53[i]; 3472 cmp[i]= c->w53[i];
3473 break; 3473 break;
3474 case FF_CMP_W97: 3474 case FF_CMP_W97:
3475 cmp[i]= c->w97[i]; 3475 cmp[i]= c->w97[i];
3516 dst[i] = src1[i]+src2[i]; 3516 dst[i] = src1[i]+src2[i];
3517 } 3517 }
3518 3518
3519 static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){ 3519 static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
3520 long i; 3520 long i;
3521 #ifndef HAVE_FAST_UNALIGNED 3521 #if !HAVE_FAST_UNALIGNED
3522 if((long)src2 & (sizeof(long)-1)){ 3522 if((long)src2 & (sizeof(long)-1)){
3523 for(i=0; i+7<w; i+=8){ 3523 for(i=0; i+7<w; i+=8){
3524 dst[i+0] = src1[i+0]-src2[i+0]; 3524 dst[i+0] = src1[i+0]-src2[i+0];
3525 dst[i+1] = src1[i+1]-src2[i+1]; 3525 dst[i+1] = src1[i+1]-src2[i+1];
3526 dst[i+2] = src1[i+2]-src2[i+2]; 3526 dst[i+2] = src1[i+2]-src2[i+2];
3684 s->dsp.diff_pixels(temp, src1, src2, stride); 3684 s->dsp.diff_pixels(temp, src1, src2, stride);
3685 s->dsp.fdct(temp); 3685 s->dsp.fdct(temp);
3686 return s->dsp.sum_abs_dctelem(temp); 3686 return s->dsp.sum_abs_dctelem(temp);
3687 } 3687 }
3688 3688
3689 #ifdef CONFIG_GPL 3689 #if CONFIG_GPL
3690 #define DCT8_1D {\ 3690 #define DCT8_1D {\
3691 const int s07 = SRC(0) + SRC(7);\ 3691 const int s07 = SRC(0) + SRC(7);\
3692 const int s16 = SRC(1) + SRC(6);\ 3692 const int s16 = SRC(1) + SRC(6);\
3693 const int s25 = SRC(2) + SRC(5);\ 3693 const int s25 = SRC(2) + SRC(5);\
3694 const int s34 = SRC(3) + SRC(4);\ 3694 const int s34 = SRC(3) + SRC(4);\
3990 } 3990 }
3991 3991
3992 WRAPPER8_16_SQ(hadamard8_diff8x8_c, hadamard8_diff16_c) 3992 WRAPPER8_16_SQ(hadamard8_diff8x8_c, hadamard8_diff16_c)
3993 WRAPPER8_16_SQ(hadamard8_intra8x8_c, hadamard8_intra16_c) 3993 WRAPPER8_16_SQ(hadamard8_intra8x8_c, hadamard8_intra16_c)
3994 WRAPPER8_16_SQ(dct_sad8x8_c, dct_sad16_c) 3994 WRAPPER8_16_SQ(dct_sad8x8_c, dct_sad16_c)
3995 #ifdef CONFIG_GPL 3995 #if CONFIG_GPL
3996 WRAPPER8_16_SQ(dct264_sad8x8_c, dct264_sad16_c) 3996 WRAPPER8_16_SQ(dct264_sad8x8_c, dct264_sad16_c)
3997 #endif 3997 #endif
3998 WRAPPER8_16_SQ(dct_max8x8_c, dct_max16_c) 3998 WRAPPER8_16_SQ(dct_max8x8_c, dct_max16_c)
3999 WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c) 3999 WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c)
4000 WRAPPER8_16_SQ(rd8x8_c, rd16_c) 4000 WRAPPER8_16_SQ(rd8x8_c, rd16_c)
4247 static int did_fail=0; 4247 static int did_fail=0;
4248 DECLARE_ALIGNED_16(int, aligned); 4248 DECLARE_ALIGNED_16(int, aligned);
4249 4249
4250 if((long)&aligned & 15){ 4250 if((long)&aligned & 15){
4251 if(!did_fail){ 4251 if(!did_fail){
4252 #if defined(HAVE_MMX) || defined(HAVE_ALTIVEC) 4252 #if HAVE_MMX || HAVE_ALTIVEC
4253 av_log(NULL, AV_LOG_ERROR, 4253 av_log(NULL, AV_LOG_ERROR,
4254 "Compiler did not align stack variables. Libavcodec has been miscompiled\n" 4254 "Compiler did not align stack variables. Libavcodec has been miscompiled\n"
4255 "and may be very slow or crash. This is not a bug in libavcodec,\n" 4255 "and may be very slow or crash. This is not a bug in libavcodec,\n"
4256 "but in the compiler. You may try recompiling using gcc >= 4.2.\n" 4256 "but in the compiler. You may try recompiling using gcc >= 4.2.\n"
4257 "Do not report crashes to FFmpeg developers.\n"); 4257 "Do not report crashes to FFmpeg developers.\n");
4267 { 4267 {
4268 int i; 4268 int i;
4269 4269
4270 ff_check_alignment(); 4270 ff_check_alignment();
4271 4271
4272 #ifdef CONFIG_ENCODERS 4272 #if CONFIG_ENCODERS
4273 if(avctx->dct_algo==FF_DCT_FASTINT) { 4273 if(avctx->dct_algo==FF_DCT_FASTINT) {
4274 c->fdct = fdct_ifast; 4274 c->fdct = fdct_ifast;
4275 c->fdct248 = fdct_ifast248; 4275 c->fdct248 = fdct_ifast248;
4276 } 4276 }
4277 else if(avctx->dct_algo==FF_DCT_FAAN) { 4277 else if(avctx->dct_algo==FF_DCT_FAAN) {
4485 c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c; 4485 c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c;
4486 c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c; 4486 c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c;
4487 4487
4488 c->draw_edges = draw_edges_c; 4488 c->draw_edges = draw_edges_c;
4489 4489
4490 #ifdef CONFIG_CAVS_DECODER 4490 #if CONFIG_CAVS_DECODER
4491 ff_cavsdsp_init(c,avctx); 4491 ff_cavsdsp_init(c,avctx);
4492 #endif 4492 #endif
4493 #if defined(CONFIG_VC1_DECODER) || defined(CONFIG_WMV3_DECODER) 4493 #if CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER
4494 ff_vc1dsp_init(c,avctx); 4494 ff_vc1dsp_init(c,avctx);
4495 #endif 4495 #endif
4496 #if defined(CONFIG_WMV2_DECODER) || defined(CONFIG_VC1_DECODER) || defined(CONFIG_WMV3_DECODER) 4496 #if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER || CONFIG_WMV3_DECODER
4497 ff_intrax8dsp_init(c,avctx); 4497 ff_intrax8dsp_init(c,avctx);
4498 #endif 4498 #endif
4499 #if defined(CONFIG_H264_ENCODER) 4499 #if CONFIG_H264_ENCODER
4500 ff_h264dspenc_init(c,avctx); 4500 ff_h264dspenc_init(c,avctx);
4501 #endif 4501 #endif
4502 #if defined(CONFIG_RV30_DECODER) 4502 #if CONFIG_RV30_DECODER
4503 ff_rv30dsp_init(c,avctx); 4503 ff_rv30dsp_init(c,avctx);
4504 #endif 4504 #endif
4505 #if defined(CONFIG_RV40_DECODER) 4505 #if CONFIG_RV40_DECODER
4506 ff_rv40dsp_init(c,avctx); 4506 ff_rv40dsp_init(c,avctx);
4507 c->put_rv40_qpel_pixels_tab[0][15] = put_rv40_qpel16_mc33_c; 4507 c->put_rv40_qpel_pixels_tab[0][15] = put_rv40_qpel16_mc33_c;
4508 c->avg_rv40_qpel_pixels_tab[0][15] = avg_rv40_qpel16_mc33_c; 4508 c->avg_rv40_qpel_pixels_tab[0][15] = avg_rv40_qpel16_mc33_c;
4509 c->put_rv40_qpel_pixels_tab[1][15] = put_rv40_qpel8_mc33_c; 4509 c->put_rv40_qpel_pixels_tab[1][15] = put_rv40_qpel8_mc33_c;
4510 c->avg_rv40_qpel_pixels_tab[1][15] = avg_rv40_qpel8_mc33_c; 4510 c->avg_rv40_qpel_pixels_tab[1][15] = avg_rv40_qpel8_mc33_c;
4525 4525
4526 SET_CMP_FUNC(hadamard8_diff) 4526 SET_CMP_FUNC(hadamard8_diff)
4527 c->hadamard8_diff[4]= hadamard8_intra16_c; 4527 c->hadamard8_diff[4]= hadamard8_intra16_c;
4528 SET_CMP_FUNC(dct_sad) 4528 SET_CMP_FUNC(dct_sad)
4529 SET_CMP_FUNC(dct_max) 4529 SET_CMP_FUNC(dct_max)
4530 #ifdef CONFIG_GPL 4530 #if CONFIG_GPL
4531 SET_CMP_FUNC(dct264_sad) 4531 SET_CMP_FUNC(dct264_sad)
4532 #endif 4532 #endif
4533 c->sad[0]= pix_abs16_c; 4533 c->sad[0]= pix_abs16_c;
4534 c->sad[1]= pix_abs8_c; 4534 c->sad[1]= pix_abs8_c;
4535 c->sse[0]= sse16_c; 4535 c->sse[0]= sse16_c;
4542 c->vsad[4]= vsad_intra16_c; 4542 c->vsad[4]= vsad_intra16_c;
4543 c->vsse[0]= vsse16_c; 4543 c->vsse[0]= vsse16_c;
4544 c->vsse[4]= vsse_intra16_c; 4544 c->vsse[4]= vsse_intra16_c;
4545 c->nsse[0]= nsse16_c; 4545 c->nsse[0]= nsse16_c;
4546 c->nsse[1]= nsse8_c; 4546 c->nsse[1]= nsse8_c;
4547 #ifdef CONFIG_SNOW_ENCODER 4547 #if CONFIG_SNOW_ENCODER
4548 c->w53[0]= w53_16_c; 4548 c->w53[0]= w53_16_c;
4549 c->w53[1]= w53_8_c; 4549 c->w53[1]= w53_8_c;
4550 c->w97[0]= w97_16_c; 4550 c->w97[0]= w97_16_c;
4551 c->w97[1]= w97_8_c; 4551 c->w97[1]= w97_8_c;
4552 #endif 4552 #endif
4556 c->add_bytes= add_bytes_c; 4556 c->add_bytes= add_bytes_c;
4557 c->add_bytes_l2= add_bytes_l2_c; 4557 c->add_bytes_l2= add_bytes_l2_c;
4558 c->diff_bytes= diff_bytes_c; 4558 c->diff_bytes= diff_bytes_c;
4559 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; 4559 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;
4560 c->bswap_buf= bswap_buf; 4560 c->bswap_buf= bswap_buf;
4561 #ifdef CONFIG_PNG_DECODER 4561 #if CONFIG_PNG_DECODER
4562 c->add_png_paeth_prediction= ff_add_png_paeth_prediction; 4562 c->add_png_paeth_prediction= ff_add_png_paeth_prediction;
4563 #endif 4563 #endif
4564 4564
4565 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c; 4565 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c;
4566 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c; 4566 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c;
4585 c->h261_loop_filter= h261_loop_filter_c; 4585 c->h261_loop_filter= h261_loop_filter_c;
4586 4586
4587 c->try_8x8basis= try_8x8basis_c; 4587 c->try_8x8basis= try_8x8basis_c;
4588 c->add_8x8basis= add_8x8basis_c; 4588 c->add_8x8basis= add_8x8basis_c;
4589 4589
4590 #ifdef CONFIG_SNOW_DECODER 4590 #if CONFIG_SNOW_DECODER
4591 c->vertical_compose97i = ff_snow_vertical_compose97i; 4591 c->vertical_compose97i = ff_snow_vertical_compose97i;
4592 c->horizontal_compose97i = ff_snow_horizontal_compose97i; 4592 c->horizontal_compose97i = ff_snow_horizontal_compose97i;
4593 c->inner_add_yblock = ff_snow_inner_add_yblock; 4593 c->inner_add_yblock = ff_snow_inner_add_yblock;
4594 #endif 4594 #endif
4595 4595
4596 #ifdef CONFIG_VORBIS_DECODER 4596 #if CONFIG_VORBIS_DECODER
4597 c->vorbis_inverse_coupling = vorbis_inverse_coupling; 4597 c->vorbis_inverse_coupling = vorbis_inverse_coupling;
4598 #endif 4598 #endif
4599 #ifdef CONFIG_AC3_DECODER 4599 #if CONFIG_AC3_DECODER
4600 c->ac3_downmix = ff_ac3_downmix_c; 4600 c->ac3_downmix = ff_ac3_downmix_c;
4601 #endif 4601 #endif
4602 #ifdef CONFIG_FLAC_ENCODER 4602 #if CONFIG_FLAC_ENCODER
4603 c->flac_compute_autocorr = ff_flac_compute_autocorr; 4603 c->flac_compute_autocorr = ff_flac_compute_autocorr;
4604 #endif 4604 #endif
4605 c->vector_fmul = vector_fmul_c; 4605 c->vector_fmul = vector_fmul_c;
4606 c->vector_fmul_reverse = vector_fmul_reverse_c; 4606 c->vector_fmul_reverse = vector_fmul_reverse_c;
4607 c->vector_fmul_add_add = ff_vector_fmul_add_add_c; 4607 c->vector_fmul_add_add = ff_vector_fmul_add_add_c;