aboutsummaryrefslogtreecommitdiffstats
path: root/libAACenc/src
diff options
context:
space:
mode:
authorFraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de>2019-12-19 17:23:56 +0100
committerJean-Michel Trivi <jmtrivi@google.com>2020-02-13 14:41:18 -0800
commit6b0aab087dd4230e2e64f0fdc4656276c00e22bc (patch)
tree2d2f7fffe4394ac4fee8554f4ea3d4942b4789e0 /libAACenc/src
parent7b5389e63fb048932f27f621c59005071efa3741 (diff)
downloadfdk-aac-6b0aab087dd4230e2e64f0fdc4656276c00e22bc.tar.gz
fdk-aac-6b0aab087dd4230e2e64f0fdc4656276c00e22bc.tar.bz2
fdk-aac-6b0aab087dd4230e2e64f0fdc4656276c00e22bc.zip
Fix SBR encoder element mapping for channel configurations with more than one layer
Bug: 149489652 Test: atest android.media.cts.EncoderTest#testAACEncoders Change-Id: I8cd9e7f9aaeb62629f916f8d0dba7422d9a5e878
Diffstat (limited to 'libAACenc/src')
-rw-r--r--libAACenc/src/aacenc_lib.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index 0f0094f..15b06bd 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -446,6 +446,24 @@ static SBR_PS_SIGNALING getSbrSignalingMode(
return sbrSignaling;
}
+static inline INT getAssociatedChElement(SBR_ELEMENT_INFO *elInfoSbr,
+ CHANNEL_MAPPING *channelMapping) {
+ ELEMENT_INFO *elInfo = channelMapping->elInfo;
+ INT nElements = channelMapping->nElements;
+ INT associatedChElement = -1;
+ int i;
+
+ for (i = 0; i < nElements; i++) {
+ if (elInfoSbr->elType == elInfo[i].elType &&
+ elInfoSbr->instanceTag == elInfo[i].instanceTag) {
+ associatedChElement = i;
+ break;
+ }
+ }
+
+ return associatedChElement;
+}
+
/****************************************************************************
Allocate Encoder
****************************************************************************/
@@ -1921,7 +1939,15 @@ AACENC_ERROR aacEncEncode(const HANDLE_AACENCODER hAacEncoder,
{
hAacEncoder->extPayload[nExtensions].dataSize =
hAacEncoder->pSbrPayload->dataSize[nPayload][i];
- hAacEncoder->extPayload[nExtensions].associatedChElement = i;
+ hAacEncoder->extPayload[nExtensions].associatedChElement =
+ getAssociatedChElement(
+ &hAacEncoder->hEnvEnc->sbrElement[i]->elInfo,
+ &hAacEncoder->hAacEnc->channelMapping);
+ if (hAacEncoder->extPayload[nExtensions].associatedChElement ==
+ -1) {
+ err = AACENC_ENCODE_ERROR;
+ goto bail;
+ }
}
hAacEncoder->extPayload[nExtensions].dataType =
EXT_SBR_DATA; /* Once SBR Encoder supports SBR CRC set