Originally committed as revision 15662 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -1091,7 +1091,7 @@ static void print_report(AVFormatContext **output_files, |
| 1091 | 1091 |
if(qp_hist){
|
| 1092 | 1092 |
int j; |
| 1093 | 1093 |
int qp= lrintf(enc->coded_frame->quality/(float)FF_QP2LAMBDA); |
| 1094 |
- if(qp>=0 && qp<sizeof(qp_histogram)/sizeof(int)) |
|
| 1094 |
+ if(qp>=0 && qp<FF_ARRAY_ELEMS(qp_histogram)) |
|
| 1095 | 1095 |
qp_histogram[qp]++; |
| 1096 | 1096 |
for(j=0; j<32; j++) |
| 1097 | 1097 |
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log(qp_histogram[j]+1)/log(2))); |
| ... | ... |
@@ -1341,7 +1341,7 @@ static int http_parse_request(HTTPContext *c) |
| 1341 | 1341 |
/* If this is WMP, get the rate information */ |
| 1342 | 1342 |
if (extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
|
| 1343 | 1343 |
if (modify_current_stream(c, ratebuf)) {
|
| 1344 |
- for (i = 0; i < sizeof(c->feed_streams) / sizeof(c->feed_streams[0]); i++) {
|
|
| 1344 |
+ for (i = 0; i < FF_ARRAY_ELEMS(c->feed_streams); i++) {
|
|
| 1345 | 1345 |
if (c->switch_feed_streams[i] >= 0) |
| 1346 | 1346 |
do_switch_stream(c, i); |
| 1347 | 1347 |
} |
| ... | ... |
@@ -403,7 +403,7 @@ static av_cold int aac_decode_init(AVCodecContext * avccontext) {
|
| 403 | 403 |
ff_aac_pow2sf_tab[i] = pow(2, (i - 200)/4.); |
| 404 | 404 |
#endif /* CONFIG_HARDCODED_TABLES */ |
| 405 | 405 |
|
| 406 |
- INIT_VLC_STATIC(&vlc_scalefactors, 7, sizeof(ff_aac_scalefactor_code)/sizeof(ff_aac_scalefactor_code[0]), |
|
| 406 |
+ INIT_VLC_STATIC(&vlc_scalefactors,7,FF_ARRAY_ELEMS(ff_aac_scalefactor_code), |
|
| 407 | 407 |
ff_aac_scalefactor_bits, sizeof(ff_aac_scalefactor_bits[0]), sizeof(ff_aac_scalefactor_bits[0]), |
| 408 | 408 |
ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]), |
| 409 | 409 |
352); |
| ... | ... |
@@ -418,7 +418,7 @@ const CIDEntry ff_dnxhd_cid_table[] = {
|
| 418 | 418 |
int ff_dnxhd_get_cid_table(int cid) |
| 419 | 419 |
{
|
| 420 | 420 |
int i; |
| 421 |
- for (i = 0; i < sizeof(ff_dnxhd_cid_table)/sizeof(CIDEntry); i++) |
|
| 421 |
+ for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) |
|
| 422 | 422 |
if (ff_dnxhd_cid_table[i].cid == cid) |
| 423 | 423 |
return i; |
| 424 | 424 |
return -1; |
| ... | ... |
@@ -430,7 +430,7 @@ int ff_dnxhd_find_cid(AVCodecContext *avctx) |
| 430 | 430 |
int mbs = avctx->bit_rate/1000000; |
| 431 | 431 |
if (!mbs) |
| 432 | 432 |
return 0; |
| 433 |
- for (i = 0; i < sizeof(ff_dnxhd_cid_table)/sizeof(CIDEntry); i++) {
|
|
| 433 |
+ for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
|
|
| 434 | 434 |
const CIDEntry *cid = &ff_dnxhd_cid_table[i]; |
| 435 | 435 |
if (cid->width == avctx->width && cid->height == avctx->height && |
| 436 | 436 |
cid->interlaced == !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT) && |
| ... | ... |
@@ -6386,7 +6386,7 @@ static inline const DVprofile* dv_frame_profile(const uint8_t* frame) |
| 6386 | 6386 |
return &dv_profiles[2]; |
| 6387 | 6387 |
} |
| 6388 | 6388 |
|
| 6389 |
- for (i=0; i<sizeof(dv_profiles)/sizeof(DVprofile); i++) |
|
| 6389 |
+ for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++) |
|
| 6390 | 6390 |
if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype) |
| 6391 | 6391 |
return &dv_profiles[i]; |
| 6392 | 6392 |
|
| ... | ... |
@@ -6397,7 +6397,7 @@ static const DVprofile* dv_codec_profile(AVCodecContext* codec) |
| 6397 | 6397 |
{
|
| 6398 | 6398 |
int i; |
| 6399 | 6399 |
|
| 6400 |
- for (i=0; i<sizeof(dv_profiles)/sizeof(DVprofile); i++) |
|
| 6400 |
+ for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++) |
|
| 6401 | 6401 |
if (codec->height == dv_profiles[i].height && codec->pix_fmt == dv_profiles[i].pix_fmt && |
| 6402 | 6402 |
codec->width == dv_profiles[i].width) |
| 6403 | 6403 |
return &dv_profiles[i]; |
| ... | ... |
@@ -587,7 +587,7 @@ void ff_clean_mpeg4_qscales(MpegEncContext *s){
|
| 587 | 587 |
|
| 588 | 588 |
#endif //CONFIG_ENCODERS |
| 589 | 589 |
|
| 590 |
-#define tab_size ((signed)(sizeof(s->direct_scale_mv[0])/sizeof(int16_t))) |
|
| 590 |
+#define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0])) |
|
| 591 | 591 |
#define tab_bias (tab_size/2) |
| 592 | 592 |
|
| 593 | 593 |
void ff_mpeg4_init_direct_mv(MpegEncContext *s){
|
| ... | ... |
@@ -1979,7 +1979,7 @@ static av_cold void decode_init_vlc(void){
|
| 1979 | 1979 |
* the packed static coeff_token_vlc table sizes |
| 1980 | 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 | 1984 |
for(i=0; i<3; i++){
|
| 1985 | 1985 |
chroma_dc_total_zeros_vlc[i].table = chroma_dc_total_zeros_vlc_tables[i]; |
| ... | ... |
@@ -6888,7 +6888,7 @@ static inline int decode_vui_parameters(H264Context *h, SPS *sps){
|
| 6888 | 6888 |
if( aspect_ratio_idc == EXTENDED_SAR ) {
|
| 6889 | 6889 |
sps->sar.num= get_bits(&s->gb, 16); |
| 6890 | 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 | 6892 |
sps->sar= pixel_aspect[aspect_ratio_idc]; |
| 6893 | 6893 |
}else{
|
| 6894 | 6894 |
av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n"); |
| ... | ... |
@@ -7072,7 +7072,7 @@ static inline int decode_seq_parameter_set(H264Context *h){
|
| 7072 | 7072 |
sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb); |
| 7073 | 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 | 7076 |
av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", tmp); |
| 7077 | 7077 |
return -1; |
| 7078 | 7078 |
} |
| ... | ... |
@@ -790,7 +790,7 @@ int main(int argc, char **argv) |
| 790 | 790 |
} |
| 791 | 791 |
} |
| 792 | 792 |
save_pgm("/tmp/in.pgm", img, XSIZE, YSIZE);
|
| 793 |
- for(i=0;i<sizeof(factors)/sizeof(float);i++) {
|
|
| 793 |
+ for(i=0;i<FF_ARRAY_ELEMS(factors);i++) {
|
|
| 794 | 794 |
fact = factors[i]; |
| 795 | 795 |
xsize = (int)(XSIZE * fact); |
| 796 | 796 |
ysize = (int)((YSIZE - 100) * fact); |
| ... | ... |
@@ -110,7 +110,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx) |
| 110 | 110 |
ctx->prev_index = 0; |
| 111 | 111 |
ctx->cur_index = 15; |
| 112 | 112 |
|
| 113 |
- if(init_vlc(&ctx->vlc, 11, sizeof(huffbits)/sizeof(huffbits[0]), |
|
| 113 |
+ if(init_vlc(&ctx->vlc, 11, FF_ARRAY_ELEMS(huffbits), |
|
| 114 | 114 |
huffbits, 1, 1, huffcodes, 4, 4, 0)) {
|
| 115 | 115 |
av_log(avctx, AV_LOG_ERROR, "error initializing vlc table\n"); |
| 116 | 116 |
return -1; |
| ... | ... |
@@ -394,7 +394,7 @@ static int decode_init(AVCodecContext * avctx) |
| 394 | 394 |
INIT_VLC_USE_NEW_STATIC); |
| 395 | 395 |
offset += huff_vlc_tables_sizes[i]; |
| 396 | 396 |
} |
| 397 |
- assert(offset == sizeof(huff_vlc_tables)/(sizeof(VLC_TYPE)*2)); |
|
| 397 |
+ assert(offset == FF_ARRAY_ELEMS(huff_vlc_tables)); |
|
| 398 | 398 |
|
| 399 | 399 |
offset = 0; |
| 400 | 400 |
for(i=0;i<2;i++) {
|
| ... | ... |
@@ -405,7 +405,7 @@ static int decode_init(AVCodecContext * avctx) |
| 405 | 405 |
INIT_VLC_USE_NEW_STATIC); |
| 406 | 406 |
offset += huff_quad_vlc_tables_sizes[i]; |
| 407 | 407 |
} |
| 408 |
- assert(offset == sizeof(huff_quad_vlc_tables)/(sizeof(VLC_TYPE)*2)); |
|
| 408 |
+ assert(offset == FF_ARRAY_ELEMS(huff_quad_vlc_tables)); |
|
| 409 | 409 |
|
| 410 | 410 |
for(i=0;i<9;i++) {
|
| 411 | 411 |
k = 0; |
| ... | ... |
@@ -1455,7 +1455,7 @@ static const VideoFrameRateAbbr video_frame_rate_abbrs[]= {
|
| 1455 | 1455 |
int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str) |
| 1456 | 1456 |
{
|
| 1457 | 1457 |
int i; |
| 1458 |
- int n = sizeof(video_frame_size_abbrs) / sizeof(VideoFrameSizeAbbr); |
|
| 1458 |
+ int n = FF_ARRAY_ELEMS(video_frame_size_abbrs); |
|
| 1459 | 1459 |
const char *p; |
| 1460 | 1460 |
int frame_width = 0, frame_height = 0; |
| 1461 | 1461 |
|
| ... | ... |
@@ -1483,7 +1483,7 @@ int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str) |
| 1483 | 1483 |
int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg) |
| 1484 | 1484 |
{
|
| 1485 | 1485 |
int i; |
| 1486 |
- int n = sizeof(video_frame_rate_abbrs) / sizeof(VideoFrameRateAbbr); |
|
| 1486 |
+ int n = FF_ARRAY_ELEMS(video_frame_rate_abbrs); |
|
| 1487 | 1487 |
char* cp; |
| 1488 | 1488 |
|
| 1489 | 1489 |
/* First, we check our abbreviation table */ |
| ... | ... |
@@ -213,7 +213,7 @@ static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccon |
| 213 | 213 |
venc->sample_rate = avccontext->sample_rate; |
| 214 | 214 |
venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11; |
| 215 | 215 |
|
| 216 |
- venc->ncodebooks = sizeof(cvectors)/sizeof(cvectors[0]); |
|
| 216 |
+ venc->ncodebooks = FF_ARRAY_ELEMS(cvectors); |
|
| 217 | 217 |
venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks); |
| 218 | 218 |
|
| 219 | 219 |
// codebook 0..14 - floor1 book, values 0..255 |
| ... | ... |
@@ -78,7 +78,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
| 78 | 78 |
struct video_audio audio; |
| 79 | 79 |
struct video_picture pict; |
| 80 | 80 |
int j; |
| 81 |
- int vformat_num = sizeof(video_formats) / sizeof(video_formats[0]); |
|
| 81 |
+ int vformat_num = FF_ARRAY_ELEMS(video_formats); |
|
| 82 | 82 |
|
| 83 | 83 |
if (ap->width <= 0 || ap->height <= 0) {
|
| 84 | 84 |
av_log(s1, AV_LOG_ERROR, "Wrong size (%dx%d)\n", ap->width, ap->height); |
| ... | ... |
@@ -221,7 +221,7 @@ static uint32_t fmt_ff2v4l(enum PixelFormat pix_fmt) |
| 221 | 221 |
{
|
| 222 | 222 |
int i; |
| 223 | 223 |
|
| 224 |
- for (i = 0; i < sizeof(fmt_conversion_table) / sizeof(struct fmt_map); i++) {
|
|
| 224 |
+ for (i = 0; i < FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
|
|
| 225 | 225 |
if (fmt_conversion_table[i].ff_fmt == pix_fmt) {
|
| 226 | 226 |
return fmt_conversion_table[i].v4l2_fmt; |
| 227 | 227 |
} |
| ... | ... |
@@ -234,7 +234,7 @@ static enum PixelFormat fmt_v4l2ff(uint32_t pix_fmt) |
| 234 | 234 |
{
|
| 235 | 235 |
int i; |
| 236 | 236 |
|
| 237 |
- for (i = 0; i < sizeof(fmt_conversion_table) / sizeof(struct fmt_map); i++) {
|
|
| 237 |
+ for (i = 0; i < FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
|
|
| 238 | 238 |
if (fmt_conversion_table[i].v4l2_fmt == pix_fmt) {
|
| 239 | 239 |
return fmt_conversion_table[i].ff_fmt; |
| 240 | 240 |
} |
| ... | ... |
@@ -563,7 +563,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) |
| 563 | 563 |
} else {
|
| 564 | 564 |
done = 1; |
| 565 | 565 |
} |
| 566 |
- if (i == sizeof(fmt_conversion_table) / sizeof(struct fmt_map)) {
|
|
| 566 |
+ if (i == FF_ARRAY_ELEMS(fmt_conversion_table)) {
|
|
| 567 | 567 |
done = 1; |
| 568 | 568 |
} |
| 569 | 569 |
} |
| ... | ... |
@@ -152,7 +152,7 @@ static int shall_we_drop(struct vfw_ctx *ctx) |
| 152 | 152 |
{
|
| 153 | 153 |
AVFormatContext *s = ctx->s; |
| 154 | 154 |
const uint8_t dropscore[] = {62, 75, 87, 100};
|
| 155 |
- const int ndropscores = sizeof(dropscore)/sizeof(dropscore[0]); |
|
| 155 |
+ const int ndropscores = FF_ARRAY_ELEMS(dropscore); |
|
| 156 | 156 |
unsigned int buffer_fullness = (ctx->curbufsize*100)/s->max_picture_buffer; |
| 157 | 157 |
|
| 158 | 158 |
if(dropscore[++ctx->frame_num%ndropscores] <= buffer_fullness) {
|
| ... | ... |
@@ -88,7 +88,7 @@ static int infer_size(int *width_ptr, int *height_ptr, int size) |
| 88 | 88 |
{
|
| 89 | 89 |
int i; |
| 90 | 90 |
|
| 91 |
- for(i=0;i<sizeof(sizes)/sizeof(sizes[0]);i++) {
|
|
| 91 |
+ for(i=0;i<FF_ARRAY_ELEMS(sizes);i++) {
|
|
| 92 | 92 |
if ((sizes[i][0] * sizes[i][1]) == size) {
|
| 93 | 93 |
*width_ptr = sizes[i][0]; |
| 94 | 94 |
*height_ptr = sizes[i][1]; |
| ... | ... |
@@ -248,7 +248,7 @@ int ff_mov_iso639_to_lang(const char *lang, int mp4) |
| 248 | 248 |
int i, code = 0; |
| 249 | 249 |
|
| 250 | 250 |
/* old way, only for QT? */ |
| 251 |
- for (i = 0; !mp4 && (i < (sizeof(mov_mdhd_language_map)/sizeof(char *))); i++) {
|
|
| 251 |
+ for (i = 0; !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {
|
|
| 252 | 252 |
if (mov_mdhd_language_map[i] && !strcmp(lang, mov_mdhd_language_map[i])) |
| 253 | 253 |
return i; |
| 254 | 254 |
} |
| ... | ... |
@@ -284,7 +284,7 @@ int ff_mov_lang_to_iso639(int code, char *to) |
| 284 | 284 |
return 1; |
| 285 | 285 |
} |
| 286 | 286 |
/* old fashion apple lang code */ |
| 287 |
- if (code >= (sizeof(mov_mdhd_language_map)/sizeof(char *))) |
|
| 287 |
+ if (code >= FF_ARRAY_ELEMS(mov_mdhd_language_map)) |
|
| 288 | 288 |
return 0; |
| 289 | 289 |
if (!mov_mdhd_language_map[code]) |
| 290 | 290 |
return 0; |
| ... | ... |
@@ -226,8 +226,6 @@ typedef struct {
|
| 226 | 226 |
EbmlList blocks; |
| 227 | 227 |
} MatroskaCluster; |
| 228 | 228 |
|
| 229 |
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*x)) |
|
| 230 |
- |
|
| 231 | 229 |
static EbmlSyntax ebml_header[] = {
|
| 232 | 230 |
{ EBML_ID_EBMLREADVERSION, EBML_UINT, 0, offsetof(Ebml,version), {.u=EBML_VERSION} },
|
| 233 | 231 |
{ EBML_ID_EBMLMAXSIZELENGTH, EBML_UINT, 0, offsetof(Ebml,max_size), {.u=8} },
|
| ... | ... |
@@ -980,7 +978,7 @@ static void matroska_convert_tags(AVFormatContext *s, EbmlList *list) |
| 980 | 980 |
int i, j; |
| 981 | 981 |
|
| 982 | 982 |
for (i=0; i < list->nb_elem; i++) {
|
| 983 |
- for (j=0; j < ARRAY_SIZE(metadata); j++){
|
|
| 983 |
+ for (j=0; j < FF_ARRAY_ELEMS(metadata); j++){
|
|
| 984 | 984 |
if (!strcmp(tags[i].name, metadata[j].name)) {
|
| 985 | 985 |
int *ptr = (int *)((char *)s + metadata[j].offset); |
| 986 | 986 |
if (*ptr) continue; |
| ... | ... |
@@ -1050,7 +1048,7 @@ static int matroska_aac_profile(char *codec_id) |
| 1050 | 1050 |
static const char * const aac_profiles[] = { "MAIN", "LC", "SSR" };
|
| 1051 | 1051 |
int profile; |
| 1052 | 1052 |
|
| 1053 |
- for (profile=0; profile<ARRAY_SIZE(aac_profiles); profile++) |
|
| 1053 |
+ for (profile=0; profile<FF_ARRAY_ELEMS(aac_profiles); profile++) |
|
| 1054 | 1054 |
if (strstr(codec_id, aac_profiles[profile])) |
| 1055 | 1055 |
break; |
| 1056 | 1056 |
return profile + 1; |
| ... | ... |
@@ -1060,7 +1058,7 @@ static int matroska_aac_sri(int samplerate) |
| 1060 | 1060 |
{
|
| 1061 | 1061 |
int sri; |
| 1062 | 1062 |
|
| 1063 |
- for (sri=0; sri<ARRAY_SIZE(ff_mpeg4audio_sample_rates); sri++) |
|
| 1063 |
+ for (sri=0; sri<FF_ARRAY_ELEMS(ff_mpeg4audio_sample_rates); sri++) |
|
| 1064 | 1064 |
if (ff_mpeg4audio_sample_rates[sri] == samplerate) |
| 1065 | 1065 |
break; |
| 1066 | 1066 |
return sri; |
| ... | ... |
@@ -74,8 +74,7 @@ static const MXFContainerEssenceEntry mxf_essence_container_uls[] = {
|
| 74 | 74 |
typedef struct MXFContext {
|
| 75 | 75 |
int64_t footer_partition_offset; |
| 76 | 76 |
int essence_container_count; |
| 77 |
- uint8_t essence_containers_indices[sizeof(mxf_essence_container_uls)/ |
|
| 78 |
- sizeof(*mxf_essence_container_uls)]; |
|
| 77 |
+ uint8_t essence_containers_indices[FF_ARRAY_ELEMS(mxf_essence_container_uls)]; |
|
| 79 | 78 |
} MXFContext; |
| 80 | 79 |
|
| 81 | 80 |
static const uint8_t uuid_base[] = { 0xAD,0xAB,0x44,0x24,0x2f,0x25,0x4d,0xc7,0x92,0xff,0x29,0xbd };
|
| ... | ... |
@@ -207,8 +206,7 @@ static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len) |
| 207 | 207 |
static int mxf_get_essence_container_ul_index(enum CodecID id) |
| 208 | 208 |
{
|
| 209 | 209 |
int i; |
| 210 |
- for (i = 0; i < sizeof(mxf_essence_container_uls)/ |
|
| 211 |
- sizeof(*mxf_essence_container_uls); i++) |
|
| 210 |
+ for (i = 0; i < FF_ARRAY_ELEMS(mxf_essence_container_uls); i++) |
|
| 212 | 211 |
if (mxf_essence_container_uls[i].id == id) |
| 213 | 212 |
return i; |
| 214 | 213 |
return -1; |
| ... | ... |
@@ -219,7 +217,7 @@ static void mxf_write_primer_pack(AVFormatContext *s) |
| 219 | 219 |
ByteIOContext *pb = s->pb; |
| 220 | 220 |
int local_tag_number, i = 0; |
| 221 | 221 |
|
| 222 |
- local_tag_number = sizeof(mxf_local_tag_batch)/sizeof(*mxf_local_tag_batch); |
|
| 222 |
+ local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch); |
|
| 223 | 223 |
|
| 224 | 224 |
put_buffer(pb, primer_pack_key, 16); |
| 225 | 225 |
klv_encode_ber_length(pb, local_tag_number * 18 + 8); |
| ... | ... |
@@ -754,8 +752,7 @@ static int mxf_write_header(AVFormatContext *s) |
| 754 | 754 |
{
|
| 755 | 755 |
MXFContext *mxf = s->priv_data; |
| 756 | 756 |
int i; |
| 757 |
- uint8_t present[sizeof(mxf_essence_container_uls)/ |
|
| 758 |
- sizeof(*mxf_essence_container_uls)] = {0};
|
|
| 757 |
+ uint8_t present[FF_ARRAY_ELEMS(mxf_essence_container_uls)] = {0};
|
|
| 759 | 758 |
|
| 760 | 759 |
for (i = 0; i < s->nb_streams; i++) {
|
| 761 | 760 |
AVStream *st = s->streams[i]; |
| ... | ... |
@@ -2904,7 +2904,7 @@ int64_t parse_date(const char *datestr, int duration) |
| 2904 | 2904 |
q = NULL; |
| 2905 | 2905 |
if (!duration) {
|
| 2906 | 2906 |
/* parse the year-month-day part */ |
| 2907 |
- for (i = 0; i < sizeof(date_fmt) / sizeof(date_fmt[0]); i++) {
|
|
| 2907 |
+ for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) {
|
|
| 2908 | 2908 |
q = small_strptime(p, date_fmt[i], &dt); |
| 2909 | 2909 |
if (q) {
|
| 2910 | 2910 |
break; |
| ... | ... |
@@ -2928,7 +2928,7 @@ int64_t parse_date(const char *datestr, int duration) |
| 2928 | 2928 |
p++; |
| 2929 | 2929 |
|
| 2930 | 2930 |
/* parse the hour-minute-second part */ |
| 2931 |
- for (i = 0; i < sizeof(time_fmt) / sizeof(time_fmt[0]); i++) {
|
|
| 2931 |
+ for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) {
|
|
| 2932 | 2932 |
q = small_strptime(p, time_fmt[i], &dt); |
| 2933 | 2933 |
if (q) {
|
| 2934 | 2934 |
break; |
| ... | ... |
@@ -51,7 +51,7 @@ int av_base64_decode(uint8_t * out, const char *in, int out_length) |
| 51 | 51 |
v = 0; |
| 52 | 52 |
for (i = 0; in[i] && in[i] != '='; i++) {
|
| 53 | 53 |
unsigned int index= in[i]-43; |
| 54 |
- if (index>=(sizeof(map2)/sizeof(map2[0])) || map2[index] == 0xff) |
|
| 54 |
+ if (index>=FF_ARRAY_ELEMS(map2) || map2[index] == 0xff) |
|
| 55 | 55 |
return -1; |
| 56 | 56 |
v = (v << 6) + map2[index]; |
| 57 | 57 |
if (i & 3) {
|
| ... | ... |
@@ -91,7 +91,7 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
|
| 91 | 91 |
*/ |
| 92 | 92 |
const AVCRC *av_crc_get_table(AVCRCId crc_id){
|
| 93 | 93 |
#ifndef CONFIG_HARDCODED_TABLES |
| 94 |
- if (!av_crc_table[crc_id][sizeof(av_crc_table[crc_id])/sizeof(av_crc_table[crc_id][0])-1]) |
|
| 94 |
+ if (!av_crc_table[crc_id][FF_ARRAY_ELEMS(av_crc_table[crc_id])-1]) |
|
| 95 | 95 |
if (av_crc_init(av_crc_table[crc_id], |
| 96 | 96 |
av_crc_table_params[crc_id].le, |
| 97 | 97 |
av_crc_table_params[crc_id].bits, |