From 47c680c62246594107da0a8995c953dfb8040bce Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Fri, 27 Dec 2013 16:13:22 -0800 Subject: AAC Decoder: support 6.1/7.1 decoded as 5.1 - Add 6.1 and 7.1 channel support including downmixer. Per default the decoder creates a 5.1 channel output for all streams with more than six encoded channels. Modified file(s): libPCMutils/include/pcmutils_lib.h libPCMutils/src/pcmutils_lib.cpp libAACdec/include/aacdecoder_lib.h libAACdec/src/aac_rom.h libAACdec/src/aacdecoder.cpp libAACdec/src/aac_ram.cpp libAACdec/src/aacdec_drc.cpp libAACdec/src/aacdecoder_lib.cpp libAACdec/src/aac_rom.cpp libAACdec/src/aacdecoder.h libSBRdec/include/sbrdecoder.h libSBRdec/src/sbrdec_drc.h libSBRdec/src/sbrdecoder.cpp libSBRdec/src/sbr_ram.cpp libSBRdec/src/sbr_ram.h libMpegTPDec/include/tp_data.h libMpegTPDec/include/tpdec_lib.h libMpegTPDec/src/version libMpegTPDec/src/tpdec_asc.cpp libMpegTPEnc/include/tp_data.h libMpegTPEnc/src/version libSYS/include/FDK_audio.h libSYS/src/genericStds.cpp - Fix error concealment modules fade-out/in mechanism. Modified file(s): libAACdec/src/conceal.cpp Bug 9428126 Change-Id: I3230bd2072314b730911cd7ec1740e290cb1d254 --- libSYS/include/FDK_audio.h | 32 ++++++++++++++++++++++---------- libSYS/src/genericStds.cpp | 2 +- 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'libSYS') diff --git a/libSYS/include/FDK_audio.h b/libSYS/include/FDK_audio.h index c8d9c19..97770a7 100644 --- a/libSYS/include/FDK_audio.h +++ b/libSYS/include/FDK_audio.h @@ -263,17 +263,29 @@ typedef enum { } CHANNEL_MODE; -/** Speaker description tags */ +/** + * Speaker description tags. + * Do not change the enumeration values unless it keeps the following segmentation: + * - Bit 0-3: Horizontal postion (0: none, 1: front, 2: side, 3: back, 4: lfe) + * - Bit 4-7: Vertical position (0: normal, 1: top, 2: bottom) + */ typedef enum { - ACT_NONE, - ACT_FRONT, - ACT_SIDE, - ACT_BACK, - ACT_LFE, - ACT_FRONT_TOP, - ACT_SIDE_TOP, - ACT_BACK_TOP, - ACT_TOP /* Ts */ + ACT_NONE = 0x00, + ACT_FRONT = 0x01, /*!< Front speaker position (at normal height) */ + ACT_SIDE = 0x02, /*!< Side speaker position (at normal height) */ + ACT_BACK = 0x03, /*!< Back speaker position (at normal height) */ + ACT_LFE = 0x04, /*!< Low frequency effect speaker postion (front) */ + + ACT_TOP = 0x10, /*!< Top speaker area (for combination with speaker positions) */ + ACT_FRONT_TOP = 0x11, /*!< Top front speaker = (ACT_FRONT|ACT_TOP) */ + ACT_SIDE_TOP = 0x12, /*!< Top side speaker = (ACT_SIDE |ACT_TOP) */ + ACT_BACK_TOP = 0x13, /*!< Top back speaker = (ACT_BACK |ACT_TOP) */ + + ACT_BOTTOM = 0x20, /*!< Bottom speaker area (for combination with speaker positions) */ + ACT_FRONT_BOTTOM = 0x21, /*!< Bottom front speaker = (ACT_FRONT|ACT_BOTTOM) */ + ACT_SIDE_BOTTOM = 0x22, /*!< Bottom side speaker = (ACT_SIDE |ACT_BOTTOM) */ + ACT_BACK_BOTTOM = 0x23 /*!< Bottom back speaker = (ACT_BACK |ACT_BOTTOM) */ + } AUDIO_CHANNEL_TYPE; typedef enum diff --git a/libSYS/src/genericStds.cpp b/libSYS/src/genericStds.cpp index f0199fb..e67db38 100644 --- a/libSYS/src/genericStds.cpp +++ b/libSYS/src/genericStds.cpp @@ -99,7 +99,7 @@ amm-info@iis.fraunhofer.de /* library info */ #define SYS_LIB_VL0 1 #define SYS_LIB_VL1 3 -#define SYS_LIB_VL2 4 +#define SYS_LIB_VL2 5 #define SYS_LIB_TITLE "System Integration Library" #define SYS_LIB_BUILD_DATE __DATE__ #define SYS_LIB_BUILD_TIME __TIME__ -- cgit v1.2.3 From f2f96fb86d42396716b3e556da7a930956e712fb Mon Sep 17 00:00:00 2001 From: Marcus Oakland Date: Mon, 24 Feb 2014 14:48:50 +0000 Subject: AArch64: Make LONG 4 bytes The libSYS/include/machine_type.h header file states LONG should be "Data type representing 4 byte signed integer on all supported platforms" but only provided for defining LONG as INT and ULONG as UINT when __x86_64__ was defined. This has been changed to when __LP64__ is defined, so that it also applies to AArch64. The change to libFDK/include/common_fix.h is then needed to get the project to compile. Change-Id: Iea42d7eca97dcc9da772a05b207d134cb999a72a Signed-off-by: Marcus Oakland --- libFDK/include/common_fix.h | 4 ++-- libSYS/include/machine_type.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'libSYS') diff --git a/libFDK/include/common_fix.h b/libFDK/include/common_fix.h index 79c87ac..d2d11f4 100644 --- a/libFDK/include/common_fix.h +++ b/libFDK/include/common_fix.h @@ -226,7 +226,7 @@ FDK_INLINE FIXP_SGL fAbs(FIXP_SGL x) { return fixabs_S(x); } /* workaround for TI C6x compiler but not for TI ARM9E compiler */ -#if (!defined(__TI_COMPILER_VERSION__) || defined(__TI_TMS470_V5__)) && !defined(__x86_64__) +#if (!defined(__TI_COMPILER_VERSION__) || defined(__TI_TMS470_V5__)) && !defined(__LP64__) FDK_INLINE INT fAbs(INT x) { return fixabs_I(x); } #endif @@ -336,7 +336,7 @@ FDK_INLINE FIXP_SGL fMax(FIXP_SGL a, FIXP_SGL b) { return fixmax_S(a,b); } /* workaround for TI C6x compiler but not for TI ARM9E */ -#if ((!defined(__TI_COMPILER_VERSION__) || defined(__TI_TMS470_V5__)) && !defined(__x86_64__)) || (FIX_FRACT == 1) +#if ((!defined(__TI_COMPILER_VERSION__) || defined(__TI_TMS470_V5__)) && !defined(__LP64__)) || (FIX_FRACT == 1) FDK_INLINE INT fMax(INT a, INT b) { return fixmax_I(a,b); } FDK_INLINE INT fMin(INT a, INT b) diff --git a/libSYS/include/machine_type.h b/libSYS/include/machine_type.h index 4745e43..b328953 100644 --- a/libSYS/include/machine_type.h +++ b/libSYS/include/machine_type.h @@ -154,15 +154,15 @@ amm-info@iis.fraunhofer.de typedef signed int INT; typedef unsigned int UINT; -#ifdef __x86_64__ +#ifdef __LP64__ /* force FDK long-datatypes to 4 byte */ /* jdr: Use defines to avoid type alias problems on 64 bit machines. */ #define LONG INT #define ULONG UINT -#else /* __x86_64__ */ +#else /* __LP64__ */ typedef signed long LONG; typedef unsigned long ULONG; -#endif /* __x86_64__ */ +#endif /* __LP64__ */ typedef signed short SHORT; typedef unsigned short USHORT; typedef signed char SCHAR; -- cgit v1.2.3 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 +++++++++------ libSBRdec/include/sbrdecoder.h | 7 +++++++ libSBRdec/src/env_extr.h | 1 + libSBRdec/src/sbrdecoder.cpp | 35 ++++++++++++++++++++++++++++++++++- libSYS/include/FDK_audio.h | 8 ++++++++ libSYS/src/genericStds.cpp | 2 +- 6 files changed, 60 insertions(+), 8 deletions(-) (limited to 'libSYS') 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; diff --git a/libSBRdec/include/sbrdecoder.h b/libSBRdec/include/sbrdecoder.h index 36a4739..174fb5c 100644 --- a/libSBRdec/include/sbrdecoder.h +++ b/libSBRdec/include/sbrdecoder.h @@ -331,6 +331,13 @@ SBR_ERROR sbrDecoder_Close ( HANDLE_SBRDECODER *self ); */ INT sbrDecoder_GetLibInfo( LIB_INFO *info ); +/** + * \brief Determine the modules output signal delay in samples. + * \param self SBR decoder handle. + * \return The number of samples signal delay added by the module. + */ +UINT sbrDecoder_GetDelay( const HANDLE_SBRDECODER self ); + #ifdef __cplusplus } 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); +} diff --git a/libSYS/include/FDK_audio.h b/libSYS/include/FDK_audio.h index 97770a7..0660f4c 100644 --- a/libSYS/include/FDK_audio.h +++ b/libSYS/include/FDK_audio.h @@ -232,6 +232,14 @@ typedef enum } AUDIO_OBJECT_TYPE; +#define IS_USAC(aot) \ + ((aot) == AOT_USAC \ +|| (aot) == AOT_RSVD50) + +#define IS_LOWDELAY(aot) \ + ((aot) == AOT_ER_AAC_LD \ +|| (aot) == AOT_ER_AAC_ELD) + /** Channel Mode ( 1-7 equals MPEG channel configurations, others are arbitrary). */ typedef enum { MODE_INVALID = -1, diff --git a/libSYS/src/genericStds.cpp b/libSYS/src/genericStds.cpp index e67db38..3381e37 100644 --- a/libSYS/src/genericStds.cpp +++ b/libSYS/src/genericStds.cpp @@ -99,7 +99,7 @@ amm-info@iis.fraunhofer.de /* library info */ #define SYS_LIB_VL0 1 #define SYS_LIB_VL1 3 -#define SYS_LIB_VL2 5 +#define SYS_LIB_VL2 6 #define SYS_LIB_TITLE "System Integration Library" #define SYS_LIB_BUILD_DATE __DATE__ #define SYS_LIB_BUILD_TIME __TIME__ -- cgit v1.2.3