Mercurial > libavcodec.hg
comparison mpegvideo.c @ 4668:1f1a0e67b961 libavcodec
kill av_mallocz_static() calls in init_rl()
author | michael |
---|---|
date | Wed, 14 Mar 2007 13:19:19 +0000 |
parents | 31ebbdad594e |
children | 6d45158e0249 |
comparison
equal
deleted
inserted
replaced
4667:b3f099adfb36 | 4668:1f1a0e67b961 |
---|---|
1409 return 0; | 1409 return 0; |
1410 } | 1410 } |
1411 | 1411 |
1412 #endif //CONFIG_ENCODERS | 1412 #endif //CONFIG_ENCODERS |
1413 | 1413 |
1414 void init_rl(RLTable *rl, int use_static) | 1414 void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]) |
1415 { | 1415 { |
1416 int8_t max_level[MAX_RUN+1], max_run[MAX_LEVEL+1]; | 1416 int8_t max_level[MAX_RUN+1], max_run[MAX_LEVEL+1]; |
1417 uint8_t index_run[MAX_RUN+1]; | 1417 uint8_t index_run[MAX_RUN+1]; |
1418 int last, run, level, start, end, i; | 1418 int last, run, level, start, end, i; |
1419 | 1419 |
1420 /* If table is static, we can quit if rl->max_level[0] is not NULL */ | 1420 /* If table is static, we can quit if rl->max_level[0] is not NULL */ |
1421 if(use_static && rl->max_level[0]) | 1421 if(static_store && rl->max_level[0]) |
1422 return; | 1422 return; |
1423 | 1423 |
1424 /* compute max_level[], max_run[] and index_run[] */ | 1424 /* compute max_level[], max_run[] and index_run[] */ |
1425 for(last=0;last<2;last++) { | 1425 for(last=0;last<2;last++) { |
1426 if (last == 0) { | 1426 if (last == 0) { |
1442 if (level > max_level[run]) | 1442 if (level > max_level[run]) |
1443 max_level[run] = level; | 1443 max_level[run] = level; |
1444 if (run > max_run[level]) | 1444 if (run > max_run[level]) |
1445 max_run[level] = run; | 1445 max_run[level] = run; |
1446 } | 1446 } |
1447 if(use_static) | 1447 if(static_store) |
1448 rl->max_level[last] = av_mallocz_static(MAX_RUN + 1); | 1448 rl->max_level[last] = static_store[last]; |
1449 else | 1449 else |
1450 rl->max_level[last] = av_malloc(MAX_RUN + 1); | 1450 rl->max_level[last] = av_malloc(MAX_RUN + 1); |
1451 memcpy(rl->max_level[last], max_level, MAX_RUN + 1); | 1451 memcpy(rl->max_level[last], max_level, MAX_RUN + 1); |
1452 if(use_static) | 1452 if(static_store) |
1453 rl->max_run[last] = av_mallocz_static(MAX_LEVEL + 1); | 1453 rl->max_run[last] = static_store[last] + MAX_RUN + 1; |
1454 else | 1454 else |
1455 rl->max_run[last] = av_malloc(MAX_LEVEL + 1); | 1455 rl->max_run[last] = av_malloc(MAX_LEVEL + 1); |
1456 memcpy(rl->max_run[last], max_run, MAX_LEVEL + 1); | 1456 memcpy(rl->max_run[last], max_run, MAX_LEVEL + 1); |
1457 if(use_static) | 1457 if(static_store) |
1458 rl->index_run[last] = av_mallocz_static(MAX_RUN + 1); | 1458 rl->index_run[last] = static_store[last] + MAX_RUN + MAX_LEVEL + 2; |
1459 else | 1459 else |
1460 rl->index_run[last] = av_malloc(MAX_RUN + 1); | 1460 rl->index_run[last] = av_malloc(MAX_RUN + 1); |
1461 memcpy(rl->index_run[last], index_run, MAX_RUN + 1); | 1461 memcpy(rl->index_run[last], index_run, MAX_RUN + 1); |
1462 } | 1462 } |
1463 } | 1463 } |