aboutsummaryrefslogtreecommitdiffstats
path: root/libFDK
diff options
context:
space:
mode:
Diffstat (limited to 'libFDK')
-rw-r--r--libFDK/src/FDK_crc.cpp94
-rw-r--r--libFDK/src/FDK_tools_rom.cpp3
-rw-r--r--libFDK/src/fft.cpp9
-rw-r--r--libFDK/src/mdct.cpp3
4 files changed, 100 insertions, 9 deletions
diff --git a/libFDK/src/FDK_crc.cpp b/libFDK/src/FDK_crc.cpp
index 17d47ad..a4c6900 100644
--- a/libFDK/src/FDK_crc.cpp
+++ b/libFDK/src/FDK_crc.cpp
@@ -87,7 +87,7 @@ amm-info@iis.fraunhofer.de
contents/description: CRC calculation
******************************************************************************/
-
+#include <stdio.h>
#include "FDK_crc.h"
@@ -132,7 +132,7 @@ static const USHORT crcLookup_16_15_2_0[256] =
0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
};
-
+#if 1
/**
* \brief This table defines precalculated lookup tables for crc polynom x^16 + x^12 + x^5 + x^0.
*/
@@ -171,7 +171,83 @@ static const USHORT crcLookup_16_12_5_0[256] =
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
};
+#else
+static const USHORT crcLookup_16_12_5_0[256] =
+{
+ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
+ 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
+ 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
+ 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
+ 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
+ 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
+ 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
+ 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
+ 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
+ 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
+ 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
+ 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
+ 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
+ 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
+ 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
+ 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
+ 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
+ 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
+ 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
+ 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
+ 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
+ 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
+ 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
+ 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
+ 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
+ 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
+ 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
+ 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
+ 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
+ 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
+ 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
+ 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
+};
+#endif
+
+/**
+ * \brief This table defines precalculated lookup tables for crc polynom x^16 + x^14 + x^13 + x^12 + x^11 + x^5 + x^3 + x^2 + x^0.
+ */
+static const USHORT crcLookup_16_14_13_12_11_5_3_2_0[256] =
+{
+ 0x0000, 0x782f, 0xf05e, 0x8871, 0x9893, 0xe0bc, 0x68cd, 0x10e2,
+ 0x4909, 0x3126, 0xb957, 0xc178, 0xd19a, 0xa9b5, 0x21c4, 0x59eb,
+ 0x9212, 0xea3d, 0x624c, 0x1a63, 0x0a81, 0x72ae, 0xfadf, 0x82f0,
+ 0xdb1b, 0xa334, 0x2b45, 0x536a, 0x4388, 0x3ba7, 0xb3d6, 0xcbf9,
+ 0x5c0b, 0x2424, 0xac55, 0xd47a, 0xc498, 0xbcb7, 0x34c6, 0x4ce9,
+ 0x1502, 0x6d2d, 0xe55c, 0x9d73, 0x8d91, 0xf5be, 0x7dcf, 0x05e0,
+ 0xce19, 0xb636, 0x3e47, 0x4668, 0x568a, 0x2ea5, 0xa6d4, 0xdefb,
+ 0x8710, 0xff3f, 0x774e, 0x0f61, 0x1f83, 0x67ac, 0xefdd, 0x97f2,
+ 0xb816, 0xc039, 0x4848, 0x3067, 0x2085, 0x58aa, 0xd0db, 0xa8f4,
+ 0xf11f, 0x8930, 0x0141, 0x796e, 0x698c, 0x11a3, 0x99d2, 0xe1fd,
+ 0x2a04, 0x522b, 0xda5a, 0xa275, 0xb297, 0xcab8, 0x42c9, 0x3ae6,
+ 0x630d, 0x1b22, 0x9353, 0xeb7c, 0xfb9e, 0x83b1, 0x0bc0, 0x73ef,
+ 0xe41d, 0x9c32, 0x1443, 0x6c6c, 0x7c8e, 0x04a1, 0x8cd0, 0xf4ff,
+ 0xad14, 0xd53b, 0x5d4a, 0x2565, 0x3587, 0x4da8, 0xc5d9, 0xbdf6,
+ 0x760f, 0x0e20, 0x8651, 0xfe7e, 0xee9c, 0x96b3, 0x1ec2, 0x66ed,
+ 0x3f06, 0x4729, 0xcf58, 0xb777, 0xa795, 0xdfba, 0x57cb, 0x2fe4,
+ 0x0803, 0x702c, 0xf85d, 0x8072, 0x9090, 0xe8bf, 0x60ce, 0x18e1,
+ 0x410a, 0x3925, 0xb154, 0xc97b, 0xd999, 0xa1b6, 0x29c7, 0x51e8,
+ 0x9a11, 0xe23e, 0x6a4f, 0x1260, 0x0282, 0x7aad, 0xf2dc, 0x8af3,
+ 0xd318, 0xab37, 0x2346, 0x5b69, 0x4b8b, 0x33a4, 0xbbd5, 0xc3fa,
+ 0x5408, 0x2c27, 0xa456, 0xdc79, 0xcc9b, 0xb4b4, 0x3cc5, 0x44ea,
+ 0x1d01, 0x652e, 0xed5f, 0x9570, 0x8592, 0xfdbd, 0x75cc, 0x0de3,
+ 0xc61a, 0xbe35, 0x3644, 0x4e6b, 0x5e89, 0x26a6, 0xaed7, 0xd6f8,
+ 0x8f13, 0xf73c, 0x7f4d, 0x0762, 0x1780, 0x6faf, 0xe7de, 0x9ff1,
+ 0xb015, 0xc83a, 0x404b, 0x3864, 0x2886, 0x50a9, 0xd8d8, 0xa0f7,
+ 0xf91c, 0x8133, 0x0942, 0x716d, 0x618f, 0x19a0, 0x91d1, 0xe9fe,
+ 0x2207, 0x5a28, 0xd259, 0xaa76, 0xba94, 0xc2bb, 0x4aca, 0x32e5,
+ 0x6b0e, 0x1321, 0x9b50, 0xe37f, 0xf39d, 0x8bb2, 0x03c3, 0x7bec,
+ 0xec1e, 0x9431, 0x1c40, 0x646f, 0x748d, 0x0ca2, 0x84d3, 0xfcfc,
+ 0xa517, 0xdd38, 0x5549, 0x2d66, 0x3d84, 0x45ab, 0xcdda, 0xb5f5,
+ 0x7e0c, 0x0623, 0x8e52, 0xf67d, 0xe69f, 0x9eb0, 0x16c1, 0x6eee,
+ 0x3705, 0x4f2a, 0xc75b, 0xbf74, 0xaf96, 0xd7b9, 0x5fc8, 0x27e7,
+};
/*--------------- function declarations --------------------*/
@@ -207,6 +283,10 @@ void FDKcrcInit(
)
{
/* crc polynom example:
+ DAB+ FireCode:
+ x^16 + x^14 + x^13 + x^12 + x^11 + x^5 + x^3 + x^2 + x^0
+ (1) 0111 1000 0010 1101 -> 0x782d
+
x^16 + x^15 + x^2 + x^0 (1) 1000 0000 0000 0101 -> 0x8005
x^16 + x^12 + x^5 + x^0 (1) 0001 0000 0010 0001 -> 0x1021
x^8 + x^4 + x^3 + x^2 + x^0 (1) 0001 1101 -> 0x001d */
@@ -228,6 +308,9 @@ void FDKcrcInit(
case 0x1021:
hCrcInfo->pCrcLookup = crcLookup_16_12_5_0;
break;
+ case 0x782d:
+ hCrcInfo->pCrcLookup = crcLookup_16_14_13_12_11_5_3_2_0;
+ break;
case 0x001d:
default:
/* no lookup table */
@@ -372,10 +455,9 @@ static inline INT calcCrc_Bytes(
{
int i;
USHORT crc = *pCrc; /* get crc value */
-
if (hBs!=NULL) {
for (i=0; i<nBytes; i++) {
- crc = (crc<<8)^pCrcLookup[((crc>>8)^((UCHAR)FDKreadBits(hBs,8)))&0xFF];
+ crc = (crc<<8)^pCrcLookup[((crc>>8)^(FDKreadBits(hBs,8)))&0xFF];
}
}
else {
@@ -385,6 +467,7 @@ static inline INT calcCrc_Bytes(
}
*pCrc = crc; /* update crc value */
+ //fprintf(stderr, "\n\n crc[%d]=%04x\n", i, crc);
return (i);
}
@@ -420,7 +503,7 @@ static void crcCalc(
}
int bits, rBits;
- rBits = (rD->maxBits>=0) ? rD->maxBits : -rD->maxBits; /* ramaining bits */
+ rBits = (rD->maxBits>=0) ? rD->maxBits : -rD->maxBits; /* remaining bits */
if ((rD->maxBits>0) && (((INT)rD->bitBufCntBits>>3<<3)<rBits) ) {
bits = rD->bitBufCntBits;
}
@@ -454,6 +537,7 @@ static void crcCalc(
}
}
+ //fprintf(stderr, "\n\n crc=%04x\n", crc);
hCrcInfo->crcValue = crc;
}
diff --git a/libFDK/src/FDK_tools_rom.cpp b/libFDK/src/FDK_tools_rom.cpp
index f9121d1..a829485 100644
--- a/libFDK/src/FDK_tools_rom.cpp
+++ b/libFDK/src/FDK_tools_rom.cpp
@@ -2554,6 +2554,9 @@ const element_list_t * getBitstreamElementList(AUDIO_OBJECT_TYPE aot, SCHAR epCo
case AOT_AAC_LC:
case AOT_SBR:
case AOT_PS:
+ case AOT_DABPLUS_AAC_LC:
+ case AOT_DABPLUS_SBR:
+ case AOT_DABPLUS_PS:
FDK_ASSERT(epConfig == -1);
if (nChannels == 1) {
return &node_aac_sce;
diff --git a/libFDK/src/fft.cpp b/libFDK/src/fft.cpp
index 653a71a..ae3c98d 100644
--- a/libFDK/src/fft.cpp
+++ b/libFDK/src/fft.cpp
@@ -1078,7 +1078,8 @@ static inline void fft_apply_rot_vector(FIXP_DBL *RESTRICT pData, const int cl,
}
}
-#define FFT_TWO_STAGE_MACRO_ENABLE
+//FIXME:buggy for fft480
+//#define FFT_TWO_STAGE_MACRO_ENABLE
#ifdef FFT_TWO_STAGE_MACRO_ENABLE
@@ -1154,7 +1155,7 @@ static inline void fft_apply_rot_vector(FIXP_DBL *RESTRICT pData, const int cl,
#else /* FFT_TWO_STAGE_MACRO_ENABLE */
/* select either switch case of function pointer. */
-//#define FFT_TWO_STAGE_SWITCH_CASE
+#define FFT_TWO_STAGE_SWITCH_CASE
static inline void fftN2(
FIXP_DBL *pInput,
@@ -1206,7 +1207,7 @@ static inline void fftN2(
case 16: fft_16(pDst); break;
case 32: fft_32(pDst); break;
/*case 64: fft_64(pDst); break;*/
- case 128: fft_128(pDst); break;
+ /*case 128: fft_128(pDst); break;*/
}
#endif
pSrc += 2;
@@ -1245,7 +1246,7 @@ static inline void fftN2(
case 16: fft_16(pDst); break;
case 32: fft_32(pDst); break;
/*case 64: fft_64(pDst); break;*/
- case 128: fft_128(pDst); break;
+ /*case 128: fft_128(pDst); break;*/
}
#endif
diff --git a/libFDK/src/mdct.cpp b/libFDK/src/mdct.cpp
index 9a29aa1..9347a16 100644
--- a/libFDK/src/mdct.cpp
+++ b/libFDK/src/mdct.cpp
@@ -119,6 +119,9 @@ void imdct_gain(FIXP_DBL *pGain_m, int *pGain_e, int tl)
gain_e += -MDCT_OUTPUT_GAIN - log2_tl - MDCT_OUT_HEADROOM + 1;
+ FDK_ASSERT(log2_tl - 2 >= 0);
+ FDK_ASSERT(log2_tl - 2 < 8*sizeof(int));
+
/* Detect non-radix 2 transform length and add amplitude compensation factor
which cannot be included into the exponent above */
switch ( (tl) >> (log2_tl - 2) ) {