summaryrefslogtreecommitdiffstats
path: root/fdk-aac/libSBRenc/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2024-01-05 19:05:48 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2024-01-05 19:05:48 +0100
commit28ec47d8887f43ba54d79dd6d738aef1ff0ec9b9 (patch)
tree36714366ee8883927f57e096490c209d8317ee99 /fdk-aac/libSBRenc/src
parentc573d3e3cfa9afe42bb3aafae17d527a7f608d55 (diff)
downloadODR-AudioEnc-28ec47d8887f43ba54d79dd6d738aef1ff0ec9b9.tar.gz
ODR-AudioEnc-28ec47d8887f43ba54d79dd6d738aef1ff0ec9b9.tar.bz2
ODR-AudioEnc-28ec47d8887f43ba54d79dd6d738aef1ff0ec9b9.zip
Update fdk-aac to v2.0.3
Diffstat (limited to 'fdk-aac/libSBRenc/src')
-rw-r--r--fdk-aac/libSBRenc/src/env_est.cpp26
-rw-r--r--fdk-aac/libSBRenc/src/sbr_encoder.cpp5
2 files changed, 19 insertions, 12 deletions
diff --git a/fdk-aac/libSBRenc/src/env_est.cpp b/fdk-aac/libSBRenc/src/env_est.cpp
index 4af561b..3936d88 100644
--- a/fdk-aac/libSBRenc/src/env_est.cpp
+++ b/fdk-aac/libSBRenc/src/env_est.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -637,8 +637,8 @@ static FIXP_DBL getEnvSfbEnergy(
for (; l < stop_pos; l++) {
nrg2 += YBuffer[l >> YBufferSzShift][k] >> sc1;
}
- accu1 += (nrg1 >> dynScale1);
- accu2 += (nrg2 >> dynScale2);
+ accu1 = fAddSaturate(accu1, (nrg1 >> dynScale1));
+ accu2 = fAddSaturate(accu2, (nrg2 >> dynScale2));
}
/* This shift factor is always positive. See comment above. */
nrgSum +=
@@ -1268,6 +1268,7 @@ void FDKsbrEnc_extractSbrEnvelope2(
sbrExtrEnv->pre_transient_info[1] = ed->transient_info[1]; /* tran_flag */
hEnvChan->encEnvData.noOfEnvelopes = ed->nEnvelopes =
ed->frame_info->nEnvelopes; /* number of envelopes of current frame */
+ hEnvChan->encEnvData.currentAmpResFF = (AMP_RES)h_con->initAmpResFF;
/*
Check if the current frame is divided into one envelope only. If so, set
@@ -1275,8 +1276,9 @@ void FDKsbrEnc_extractSbrEnvelope2(
*/
if ((hEnvChan->encEnvData.hSbrBSGrid->frameClass == FIXFIX) &&
(ed->nEnvelopes == 1)) {
+ AMP_RES currentAmpResFF = SBR_AMP_RES_1_5;
if (h_con->sbrSyntaxFlags & SBR_SYNTAX_LOW_DELAY) {
- /* Note: global_tonaliy_float_value ==
+ /* Note: global_tonality_float_value ==
((float)hEnvChan->encEnvData.global_tonality/((INT64)(1)<<(31-(19+2)))/0.524288*(2.0/3.0)));
threshold_float_value ==
((float)h_con->thresholdAmpResFF_m/((INT64)(1)<<(31-(h_con->thresholdAmpResFF_e)))/0.524288*(2.0/3.0)));
@@ -1290,14 +1292,13 @@ void FDKsbrEnc_extractSbrEnvelope2(
} else {
hEnvChan->encEnvData.currentAmpResFF = SBR_AMP_RES_3_0;
}
- } else
- hEnvChan->encEnvData.currentAmpResFF = SBR_AMP_RES_1_5;
+ currentAmpResFF = hEnvChan->encEnvData.currentAmpResFF;
+ }
- if (hEnvChan->encEnvData.currentAmpResFF !=
- hEnvChan->encEnvData.init_sbr_amp_res) {
+ if (currentAmpResFF != hEnvChan->encEnvData.init_sbr_amp_res) {
FDKsbrEnc_InitSbrHuffmanTables(
&hEnvChan->encEnvData, &hEnvChan->sbrCodeEnvelope,
- &hEnvChan->sbrCodeNoiseFloor, hEnvChan->encEnvData.currentAmpResFF);
+ &hEnvChan->sbrCodeNoiseFloor, currentAmpResFF);
}
} else {
if (sbrHeaderData->sbr_amp_res != hEnvChan->encEnvData.init_sbr_amp_res) {
@@ -1356,6 +1357,13 @@ void FDKsbrEnc_extractSbrEnvelope2(
}
}
+ if (h_con->sbrSyntaxFlags & SBR_SYNTAX_LOW_DELAY &&
+ stereoMode == SBR_SWITCH_LRC &&
+ h_envChan[0]->encEnvData.currentAmpResFF !=
+ h_envChan[1]->encEnvData.currentAmpResFF) {
+ stereoMode = SBR_LEFT_RIGHT;
+ }
+
/*
Extract envelope of current frame.
*/
diff --git a/fdk-aac/libSBRenc/src/sbr_encoder.cpp b/fdk-aac/libSBRenc/src/sbr_encoder.cpp
index e495dea..048c734 100644
--- a/fdk-aac/libSBRenc/src/sbr_encoder.cpp
+++ b/fdk-aac/libSBRenc/src/sbr_encoder.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -1450,8 +1450,6 @@ static INT initEnvChannel(HANDLE_SBR_CONFIG_DATA sbrConfigData,
params->deltaTAcrossFrames, 0, 0))
return (1);
- sbrConfigData->initAmpResFF = params->init_amp_res_FF;
-
if (FDKsbrEnc_InitSbrHuffmanTables(&hEnv->encEnvData, &hEnv->sbrCodeEnvelope,
&hEnv->sbrCodeNoiseFloor,
sbrHeaderData->sbr_amp_res))
@@ -1749,6 +1747,7 @@ static INT FDKsbrEnc_EnvInit(HANDLE_SBR_ELEMENT hSbrElement,
hSbrElement->sbrHeaderData.sbr_data_extra = 1;
hSbrElement->sbrHeaderData.sbr_amp_res = (AMP_RES)params->amp_res;
+ hSbrElement->sbrConfigData.initAmpResFF = params->init_amp_res_FF;
/* header_extra_1 */
hSbrElement->sbrHeaderData.freqScale = params->freqScale;