From 6522e87ad6a10ed1786bda310c27a37129a517a6 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Mon, 28 Jul 2014 12:07:59 +0300 Subject: 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. --- libFDK/include/fixpoint_math.h | 8 ++++---- libFDK/src/FDK_tools_rom.cpp | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'libFDK') diff --git a/libFDK/include/fixpoint_math.h b/libFDK/include/fixpoint_math.h index df141d3..af14f99 100644 --- a/libFDK/include/fixpoint_math.h +++ b/libFDK/include/fixpoint_math.h @@ -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]; } diff --git a/libFDK/src/FDK_tools_rom.cpp b/libFDK/src/FDK_tools_rom.cpp index c6e517e..9d4738c 100644 --- a/libFDK/src/FDK_tools_rom.cpp +++ b/libFDK/src/FDK_tools_rom.cpp @@ -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 }; -- cgit v1.2.3