comparison h264.c @ 5127:4dbe6578f811 libavcodec

misc spelling fixes
author diego
date Tue, 12 Jun 2007 09:29:25 +0000
parents ddb5abe164f3
children 0244bba24b43
comparison
equal deleted inserted replaced
5126:7982b376b58a 5127:4dbe6578f811
1600 static inline int get_chroma_qp(int chroma_qp_index_offset, int qscale){ 1600 static inline int get_chroma_qp(int chroma_qp_index_offset, int qscale){
1601 1601
1602 return chroma_qp[av_clip(qscale + chroma_qp_index_offset, 0, 51)]; 1602 return chroma_qp[av_clip(qscale + chroma_qp_index_offset, 0, 51)];
1603 } 1603 }
1604 1604
1605 //FIXME need to check that this doesnt overflow signed 32 bit for low qp, i am not sure, it's very close 1605 //FIXME need to check that this does not overflow signed 32 bit for low qp, i am not sure, it's very close
1606 //FIXME check that gcc inlines this (and optimizes intra & separate_dc stuff away) 1606 //FIXME check that gcc inlines this (and optimizes intra & separate_dc stuff away)
1607 static inline int quantize_c(DCTELEM *block, uint8_t *scantable, int qscale, int intra, int separate_dc){ 1607 static inline int quantize_c(DCTELEM *block, uint8_t *scantable, int qscale, int intra, int separate_dc){
1608 int i; 1608 int i;
1609 const int * const quant_table= quant_coeff[qscale]; 1609 const int * const quant_table= quant_coeff[qscale];
1610 const int bias= intra ? (1<<QUANT_SHIFT)/3 : (1<<QUANT_SHIFT)/6; 1610 const int bias= intra ? (1<<QUANT_SHIFT)/3 : (1<<QUANT_SHIFT)/6;
4814 h->slice_table[ mb_xy ]= h->slice_num; 4814 h->slice_table[ mb_xy ]= h->slice_num;
4815 4815
4816 if(IS_INTRA_PCM(mb_type)){ 4816 if(IS_INTRA_PCM(mb_type)){
4817 unsigned int x, y; 4817 unsigned int x, y;
4818 4818
4819 // we assume these blocks are very rare so we dont optimize it 4819 // We assume these blocks are very rare so we do not optimize it.
4820 align_get_bits(&s->gb); 4820 align_get_bits(&s->gb);
4821 4821
4822 // The pixels are stored in the same order as levels in h->mb array. 4822 // The pixels are stored in the same order as levels in h->mb array.
4823 for(y=0; y<16; y++){ 4823 for(y=0; y<16; y++){
4824 const int index= 4*(y&3) + 32*((y>>2)&1) + 128*(y>>3); 4824 const int index= 4*(y&3) + 32*((y>>2)&1) + 128*(y>>3);
5955 5955
5956 if(IS_INTRA_PCM(mb_type)) { 5956 if(IS_INTRA_PCM(mb_type)) {
5957 const uint8_t *ptr; 5957 const uint8_t *ptr;
5958 unsigned int x, y; 5958 unsigned int x, y;
5959 5959
5960 // We assume these blocks are very rare so we dont optimize it. 5960 // We assume these blocks are very rare so we do not optimize it.
5961 // FIXME The two following lines get the bitstream position in the cabac 5961 // FIXME The two following lines get the bitstream position in the cabac
5962 // decode, I think it should be done by a function in cabac.h (or cabac.c). 5962 // decode, I think it should be done by a function in cabac.h (or cabac.c).
5963 ptr= h->cabac.bytestream; 5963 ptr= h->cabac.bytestream;
5964 if(h->cabac.low&0x1) ptr--; 5964 if(h->cabac.low&0x1) ptr--;
5965 if(CABAC_BITS==16){ 5965 if(CABAC_BITS==16){
7719 if (h->is_avc && (nalsize != consumed)) 7719 if (h->is_avc && (nalsize != consumed))
7720 av_log(h->s.avctx, AV_LOG_ERROR, "AVC: Consumed only %d bytes instead of %d\n", consumed, nalsize); 7720 av_log(h->s.avctx, AV_LOG_ERROR, "AVC: Consumed only %d bytes instead of %d\n", consumed, nalsize);
7721 7721
7722 buf_index += consumed; 7722 buf_index += consumed;
7723 7723
7724 if( (s->hurry_up == 1 && h->nal_ref_idc == 0) //FIXME dont discard SEI id 7724 if( (s->hurry_up == 1 && h->nal_ref_idc == 0) //FIXME do not discard SEI id
7725 ||(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0)) 7725 ||(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0))
7726 continue; 7726 continue;
7727 7727
7728 switch(h->nal_unit_type){ 7728 switch(h->nal_unit_type){
7729 case NAL_IDR_SLICE: 7729 case NAL_IDR_SLICE:
7816 pos -= s->parse_context.last_index; 7816 pos -= s->parse_context.last_index;
7817 if(pos<0) pos=0; // FIXME remove (unneeded?) 7817 if(pos<0) pos=0; // FIXME remove (unneeded?)
7818 7818
7819 return pos; 7819 return pos;
7820 }else{ 7820 }else{
7821 if(pos==0) pos=1; //avoid infinite loops (i doubt thats needed but ...) 7821 if(pos==0) pos=1; //avoid infinite loops (i doubt that is needed but ...)
7822 if(pos+10>buf_size) pos=buf_size; // oops ;) 7822 if(pos+10>buf_size) pos=buf_size; // oops ;)
7823 7823
7824 return pos; 7824 return pos;
7825 } 7825 }
7826 } 7826 }
8082 s= show_bits(&gb, 24); 8082 s= show_bits(&gb, 24);
8083 8083
8084 START_TIMER 8084 START_TIMER
8085 j= get_ue_golomb(&gb); 8085 j= get_ue_golomb(&gb);
8086 if(j != i){ 8086 if(j != i){
8087 printf("missmatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s); 8087 printf("mismatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s);
8088 // return -1; 8088 // return -1;
8089 } 8089 }
8090 STOP_TIMER("get_ue_golomb"); 8090 STOP_TIMER("get_ue_golomb");
8091 } 8091 }
8092 8092
8107 s= show_bits(&gb, 24); 8107 s= show_bits(&gb, 24);
8108 8108
8109 START_TIMER 8109 START_TIMER
8110 j= get_se_golomb(&gb); 8110 j= get_se_golomb(&gb);
8111 if(j != i - COUNT/2){ 8111 if(j != i - COUNT/2){
8112 printf("missmatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s); 8112 printf("mismatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s);
8113 // return -1; 8113 // return -1;
8114 } 8114 }
8115 STOP_TIMER("get_se_golomb"); 8115 STOP_TIMER("get_se_golomb");
8116 } 8116 }
8117 8117
8211 printf("incorrect consumed length %d %d\n", nal_length, consumed); 8211 printf("incorrect consumed length %d %d\n", nal_length, consumed);
8212 return -1; 8212 return -1;
8213 } 8213 }
8214 8214
8215 if(memcmp(bitstream, out, COUNT)){ 8215 if(memcmp(bitstream, out, COUNT)){
8216 printf("missmatch\n"); 8216 printf("mismatch\n");
8217 return -1; 8217 return -1;
8218 } 8218 }
8219 } 8219 }
8220 8220
8221 printf("Testing RBSP\n"); 8221 printf("Testing RBSP\n");