comparison h264.c @ 2748:135aa7d0bd17 libavcodec

avoid one transpose (730->680 dezicycles on duron)
author michael
date Wed, 01 Jun 2005 08:43:40 +0000
parents 4e71804a0c92
children 3247049dfc7a
comparison
equal deleted inserted replaced
2747:6eded34ab57b 2748:135aa7d0bd17
331 int16_t (*mvd_table[2])[2]; 331 int16_t (*mvd_table[2])[2];
332 int16_t mvd_cache[2][5*8][2] __align8; 332 int16_t mvd_cache[2][5*8][2] __align8;
333 uint8_t *direct_table; 333 uint8_t *direct_table;
334 uint8_t direct_cache[5*8]; 334 uint8_t direct_cache[5*8];
335 335
336 uint8_t zigzag_scan[16];
337 uint8_t field_scan[16];
336 }H264Context; 338 }H264Context;
337 339
338 static VLC coeff_token_vlc[4]; 340 static VLC coeff_token_vlc[4];
339 static VLC chroma_dc_coeff_token_vlc; 341 static VLC chroma_dc_coeff_token_vlc;
340 342
2719 // set defaults 2721 // set defaults
2720 // s->decode_mb= ff_h263_decode_mb; 2722 // s->decode_mb= ff_h263_decode_mb;
2721 s->low_delay= 1; 2723 s->low_delay= 1;
2722 avctx->pix_fmt= PIX_FMT_YUV420P; 2724 avctx->pix_fmt= PIX_FMT_YUV420P;
2723 2725
2726 if(s->dsp.h264_idct_add == ff_h264_idct_add_c){ //FIXME little ugly
2727 memcpy(h->zigzag_scan, zigzag_scan, 16*sizeof(uint8_t));
2728 memcpy(h-> field_scan, field_scan, 16*sizeof(uint8_t));
2729 }else{
2730 int i;
2731 for(i=0; i<16; i++){
2732 #define T(x) (x>>2) | ((x<<2) & 0xF)
2733 h->zigzag_scan[i] = T(zigzag_scan[i]);
2734 h-> field_scan[i] = T( field_scan[i]);
2735 }
2736 }
2737
2724 decode_init_vlc(h); 2738 decode_init_vlc(h);
2725 2739
2726 if(avctx->extradata_size > 0 && avctx->extradata && 2740 if(avctx->extradata_size > 0 && avctx->extradata &&
2727 *(char *)avctx->extradata == 1){ 2741 *(char *)avctx->extradata == 1){
2728 h->is_avc = 1; 2742 h->is_avc = 1;
4589 const uint8_t *scan, *dc_scan; 4603 const uint8_t *scan, *dc_scan;
4590 4604
4591 // fill_non_zero_count_cache(h); 4605 // fill_non_zero_count_cache(h);
4592 4606
4593 if(IS_INTERLACED(mb_type)){ 4607 if(IS_INTERLACED(mb_type)){
4594 scan= field_scan; 4608 scan= h->field_scan;
4595 dc_scan= luma_dc_field_scan; 4609 dc_scan= luma_dc_field_scan;
4596 }else{ 4610 }else{
4597 scan= zigzag_scan; 4611 scan= h->zigzag_scan;
4598 dc_scan= luma_dc_zigzag_scan; 4612 dc_scan= luma_dc_zigzag_scan;
4599 } 4613 }
4600 4614
4601 dquant= get_se_golomb(&s->gb); 4615 dquant= get_se_golomb(&s->gb);
4602 4616
5573 if( cbp || IS_INTRA16x16( mb_type ) ) { 5587 if( cbp || IS_INTRA16x16( mb_type ) ) {
5574 const uint8_t *scan, *dc_scan; 5588 const uint8_t *scan, *dc_scan;
5575 int dqp; 5589 int dqp;
5576 5590
5577 if(IS_INTERLACED(mb_type)){ 5591 if(IS_INTERLACED(mb_type)){
5578 scan= field_scan; 5592 scan= h->field_scan;
5579 dc_scan= luma_dc_field_scan; 5593 dc_scan= luma_dc_field_scan;
5580 }else{ 5594 }else{
5581 scan= zigzag_scan; 5595 scan= h->zigzag_scan;
5582 dc_scan= luma_dc_zigzag_scan; 5596 dc_scan= luma_dc_zigzag_scan;
5583 } 5597 }
5584 5598
5585 h->last_qscale_diff = dqp = decode_cabac_mb_dqp( h ); 5599 h->last_qscale_diff = dqp = decode_cabac_mb_dqp( h );
5586 s->qscale += dqp; 5600 s->qscale += dqp;