Commit 6522e87a authored by Martin Storsjo's avatar Martin Storsjo

Extend GetInvInt to support values up to 54

For sample rates >= 64 kHz with short blocks, the largest sfb
width is 36, which after grouping can be multiplied with 3,
ending up as 108. GetInvInt needs to be able to support
the largest grouped sfb width, divided by two (3 * 36 / 2 = 54).

This fixes VBR encoding with sample rates >= 64 kHz.
parent f8251041
......@@ -438,11 +438,11 @@ inline FIXP_DBL fAddSaturate(const FIXP_DBL a, const FIXP_DBL b)
/*****************************************************************************
array for 1/n, n=1..50
array for 1/n, n=1..55
****************************************************************************/
extern const FIXP_DBL invCount[50];
extern const FIXP_DBL invCount[55];
LNK_SECTION_INITCODE
inline void InitInvInt(void) {}
......@@ -456,8 +456,8 @@ inline FIXP_DBL fAddSaturate(const FIXP_DBL a, const FIXP_DBL b)
*/
inline FIXP_DBL GetInvInt(int intValue)
{
FDK_ASSERT((intValue > 0) && (intValue < 50));
FDK_ASSERT(intValue<50);
FDK_ASSERT((intValue > 0) && (intValue < 55));
FDK_ASSERT(intValue<55);
return invCount[intValue];
}
......
......@@ -1902,7 +1902,7 @@ const USHORT sqrt_tab[49]={
0xb504};
LNK_SECTION_CONSTDATA_L1
const FIXP_DBL invCount[50]= /* This could be 16-bit wide */
const FIXP_DBL invCount[55]= /* This could be 16-bit wide */
{
0x00000000, 0x7fffffff, 0x40000000, 0x2aaaaaab, 0x20000000,
0x1999999a, 0x15555555, 0x12492492, 0x10000000, 0x0e38e38e,
......@@ -1913,7 +1913,8 @@ const FIXP_DBL invCount[50]= /* This could be 16-bit wide */
0x04444444, 0x04210842, 0x04000000, 0x03e0f83e, 0x03c3c3c4,
0x03a83a84, 0x038e38e4, 0x03759f23, 0x035e50d8, 0x03483483,
0x03333333, 0x031f3832, 0x030c30c3, 0x02fa0be8, 0x02e8ba2f,
0x02d82d83, 0x02c8590b, 0x02b93105, 0x02aaaaab, 0x029cbc15
0x02d82d83, 0x02c8590b, 0x02b93105, 0x02aaaaab, 0x029cbc15,
0x028f5c29, 0x02828283, 0x02762763, 0x026a43a0, 0x025ed098
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment