From 373b4ef6ff8a7d6d0ec96a2c1a757c3a8e77b088 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Thu, 23 Nov 2017 19:31:39 -0800 Subject: [PATCH] Move a few small tables into PROGMEM No reason not to save a few bytes of RAM by moving some char[] to PROGMEM. --- src/libhelix-aac/aaccommon.h | 12 ++++++------ src/libhelix-aac/aactabs.c | 12 ++++++------ src/libhelix-aac/tns.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/libhelix-aac/aaccommon.h b/src/libhelix-aac/aaccommon.h index 430245a..4839c2f 100644 --- a/src/libhelix-aac/aaccommon.h +++ b/src/libhelix-aac/aaccommon.h @@ -187,17 +187,17 @@ extern const int sampRateTab[NUM_SAMPLE_RATES]; extern const int predSFBMax[NUM_SAMPLE_RATES]; extern const int channelMapTab[NUM_DEF_CHAN_MAPS]; extern const int elementNumChans[NUM_ELEMENTS]; -extern const unsigned char sfBandTotalShort[NUM_SAMPLE_RATES]; -extern const unsigned char sfBandTotalLong[NUM_SAMPLE_RATES]; +extern const unsigned /*char*/ int sfBandTotalShort[NUM_SAMPLE_RATES]; +extern const unsigned /*char*/ int sfBandTotalLong[NUM_SAMPLE_RATES]; extern const int sfBandTabShortOffset[NUM_SAMPLE_RATES]; extern const /*short*/ int sfBandTabShort[76]; extern const int sfBandTabLongOffset[NUM_SAMPLE_RATES]; extern const /*short*/ int sfBandTabLong[325]; extern const int tnsMaxBandsShortOffset[AAC_NUM_PROFILES]; -extern const unsigned char tnsMaxBandsShort[2*NUM_SAMPLE_RATES]; -extern const unsigned char tnsMaxOrderShort[AAC_NUM_PROFILES]; +extern const unsigned /*char*/ int tnsMaxBandsShort[2*NUM_SAMPLE_RATES]; +extern const unsigned /*char*/ int tnsMaxOrderShort[AAC_NUM_PROFILES]; extern const int tnsMaxBandsLongOffset[AAC_NUM_PROFILES]; -extern const unsigned char tnsMaxBandsLong[2*NUM_SAMPLE_RATES]; -extern const unsigned char tnsMaxOrderLong[AAC_NUM_PROFILES]; +extern const unsigned /*char*/ int tnsMaxBandsLong[2*NUM_SAMPLE_RATES]; +extern const unsigned /*char*/ int tnsMaxOrderLong[AAC_NUM_PROFILES]; #endif /* _AACCOMMON_H */ diff --git a/src/libhelix-aac/aactabs.c b/src/libhelix-aac/aactabs.c index 45c9317..1efa20c 100644 --- a/src/libhelix-aac/aactabs.c +++ b/src/libhelix-aac/aactabs.c @@ -69,11 +69,11 @@ const int elementNumChans[NUM_ELEMENTS] PROGMEM = { }; /* total number of scale factor bands in one window */ -const unsigned char sfBandTotalShort[NUM_SAMPLE_RATES] = { +const unsigned int /*char*/ sfBandTotalShort[NUM_SAMPLE_RATES] PROGMEM = { 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15 }; -const unsigned char sfBandTotalLong[NUM_SAMPLE_RATES] = { +const unsigned int /*char*/ sfBandTotalLong[NUM_SAMPLE_RATES] PROGMEM = { 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40 }; @@ -140,18 +140,18 @@ const /*short*/ int sfBandTabLong[325] PROGMEM = { /* TNS max bands (table 4.139) and max order (table 4.138) */ const int tnsMaxBandsShortOffset[AAC_NUM_PROFILES] PROGMEM = {0, 0, 12}; -const unsigned char tnsMaxBandsShort[2*NUM_SAMPLE_RATES] = { +const unsigned /*char*/ int tnsMaxBandsShort[2*NUM_SAMPLE_RATES] PROGMEM = { 9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* short block, Main/LC */ 7, 7, 7, 6, 6, 6, 7, 7, 8, 8, 8, 7 /* short block, SSR */ }; -const unsigned char tnsMaxOrderShort[AAC_NUM_PROFILES] = {7, 7, 7}; +const unsigned /*char*/ int tnsMaxOrderShort[AAC_NUM_PROFILES] PROGMEM = {7, 7, 7}; const int tnsMaxBandsLongOffset[AAC_NUM_PROFILES] PROGMEM = {0, 0, 12}; -const unsigned char tnsMaxBandsLong[2*NUM_SAMPLE_RATES] = { +const unsigned int /*char*/ tnsMaxBandsLong[2*NUM_SAMPLE_RATES] PROGMEM = { 31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, /* long block, Main/LC */ 28, 28, 27, 26, 26, 26, 29, 29, 23, 23, 23, 19, /* long block, SSR */ }; -const unsigned char tnsMaxOrderLong[AAC_NUM_PROFILES] = {20, 12, 12}; +const unsigned /*char*/ int tnsMaxOrderLong[AAC_NUM_PROFILES] PROGMEM = {20, 12, 12}; diff --git a/src/libhelix-aac/tns.c b/src/libhelix-aac/tns.c index 9066f0b..8772606 100644 --- a/src/libhelix-aac/tns.c +++ b/src/libhelix-aac/tns.c @@ -190,7 +190,7 @@ int TNSFilter(AACDecInfo *aacDecInfo, int ch) int *audioCoef; unsigned char *filtLength, *filtOrder, *filtRes, *filtDir; signed char *filtCoef; - const unsigned char *tnsMaxBandTab; + const unsigned /*char*/ int *tnsMaxBandTab; const /*short*/ int *sfbTab; ICSInfo *icsInfo; TNSInfo *ti;