diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2014-05-20 17:39:03 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2014-05-20 17:39:03 -0700 |
commit | 6792cf6361ff339e336287affb0bfe54bf6957a9 (patch) | |
tree | 6c4e2434c706bb4b13763a097c1ae2c160eb96c0 /libSBRdec/src/sbrdecoder.cpp | |
parent | 8e087bf394c5ceddcdb8b1d029795aff3026eea0 (diff) | |
download | fdk-aac-6792cf6361ff339e336287affb0bfe54bf6957a9.tar.gz fdk-aac-6792cf6361ff339e336287affb0bfe54bf6957a9.tar.bz2 fdk-aac-6792cf6361ff339e336287affb0bfe54bf6957a9.zip |
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
Diffstat (limited to 'libSBRdec/src/sbrdecoder.cpp')
-rw-r--r-- | libSBRdec/src/sbrdecoder.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
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); +} |