summaryrefslogtreecommitdiffstats
path: root/libSBRdec/src
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2014-05-20 17:39:03 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2014-05-20 17:39:03 -0700
commit6792cf6361ff339e336287affb0bfe54bf6957a9 (patch)
tree6c4e2434c706bb4b13763a097c1ae2c160eb96c0 /libSBRdec/src
parent8e087bf394c5ceddcdb8b1d029795aff3026eea0 (diff)
downloadfdk-aac-dabplus-6792cf6361ff339e336287affb0bfe54bf6957a9.tar.gz
fdk-aac-dabplus-6792cf6361ff339e336287affb0bfe54bf6957a9.tar.bz2
fdk-aac-dabplus-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')
-rw-r--r--libSBRdec/src/env_extr.h1
-rw-r--r--libSBRdec/src/sbrdecoder.cpp35
2 files changed, 35 insertions, 1 deletions
diff --git a/libSBRdec/src/env_extr.h b/libSBRdec/src/env_extr.h
index ddbfa18..ab6b704 100644
--- a/libSBRdec/src/env_extr.h
+++ b/libSBRdec/src/env_extr.h
@@ -179,6 +179,7 @@ typedef FREQ_BAND_DATA *HANDLE_FREQ_BAND_DATA;
#define SBRDEC_LOW_POWER 16 /* Flag indicating that Low Power QMF mode shall be used. */
#define SBRDEC_PS_DECODED 32 /* Flag indicating that PS was decoded and rendered. */
#define SBRDEC_LD_MPS_QMF 512 /* Flag indicating that the LD-MPS QMF shall be used. */
+#define SBRDEC_DOWNSAMPLE 8192 /* Flag indicating that the downsampling mode is used. */
#define SBRDEC_FLUSH 16384 /* Flag is used to flush all elements in use. */
#define SBRDEC_FORCE_RESET 32768 /* Flag is used to force a reset of all elements in use. */
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);
+}