From e4217d48452cc0dc364de1eb6338476b00be4295 Mon Sep 17 00:00:00 2001 From: Dave Hooper Date: Sat, 20 Feb 2010 12:55:35 +0000 Subject: [PATCH] Reinstate ICONST_ATTR for matrixCoeffs_fix ; remove (silly) gain_tab1 and replace with a simple bitshift in the code git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24788 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libatrac/atrac3.c | 4 ++-- apps/codecs/libatrac/atrac3data_fixed.h | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c index fa0400a408..ecb5a1480d 100644 --- a/apps/codecs/libatrac/atrac3.c +++ b/apps/codecs/libatrac/atrac3.c @@ -726,7 +726,7 @@ static void gainCompensateAndOverlap (int32_t *pIn, int32_t *pPrev, int32_t *pOu if (pGain2->num_gain_data == 0) gain1 = ONE_16; else - gain1 = gain_tab1[pGain2->levcode[0]]; + gain1 = (ONE_16<<4)>>(pGain2->levcode[0]); if (pGain1->num_gain_data == 0) { /* Remark: This path is called >90%. */ @@ -743,7 +743,7 @@ static void gainCompensateAndOverlap (int32_t *pIn, int32_t *pPrev, int32_t *pOu for (cnt = 0; cnt < numdata; cnt++) { startLoc = pGain1->loccode[cnt] * 8; - gain2 = gain_tab1[pGain1->levcode[cnt]]; + gain2 = (ONE_16<<4)>>(pGain1->levcode[cnt]); gain_inc = gain_tab2[(pGain1->levcode[cnt+1] - pGain1->levcode[cnt])+15]; /* Apply variable gain (gain1 -> gain2) to samples */ diff --git a/apps/codecs/libatrac/atrac3data_fixed.h b/apps/codecs/libatrac/atrac3data_fixed.h index 0ea7b86d62..b733ee71c4 100644 --- a/apps/codecs/libatrac/atrac3data_fixed.h +++ b/apps/codecs/libatrac/atrac3data_fixed.h @@ -78,12 +78,6 @@ static const int32_t window_lookup[128] ICONST_ATTR = { }; /* Gain tables scaled by 2^16 */ -static const int32_t gain_tab1[16] ICONST_ATTR = { - 0x00100000, 0x00080000, 0x00040000, 0x00020000, 0x00010000, 0x00008000, - 0x00004000, 0x00002000, 0x00001000, 0x00000800, 0x00000400, 0x00000200, - 0x00000100, 0x00000080, 0x00000040, 0x00000020, -}; - static const int32_t gain_tab2[31] ICONST_ATTR = { 0x0003ab03, 0x00035d14, 0x0003159d, 0x0002d414, 0x000297fb, 0x000260e0, 0x00022e57, 0x00020000, 0x0001d582, 0x0001ae8a, 0x00018ace, 0x00016a0a, @@ -95,7 +89,7 @@ static const int32_t gain_tab2[31] ICONST_ATTR = { }; /* Joint-Stereo related tables, scaled by 2^16 */ -static const int32_t matrixCoeffs_fix[8]= { +static const int32_t matrixCoeffs_fix[8] ICONST_ATTR = { 0x00000000, 0x00020000, 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00010000, 0x00010000, };