summaryrefslogtreecommitdiffstats
path: root/libAACenc/src/psy_configuration.cpp
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>2013-12-14 17:32:17 +0100
commitee7be955947a0a591f42641419bf4a88953a77fb (patch)
treeef422756ae45ec9db4280bb0585f66a7beca72ef /libAACenc/src/psy_configuration.cpp
parent2f29dd48d02d402169246e3c7f9256869817392a (diff)
downloadfdk-aac-ee7be955947a0a591f42641419bf4a88953a77fb.tar.gz
fdk-aac-ee7be955947a0a591f42641419bf4a88953a77fb.tar.bz2
fdk-aac-ee7be955947a0a591f42641419bf4a88953a77fb.zip
Apply piratfm's first commit
It's the patch from commit e969ea8 AAC960 works now. All modes: LC/SBR/PS. Only for DAB+, not DRM. without the copyright headers that create a ton of merge conficts
Diffstat (limited to 'libAACenc/src/psy_configuration.cpp')
-rw-r--r--libAACenc/src/psy_configuration.cpp86
1 files changed, 85 insertions, 1 deletions
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 */