Lines Matching refs:hAacConfig

364 static inline INT isSbrActive(const HANDLE_AACENC_CONFIG hAacConfig) {  in isSbrActive()  argument
369 if ((hAacConfig->audioObjectType == AOT_SBR) || in isSbrActive()
370 (hAacConfig->audioObjectType == AOT_PS) || in isSbrActive()
371 (hAacConfig->audioObjectType == AOT_MP2_SBR)) { in isSbrActive()
374 if (hAacConfig->audioObjectType == AOT_ER_AAC_ELD && in isSbrActive()
375 (hAacConfig->syntaxFlags & AC_SBR_PRESENT)) { in isSbrActive()
462 const HANDLE_AACENC_CONFIG hAacConfig) { in H_ALLOC_MEM()
468 cc->samplesPerFrame = hAacConfig->framelength; in H_ALLOC_MEM()
469 cc->samplingRate = hAacConfig->sampleRate; in H_ALLOC_MEM()
473 switch (hAacConfig->audioObjectType) { in H_ALLOC_MEM()
482 transport_AOT = hAacConfig->audioObjectType; in H_ALLOC_MEM()
485 if (hAacConfig->audioObjectType == AOT_ER_AAC_ELD) { in H_ALLOC_MEM()
486 cc->flags |= (hAacConfig->syntaxFlags & AC_SBR_PRESENT) ? CC_SBR : 0; in H_ALLOC_MEM()
487 cc->flags |= (hAacConfig->syntaxFlags & AC_LD_MPS) ? CC_SAC : 0; in H_ALLOC_MEM()
517 if (hAacConfig->downscaleFactor > 1) { in H_ALLOC_MEM()
519 cc->samplingRate *= hAacConfig->downscaleFactor; in H_ALLOC_MEM()
520 cc->extSamplingRate *= hAacConfig->downscaleFactor; in H_ALLOC_MEM()
523 cc->bitRate = hAacConfig->bitRate; in H_ALLOC_MEM()
524 cc->noChannels = hAacConfig->nChannels; in H_ALLOC_MEM()
526 cc->channelMode = hAacConfig->channelMode; in H_ALLOC_MEM()
528 cc->nSubFrames = (hAacConfig->nSubFrames > 1 && extCfg->userTpNsubFrames == 1) in H_ALLOC_MEM()
529 ? hAacConfig->nSubFrames in H_ALLOC_MEM()
549 switch (hAacConfig->audioObjectType) { in H_ALLOC_MEM()
560 cc->flags |= (hAacConfig->syntaxFlags & AC_ER_VCB11) ? CC_VCB11 : 0; in H_ALLOC_MEM()
561 cc->flags |= (hAacConfig->syntaxFlags & AC_ER_HCR) ? CC_HCR : 0; in H_ALLOC_MEM()
562 cc->flags |= (hAacConfig->syntaxFlags & AC_ER_RVLC) ? CC_RVLC : 0; in H_ALLOC_MEM()
565 if ((extCfg->userPceAdditions & 0x1) && (hAacConfig->epConfig == -1) && in H_ALLOC_MEM()
638 AAC_ENCODER_ERROR aacEncDefaultConfig(HANDLE_AACENC_CONFIG hAacConfig, in aacEncDefaultConfig() argument
641 FDKaacEnc_AacInitDefaultConfig(hAacConfig); in aacEncDefaultConfig()
647 config->nChannels = hAacConfig->nChannels; in aacEncDefaultConfig()
648 config->userAOT = hAacConfig->audioObjectType = AOT_AAC_LC; in aacEncDefaultConfig()
649 config->userSamplerate = hAacConfig->sampleRate; in aacEncDefaultConfig()
650 config->userChannelMode = hAacConfig->channelMode; in aacEncDefaultConfig()
651 config->userBitrate = hAacConfig->bitRate; in aacEncDefaultConfig()
652 config->userBitrateMode = hAacConfig->bitrateMode; in aacEncDefaultConfig()
654 config->userBandwidth = hAacConfig->bandWidth; in aacEncDefaultConfig()
655 config->userTns = hAacConfig->useTns; in aacEncDefaultConfig()
656 config->userPns = hAacConfig->usePns; in aacEncDefaultConfig()
657 config->userIntensity = hAacConfig->useIS; in aacEncDefaultConfig()
658 config->userAfterburner = hAacConfig->useRequant; in aacEncDefaultConfig()
817 static INT FDKaacEnc_GetCBRBitrate(const HANDLE_AACENC_CONFIG hAacConfig, in FDKaacEnc_GetCBRBitrate() argument
819 INT bitrate = FDKaacEnc_GetChannelModeConfiguration(hAacConfig->channelMode) in FDKaacEnc_GetCBRBitrate()
821 hAacConfig->sampleRate; in FDKaacEnc_GetCBRBitrate()
823 if (isPsActive(hAacConfig->audioObjectType)) { in FDKaacEnc_GetCBRBitrate()
825 } else if (isSbrActive(hAacConfig)) { in FDKaacEnc_GetCBRBitrate()
828 (hAacConfig->audioObjectType != AOT_ER_AAC_ELD))) { in FDKaacEnc_GetCBRBitrate()
833 (hAacConfig->audioObjectType == AOT_ER_AAC_ELD))) { in FDKaacEnc_GetCBRBitrate()
857 HANDLE_AACENC_CONFIG hAacConfig = &hAacEncoder->aacConfig; in FDKaacEnc_AdjustEncSettings() local
860 hAacConfig->sampleRate = config->userSamplerate; in FDKaacEnc_AdjustEncSettings()
862 hAacConfig->useTns = 0; in FDKaacEnc_AdjustEncSettings()
863 hAacConfig->usePns = 0; in FDKaacEnc_AdjustEncSettings()
864 hAacConfig->useIS = 0; in FDKaacEnc_AdjustEncSettings()
866 hAacConfig->useTns = config->userTns; in FDKaacEnc_AdjustEncSettings()
867 hAacConfig->usePns = config->userPns; in FDKaacEnc_AdjustEncSettings()
868 hAacConfig->useIS = config->userIntensity; in FDKaacEnc_AdjustEncSettings()
871 hAacConfig->audioObjectType = config->userAOT; in FDKaacEnc_AdjustEncSettings()
872 hAacConfig->channelMode = in FDKaacEnc_AdjustEncSettings()
873 GetCoreChannelMode(config->userChannelMode, hAacConfig->audioObjectType); in FDKaacEnc_AdjustEncSettings()
874 hAacConfig->nChannels = in FDKaacEnc_AdjustEncSettings()
875 FDKaacEnc_GetChannelModeConfiguration(hAacConfig->channelMode)->nChannels; in FDKaacEnc_AdjustEncSettings()
876 hAacConfig->bitrateMode = (AACENC_BITRATE_MODE)config->userBitrateMode; in FDKaacEnc_AdjustEncSettings()
877 hAacConfig->bandWidth = config->userBandwidth; in FDKaacEnc_AdjustEncSettings()
878 hAacConfig->useRequant = config->userAfterburner; in FDKaacEnc_AdjustEncSettings()
880 hAacConfig->anc_Rate = config->userAncDataRate; in FDKaacEnc_AdjustEncSettings()
881 hAacConfig->syntaxFlags = 0; in FDKaacEnc_AdjustEncSettings()
882 hAacConfig->epConfig = -1; in FDKaacEnc_AdjustEncSettings()
884 if (hAacConfig->audioObjectType != AOT_ER_AAC_ELD && in FDKaacEnc_AdjustEncSettings()
900 hAacConfig->audioMuxVersion = config->userTpAmxv; in FDKaacEnc_AdjustEncSettings()
902 hAacConfig->audioMuxVersion = -1; in FDKaacEnc_AdjustEncSettings()
909 hAacConfig->usePns = 0; in FDKaacEnc_AdjustEncSettings()
916 hAacConfig->framelength = (config->userFramelength != (UINT)-1) in FDKaacEnc_AdjustEncSettings()
919 if (hAacConfig->framelength != 1024 && hAacConfig->framelength != 960) { in FDKaacEnc_AdjustEncSettings()
924 hAacConfig->epConfig = 0; in FDKaacEnc_AdjustEncSettings()
925 hAacConfig->syntaxFlags |= AC_ER | AC_LD; in FDKaacEnc_AdjustEncSettings()
926 hAacConfig->syntaxFlags |= in FDKaacEnc_AdjustEncSettings()
928 hAacConfig->syntaxFlags |= ((config->userErTools & 0x2) ? AC_ER_HCR : 0); in FDKaacEnc_AdjustEncSettings()
929 hAacConfig->syntaxFlags |= ((config->userErTools & 0x4) ? AC_ER_RVLC : 0); in FDKaacEnc_AdjustEncSettings()
932 hAacConfig->framelength = in FDKaacEnc_AdjustEncSettings()
934 if (hAacConfig->framelength != 512 && hAacConfig->framelength != 480) { in FDKaacEnc_AdjustEncSettings()
939 hAacConfig->epConfig = 0; in FDKaacEnc_AdjustEncSettings()
940 hAacConfig->syntaxFlags |= AC_ER | AC_ELD; in FDKaacEnc_AdjustEncSettings()
941 hAacConfig->syntaxFlags |= in FDKaacEnc_AdjustEncSettings()
943 hAacConfig->syntaxFlags |= ((config->userErTools & 0x2) ? AC_ER_HCR : 0); in FDKaacEnc_AdjustEncSettings()
944 hAacConfig->syntaxFlags |= ((config->userErTools & 0x4) ? AC_ER_RVLC : 0); in FDKaacEnc_AdjustEncSettings()
945 hAacConfig->syntaxFlags |= in FDKaacEnc_AdjustEncSettings()
947 hAacConfig->syntaxFlags |= in FDKaacEnc_AdjustEncSettings()
951 hAacConfig->framelength = in FDKaacEnc_AdjustEncSettings()
954 hAacConfig->downscaleFactor = config->userDownscaleFactor; in FDKaacEnc_AdjustEncSettings()
961 hAacConfig->syntaxFlags |= AC_ELD_DOWNSCALE; in FDKaacEnc_AdjustEncSettings()
967 if (hAacConfig->framelength != 512 && hAacConfig->framelength != 480 && in FDKaacEnc_AdjustEncSettings()
968 hAacConfig->framelength != 256 && hAacConfig->framelength != 240 && in FDKaacEnc_AdjustEncSettings()
969 hAacConfig->framelength != 128 && hAacConfig->framelength != 120) { in FDKaacEnc_AdjustEncSettings()
978 if ((config->userSbrRatio == 0) && (isSbrActive(hAacConfig))) { in FDKaacEnc_AdjustEncSettings()
983 if (hAacConfig->audioObjectType == AOT_ER_AAC_ELD) { in FDKaacEnc_AdjustEncSettings()
984 hAacConfig->sbrRatio = ((hAacConfig->syntaxFlags & AC_LD_MPS) && in FDKaacEnc_AdjustEncSettings()
985 (hAacConfig->sampleRate >= 27713)) in FDKaacEnc_AdjustEncSettings()
989 hAacConfig->sbrRatio = 2; in FDKaacEnc_AdjustEncSettings()
993 hAacConfig->sbrRatio = isSbrActive(hAacConfig) ? config->userSbrRatio : 0; in FDKaacEnc_AdjustEncSettings()
997 hAacConfig->bitRate = config->userBitrate; in FDKaacEnc_AdjustEncSettings()
999 switch (hAacConfig->bitrateMode) { in FDKaacEnc_AdjustEncSettings()
1003 hAacConfig->bitRate = in FDKaacEnc_AdjustEncSettings()
1004 FDKaacEnc_GetCBRBitrate(hAacConfig, config->userSbrRatio); in FDKaacEnc_AdjustEncSettings()
1006 hAacConfig->averageBits = -1; in FDKaacEnc_AdjustEncSettings()
1016 hAacConfig->bitRate = FDKaacEnc_GetVBRBitrate(hAacConfig->bitrateMode, in FDKaacEnc_AdjustEncSettings()
1017 hAacConfig->channelMode); in FDKaacEnc_AdjustEncSettings()
1024 switch (hAacConfig->bitrateMode) { in FDKaacEnc_AdjustEncSettings()
1032 hAacConfig->maxBitsPerFrame = in FDKaacEnc_AdjustEncSettings()
1034 fMax(hAacConfig->bitRate, (INT)config->userPeakBitrate), in FDKaacEnc_AdjustEncSettings()
1035 hAacConfig->framelength, hAacConfig->sampleRate) + in FDKaacEnc_AdjustEncSettings()
1039 hAacConfig->maxBitsPerFrame = -1; in FDKaacEnc_AdjustEncSettings()
1041 if (hAacConfig->audioMuxVersion == 2) { in FDKaacEnc_AdjustEncSettings()
1042 hAacConfig->minBitsPerFrame = in FDKaacEnc_AdjustEncSettings()
1043 fMin(32 * 8, FDKaacEnc_CalcBitsPerFrame(hAacConfig->bitRate, in FDKaacEnc_AdjustEncSettings()
1044 hAacConfig->framelength, in FDKaacEnc_AdjustEncSettings()
1045 hAacConfig->sampleRate)) & in FDKaacEnc_AdjustEncSettings()
1069 if (hAacConfig->maxBitsPerFrame > maxFrameLength) { in FDKaacEnc_AdjustEncSettings()
1071 } else if (hAacConfig->maxBitsPerFrame == -1) { in FDKaacEnc_AdjustEncSettings()
1072 hAacConfig->maxBitsPerFrame = maxFrameLength; in FDKaacEnc_AdjustEncSettings()
1077 if ((hAacConfig->audioObjectType == AOT_ER_AAC_ELD) && in FDKaacEnc_AdjustEncSettings()
1078 !(hAacConfig->syntaxFlags & AC_ELD_DOWNSCALE) && in FDKaacEnc_AdjustEncSettings()
1080 ((hAacConfig->syntaxFlags & AC_LD_MPS) == 0)) { in FDKaacEnc_AdjustEncSettings()
1085 FDKaacEnc_GetChannelModeConfiguration(hAacConfig->channelMode) in FDKaacEnc_AdjustEncSettings()
1087 hAacConfig->sampleRate, hAacConfig->bitRate))) { in FDKaacEnc_AdjustEncSettings()
1088 hAacConfig->syntaxFlags |= (pConfig->sbrMode == 0) ? 0 : AC_SBR_PRESENT; in FDKaacEnc_AdjustEncSettings()
1089 hAacConfig->syntaxFlags |= (pConfig->chMode == MODE_212) ? AC_LD_MPS : 0; in FDKaacEnc_AdjustEncSettings()
1090 hAacConfig->channelMode = in FDKaacEnc_AdjustEncSettings()
1091 GetCoreChannelMode(pConfig->chMode, hAacConfig->audioObjectType); in FDKaacEnc_AdjustEncSettings()
1092 hAacConfig->nChannels = in FDKaacEnc_AdjustEncSettings()
1093 FDKaacEnc_GetChannelModeConfiguration(hAacConfig->channelMode) in FDKaacEnc_AdjustEncSettings()
1095 hAacConfig->sbrRatio = in FDKaacEnc_AdjustEncSettings()
1102 getSbrSignalingMode(hAacConfig->audioObjectType, config->userTpType, in FDKaacEnc_AdjustEncSettings()
1103 config->userTpSignaling, hAacConfig->sbrRatio); in FDKaacEnc_AdjustEncSettings()
1105 if ((hAacConfig->audioObjectType == AOT_AAC_LC || in FDKaacEnc_AdjustEncSettings()
1106 hAacConfig->audioObjectType == AOT_SBR || in FDKaacEnc_AdjustEncSettings()
1107 hAacConfig->audioObjectType == AOT_PS) && in FDKaacEnc_AdjustEncSettings()
1116 if ((hAacConfig->audioObjectType == AOT_AAC_LC || in FDKaacEnc_AdjustEncSettings()
1117 hAacConfig->audioObjectType == AOT_SBR || in FDKaacEnc_AdjustEncSettings()
1118 hAacConfig->audioObjectType == AOT_PS) && in FDKaacEnc_AdjustEncSettings()
1119 (tpSignaling == 0) && (hAacConfig->sbrRatio == 1)) { in FDKaacEnc_AdjustEncSettings()
1126 switch (hAacConfig->bitrateMode) { in FDKaacEnc_AdjustEncSettings()
1134 if (0 >= (hAacConfig->bitRate = aacEncoder_LimitBitrate( in FDKaacEnc_AdjustEncSettings()
1135 NULL, hAacConfig->sampleRate, hAacConfig->framelength, in FDKaacEnc_AdjustEncSettings()
1136 hAacConfig->nChannels, hAacConfig->channelMode, in FDKaacEnc_AdjustEncSettings()
1137 hAacConfig->bitRate, hAacConfig->nSubFrames, in FDKaacEnc_AdjustEncSettings()
1138 isSbrActive(hAacConfig), hAacConfig->sbrRatio, in FDKaacEnc_AdjustEncSettings()
1139 hAacConfig->syntaxFlags, hAacConfig->audioObjectType))) { in FDKaacEnc_AdjustEncSettings()
1148 if (AACENC_BR_MODE_IS_VBR(hAacConfig->bitrateMode) /* VBR without PNS. */ in FDKaacEnc_AdjustEncSettings()
1149 || (hAacConfig->useTns == 0)) /* TNS required. */ in FDKaacEnc_AdjustEncSettings()
1151 hAacConfig->usePns = 0; in FDKaacEnc_AdjustEncSettings()
1154 if (hAacConfig->epConfig >= 0) { in FDKaacEnc_AdjustEncSettings()
1155 hAacConfig->syntaxFlags |= AC_ER; in FDKaacEnc_AdjustEncSettings()
1156 if (((INT)hAacConfig->channelMode < 1) || in FDKaacEnc_AdjustEncSettings()
1157 ((INT)hAacConfig->channelMode > 14)) { in FDKaacEnc_AdjustEncSettings()
1162 if ((hAacConfig->syntaxFlags & AC_LD_MPS) == 0) { in FDKaacEnc_AdjustEncSettings()
1163 if (FDKaacEnc_DetermineEncoderMode(&hAacConfig->channelMode, in FDKaacEnc_AdjustEncSettings()
1164 hAacConfig->nChannels) != AAC_ENC_OK) { in FDKaacEnc_AdjustEncSettings()
1170 if ((hAacConfig->nChannels > hAacEncoder->nMaxAacChannels) || in FDKaacEnc_AdjustEncSettings()
1171 ((FDKaacEnc_GetChannelModeConfiguration(hAacConfig->channelMode) in FDKaacEnc_AdjustEncSettings()
1173 isSbrActive(hAacConfig))) { in FDKaacEnc_AdjustEncSettings()
1178 switch (hAacConfig->audioObjectType) { in FDKaacEnc_AdjustEncSettings()
1186 if (!((((INT)hAacConfig->channelMode >= 1) && in FDKaacEnc_AdjustEncSettings()
1187 ((INT)hAacConfig->channelMode <= 14)) || in FDKaacEnc_AdjustEncSettings()
1188 (MODE_7_1_REAR_SURROUND == hAacConfig->channelMode) || in FDKaacEnc_AdjustEncSettings()
1189 (MODE_7_1_FRONT_CENTER == hAacConfig->channelMode))) { in FDKaacEnc_AdjustEncSettings()
1234 HANDLE_AACENC_CONFIG hAacConfig = &hAacEncoder->aacConfig; in aacEncInit() local
1238 INT frameLength = hAacConfig->framelength; in aacEncInit()
1241 CHANNEL_MODE prevChMode = hAacConfig->channelMode; in aacEncInit()
1247 frameLength = hAacConfig->framelength; /* adapt temporal framelength */ in aacEncInit()
1250 if ((prevChMode != hAacConfig->channelMode) && isSbrActive(hAacConfig)) { in aacEncInit()
1263 switch (hAacConfig->audioObjectType) { in aacEncInit()
1265 hAacEncoder->nDelay = DELAY_AACLD(hAacConfig->framelength); in aacEncInit()
1268 hAacEncoder->nDelay = DELAY_AACELD(hAacConfig->framelength); in aacEncInit()
1272 DELAY_AAC(hAacConfig->framelength); /* AAC encoder delay */ in aacEncInit()
1275 hAacConfig->ancDataBitRate = 0; in aacEncInit()
1278 if ((NULL != hAacEncoder->hEnvEnc) && isSbrActive(hAacConfig) && in aacEncInit()
1284 CHANNEL_MODE channelMode = isPsActive(hAacConfig->audioObjectType) in aacEncInit()
1286 : hAacConfig->channelMode; in aacEncInit()
1287 INT numChannels = isPsActive(hAacConfig->audioObjectType) in aacEncInit()
1289 : hAacConfig->nChannels; in aacEncInit()
1291 if (FDKaacEnc_InitChannelMapping(channelMode, hAacConfig->channelOrder, in aacEncInit()
1301 aacEncDistributeSbrBits(&channelMapping, sbrElInfo, hAacConfig->bitRate); in aacEncInit()
1310 &hAacConfig->bandWidth, &aacBufferOffset, &numChannels, in aacEncInit()
1311 hAacConfig->syntaxFlags, &hAacConfig->sampleRate, &hAacConfig->sbrRatio, in aacEncInit()
1312 &frameLength, hAacConfig->audioObjectType, &hAacEncoder->nDelay, in aacEncInit()
1313 (hAacConfig->audioObjectType == AOT_ER_AAC_ELD) ? 1 : TRANS_FAC, in aacEncInit()
1320 if ((sbrError) || (numChannels != hAacConfig->nChannels)) { in aacEncInit()
1325 hAacConfig->channelMode = MODE_1; in aacEncInit()
1329 if (hAacConfig->usePns) { in aacEncInit()
1330 hAacConfig->usePns = 0; in aacEncInit()
1334 hAacConfig->ancDataBitRate = sbrEncoder_GetEstimateBitrate(*hSbrEncoder); in aacEncInit()
1338 if ((hAacEncoder->hMpsEnc != NULL) && (hAacConfig->syntaxFlags & AC_LD_MPS)) { in aacEncInit()
1339 int coreCoderDelay = DELAY_AACELD(hAacConfig->framelength); in aacEncInit()
1341 if (isSbrActive(hAacConfig)) { in aacEncInit()
1342 coreCoderDelay = hAacConfig->sbrRatio * coreCoderDelay + in aacEncInit()
1347 FDK_MpegsEnc_Init(hAacEncoder->hMpsEnc, hAacConfig->audioObjectType, in aacEncInit()
1348 config->userSamplerate, hAacConfig->bitRate, in aacEncInit()
1349 isSbrActive(hAacConfig) ? hAacConfig->sbrRatio : 0, in aacEncInit()
1368 getSbrSignalingMode(hAacConfig->audioObjectType, config->userTpType, in aacEncInit()
1369 config->userTpSignaling, hAacConfig->sbrRatio), in aacEncInit()
1370 hAacConfig); in aacEncInit()
1394 hAacEncoder->hAacEnc, hAacConfig, hAacEncoder->hTpEnc, in aacEncInit()
1406 INT inputDataDelay = DELAY_AAC(hAacConfig->framelength); in aacEncInit()
1408 if (isSbrActive(hAacConfig) && hSbrEncoder != NULL) { in aacEncInit()
1409 inputDataDelay = hAacConfig->sbrRatio * inputDataDelay + in aacEncInit()
1418 hAacConfig->channelOrder) != 0) { in aacEncInit()
1427 if ((hAacEncoder->hMpsEnc != NULL) && (hAacConfig->syntaxFlags & AC_LD_MPS)) { in aacEncInit()
1431 } else if (isSbrActive(hAacConfig) && hSbrEncoder != NULL) { in aacEncInit()