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 --- libSBRdec/src/sbrdecoder.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'libSBRdec/src/sbrdecoder.cpp') diff --git a/libSBRdec/src/sbrdecoder.cpp b/libSBRdec/src/sbrdecoder.cpp index bed23c7..16b0bbc 100644 --- a/libSBRdec/src/sbrdecoder.cpp +++ b/libSBRdec/src/sbrdecoder.cpp @@ -137,7 +137,7 @@ amm-info@iis.fraunhofer.de /* Decoder library info */ #define SBRDECODER_LIB_VL0 2 #define SBRDECODER_LIB_VL1 2 -#define SBRDECODER_LIB_VL2 5 +#define SBRDECODER_LIB_VL2 6 #define SBRDECODER_LIB_TITLE "SBR Decoder" #define SBRDECODER_LIB_BUILD_DATE __DATE__ #define SBRDECODER_LIB_BUILD_TIME __TIME__ @@ -251,8 +251,10 @@ SBR_ERROR sbrDecoder_ResetElement ( if ( sampleRateIn == sampleRateOut ) { synDownsampleFac = 2; + self->flags |= SBRDEC_DOWNSAMPLE; } else { synDownsampleFac = 1; + self->flags &= ~SBRDEC_DOWNSAMPLE; } self->synDownsampleFac = synDownsampleFac; @@ -1582,3 +1584,34 @@ INT sbrDecoder_GetLibInfo( LIB_INFO *info ) return 0; } + +UINT sbrDecoder_GetDelay( const HANDLE_SBRDECODER self ) +{ + UINT outputDelay = 0; + + if ( self != NULL) { + UINT flags = self->flags; + + /* See chapter 1.6.7.2 of ISO/IEC 14496-3 for the GA-SBR figures below. */ + + /* Are we initialized? */ + if ( (self->numSbrChannels > 0) + && (self->numSbrElements > 0) ) + { + /* Add QMF synthesis delay */ + if ( (flags & SBRDEC_ELD_GRID) + && IS_LOWDELAY(self->coreCodec) ) { + /* Low delay SBR: */ + { + outputDelay += (flags & SBRDEC_DOWNSAMPLE) ? 32 : 64; /* QMF synthesis */ + } + } + else if (!IS_USAC(self->coreCodec)) { + /* By the method of elimination this is the GA (AAC-LC, HE-AAC, ...) branch: */ + outputDelay += (flags & SBRDEC_DOWNSAMPLE) ? 481 : 962; + } + } + } + + return (outputDelay); +} -- cgit v1.2.3