comparison dsputil.c @ 1784:65f7bd09f37b libavcodec

quantizer noise shaping optimization
author michael
date Fri, 06 Feb 2004 02:12:37 +0000
parents 07a484280a82
children 9a73e6dc5d68
comparison
equal deleted inserted replaced
1783:66ae3c109d90 1784:65f7bd09f37b
2530 pix3 += line_size; 2530 pix3 += line_size;
2531 } 2531 }
2532 return s; 2532 return s;
2533 } 2533 }
2534 2534
2535 static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){
2536 int i;
2537 unsigned int sum=0;
2538
2539 for(i=0; i<8*8; i++){
2540 int b= rem[i] + ((basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT));
2541 int w= weight[i];
2542 b>>= RECON_SHIFT;
2543 assert(-512<b && b<512);
2544
2545 sum += (w*b)*(w*b)>>4;
2546 }
2547 return sum>>2;
2548 }
2549
2550 static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){
2551 int i;
2552
2553 for(i=0; i<8*8; i++){
2554 rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT);
2555 }
2556 }
2557
2535 /** 2558 /**
2536 * permutes an 8x8 block. 2559 * permutes an 8x8 block.
2537 * @param block the block which will be permuted according to the given permutation vector 2560 * @param block the block which will be permuted according to the given permutation vector
2538 * @param permutation the permutation vector 2561 * @param permutation the permutation vector
2539 * @param last the last non zero coefficient in scantable order, used to speed the permutation up 2562 * @param last the last non zero coefficient in scantable order, used to speed the permutation up
3233 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; 3256 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;
3234 c->bswap_buf= bswap_buf; 3257 c->bswap_buf= bswap_buf;
3235 3258
3236 c->h263_h_loop_filter= h263_h_loop_filter_c; 3259 c->h263_h_loop_filter= h263_h_loop_filter_c;
3237 c->h263_v_loop_filter= h263_v_loop_filter_c; 3260 c->h263_v_loop_filter= h263_v_loop_filter_c;
3261
3262 c->try_8x8basis= try_8x8basis_c;
3263 c->add_8x8basis= add_8x8basis_c;
3238 3264
3239 #ifdef HAVE_MMX 3265 #ifdef HAVE_MMX
3240 dsputil_init_mmx(c, avctx); 3266 dsputil_init_mmx(c, avctx);
3241 #endif 3267 #endif
3242 #ifdef ARCH_ARMV4L 3268 #ifdef ARCH_ARMV4L