libaacplus/patches/0011-implement_lc_profile.patch
2025-07-14 16:06:46 +07:00

397 lines
11 KiB
Diff

diff -Nupr src.old/aacenc.c src.new.redone2/aacenc.c
--- src.old/aacenc.c 2025-07-13 20:56:34.301758060 +0700
+++ src.new.redone2/aacenc.c 2025-07-13 20:56:34.209753269 +0700
@@ -33,6 +33,9 @@ void AacInitDefaultConfig(aacplusEncConf
config->bitRate = 48000;
config->bandWidth = 0;
config->nSamplesPerFrame = AACENC_BLOCKSIZE;
+#if (!AACPLUS_DISABLE_PS)
+ config->heV2Override = -1;
+#endif
}
@@ -70,7 +73,7 @@ AacEncOpen ( struct AAC_ENCODER *hA
config->nChannelsOut < 1 || config->nChannelsOut > MAX_CHANNELS ||
config->nChannelsIn < config->nChannelsOut ||
(config->bitRate!=0 && (config->bitRate / config->nChannelsOut < 8000 ||
- config->bitRate / config->nChannelsOut > 160000)));
+ config->bitRate / config->nChannelsOut > 192000)));
}
/* check sample rate */
@@ -82,6 +85,7 @@ AacEncOpen ( struct AAC_ENCODER *hA
case 8000: case 11025: case 12000:
case 16000: case 22050: case 24000:
case 32000: case 44100: case 48000:
+ case 64000: case 88200: case 96000:
break;
default:
diff -Nupr src.old/aac_rom.c src.new.redone2/aac_rom.c
--- src.old/aac_rom.c 2025-07-13 20:56:34.301758060 +0700
+++ src.new.redone2/aac_rom.c 2025-07-14 15:54:40.469904744 +0700
@@ -947,6 +947,23 @@ const float pow4_3_tab[MAX_POW4_3_TABLE]
/*
+ 8000 Hz
+*/
+const unsigned char sfb_8000_long_1024[] = {
+ 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, 80
+};
+const unsigned char sfb_8000_short_128[] = {
+ 4, 4, 4, 4, 4, 4, 4, 8, 8, 8,
+ 8, 12, 16, 20, 20
+};
+
+
+
+
+/*
11025 Hz
*/
const unsigned char sfb_11025_long_1024[] = {
@@ -1034,6 +1051,113 @@ const unsigned char sfb_24000_short_128[
};
+/*
+ 32000 Hz
+*/
+const unsigned char sfb_32000_long_1024[] = {
+ 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, 32,
+ 32
+};
+const unsigned char sfb_32000_short_128[] = {
+ 4, 4, 4, 4, 4, 8, 8, 8, 12, 12,
+ 12, 16, 16, 16
+};
+
+
+
+
+/*
+ 44100 Hz
+*/
+const unsigned char sfb_44100_long_1024[] = {
+ 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, 96
+};
+const unsigned char sfb_44100_short_128[] = {
+ 4, 4, 4, 4, 4, 8, 8, 8, 12, 12,
+ 12, 16, 16, 16
+};
+
+
+
+
+/*
+ 48000 Hz
+*/
+const unsigned char sfb_48000_long_1024[] = {
+ 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, 96
+};
+const unsigned char sfb_48000_short_128[] = {
+ 4, 4, 4, 4, 4, 8, 8, 8, 12, 12,
+ 12, 16, 16, 16
+};
+
+
+
+
+/*
+ 64000 Hz
+*/
+const unsigned char sfb_64000_long_1024[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 8, 8, 8, 8, 12, 12,
+ 12, 16, 16, 16, 20, 24, 24, 28, 36, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40
+};
+const unsigned char sfb_64000_short_128[] = {
+ 4, 4, 4, 4, 4, 4, 8, 8, 8, 16,
+ 28, 36
+};
+
+
+
+
+/*
+ 88200 Hz
+*/
+const unsigned char sfb_88200_long_1024[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 8, 8, 8, 8, 8, 12,
+ 12, 12, 12, 12, 16, 16, 24, 28, 36, 44,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64
+};
+const unsigned char sfb_88200_short_128[] = {
+ 4, 4, 4, 4, 4, 4, 8, 8, 8, 16,
+ 28, 36
+};
+
+
+
+
+/*
+ 96000 Hz
+*/
+const unsigned char sfb_96000_long_1024[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 8, 8, 8, 8, 8, 12,
+ 12, 12, 12, 12, 16, 16, 24, 28, 36, 44,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64
+};
+const unsigned char sfb_96000_short_128[] = {
+ 4, 4, 4, 4, 4, 4, 8, 8, 8, 16,
+ 28, 36
+};
+
+
/*
these tables are used only for counting and
@@ -1806,13 +1930,13 @@ const TNS_CONFIG_TABULATED p_8000_stere
0.6f
};
const TNS_CONFIG_TABULATED p_16000_mono_long ={
- 1.2f,
- 2000,
+ 1.41f,
+ 2500,
16000,
0.6f
};
const TNS_CONFIG_TABULATED p_16000_mono_short ={
- 1.2f,
+ 1.41f,
3750,
16000,
0.6f
@@ -1877,12 +2001,63 @@ const TNS_CONFIG_TABULATED p_32000_stere
16000,
0.3f
};
+const TNS_CONFIG_TABULATED p_48000_mono_long ={
+ 1.41f,
+ 2500,
+ 16000,
+ 0.5f
+};
+const TNS_CONFIG_TABULATED p_48000_mono_short ={
+ 1.41f,
+ 3750,
+ 16000,
+ 0.1f
+};
+const TNS_CONFIG_TABULATED p_48000_stereo_long ={
+ 1.41f,
+ 2500,
+ 16000,
+ 0.5f
+};
+const TNS_CONFIG_TABULATED p_48000_stereo_short ={
+ 1.41f,
+ 3750,
+ 16000,
+ 0.1f
+};
+const TNS_CONFIG_TABULATED p_96000_mono_long ={
+ 1.41f,
+ 2500,
+ 16000,
+ 0.3f
+};
+const TNS_CONFIG_TABULATED p_96000_mono_short ={
+ 1.41f,
+ 3750,
+ 16000,
+ 0.1f
+};
+const TNS_CONFIG_TABULATED p_96000_stereo_long ={
+ 1.41f,
+ 2500,
+ 16000,
+ 0.3f
+};
+const TNS_CONFIG_TABULATED p_96000_stereo_short ={
+ 1.41f,
+ 3750,
+ 16000,
+ 0.1f
+};
const TNS_MAX_TAB_ENTRY
-tnsMaxBandsTab[9] = {
+tnsMaxBandsTab[12] = {
/* entry for each sampling rate
* 1 long window
* 2 short window */
+ {96000,31, 9}, /* 96000 */
+ {88200,31, 9}, /* 88200 */
+ {64000,34, 10}, /* 64000 */
{48000,40, 14}, /* 48000 */
{44100,42, 14}, /* 44100 */
{32000,51, 14}, /* 32000 */
@@ -1895,10 +2070,12 @@ tnsMaxBandsTab[9] = {
};
/* this table describes which parameter set is used for which bitrate */
-const TNS_INFO_TAB tnsInfoTab[4] = {
+const TNS_INFO_TAB tnsInfoTab[6] = {
{ 4000, 12000, &p_8000_mono_long, &p_8000_mono_short, &p_8000_stereo_long, &p_8000_stereo_short},
{ 12001, 20000, &p_16000_mono_long, &p_16000_mono_short, &p_16000_stereo_long, &p_16000_stereo_short},
{ 20001, 28000, &p_24000_mono_long, &p_24000_mono_short, &p_24000_stereo_long, &p_24000_stereo_short},
- { 28001, 44001, &p_32000_mono_long, &p_32000_mono_short, &p_32000_stereo_long, &p_32000_stereo_short},
+ { 28001, 36000, &p_32000_mono_long, &p_32000_mono_short, &p_32000_stereo_long, &p_32000_stereo_short},
+ { 36001, 52000, &p_48000_mono_long, &p_48000_mono_short, &p_48000_stereo_long, &p_48000_stereo_short},
+ { 52001, 384000, &p_96000_mono_long, &p_96000_mono_short, &p_96000_stereo_long, &p_96000_stereo_short}
};
diff -Nupr src.old/aac_rom.h src.new.redone2/aac_rom.h
--- src.old/aac_rom.h 2025-07-13 20:56:34.301758060 +0700
+++ src.new.redone2/aac_rom.h 2025-07-14 15:45:36.165624433 +0700
@@ -59,6 +59,8 @@ extern const unsigned long huff_ctabscf
misc
*/
+extern const unsigned char sfb_8000_long_1024[];
+extern const unsigned char sfb_8000_short_128[];
extern const unsigned char sfb_11025_long_1024[];
extern const unsigned char sfb_11025_short_128[];
extern const unsigned char sfb_12000_long_1024[];
@@ -69,12 +71,25 @@ extern const unsigned char sfb_22050_lon
extern const unsigned char sfb_22050_short_128[];
extern const unsigned char sfb_24000_long_1024[];
extern const unsigned char sfb_24000_short_128[];
+extern const unsigned char sfb_32000_long_1024[];
+extern const unsigned char sfb_32000_short_128[];
+extern const unsigned char sfb_44100_long_1024[];
+extern const unsigned char sfb_44100_short_128[];
+extern const unsigned char sfb_48000_long_1024[];
+extern const unsigned char sfb_48000_short_128[];
+extern const unsigned char sfb_64000_long_1024[];
+extern const unsigned char sfb_64000_short_128[];
+extern const unsigned char sfb_88200_long_1024[];
+extern const unsigned char sfb_88200_short_128[];
+extern const unsigned char sfb_96000_long_1024[];
+extern const unsigned char sfb_96000_short_128[];
+
/*
TNS
*/
-extern const TNS_MAX_TAB_ENTRY tnsMaxBandsTab[9];
+extern const TNS_MAX_TAB_ENTRY tnsMaxBandsTab[12];
extern const TNS_CONFIG_TABULATED p_8000_mono_long;
extern const TNS_CONFIG_TABULATED p_8000_mono_short;
extern const TNS_CONFIG_TABULATED p_8000_stereo_long;
@@ -91,7 +106,15 @@ extern const TNS_CONFIG_TABULATED p_320
extern const TNS_CONFIG_TABULATED p_32000_mono_short;
extern const TNS_CONFIG_TABULATED p_32000_stereo_long;
extern const TNS_CONFIG_TABULATED p_32000_stereo_short;
-extern const TNS_INFO_TAB tnsInfoTab[4];
+extern const TNS_CONFIG_TABULATED p_48000_mono_long;
+extern const TNS_CONFIG_TABULATED p_48000_mono_short;
+extern const TNS_CONFIG_TABULATED p_48000_stereo_long;
+extern const TNS_CONFIG_TABULATED p_48000_stereo_short;
+extern const TNS_CONFIG_TABULATED p_96000_mono_long;
+extern const TNS_CONFIG_TABULATED p_96000_mono_short;
+extern const TNS_CONFIG_TABULATED p_96000_stereo_long;
+extern const TNS_CONFIG_TABULATED p_96000_stereo_short;
+extern const TNS_INFO_TAB tnsInfoTab[6];
extern const float tnsCoeff3[8];
extern const float tnsCoeff3Borders[8];
diff -Nupr src.old/code_env.c src.new.redone2/code_env.c
--- src.old/code_env.c 2025-07-13 20:56:34.321759101 +0700
+++ src.new.redone2/code_env.c 2025-07-13 20:56:34.229754310 +0700
@@ -364,10 +364,14 @@ computeBits (int delta,
if (index != delta) {
+ fprintf(stderr, "SBR delta %d != %d\n", index, delta);
+
+ /*
assert(0);
return (10000);
+ */
}
@@ -382,10 +386,14 @@ computeBits (int delta,
if (index != delta) {
+ fprintf(stderr, "SBR delta %d != %d\n", index, delta);
+
+ /*
assert(0);
return (10000);
+ */
}
@@ -401,10 +409,14 @@ computeBits (int delta,
if (index != delta) {
+ fprintf(stderr, "SBR delta %d != %d\n", index, delta);
+
+ /*
assert(0);
return (10000);
+ */
}
diff -Nupr src.old/psy_configuration.c src.new.redone2/psy_configuration.c
--- src.old/psy_configuration.c 2025-07-13 20:56:34.329759518 +0700
+++ src.new.redone2/psy_configuration.c 2025-07-13 20:56:34.233754518 +0700
@@ -23,12 +23,19 @@ static const float BARC_THR_QUIET[] = {1
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3.0f, 5.0f, 10.0f, 20.0f, 30.0f};
-static const SFB_INFO_TAB sfbInfoTab[] ={
+static const SFB_INFO_TAB sfbInfoTab[] = {
+ {8000, sfb_8000_long_1024, sfb_8000_short_128},
{11025, sfb_11025_long_1024, sfb_11025_short_128},
{12000, sfb_12000_long_1024, sfb_12000_short_128},
{16000, sfb_16000_long_1024, sfb_16000_short_128},
{22050, sfb_22050_long_1024, sfb_22050_short_128},
- {24000, sfb_24000_long_1024, sfb_24000_short_128}
+ {24000, sfb_24000_long_1024, sfb_24000_short_128},
+ {32000, sfb_32000_long_1024, sfb_32000_short_128},
+ {44100, sfb_44100_long_1024, sfb_44100_short_128},
+ {48000, sfb_48000_long_1024, sfb_48000_short_128},
+ {64000, sfb_64000_long_1024, sfb_64000_short_128},
+ {88200, sfb_88200_long_1024, sfb_88200_short_128},
+ {96000, sfb_96000_long_1024, sfb_96000_short_128},
};