aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRdec/src/env_dec.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2019-01-21 15:54:25 +0200
committerMartin Storsjo <martin@martin.st>2019-01-21 15:54:25 +0200
commit02103fd6308a40c58013d8ec8610ad8a71075aca (patch)
tree77e30d296d5cec1f24b5c0e03b49f197d5bf080e /libSBRdec/src/env_dec.cpp
parent2326faaf8f2cdf2c3a9108ccdaf1d7551aec543e (diff)
parented56e77acb1ca4524bf49d9cdec7d11a51f5134d (diff)
downloadfdk-aac-02103fd6308a40c58013d8ec8610ad8a71075aca.tar.gz
fdk-aac-02103fd6308a40c58013d8ec8610ad8a71075aca.tar.bz2
fdk-aac-02103fd6308a40c58013d8ec8610ad8a71075aca.zip
Merge remote-tracking branch 'aosp/master'
Diffstat (limited to 'libSBRdec/src/env_dec.cpp')
-rw-r--r--libSBRdec/src/env_dec.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/libSBRdec/src/env_dec.cpp b/libSBRdec/src/env_dec.cpp
index 88c92cd..95807c9 100644
--- a/libSBRdec/src/env_dec.cpp
+++ b/libSBRdec/src/env_dec.cpp
@@ -435,8 +435,8 @@ static void leanSbrConcealment(
/* Noisefloor levels are always cleared ... */
h_sbr_data->domain_vec_noise[0] = 1;
- for (i = 0; i < hHeaderData->freqBandData.nNfb; i++)
- h_sbr_data->sbrNoiseFloorLevel[i] = FL2FXCONST_SGL(0.0f);
+ FDKmemclear(h_sbr_data->sbrNoiseFloorLevel,
+ sizeof(h_sbr_data->sbrNoiseFloorLevel));
/* ... and so are the sines */
FDKmemclear(h_sbr_data->addHarmonics,
@@ -506,15 +506,20 @@ static void decodeEnvelope(
*/
for (i = 0; i < hHeaderData->freqBandData.nSfb[1]; i++) {
/* Former Level-Channel will be used for both channels */
- if (h_prev_data->coupling == COUPLING_BAL)
- h_prev_data->sfb_nrg_prev[i] = otherChannel->sfb_nrg_prev[i];
+ if (h_prev_data->coupling == COUPLING_BAL) {
+ h_prev_data->sfb_nrg_prev[i] =
+ (otherChannel != NULL) ? otherChannel->sfb_nrg_prev[i]
+ : (FIXP_SGL)SBR_ENERGY_PAN_OFFSET;
+ }
/* Former L/R will be combined as the new Level-Channel */
- else if (h_sbr_data->coupling == COUPLING_LEVEL)
+ else if (h_sbr_data->coupling == COUPLING_LEVEL &&
+ otherChannel != NULL) {
h_prev_data->sfb_nrg_prev[i] = (h_prev_data->sfb_nrg_prev[i] +
otherChannel->sfb_nrg_prev[i]) >>
1;
- else if (h_sbr_data->coupling == COUPLING_BAL)
+ } else if (h_sbr_data->coupling == COUPLING_BAL) {
h_prev_data->sfb_nrg_prev[i] = (FIXP_SGL)SBR_ENERGY_PAN_OFFSET;
+ }
}
}
}