Mercurial > libavcodec.hg
changeset 8042:e70975d5ff80 libavcodec
uses FF_ARRAY_ELEMS() where appropriate
author | aurel |
---|---|
date | Tue, 21 Oct 2008 21:40:24 +0000 |
parents | 24761747ac3d |
children | a591c3736fd8 |
files | aac.c dnxhddata.c dvdata.h h263.c h264.c imgresample.c mimic.c mpegaudiodec.c utils.c vorbis_enc.c |
diffstat | 10 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/aac.c Mon Oct 20 16:05:29 2008 +0000 +++ b/aac.c Tue Oct 21 21:40:24 2008 +0000 @@ -403,7 +403,7 @@ ff_aac_pow2sf_tab[i] = pow(2, (i - 200)/4.); #endif /* CONFIG_HARDCODED_TABLES */ - INIT_VLC_STATIC(&vlc_scalefactors, 7, sizeof(ff_aac_scalefactor_code)/sizeof(ff_aac_scalefactor_code[0]), + INIT_VLC_STATIC(&vlc_scalefactors,7,FF_ARRAY_ELEMS(ff_aac_scalefactor_code), ff_aac_scalefactor_bits, sizeof(ff_aac_scalefactor_bits[0]), sizeof(ff_aac_scalefactor_bits[0]), ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]), 352);
--- a/dnxhddata.c Mon Oct 20 16:05:29 2008 +0000 +++ b/dnxhddata.c Tue Oct 21 21:40:24 2008 +0000 @@ -418,7 +418,7 @@ int ff_dnxhd_get_cid_table(int cid) { int i; - for (i = 0; i < sizeof(ff_dnxhd_cid_table)/sizeof(CIDEntry); i++) + for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) if (ff_dnxhd_cid_table[i].cid == cid) return i; return -1; @@ -430,7 +430,7 @@ int mbs = avctx->bit_rate/1000000; if (!mbs) return 0; - for (i = 0; i < sizeof(ff_dnxhd_cid_table)/sizeof(CIDEntry); i++) { + for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) { const CIDEntry *cid = &ff_dnxhd_cid_table[i]; if (cid->width == avctx->width && cid->height == avctx->height && cid->interlaced == !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT) &&
--- a/dvdata.h Mon Oct 20 16:05:29 2008 +0000 +++ b/dvdata.h Tue Oct 21 21:40:24 2008 +0000 @@ -6386,7 +6386,7 @@ return &dv_profiles[2]; } - for (i=0; i<sizeof(dv_profiles)/sizeof(DVprofile); i++) + for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++) if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype) return &dv_profiles[i]; @@ -6397,7 +6397,7 @@ { int i; - for (i=0; i<sizeof(dv_profiles)/sizeof(DVprofile); i++) + for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++) if (codec->height == dv_profiles[i].height && codec->pix_fmt == dv_profiles[i].pix_fmt && codec->width == dv_profiles[i].width) return &dv_profiles[i];
--- a/h263.c Mon Oct 20 16:05:29 2008 +0000 +++ b/h263.c Tue Oct 21 21:40:24 2008 +0000 @@ -587,7 +587,7 @@ #endif //CONFIG_ENCODERS -#define tab_size ((signed)(sizeof(s->direct_scale_mv[0])/sizeof(int16_t))) +#define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0])) #define tab_bias (tab_size/2) void ff_mpeg4_init_direct_mv(MpegEncContext *s){
--- a/h264.c Mon Oct 20 16:05:29 2008 +0000 +++ b/h264.c Tue Oct 21 21:40:24 2008 +0000 @@ -1979,7 +1979,7 @@ * the packed static coeff_token_vlc table sizes * were initialized correctly. */ - assert(offset == sizeof(coeff_token_vlc_tables)/(sizeof(VLC_TYPE)*2)); + assert(offset == FF_ARRAY_ELEMS(coeff_token_vlc_tables)); for(i=0; i<3; i++){ chroma_dc_total_zeros_vlc[i].table = chroma_dc_total_zeros_vlc_tables[i]; @@ -6888,7 +6888,7 @@ if( aspect_ratio_idc == EXTENDED_SAR ) { sps->sar.num= get_bits(&s->gb, 16); sps->sar.den= get_bits(&s->gb, 16); - }else if(aspect_ratio_idc < sizeof(pixel_aspect)/sizeof(*pixel_aspect)){ + }else if(aspect_ratio_idc < FF_ARRAY_ELEMS(pixel_aspect)){ sps->sar= pixel_aspect[aspect_ratio_idc]; }else{ av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n"); @@ -7072,7 +7072,7 @@ sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb); tmp= get_ue_golomb(&s->gb); - if(tmp >= sizeof(sps->offset_for_ref_frame) / sizeof(sps->offset_for_ref_frame[0])){ + if(tmp >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)){ av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", tmp); return -1; }
--- a/imgresample.c Mon Oct 20 16:05:29 2008 +0000 +++ b/imgresample.c Tue Oct 21 21:40:24 2008 +0000 @@ -790,7 +790,7 @@ } } save_pgm("/tmp/in.pgm", img, XSIZE, YSIZE); - for(i=0;i<sizeof(factors)/sizeof(float);i++) { + for(i=0;i<FF_ARRAY_ELEMS(factors);i++) { fact = factors[i]; xsize = (int)(XSIZE * fact); ysize = (int)((YSIZE - 100) * fact);
--- a/mimic.c Mon Oct 20 16:05:29 2008 +0000 +++ b/mimic.c Tue Oct 21 21:40:24 2008 +0000 @@ -110,7 +110,7 @@ ctx->prev_index = 0; ctx->cur_index = 15; - if(init_vlc(&ctx->vlc, 11, sizeof(huffbits)/sizeof(huffbits[0]), + if(init_vlc(&ctx->vlc, 11, FF_ARRAY_ELEMS(huffbits), huffbits, 1, 1, huffcodes, 4, 4, 0)) { av_log(avctx, AV_LOG_ERROR, "error initializing vlc table\n"); return -1;
--- a/mpegaudiodec.c Mon Oct 20 16:05:29 2008 +0000 +++ b/mpegaudiodec.c Tue Oct 21 21:40:24 2008 +0000 @@ -394,7 +394,7 @@ INIT_VLC_USE_NEW_STATIC); offset += huff_vlc_tables_sizes[i]; } - assert(offset == sizeof(huff_vlc_tables)/(sizeof(VLC_TYPE)*2)); + assert(offset == FF_ARRAY_ELEMS(huff_vlc_tables)); offset = 0; for(i=0;i<2;i++) { @@ -405,7 +405,7 @@ INIT_VLC_USE_NEW_STATIC); offset += huff_quad_vlc_tables_sizes[i]; } - assert(offset == sizeof(huff_quad_vlc_tables)/(sizeof(VLC_TYPE)*2)); + assert(offset == FF_ARRAY_ELEMS(huff_quad_vlc_tables)); for(i=0;i<9;i++) { k = 0;
--- a/utils.c Mon Oct 20 16:05:29 2008 +0000 +++ b/utils.c Tue Oct 21 21:40:24 2008 +0000 @@ -1455,7 +1455,7 @@ int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str) { int i; - int n = sizeof(video_frame_size_abbrs) / sizeof(VideoFrameSizeAbbr); + int n = FF_ARRAY_ELEMS(video_frame_size_abbrs); const char *p; int frame_width = 0, frame_height = 0; @@ -1483,7 +1483,7 @@ int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg) { int i; - int n = sizeof(video_frame_rate_abbrs) / sizeof(VideoFrameRateAbbr); + int n = FF_ARRAY_ELEMS(video_frame_rate_abbrs); char* cp; /* First, we check our abbreviation table */
--- a/vorbis_enc.c Mon Oct 20 16:05:29 2008 +0000 +++ b/vorbis_enc.c Tue Oct 21 21:40:24 2008 +0000 @@ -213,7 +213,7 @@ venc->sample_rate = avccontext->sample_rate; venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11; - venc->ncodebooks = sizeof(cvectors)/sizeof(cvectors[0]); + venc->ncodebooks = FF_ARRAY_ELEMS(cvectors); venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks); // codebook 0..14 - floor1 book, values 0..255