comparison h264.c @ 8042:e70975d5ff80 libavcodec

uses FF_ARRAY_ELEMS() where appropriate
author aurel
date Tue, 21 Oct 2008 21:40:24 +0000
parents 2dfff0e25b47
children 2d3c7cd7d143
comparison
equal deleted inserted replaced
8041:24761747ac3d 8042:e70975d5ff80
1977 /* 1977 /*
1978 * This is a one time safety check to make sure that 1978 * This is a one time safety check to make sure that
1979 * the packed static coeff_token_vlc table sizes 1979 * the packed static coeff_token_vlc table sizes
1980 * were initialized correctly. 1980 * were initialized correctly.
1981 */ 1981 */
1982 assert(offset == sizeof(coeff_token_vlc_tables)/(sizeof(VLC_TYPE)*2)); 1982 assert(offset == FF_ARRAY_ELEMS(coeff_token_vlc_tables));
1983 1983
1984 for(i=0; i<3; i++){ 1984 for(i=0; i<3; i++){
1985 chroma_dc_total_zeros_vlc[i].table = chroma_dc_total_zeros_vlc_tables[i]; 1985 chroma_dc_total_zeros_vlc[i].table = chroma_dc_total_zeros_vlc_tables[i];
1986 chroma_dc_total_zeros_vlc[i].table_allocated = chroma_dc_total_zeros_vlc_tables_size; 1986 chroma_dc_total_zeros_vlc[i].table_allocated = chroma_dc_total_zeros_vlc_tables_size;
1987 init_vlc(&chroma_dc_total_zeros_vlc[i], 1987 init_vlc(&chroma_dc_total_zeros_vlc[i],
6886 if( aspect_ratio_info_present_flag ) { 6886 if( aspect_ratio_info_present_flag ) {
6887 aspect_ratio_idc= get_bits(&s->gb, 8); 6887 aspect_ratio_idc= get_bits(&s->gb, 8);
6888 if( aspect_ratio_idc == EXTENDED_SAR ) { 6888 if( aspect_ratio_idc == EXTENDED_SAR ) {
6889 sps->sar.num= get_bits(&s->gb, 16); 6889 sps->sar.num= get_bits(&s->gb, 16);
6890 sps->sar.den= get_bits(&s->gb, 16); 6890 sps->sar.den= get_bits(&s->gb, 16);
6891 }else if(aspect_ratio_idc < sizeof(pixel_aspect)/sizeof(*pixel_aspect)){ 6891 }else if(aspect_ratio_idc < FF_ARRAY_ELEMS(pixel_aspect)){
6892 sps->sar= pixel_aspect[aspect_ratio_idc]; 6892 sps->sar= pixel_aspect[aspect_ratio_idc];
6893 }else{ 6893 }else{
6894 av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n"); 6894 av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
6895 return -1; 6895 return -1;
6896 } 6896 }
7070 sps->delta_pic_order_always_zero_flag= get_bits1(&s->gb); 7070 sps->delta_pic_order_always_zero_flag= get_bits1(&s->gb);
7071 sps->offset_for_non_ref_pic= get_se_golomb(&s->gb); 7071 sps->offset_for_non_ref_pic= get_se_golomb(&s->gb);
7072 sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb); 7072 sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb);
7073 tmp= get_ue_golomb(&s->gb); 7073 tmp= get_ue_golomb(&s->gb);
7074 7074
7075 if(tmp >= sizeof(sps->offset_for_ref_frame) / sizeof(sps->offset_for_ref_frame[0])){ 7075 if(tmp >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)){
7076 av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", tmp); 7076 av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", tmp);
7077 return -1; 7077 return -1;
7078 } 7078 }
7079 sps->poc_cycle_length= tmp; 7079 sps->poc_cycle_length= tmp;
7080 7080