From 6792cf6361ff339e336287affb0bfe54bf6957a9 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Tue, 20 May 2014 17:39:03 -0700 Subject: 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 --- libAACdec/src/aacdecoder_lib.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'libAACdec/src/aacdecoder_lib.cpp') diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp index 8e3027a..82f85ab 100644 --- a/libAACdec/src/aacdecoder_lib.cpp +++ b/libAACdec/src/aacdecoder_lib.cpp @@ -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<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<streamInfo.frameSize = self->streamInfo.aacSamplesPerFrame << 1; + upsampleFactor = FL2FXCONST_DBL(2.0f/(1<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<streamInfo.outputDelay = (UINT)(INT)fMult((FIXP_DBL)self->streamInfo.outputDelay<streamInfo.outputDelay += sbrDecoder_GetDelay( self->hSbrDecoder ); if (self->psPossible) { self->flags |= AC_PS_PRESENT; -- cgit v1.2.3