1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-06-05 22:39:13 +02:00

AAC-Decoder: SBR delay for gapless

Revise decoder output delay determination. The output delay consisted of
  concealment and limiter delay. SBR delay was not covered but must be
  considered for gapless playback delay compensation.

Bug 9428126

Change-Id: I67483712c284de9b5378694f9db7acbed2547dd7
This commit is contained in:
Jean-Michel Trivi
2014-05-20 17:39:03 -07:00
parent 8e087bf394
commit 6792cf6361
6 changed files with 60 additions and 8 deletions

View File

@ -110,7 +110,7 @@ amm-info@iis.fraunhofer.de
/* Decoder library info */
#define AACDECODER_LIB_VL0 2
#define AACDECODER_LIB_VL1 5
#define AACDECODER_LIB_VL2 9
#define AACDECODER_LIB_VL2 10
#define AACDECODER_LIB_TITLE "AAC Decoder Lib"
#define AACDECODER_LIB_BUILD_DATE __DATE__
#define AACDECODER_LIB_BUILD_TIME __TIME__
@ -954,19 +954,22 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(
if (sbrError == SBRDEC_OK) {
#define UPS_SCALE 2 /* Maximum upsampling factor is 4 (CELP+SBR) */
FIXP_DBL upsampleFactor = FL2FXCONST_DBL(1.0f/(1<<UPS_SCALE));
/* Update data in streaminfo structure. Assume that the SBR upsampling factor is either 1 or 2 */
self->flags |= AC_SBR_PRESENT;
if (self->streamInfo.aacSampleRate != self->streamInfo.sampleRate) {
if (self->streamInfo.frameSize == 768) {
self->streamInfo.frameSize = (self->streamInfo.aacSamplesPerFrame * 8) / 3;
upsampleFactor = FL2FXCONST_DBL(8.0f/(3<<UPS_SCALE));
} else {
self->streamInfo.frameSize = self->streamInfo.aacSamplesPerFrame << 1;
upsampleFactor = FL2FXCONST_DBL(2.0f/(1<<UPS_SCALE));
}
}
/* Correct the additional concealment delay figures */
self->streamInfo.outputDelay -= self->sbrParams.bsDelay * self->streamInfo.aacSamplesPerFrame;
self->streamInfo.outputDelay += self->sbrParams.bsDelay * self->streamInfo.frameSize;
/* Apply upsampling factor to both the core frame length and the core delay */
self->streamInfo.frameSize = (INT)fMult((FIXP_DBL)self->streamInfo.aacSamplesPerFrame<<UPS_SCALE, upsampleFactor);
self->streamInfo.outputDelay = (UINT)(INT)fMult((FIXP_DBL)self->streamInfo.outputDelay<<UPS_SCALE, upsampleFactor);
self->streamInfo.outputDelay += sbrDecoder_GetDelay( self->hSbrDecoder );
if (self->psPossible) {
self->flags |= AC_PS_PRESENT;