From: chenyu <chenyu202...@gmail.com> Optimizing 160k code size by converting static array to dynamic malloc memory.
Signed-off-by: chenyu <chenyu202...@gmail.com> --- libavcodec/mpegaudiodata.h | 4 ++-- libavcodec/mpegaudiodec_common_tablegen.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libavcodec/mpegaudiodata.h b/libavcodec/mpegaudiodata.h index 720c4bee64..6dfb74cd01 100644 --- a/libavcodec/mpegaudiodata.h +++ b/libavcodec/mpegaudiodata.h @@ -50,8 +50,8 @@ extern const unsigned char * const ff_mpa_alloc_tables[5]; extern const int8_t ff_table_4_3_exp [TABLE_4_3_SIZE]; extern const uint32_t ff_table_4_3_value[TABLE_4_3_SIZE]; #else -extern int8_t ff_table_4_3_exp [TABLE_4_3_SIZE]; -extern uint32_t ff_table_4_3_value[TABLE_4_3_SIZE]; +extern int8_t *ff_table_4_3_exp; +extern uint32_t *ff_table_4_3_value; #endif /* VLCs for decoding layer 3 huffman tables */ diff --git a/libavcodec/mpegaudiodec_common_tablegen.h b/libavcodec/mpegaudiodec_common_tablegen.h index bf402c9d84..66e93df27f 100644 --- a/libavcodec/mpegaudiodec_common_tablegen.h +++ b/libavcodec/mpegaudiodec_common_tablegen.h @@ -34,9 +34,10 @@ #else #include <math.h> #include "libavutil/attributes.h" +#include "libavutil/mem.h" -int8_t ff_table_4_3_exp [TABLE_4_3_SIZE]; -uint32_t ff_table_4_3_value[TABLE_4_3_SIZE]; +int8_t *ff_table_4_3_exp; +uint32_t *ff_table_4_3_value; #define FRAC_BITS 23 #define IMDCT_SCALAR 1.759 @@ -51,6 +52,11 @@ static av_cold void mpegaudiodec_common_tableinit(void) }; double pow43_val = 0; +#if !CONFIG_HARDCODED_TABLES + ff_table_4_3_exp = (int8_t *)av_calloc(TABLE_4_3_SIZE, sizeof(int8_t)); + ff_table_4_3_value = (uint32_t *)av_calloc(TABLE_4_3_SIZE, sizeof(uint32_t)); +#endif + for (int i = 1; i < TABLE_4_3_SIZE; i++) { double f, fm; int e, m; -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".