Extend the GetInvInt table to 80 elements

This is a bug fix patch from Fraunhofer, amending/replacing/extending
the previous commit which only extended the table to 55 elements.
(In my previous fix, 55 seemed to be enough for the issue at hand at
least. A few of the coefficients had slightly different rounding than
what Fraunhofer had used though).

This will show up in AOSP in the next code drop as well.
This commit is contained in:
Martin Storsjo 2014-08-01 10:31:53 +03:00
parent 6522e87ad6
commit 9a3234055a
3 changed files with 14 additions and 10 deletions

View File

@ -2,7 +2,7 @@
/* ----------------------------------------------------------------------------------------------------------- /* -----------------------------------------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. © Copyright 1995 - 2014 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
All rights reserved. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -325,7 +325,6 @@ FDKaacEnc_prepareIntensityDecision(const FIXP_DBL *sfbEnergyLeft,
channelCorr[sfb + sfboffs] = FL2FXCONST_DBL(0.0f); channelCorr[sfb + sfboffs] = FL2FXCONST_DBL(0.0f);
FDK_ASSERT(50 >= 49);
/* max width of scalefactorband is 96; width's are always even */ /* max width of scalefactorband is 96; width's are always even */
/* inv_n is scaled with factor 2 to compensate fMultDiv2() in subsequent loops */ /* inv_n is scaled with factor 2 to compensate fMultDiv2() in subsequent loops */
inv_n = GetInvInt((sfbOffset[sfb + sfboffs + 1] - sfbOffset[sfb + sfboffs])>>1); inv_n = GetInvInt((sfbOffset[sfb + sfboffs + 1] - sfbOffset[sfb + sfboffs])>>1);

View File

@ -2,7 +2,7 @@
/* ----------------------------------------------------------------------------------------------------------- /* -----------------------------------------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. © Copyright 1995 - 2014 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
All rights reserved. All rights reserved.
1. INTRODUCTION 1. INTRODUCTION
@ -438,11 +438,11 @@ inline FIXP_DBL fAddSaturate(const FIXP_DBL a, const FIXP_DBL b)
/***************************************************************************** /*****************************************************************************
array for 1/n, n=1..55 array for 1/n, n=1..80
****************************************************************************/ ****************************************************************************/
extern const FIXP_DBL invCount[55]; extern const FIXP_DBL invCount[80];
LNK_SECTION_INITCODE LNK_SECTION_INITCODE
inline void InitInvInt(void) {} inline void InitInvInt(void) {}
@ -450,14 +450,14 @@ inline FIXP_DBL fAddSaturate(const FIXP_DBL a, const FIXP_DBL b)
/** /**
* \brief Calculate the value of 1/i where i is a integer value. It supports * \brief Calculate the value of 1/i where i is a integer value. It supports
* input values from 1 upto 50. * input values from 1 upto 80.
* \param intValue Integer input value. * \param intValue Integer input value.
* \param FIXP_DBL representation of 1/intValue * \param FIXP_DBL representation of 1/intValue
*/ */
inline FIXP_DBL GetInvInt(int intValue) inline FIXP_DBL GetInvInt(int intValue)
{ {
FDK_ASSERT((intValue > 0) && (intValue < 55)); FDK_ASSERT((intValue > 0) && (intValue < 80));
FDK_ASSERT(intValue<55); FDK_ASSERT(intValue<80);
return invCount[intValue]; return invCount[intValue];
} }

View File

@ -1902,7 +1902,7 @@ const USHORT sqrt_tab[49]={
0xb504}; 0xb504};
LNK_SECTION_CONSTDATA_L1 LNK_SECTION_CONSTDATA_L1
const FIXP_DBL invCount[55]= /* This could be 16-bit wide */ const FIXP_DBL invCount[80]= /* This could be 16-bit wide */
{ {
0x00000000, 0x7fffffff, 0x40000000, 0x2aaaaaab, 0x20000000, 0x00000000, 0x7fffffff, 0x40000000, 0x2aaaaaab, 0x20000000,
0x1999999a, 0x15555555, 0x12492492, 0x10000000, 0x0e38e38e, 0x1999999a, 0x15555555, 0x12492492, 0x10000000, 0x0e38e38e,
@ -1914,7 +1914,12 @@ const FIXP_DBL invCount[55]= /* This could be 16-bit wide */
0x03a83a84, 0x038e38e4, 0x03759f23, 0x035e50d8, 0x03483483, 0x03a83a84, 0x038e38e4, 0x03759f23, 0x035e50d8, 0x03483483,
0x03333333, 0x031f3832, 0x030c30c3, 0x02fa0be8, 0x02e8ba2f, 0x03333333, 0x031f3832, 0x030c30c3, 0x02fa0be8, 0x02e8ba2f,
0x02d82d83, 0x02c8590b, 0x02b93105, 0x02aaaaab, 0x029cbc15, 0x02d82d83, 0x02c8590b, 0x02b93105, 0x02aaaaab, 0x029cbc15,
0x028f5c29, 0x02828283, 0x02762763, 0x026a43a0, 0x025ed098 0x028f5c29, 0x02828283, 0x02762762, 0x026a439f, 0x025ed098,
0x0253c825, 0x02492492, 0x023ee090, 0x0234f72c, 0x022b63cc,
0x02222222, 0x02192e2a, 0x02108421, 0x02082082, 0x02000000,
0x01f81f82, 0x01f07c1f, 0x01e9131b, 0x01e1e1e2, 0x01dae607,
0x01d41d42, 0x01cd8569, 0x01c71c72, 0x01c0e070, 0x01bacf91,
0x01b4e81b, 0x01af286c, 0x01a98ef6, 0x01a41a42, 0x019ec8e9
}; };