aboutsummaryrefslogtreecommitdiffstats
path: root/libFDK
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2013-12-14 17:32:17 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-09-12 14:20:53 +0200
commitbdfafd471e3c7c240b5c78e8d1233ce61f17c296 (patch)
tree4cff9d116268d3941bd328e606c15f0ee8d3a6df /libFDK
parent651ff34d8d35fb6a3b75471d54b271852f5924cc (diff)
downloadfdk-aac-bdfafd471e3c7c240b5c78e8d1233ce61f17c296.tar.gz
fdk-aac-bdfafd471e3c7c240b5c78e8d1233ce61f17c296.tar.bz2
fdk-aac-bdfafd471e3c7c240b5c78e8d1233ce61f17c296.zip
Add DAB+ support
Diffstat (limited to 'libFDK')
-rw-r--r--libFDK/src/FDK_crc.cpp49
-rw-r--r--libFDK/src/FDK_tools_rom.cpp3
-rw-r--r--libFDK/src/mdct.cpp3
3 files changed, 54 insertions, 1 deletions
diff --git a/libFDK/src/FDK_crc.cpp b/libFDK/src/FDK_crc.cpp
index e208338..ecbddb1 100644
--- a/libFDK/src/FDK_crc.cpp
+++ b/libFDK/src/FDK_crc.cpp
@@ -175,10 +175,48 @@ static const USHORT crcLookup_16_12_5_0[256] = {
0x2e93, 0x3eb2, 0x0ed1, 0x1ef0};
/**
+ * \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,
+};
+
+/**
* \brief This table defines precalculated lookup tables for crc polynom x^16
* + x^15 + x^5 + x^0.
*/
-
static const USHORT crcLookup_16_15_5_0[256] = {
0x0000, 0x8021, 0x8063, 0x0042, 0x80e7, 0x00c6, 0x0084, 0x80a5, 0x81ef,
0x01ce, 0x018c, 0x81ad, 0x0108, 0x8129, 0x816b, 0x014a, 0x83ff, 0x03de,
@@ -228,6 +266,10 @@ static void crcCalc(HANDLE_FDK_CRCINFO hCrcInfo, HANDLE_FDK_BITSTREAM hBs,
void FDKcrcInit(HANDLE_FDK_CRCINFO hCrcInfo, const UINT crcPoly,
const UINT crcStartValue, const UINT crcLen) {
/* 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^5 + x^0 (1) 1000 0000 0010 0001 -> 0x8021
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
@@ -254,6 +296,9 @@ void FDKcrcInit(HANDLE_FDK_CRCINFO hCrcInfo, const UINT crcPoly,
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 */
@@ -406,6 +451,7 @@ static inline INT calcCrc_Bytes(USHORT *const pCrc, const USHORT *pCrcLookup,
}
*pCrc = crc; /* update crc value */
+ //fprintf(stderr, "\n\n crc[%d]=%04x\n", i, crc);
return (nBytes);
}
@@ -475,5 +521,6 @@ static void crcCalc(HANDLE_FDK_CRCINFO hCrcInfo, HANDLE_FDK_BITSTREAM hBs,
}
}
+ //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 0095878..e9e1206 100644
--- a/libFDK/src/FDK_tools_rom.cpp
+++ b/libFDK/src/FDK_tools_rom.cpp
@@ -7137,6 +7137,9 @@ const element_list_t *getBitstreamElementList(AUDIO_OBJECT_TYPE aot,
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 (elFlags & AC_EL_GA_CCE) {
return &node_aac_cce;
diff --git a/libFDK/src/mdct.cpp b/libFDK/src/mdct.cpp
index d697cfb..f5aa284 100644
--- a/libFDK/src/mdct.cpp
+++ b/libFDK/src/mdct.cpp
@@ -285,6 +285,9 @@ void imdct_gain(FIXP_DBL *pGain_m, int *pGain_e, int tl) {
log2_tl = DFRACT_BITS - 1 - fNormz((FIXP_DBL)tl);
gain_e += -log2_tl;
+ 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)) {