aboutsummaryrefslogtreecommitdiffstats
path: root/libAACenc
diff options
context:
space:
mode:
Diffstat (limited to 'libAACenc')
-rw-r--r--libAACenc/include/aacenc_lib.h1
-rw-r--r--libAACenc/src/aacenc.cpp1
-rw-r--r--libAACenc/src/aacenc_lib.cpp36
-rw-r--r--libAACenc/src/aacenc_tns.cpp15
-rw-r--r--libAACenc/src/bitenc.cpp1
-rw-r--r--libAACenc/src/psy_configuration.cpp86
-rw-r--r--libAACenc/src/psy_const.h1
7 files changed, 138 insertions, 3 deletions
diff --git a/libAACenc/include/aacenc_lib.h b/libAACenc/include/aacenc_lib.h
index 307dfd4..94a506a 100644
--- a/libAACenc/include/aacenc_lib.h
+++ b/libAACenc/include/aacenc_lib.h
@@ -927,6 +927,7 @@ typedef enum
AACENC_GRANULE_LENGTH = 0x0105, /*!< Core encoder (AAC) audio frame length in samples:
- 1024: Default configuration.
+ - 960: DRM/DAB+.
- 512: Default LD/ELD configuration.
- 480: Optional length in LD/ELD configuration. */
diff --git a/libAACenc/src/aacenc.cpp b/libAACenc/src/aacenc.cpp
index 569662b..e0bda19 100644
--- a/libAACenc/src/aacenc.cpp
+++ b/libAACenc/src/aacenc.cpp
@@ -451,6 +451,7 @@ AAC_ENCODER_ERROR FDKaacEnc_Initialize(HANDLE_AAC_ENC hAacEnc,
switch (config->framelength)
{
case 1024:
+ case 960: //TODO: DRM
if ( config->audioObjectType == AOT_ER_AAC_LD
|| config->audioObjectType == AOT_ER_AAC_ELD )
{
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index 95c08b3..392a0a6 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -428,13 +428,16 @@ static void FDKaacEnc_MapConfig(
/* Map virtual aot to transport aot. */
switch (hAacConfig->audioObjectType) {
case AOT_MP2_AAC_LC:
+ case AOT_DABPLUS_AAC_LC:
transport_AOT = AOT_AAC_LC;
break;
case AOT_MP2_SBR:
+ case AOT_DABPLUS_SBR:
transport_AOT = AOT_SBR;
cc->flags |= CC_SBR;
break;
case AOT_MP2_PS:
+ case AOT_DABPLUS_PS:
transport_AOT = AOT_PS;
cc->flags |= CC_SBR;
break;
@@ -758,7 +761,7 @@ INT aacEncoder_LimitBitrate(
*
* \hAacEncoder Internal encoder config which is to be updated
* \param config User provided config (public struct)
- * \return ´returns always AAC_ENC_OK
+ * \return �returns always AAC_ENC_OK
*/
static
AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
@@ -798,10 +801,33 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
case AOT_PS:
config->userTpType = (config->userTpType!=TT_UNKNOWN) ? config->userTpType : TT_MP4_ADTS;
hAacConfig->framelength = (config->userFramelength!=(UINT)-1) ? config->userFramelength : 1024;
- if (hAacConfig->framelength != 1024) {
+ if (hAacConfig->framelength != 1024 && hAacConfig->framelength != 960) {
return AACENC_INVALID_CONFIG;
}
break;
+ case AOT_DABPLUS_SBR:
+ case AOT_DABPLUS_PS:
+ hAacConfig->syntaxFlags |= ((config->userSbrEnabled) ? AC_SBR_PRESENT : 0);
+ case AOT_DABPLUS_AAC_LC:
+ config->userTpType = (config->userTpType!=TT_UNKNOWN) ? config->userTpType : TT_MP4_RAW;
+ hAacConfig->framelength = (config->userFramelength!=(UINT)-1) ? config->userFramelength : 960;
+ if (hAacConfig->framelength != 960) {
+ return AACENC_INVALID_CONFIG;
+ }
+ break;
+#if 0
+ case AOT_ER_AAC_LC:
+ hAacConfig->epConfig = 0;
+ hAacConfig->syntaxFlags |= AC_ER;
+ hAacConfig->syntaxFlags |= ((config->userErTools & 0x1) ? AC_ER_VCB11 : 0);
+ hAacConfig->syntaxFlags |= ((config->userErTools & 0x2) ? AC_ER_HCR : 0);
+ config->userTpType = (config->userTpType!=TT_UNKNOWN) ? config->userTpType : TT_MP4_LOAS;
+ hAacConfig->framelength = (config->userFramelength!=(UINT)-1) ? config->userFramelength : 1024;
+ if (hAacConfig->framelength != 1024 && hAacConfig->framelength != 960) {
+ return AACENC_INVALID_CONFIG;
+ }
+ break;
+#endif
case AOT_ER_AAC_LD:
hAacConfig->epConfig = 0;
hAacConfig->syntaxFlags |= AC_ER|AC_LD;
@@ -1748,6 +1774,7 @@ AACENC_ERROR aacEncGetLibInfo(LIB_INFO *info)
/* Capability flags */
info[i].flags = 0
| CAPF_AAC_1024 | CAPF_AAC_LC
+ | CAPF_AAC_960
| CAPF_AAC_512
| CAPF_AAC_480
| CAPF_AAC_DRC
@@ -1780,18 +1807,22 @@ AACENC_ERROR aacEncoder_SetParam(
/* check if AOT matches the allocated modules */
switch ( value ) {
case AOT_PS:
+ case AOT_DRM_SBR: // Added mfeilen
+ case AOT_DABPLUS_PS:
case AOT_MP2_PS:
if (!(hAacEncoder->encoder_modis & (ENC_MODE_FLAG_PS))) {
err = AACENC_INVALID_CONFIG;
goto bail;
}
case AOT_SBR:
+ case AOT_DABPLUS_SBR:
case AOT_MP2_SBR:
if (!(hAacEncoder->encoder_modis & (ENC_MODE_FLAG_SBR))) {
err = AACENC_INVALID_CONFIG;
goto bail;
}
case AOT_AAC_LC:
+ case AOT_DABPLUS_AAC_LC:
case AOT_MP2_AAC_LC:
case AOT_ER_AAC_LD:
case AOT_ER_AAC_ELD:
@@ -1899,6 +1930,7 @@ AACENC_ERROR aacEncoder_SetParam(
if (settings->userFramelength != value) {
switch (value) {
case 1024:
+ case 960:
case 512:
case 480:
settings->userFramelength = value;
diff --git a/libAACenc/src/aacenc_tns.cpp b/libAACenc/src/aacenc_tns.cpp
index 85aea65..10586f5 100644
--- a/libAACenc/src/aacenc_tns.cpp
+++ b/libAACenc/src/aacenc_tns.cpp
@@ -186,6 +186,17 @@ static const TNS_MAX_TAB_ENTRY tnsMaxBandsTab1024[] =
{ 8000, { 39, 14}}
};
+static const TNS_MAX_TAB_ENTRY tnsMaxBandsTab960[] =
+{
+ { 48000, { 49, 14}},
+ { 44100, { 49, 14}},
+ { 32000, { 49, 14}},
+ { 24000, { 46, 15}},
+ { 22050, { 46, 15}},
+ { 16000, { 42, 15}},
+ { 8000, { 40, 15}}
+};
+
static const TNS_MAX_TAB_ENTRY tnsMaxBandsTab480[] =
{
{ 48000, { 31, -1}},
@@ -281,6 +292,10 @@ static INT getTnsMaxBands(
int maxBandsTabSize = 0;
switch (granuleLength) {
+ case 960:
+ pMaxBandsTab = tnsMaxBandsTab960;
+ maxBandsTabSize = sizeof(tnsMaxBandsTab960)/sizeof(TNS_MAX_TAB_ENTRY);
+ break;
case 1024:
pMaxBandsTab = tnsMaxBandsTab1024;
maxBandsTabSize = sizeof(tnsMaxBandsTab1024)/sizeof(TNS_MAX_TAB_ENTRY);
diff --git a/libAACenc/src/bitenc.cpp b/libAACenc/src/bitenc.cpp
index 8e477aa..c521cc9 100644
--- a/libAACenc/src/bitenc.cpp
+++ b/libAACenc/src/bitenc.cpp
@@ -1196,6 +1196,7 @@ AAC_ENCODER_ERROR FDKaacEnc_ChannelElementWrite( HANDLE_TRANSPORTENC hTpEnc,
case esc1_hcr:
+ //TODO: DRM!
if (syntaxFlags & AC_ER_HCR)
{
error = AAC_ENC_UNKNOWN;
diff --git a/libAACenc/src/psy_configuration.cpp b/libAACenc/src/psy_configuration.cpp
index 4393fa1..136e90a 100644
--- a/libAACenc/src/psy_configuration.cpp
+++ b/libAACenc/src/psy_configuration.cpp
@@ -119,6 +119,73 @@ static const SFB_INFO_TAB sfbInfoTab[] = {
};
+
+
+const SFB_PARAM_LONG p_FDKaacEnc_8000_long_960 = {
+ 40,
+ { 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16,
+ 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 24, 24, 24, 28,
+ 28, 32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 16 }
+};
+const SFB_PARAM_SHORT p_FDKaacEnc_8000_short_120 = {
+ 15,
+ { 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 16, 20, 12 }
+};
+
+
+const SFB_PARAM_LONG p_FDKaacEnc_16000_long_960 = {
+ 42,
+ { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24,
+ 24, 28, 28, 32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64 }
+};
+const SFB_PARAM_SHORT p_FDKaacEnc_16000_short_120 = {
+ 15,
+ { 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 12 }
+};
+
+const SFB_PARAM_LONG p_FDKaacEnc_24000_long_960 = {
+ 46,
+ { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 16, 16, 16,
+ 20, 20, 24, 24, 28, 28, 32, 36, 36, 40, 44, 48, 52, 52,
+ 64, 64, 64, 64 }
+};
+const SFB_PARAM_SHORT p_FDKaacEnc_24000_short_120 = {
+ 15,
+ { 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 12 }
+};
+
+const SFB_PARAM_SHORT p_FDKaacEnc_32000_short_120 = {
+ 14,
+ { 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16 }
+};
+
+
+const SFB_PARAM_LONG p_FDKaacEnc_48000_long_960 = {
+ 49,
+ { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8,
+ 8, 8, 8, 12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28,
+ 28, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32 }
+};
+const SFB_PARAM_SHORT p_FDKaacEnc_48000_short_120 = {
+ 14,
+ { 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 8 }
+};
+
+//TODO: add others
+static const SFB_INFO_TAB sfbInfoTab960[] = {
+ { 8000, &p_FDKaacEnc_8000_long_960, &p_FDKaacEnc_8000_short_120},
+ {16000, &p_FDKaacEnc_16000_long_960, &p_FDKaacEnc_16000_short_120},
+ {22050, &p_FDKaacEnc_24000_long_960, &p_FDKaacEnc_24000_short_120},
+ {24000, &p_FDKaacEnc_24000_long_960, &p_FDKaacEnc_24000_short_120},
+ {32000, &p_FDKaacEnc_48000_long_960, &p_FDKaacEnc_32000_short_120},
+ {44100, &p_FDKaacEnc_48000_long_960, &p_FDKaacEnc_48000_short_120},
+ {48000, &p_FDKaacEnc_48000_long_960, &p_FDKaacEnc_48000_short_120},
+};
+
+
/* 22050 and 24000 Hz */
static const SFB_PARAM_LONG p_22050_long_512 = {
31,
@@ -220,10 +287,13 @@ static AAC_ENCODER_ERROR FDKaacEnc_initSfbTable(LONG sampleRate, INT blockType,
*/
switch(granuleLength) {
case 1024:
- case 960:
sfbInfo = sfbInfoTab;
size = (INT)(sizeof(sfbInfoTab)/sizeof(SFB_INFO_TAB));
break;
+ case 960:
+ sfbInfo = sfbInfoTab960;
+ size = (INT)(sizeof(sfbInfoTab960)/sizeof(SFB_INFO_TAB));
+ break;
case 512:
sfbInfo = sfbInfoTabLD512;
size = sizeof(sfbInfoTabLD512);
@@ -307,9 +377,15 @@ static FIXP_DBL FDKaacEnc_BarcLineValue(INT noOfLines, INT fftLine, LONG samplin
case 1024:
center_freq = center_freq << 2; /* q13 */
break;
+ case 960:
+ center_freq = fMult(center_freq, INV480) << 3;
+ break;
case 128:
center_freq = center_freq << 5; /* q13 */
break;
+ case 120:
+ center_freq = fMult(center_freq, INV480) << 6;
+ break;
case 512:
center_freq = (fftLine * samplingFreq) << 3; // q13
break;
@@ -505,6 +581,14 @@ static void FDKaacEnc_initMinSnr(const LONG bitrate,
qperwin = qperwin - 9;
pePerWindow = fMult(pePerWindow, FL2FXCONST_DBL(480.f/512.f));
break;
+ case 960:
+ pePerWindow = fMult(pePerWindow, FL2FXCONST_DBL(960.f/1024.f));
+ qperwin = qperwin - 10;
+ break;
+ case 120:
+ pePerWindow = fMult(pePerWindow, FL2FXCONST_DBL(120.f/128.f));
+ qperwin = qperwin - 7;
+ break;
}
/* for short blocks it is assumed that more bits are available */
diff --git a/libAACenc/src/psy_const.h b/libAACenc/src/psy_const.h
index d9c9f43..15a69c9 100644
--- a/libAACenc/src/psy_const.h
+++ b/libAACenc/src/psy_const.h
@@ -96,6 +96,7 @@ amm-info@iis.fraunhofer.de
#define TRANS_FAC 8 /* encoder short long ratio */
+#define FRAME_LEN_LONG_960 (960)
#define FRAME_MAXLEN_SHORT ((1024)/TRANS_FAC)
#define FRAME_LEN_SHORT_128 ((1024)/TRANS_FAC)