Lines Matching refs:hAacEncoder
735 * \hAacEncoder Internal encoder config which is to be updated
740 AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
746 HANDLE_AACENC_CONFIG hAacConfig = &hAacEncoder->aacConfig;
962 if ( (hAacConfig->nChannels > hAacEncoder->nMaxAacChannels)
963 || ( (FDKaacEnc_GetChannelModeConfiguration(hAacConfig->channelMode)->nChannelsEff > hAacEncoder->nMaxSbrChannels) &&
977 hAacEncoder->metaDataAllowed = 1;
984 hAacEncoder->metaDataAllowed = 0;
1002 HANDLE_AACENCODER hAacEncoder = (HANDLE_AACENCODER)self;
1004 sbrEncoder_GetHeader(hAacEncoder->hEnvEnc, hBs, elementIndex, 0);
1009 static AACENC_ERROR aacEncInit(HANDLE_AACENCODER hAacEncoder,
1016 HANDLE_SBR_ENCODER *hSbrEncoder = &hAacEncoder->hEnvEnc;
1017 HANDLE_AACENC_CONFIG hAacConfig = &hAacEncoder->aacConfig;
1019 hAacEncoder->nZerosAppended = 0; /* count appended zeros */
1028 if ( (err=FDKaacEnc_AdjustEncSettings(hAacEncoder, config)) != AACENC_OK ) {
1041 FDKmemclear(hAacEncoder->inputBuffer, sizeof(INT_PCM)*hAacEncoder->nMaxAacChannels*INPUTBUFFER_SIZE);
1048 hAacEncoder->nDelay = DELAY_AACELD(hAacConfig->framelength);
1051 hAacEncoder->nDelay = DELAY_AAC(hAacConfig->framelength); /* AAC encoder delay */
1085 hAacEncoder->inputBuffer,
1093 &hAacEncoder->nDelay,
1127 &hAacEncoder->coderConfig,
1137 FDKmemclear(hAacEncoder->outBuffer, hAacEncoder->outBufferInBytes*sizeof(UCHAR));
1140 if ( transportEnc_Init(hAacEncoder->hTpEnc, hAacEncoder->outBuffer, hAacEncoder->outBufferInBytes, config->userTpType, &hAacEncoder->coderConfig, flags) != 0) {
1153 err = FDKaacEnc_Initialize(hAacEncoder->hAacEnc,
1155 hAacEncoder->hTpEnc,
1167 if ( hAacEncoder->hMetadataEnc && (hAacEncoder->metaDataAllowed!=0) &&
1176 if ( FDK_MetadataEnc_Init(hAacEncoder->hMetadataEnc,
1189 hAacEncoder->nDelay += FDK_MetadataEnc_GetDelay(hAacEncoder->hMetadataEnc);
1197 hAacEncoder->inputBufferOffset = aacBufferOffset;
1199 hAacEncoder->nSamplesToRead = frameLength * config->nChannels;
1202 hAacEncoder->nDelay *= config->nChannels;
1217 HANDLE_AACENCODER hAacEncoder = NULL;
1225 hAacEncoder = Get_AacEncoder();
1227 if (hAacEncoder == NULL) {
1232 FDKmemclear(hAacEncoder, sizeof(AACENCODER));
1236 hAacEncoder->encoder_modis = ENC_MODE_FLAG_AAC;
1237 hAacEncoder->encoder_modis |= ENC_MODE_FLAG_SBR;
1238 hAacEncoder->encoder_modis |= ENC_MODE_FLAG_PS;
1239 hAacEncoder->encoder_modis |= ENC_MODE_FLAG_META;
1243 hAacEncoder->encoder_modis = encModules;
1248 hAacEncoder->nMaxAacChannels = (8);
1249 hAacEncoder->nMaxSbrChannels = (8);
1252 hAacEncoder->nMaxAacChannels = (maxChannels&0x00FF);
1253 if ( (hAacEncoder->encoder_modis&ENC_MODE_FLAG_SBR) ) {
1254 hAacEncoder->nMaxSbrChannels = (maxChannels&0xFF00) ? (maxChannels>>8) : hAacEncoder->nMaxAacChannels;
1257 if ( (hAacEncoder->nMaxAacChannels>(8)) || (hAacEncoder->nMaxSbrChannels>(8)) ) {
1264 hAacEncoder->nMaxAacElements = fixMin((8), hAacEncoder->nMaxAacChannels);
1265 hAacEncoder->nMaxSbrElements = fixMin((8), hAacEncoder->nMaxSbrChannels);
1266 hAacEncoder->nMaxSubFrames = (1);
1271 hAacEncoder->inputBuffer = (INT_PCM*)FDKcalloc(hAacEncoder->nMaxAacChannels*INPUTBUFFER_SIZE, sizeof(INT_PCM));
1274 if (hAacEncoder->encoder_modis&ENC_MODE_FLAG_SBR) {
1275 if ( sbrEncoder_Open(&hAacEncoder->hEnvEnc,
1276 hAacEncoder->nMaxSbrElements,
1277 hAacEncoder->nMaxSbrChannels,
1278 (hAacEncoder->encoder_modis&ENC_MODE_FLAG_PS) ? 1 : 0 ) )
1287 if ( FDKaacEnc_Open(&hAacEncoder->hAacEnc,
1288 hAacEncoder->nMaxAacElements,
1289 hAacEncoder->nMaxAacChannels,
1298 for (ld_M=1; (UINT)(1<<ld_M) < (hAacEncoder->nMaxSubFrames*hAacEncoder->nMaxAacChannels*6144)>>3; ld_M++) ;
1299 hAacEncoder->outBufferInBytes = (1<<ld_M); /* buffer has to be 2^n */
1301 hAacEncoder->outBuffer = GetRam_bsOutbuffer();
1302 if (OUTPUTBUFFER_SIZE < hAacEncoder->outBufferInBytes ) {
1308 if (hAacEncoder->encoder_modis&ENC_MODE_FLAG_META) {
1309 if ( FDK_MetadataEnc_Open(&hAacEncoder->hMetadataEnc) )
1317 if ( transportEnc_Open(&hAacEncoder->hTpEnc) != 0 )
1329 hAacEncoder->CAPF_tpEnc = FDKlibInfo_getCapabilities( pLibInfo, FDK_TPENC);
1333 if ( transportEnc_RegisterSbrCallback(hAacEncoder->hTpEnc, aacenc_SbrCallback, hAacEncoder) != 0 ) {
1339 aacEncDefaultConfig(&hAacEncoder->aacConfig, &hAacEncoder->extParam);
1342 hAacEncoder->coderConfig.headerPeriod = hAacEncoder->extParam.userTpHeaderPeriod;
1345 hAacEncoder->InitFlags = AACENC_INIT_ALL;
1348 *phAacEncoder = hAacEncoder;
1353 aacEncClose(&hAacEncoder);
1370 HANDLE_AACENCODER hAacEncoder = *phAacEncoder;
1373 if (hAacEncoder->inputBuffer!=NULL) {
1374 FDKfree(hAacEncoder->inputBuffer);
1375 hAacEncoder->inputBuffer = NULL;
1378 if (hAacEncoder->outBuffer) {
1379 FreeRam_bsOutbuffer(&hAacEncoder->outBuffer);
1382 if (hAacEncoder->hEnvEnc) {
1383 sbrEncoder_Close (&hAacEncoder->hEnvEnc);
1385 if (hAacEncoder->hAacEnc) {
1386 FDKaacEnc_Close (&hAacEncoder->hAacEnc);
1389 transportEnc_Close(&hAacEncoder->hTpEnc);
1391 if (hAacEncoder->hMetadataEnc) {
1392 FDK_MetadataEnc_Close (&hAacEncoder->hMetadataEnc);
1403 const HANDLE_AACENCODER hAacEncoder,
1417 if (hAacEncoder==NULL) {
1426 if (hAacEncoder->InitFlags!=0) {
1428 err = aacEncInit(hAacEncoder,
1429 hAacEncoder->InitFlags,
1430 &hAacEncoder->extParam);
1436 hAacEncoder->InitFlags = AACENC_INIT_NONE;
1454 if ( (hAacEncoder!=NULL) & (inBufDesc==NULL) && (outBufDesc==NULL) && (inargs==NULL) && (outargs==NULL) ) {
1459 FDKmemclear(outBytes, hAacEncoder->aacConfig.nSubFrames*sizeof(INT));
1468 INT newSamples = fixMax(0,fixMin(inargs->numInSamples, hAacEncoder->nSamplesToRead-hAacEncoder->nSamplesRead));
1469 INT_PCM *pIn = hAacEncoder->inputBuffer+hAacEncoder->inputBufferOffset+hAacEncoder->nSamplesRead;
1485 hAacEncoder->nSamplesRead += newSamples;
1492 if (hAacEncoder->nSamplesRead < hAacEncoder->nSamplesToRead)
1498 if ( (hAacEncoder->nZerosAppended < hAacEncoder->nDelay)
1501 int nZeros = hAacEncoder->nSamplesToRead - hAacEncoder->nSamplesRead;
1507 FDKmemclear(hAacEncoder->inputBuffer+hAacEncoder->inputBufferOffset+hAacEncoder->nSamplesRead, sizeof(INT_PCM)*nZeros );
1508 hAacEncoder->nZerosAppended += nZeros;
1509 hAacEncoder->nSamplesRead = hAacEncoder->nSamplesToRead;
1523 FDKmemclear(hAacEncoder->extPayload, sizeof(AACENC_EXT_PAYLOAD) * MAX_TOTAL_EXT_PAYLOADS);
1525 hAacEncoder->extPayload[i].associatedChElement = -1;
1527 FDKmemclear(hAacEncoder->extPayloadData, sizeof(hAacEncoder->extPayloadData));
1528 FDKmemclear(hAacEncoder->extPayloadSize, sizeof(hAacEncoder->extPayloadSize));
1534 if ( (hAacEncoder->hMetadataEnc!=NULL) && (hAacEncoder->metaDataAllowed!=0) ) {
1546 FDK_MetadataEnc_Process(hAacEncoder->hMetadataEnc,
1547 hAacEncoder->inputBuffer+hAacEncoder->inputBufferOffset,
1548 hAacEncoder->nSamplesRead,
1556 hAacEncoder->extPayload[nExtensions++] = pMetaDataExtPayload[i];
1560 && ((hAacEncoder->extParam.userChannelMode==MODE_1_2_2)||(hAacEncoder->extParam.userChannelMode==MODE_1_2_2_1)) )
1564 if (hAacEncoder->extParam.userPceAdditions != pceValue) {
1565 hAacEncoder->extParam.userPceAdditions = pceValue;
1566 hAacEncoder->InitFlags |= AACENC_INIT_TRANSPORT;
1572 if ( isSbrActive(&hAacEncoder->aacConfig) ) {
1579 if (sbrEncoder_EncodeFrame(hAacEncoder->hEnvEnc,
1580 hAacEncoder->inputBuffer,
1581 hAacEncoder->extParam.nChannels,
1582 hAacEncoder->extPayloadSize[nPayload],
1583 hAacEncoder->extPayloadData[nPayload]
1585 ,hAacEncoder->hAacEnc->clearOutput
1595 if (hAacEncoder->extPayloadSize[nPayload][i] > 0) {
1596 hAacEncoder->extPayload[nExtensions].pData = hAacEncoder->extPayloadData[nPayload][i];
1598 hAacEncoder->extPayload[nExtensions].dataSize = hAacEncoder->extPayloadSize[nPayload][i];
1599 hAacEncoder->extPayload[nExtensions].associatedChElement = i;
1601 hAacEncoder->extPayload[nExtensions].dataType = EXT_SBR_DATA; /* Once SBR Encoder supports SBR CRC set EXT_SBR_DATA_CRC */
1612 hAacEncoder->extPayload[nExtensions].dataSize = inargs->numAncBytes * 8;
1613 hAacEncoder->extPayload[nExtensions].pData = (UCHAR*)inBufDesc->bufs[idx];
1614 hAacEncoder->extPayload[nExtensions].dataType = EXT_DATA_ELEMENT;
1615 hAacEncoder->extPayload[nExtensions].associatedChElement = -1;
1623 if ( FDKaacEnc_EncodeFrame( hAacEncoder->hAacEnc,
1624 hAacEncoder->hTpEnc,
1625 hAacEncoder->inputBuffer,
1627 hAacEncoder->extPayload
1635 outargs->numAncBytes = inargs->numAncBytes - (hAacEncoder->extPayload[ancDataExtIdx].dataSize>>3);
1639 hAacEncoder->nSamplesRead -= hAacEncoder->nSamplesToRead;
1644 if (isSbrActive(&hAacEncoder->aacConfig)) {
1645 sbrEncoder_UpdateBuffers(hAacEncoder->hEnvEnc, hAacEncoder->inputBuffer);
1656 for (i=0,nBsBytes=0; i<hAacEncoder->aacConfig.nSubFrames; i++) {
1665 FDKmemcpy(outBufDesc->bufs[bsIdx], hAacEncoder->outBuffer, sizeof(UCHAR)*nBsBytes);
1678 hAacEncoder->InitFlags = AACENC_INIT_ALL;
1685 AAC_ENCODER_ERROR aacEncGetConf(HANDLE_AACENCODER hAacEncoder,
1698 err = transportEnc_GetConf(hAacEncoder->hTpEnc, &hAacEncoder->coderConfig, &tmpConf, &confType);
1757 const HANDLE_AACENCODER hAacEncoder,
1763 USER_PARAM *settings = &hAacEncoder->extParam;
1766 if (hAacEncoder == NULL) {
1779 if (!(hAacEncoder->encoder_modis & (ENC_MODE_FLAG_PS))) {
1784 if (!(hAacEncoder->encoder_modis & (ENC_MODE_FLAG_SBR))) {
1791 if (!(hAacEncoder->encoder_modis & (ENC_MODE_FLAG_AAC))) {
1801 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_STATES | AACENC_INIT_TRANSPORT;
1807 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_TRANSPORT;
1817 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_TRANSPORT;
1834 hAacEncoder->nSamplesRead = 0; /* reset internal inputbuffer */
1835 hAacEncoder
1845 if ( (pConfig->nElements > hAacEncoder->nMaxAacElements)
1846 || (pConfig->nChannelsEff > hAacEncoder->nMaxAacChannels)
1856 hAacEncoder->nSamplesRead = 0; /* reset internal inputbuffer */
1857 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_TRANSPORT;
1863 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG;
1867 if (hAacEncoder->aacConfig.channelOrder != (CHANNEL_ORDER)value) {
1872 hAacEncoder->aacConfig.channelOrder = (CHANNEL_ORDER)value;
1873 hAacEncoder->nSamplesRead = 0; /* reset internal inputbuffer */
1874 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_STATES | AACENC_INIT_TRANSPORT;
1884 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG;
1894 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_TRANSPORT;
1909 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_STATES | AACENC_INIT_TRANSPORT;
1915 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_STATES | AACENC_INIT_TRANSPORT;
1922 UINT flags = hAacEncoder->CAPF_tpEnc;
1936 hAacEncoder->InitFlags |= AACENC_INIT_TRANSPORT;
1946 hAacEncoder->InitFlags |= AACENC_INIT_TRANSPORT;
1956 hAacEncoder->InitFlags |= AACENC_INIT_TRANSPORT;
1962 hAacEncoder->InitFlags |= AACENC_INIT_TRANSPORT;
1972 hAacEncoder->InitFlags |= AACENC_INIT_TRANSPORT;
1982 hAacEncoder->InitFlags |= AACENC_INIT_TRANSPORT;
1991 if (hAacEncoder->InitFlags != value) {
1993 hAacEncoder->nSamplesRead = 0;
1995 hAacEncoder->InitFlags = value;
2005 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG;
2011 hAacEncoder->InitFlags |= AACENC_INIT_CONFIG | AACENC_INIT_TRANSPORT;
2024 const HANDLE_AACENCODER hAacEncoder,
2029 USER_PARAM *settings = &hAacEncoder->extParam;
2032 if (hAacEncoder == NULL) {
2040 value = (UINT)hAacEncoder->aacConfig.audioObjectType;
2043 value = (UINT)((hAacEncoder->aacConfig.bitrateMode==AACENC_BR_MODE_CBR) ? hAacEncoder->aacConfig.bitRate : -1);
2046 value = (UINT)hAacEncoder->aacConfig.bitrateMode;
2049 value = (UINT)hAacEncoder->coderConfig.extSamplingRate;
2052 value = (UINT)hAacEncoder->aacConfig.channelMode;
2055 value = (UINT)hAacEncoder->aacConfig.bandWidth;
2058 value = (UINT)hAacEncoder->aacConfig.channelOrder;
2061 value = (UINT)hAacEncoder->aacConfig.useRequant;
2064 value = (UINT)hAacEncoder->aacConfig.framelength;
2067 value = isSbrActive(&hAacEncoder->aacConfig) ? hAacEncoder->aacConfig.sbrRatio : 0;
2070 value = (UINT) (hAacEncoder->aacConfig.syntaxFlags & AC_SBR_PRESENT) ? 1 : 0;
2076 value = (UINT)getSbrSignalingMode(hAacEncoder->aacConfig.audioObjectType, settings->userTpType, settings->userTpSignaling, hAacEncoder->aacConfig.sbrRatio);
2082 value = (UINT)hAacEncoder->coderConfig.headerPeriod;
2085 value = (UINT)hAacEncoder->aacConfig.audioMuxVersion;
2091 value = (UINT)hAacEncoder->aacConfig.anc_Rate;
2094 value = (UINT)hAacEncoder->InitFlags;
2097 value = (hAacEncoder->metaDataAllowed==0) ? 0 : (UINT)settings->userMetaDataMode;
2101 if ( ((INT)hAacEncoder->extParam.userPeakBitrate!=-1) ) {
2102 value = (UINT)(fMax((INT)hAacEncoder->extParam.userPeakBitrate, hAacEncoder->aacConfig.bitRate)); /* peak bitrate parameter is in use */
2115 const HANDLE_AACENCODER hAacEncoder,
2124 pInfo->maxOutBufBytes = ((hAacEncoder->nMaxAacChannels*6144)+7)>>3;
2125 pInfo->maxAncBytes = hAacEncoder->aacConfig.maxAncBytesPerAU;
2126 pInfo->inBufFillLevel = hAacEncoder->nSamplesRead/hAacEncoder->extParam.nChannels;
2127 pInfo->inputChannels = hAacEncoder->extParam.nChannels;
2128 pInfo->frameLength = hAacEncoder->nSamplesToRead/hAacEncoder->extParam.nChannels;
2129 pInfo->encoderDelay = hAacEncoder->nDelay/hAacEncoder->extParam.nChannels;
2132 if ( aacEncGetConf(hAacEncoder, &pInfo->confSize, &pInfo->confBuf[0]) != AAC_ENC_OK) {