Lines Matching refs:hAss

145 static UINT transportEnc_LatmCountFixBitDemandHeader(HANDLE_LATM_STREAM hAss) {  in transportEnc_LatmCountFixBitDemandHeader()  argument
150 if (hAss->subFrameCnt == 0) { in transportEnc_LatmCountFixBitDemandHeader()
153 if (hAss->tt == TT_MP4_LOAS) { in transportEnc_LatmCountFixBitDemandHeader()
161 if (hAss->muxConfigPeriod > 0) { in transportEnc_LatmCountFixBitDemandHeader()
162 insertSetupData = (hAss->latmFrameCounter == 0); in transportEnc_LatmCountFixBitDemandHeader()
167 if (hAss->tt != TT_MP4_LATM_MCP0) { in transportEnc_LatmCountFixBitDemandHeader()
172 bitDemand += hAss->streamMuxConfigBits; in transportEnc_LatmCountFixBitDemandHeader()
177 bitDemand += hAss->otherDataLenBits; in transportEnc_LatmCountFixBitDemandHeader()
181 hAss->fillBits = 8 - (bitDemand % 8); in transportEnc_LatmCountFixBitDemandHeader()
182 bitDemand += hAss->fillBits; in transportEnc_LatmCountFixBitDemandHeader()
184 hAss->fillBits = 0; in transportEnc_LatmCountFixBitDemandHeader()
192 HANDLE_LATM_STREAM hAss, unsigned int streamDataLength) { in transportEnc_LatmCountVarBitDemandHeader() argument
197 if (hAss->allStreamsSameTimeFraming) { in transportEnc_LatmCountVarBitDemandHeader()
198 for (prog = 0; prog < hAss->noProgram; prog++) { in transportEnc_LatmCountVarBitDemandHeader()
200 LATM_LAYER_INFO *p_linfo = &(hAss->m_linfo[prog][layer]); in transportEnc_LatmCountVarBitDemandHeader()
229 switch (hAss->varMode) { in transportEnc_LatmCountVarBitDemandHeader()
237 hAss->varStreamCnt = 0; in transportEnc_LatmCountVarBitDemandHeader()
238 for (prog = 0; prog < hAss->noProgram; prog++) { in transportEnc_LatmCountVarBitDemandHeader()
240 LATM_LAYER_INFO *p_linfo = &(hAss->m_linfo[prog][layer]); in transportEnc_LatmCountVarBitDemandHeader()
266 hAss->varStreamCnt++; in transportEnc_LatmCountVarBitDemandHeader()
287 CreateStreamMuxConfig(HANDLE_LATM_STREAM hAss, HANDLE_FDK_BITSTREAM hBs, in CreateStreamMuxConfig() argument
294 hAss->taraBufferFullness = 0xFF; in CreateStreamMuxConfig()
295 hAss->audioMuxVersionA = 0; /* for future extensions */ in CreateStreamMuxConfig()
296 hAss->streamMuxConfigBits = 0; in CreateStreamMuxConfig()
298 FDKwriteBits(hBs, hAss->audioMuxVersion, 1); /* audioMuxVersion */ in CreateStreamMuxConfig()
299 hAss->streamMuxConfigBits += 1; in CreateStreamMuxConfig()
301 if (hAss->audioMuxVersion == 1) { in CreateStreamMuxConfig()
302 FDKwriteBits(hBs, hAss->audioMuxVersionA, 1); /* audioMuxVersionA */ in CreateStreamMuxConfig()
303 hAss->streamMuxConfigBits += 1; in CreateStreamMuxConfig()
306 if (hAss->audioMuxVersionA == 0) { in CreateStreamMuxConfig()
307 if (hAss->audioMuxVersion == 1) { in CreateStreamMuxConfig()
308 hAss->streamMuxConfigBits += transportEnc_LatmWriteValue( in CreateStreamMuxConfig()
309 hBs, hAss->taraBufferFullness); /* taraBufferFullness */ in CreateStreamMuxConfig()
311 FDKwriteBits(hBs, hAss->allStreamsSameTimeFraming ? 1 : 0, in CreateStreamMuxConfig()
313 FDKwriteBits(hBs, hAss->noSubframes - 1, 6); /* Number of Subframes */ in CreateStreamMuxConfig()
314 FDKwriteBits(hBs, hAss->noProgram - 1, 4); /* Number of Programs */ in CreateStreamMuxConfig()
316 hAss->streamMuxConfigBits += 11; in CreateStreamMuxConfig()
319 for (prog = 0; prog < hAss->noProgram; prog++) { in CreateStreamMuxConfig()
322 FDKwriteBits(hBs, hAss->noLayer[prog] - 1, 3); in CreateStreamMuxConfig()
323 hAss->streamMuxConfigBits += 3; in CreateStreamMuxConfig()
326 LATM_LAYER_INFO *p_linfo = &(hAss->m_linfo[prog][layer]); in CreateStreamMuxConfig()
327 CODER_CONFIG *p_lci = hAss->config[prog][layer]; in CreateStreamMuxConfig()
331 if (hAss->config[prog][layer] != NULL) { in CreateStreamMuxConfig()
336 hAss->streamMuxConfigBits += 1; in CreateStreamMuxConfig()
342 (transportEnc_writeASC(hBs, hAss->config[prog][layer], cb))) { in CreateStreamMuxConfig()
346 if (hAss->audioMuxVersion == 1) { in CreateStreamMuxConfig()
355 (transportEnc_writeASC(hBs, hAss->config[prog][layer], cb))) { in CreateStreamMuxConfig()
362 hAss->streamMuxConfigBits += in CreateStreamMuxConfig()
368 if (!hAss->allStreamsSameTimeFraming) { in CreateStreamMuxConfig()
388 hAss->streamMuxConfigBits += 11; in CreateStreamMuxConfig()
390 if (!hAss->allStreamsSameTimeFraming) { in CreateStreamMuxConfig()
391 CODER_CONFIG *p_lci_prev = hAss->config[prog][layer - 1]; in CreateStreamMuxConfig()
397 hAss->streamMuxConfigBits += 6; in CreateStreamMuxConfig()
412 hAss->streamMuxConfigBits += 12; in CreateStreamMuxConfig()
421 hAss->streamMuxConfigBits += 3; in CreateStreamMuxConfig()
432 hAss->streamMuxConfigBits += 6; in CreateStreamMuxConfig()
441 hAss->streamMuxConfigBits += 3; in CreateStreamMuxConfig()
453 hAss->streamMuxConfigBits += 1; in CreateStreamMuxConfig()
466 FDKwriteBits(hBs, (hAss->otherDataLenBits > 0) ? 1 : 0, in CreateStreamMuxConfig()
468 hAss->streamMuxConfigBits += 1; in CreateStreamMuxConfig()
470 if (hAss->otherDataLenBits > 0) { in CreateStreamMuxConfig()
472 FDKwriteBits(hBs, hAss->otherDataLenBits, 8); in CreateStreamMuxConfig()
473 hAss->streamMuxConfigBits += 9; in CreateStreamMuxConfig()
477 hAss->streamMuxConfigBits += 1; in CreateStreamMuxConfig()
505 HANDLE_LATM_STREAM hAss, INT noSubframes_next) /* nr of access units / in transportEnc_LatmSetNrOfSubframes() argument
514 hAss->noSubframes_next = noSubframes_next; in transportEnc_LatmSetNrOfSubframes()
518 if ((hAss->subFrameCnt == 0) && (hAss->latmFrameCounter == 0)) { in transportEnc_LatmSetNrOfSubframes()
519 hAss->noSubframes = noSubframes_next; in transportEnc_LatmSetNrOfSubframes()
525 static int allStreamsSameTimeFraming(HANDLE_LATM_STREAM hAss, UCHAR noProgram, in allStreamsSameTimeFraming() argument
539 if (hAss->config[prog][layer] != NULL) { in allStreamsSameTimeFraming()
545 highestSamplingRate = hAss->config[prog][layer]->samplingRate; in allStreamsSameTimeFraming()
547 hsfSamplesFrame = hAss->config[prog][layer]->samplesPerFrame * in allStreamsSameTimeFraming()
549 hAss->config[prog][layer]->samplingRate; in allStreamsSameTimeFraming()
574 HANDLE_LATM_STREAM hAss, int fractDelayPresent, in transportEnc_InitLatmStream() argument
580 if (hAss == NULL) return TRANSPORTENC_INVALID_PARAMETER; in transportEnc_InitLatmStream()
582 hAss->tt = tt; in transportEnc_InitLatmStream()
584 hAss->noProgram = 1; in transportEnc_InitLatmStream()
586 hAss->audioMuxVersion = audioMuxVersion; in transportEnc_InitLatmStream()
589 hAss->allStreamsSameTimeFraming = in transportEnc_InitLatmStream()
590 allStreamsSameTimeFraming(hAss, hAss->noProgram, hAss->noLayer); in transportEnc_InitLatmStream()
592 FDK_ASSERT(hAss->allStreamsSameTimeFraming); in transportEnc_InitLatmStream()
594 hAss->fractDelayPresent = fractDelayPresent; in transportEnc_InitLatmStream()
595 hAss->otherDataLenBits = 0; in transportEnc_InitLatmStream()
597 hAss->varMode = LATMVAR_SIMPLE_SEQUENCE; in transportEnc_InitLatmStream()
600 hAss->subFrameCnt = 0; in transportEnc_InitLatmStream()
601 hAss->noSubframes = DEFAULT_LATM_NR_OF_SUBFRAMES; in transportEnc_InitLatmStream()
602 hAss->noSubframes_next = DEFAULT_LATM_NR_OF_SUBFRAMES; in transportEnc_InitLatmStream()
605 hAss->audioMuxLengthBytes = 0; in transportEnc_InitLatmStream()
607 hAss->latmFrameCounter = 0; in transportEnc_InitLatmStream()
608 hAss->muxConfigPeriod = muxConfigPeriod; in transportEnc_InitLatmStream()
616 UINT transportEnc_LatmCountTotalBitDemandHeader(HANDLE_LATM_STREAM hAss, in transportEnc_LatmCountTotalBitDemandHeader() argument
620 switch (hAss->tt) { in transportEnc_LatmCountTotalBitDemandHeader()
624 if (hAss->subFrameCnt == 0) { in transportEnc_LatmCountTotalBitDemandHeader()
625 bitDemand = transportEnc_LatmCountFixBitDemandHeader(hAss); in transportEnc_LatmCountTotalBitDemandHeader()
628 hAss, streamDataLength /*- bitDemand*/); in transportEnc_LatmCountTotalBitDemandHeader()
637 static TRANSPORTENC_ERROR AdvanceAudioMuxElement(HANDLE_LATM_STREAM hAss, in AdvanceAudioMuxElement() argument
645 if (hAss->subFrameCnt == 0) { in AdvanceAudioMuxElement()
646 if (hAss->muxConfigPeriod > 0) { in AdvanceAudioMuxElement()
647 insertMuxSetup = (hAss->latmFrameCounter == 0); in AdvanceAudioMuxElement()
652 if (hAss->tt != TT_MP4_LATM_MCP0) { in AdvanceAudioMuxElement()
656 hAss, hBs, bufferFullness, cb))) { in AdvanceAudioMuxElement()
669 for (prog = 0; prog < hAss->noProgram; prog++) { in AdvanceAudioMuxElement()
670 for (layer = 0; layer < hAss->noLayer[prog]; layer++) { in AdvanceAudioMuxElement()
682 transportEnc_LatmWrite(HANDLE_LATM_STREAM hAss, HANDLE_FDK_BITSTREAM hBs, in transportEnc_LatmWrite() argument
686 if (hAss->subFrameCnt == 0) { in transportEnc_LatmWrite()
691 hAss->latmSubframeStart = FDKgetValidBits(hBs); in transportEnc_LatmWrite()
697 if (hAss->tt == TT_MP4_LOAS && hAss->subFrameCnt == 0) { in transportEnc_LatmWrite()
700 hAss->audioMuxLengthBytes = 0; in transportEnc_LatmWrite()
701 hAss->audioMuxLengthBytesPos = in transportEnc_LatmWrite()
703 FDKwriteBits(hBs, hAss->audioMuxLengthBytes, 13); in transportEnc_LatmWrite()
706 ErrorStatus = AdvanceAudioMuxElement(hAss, hBs, auBits, bufferFullness, cb); in transportEnc_LatmWrite()
713 void transportEnc_LatmAdjustSubframeBits(HANDLE_LATM_STREAM hAss, int *bits) { in transportEnc_LatmAdjustSubframeBits() argument
715 *bits -= hAss->latmSubframeStart; in transportEnc_LatmAdjustSubframeBits()
717 if (hAss->subFrameCnt == 0) { in transportEnc_LatmAdjustSubframeBits()
718 *bits += hAss->otherDataLenBits; in transportEnc_LatmAdjustSubframeBits()
719 *bits += hAss->fillBits; in transportEnc_LatmAdjustSubframeBits()
723 TRANSPORTENC_ERROR transportEnc_LatmGetFrame(HANDLE_LATM_STREAM hAss, in transportEnc_LatmGetFrame() argument
728 hAss->subFrameCnt++; in transportEnc_LatmGetFrame()
729 if (hAss->subFrameCnt >= hAss->noSubframes) { in transportEnc_LatmGetFrame()
731 if (hAss->tt == TT_MP4_LOAS) { in transportEnc_LatmGetFrame()
735 hAss->audioMuxLengthBytes = in transportEnc_LatmGetFrame()
736 ((FDKgetValidBits(hBs) + hAss->otherDataLenBits + 7) >> 3) - in transportEnc_LatmGetFrame()
740 if (hAss->audioMuxLengthBytes >= (1 << 13)) { in transportEnc_LatmGetFrame()
748 FDKpushFor(&tmpBuf, hAss->audioMuxLengthBytesPos); in transportEnc_LatmGetFrame()
749 FDKwriteBits(&tmpBuf, hAss->audioMuxLengthBytes, 13); in transportEnc_LatmGetFrame()
754 FDKwriteBits(hBs, 0, hAss->otherDataLenBits); in transportEnc_LatmGetFrame()
757 FDKwriteBits(hBs, 0, hAss->fillBits); in transportEnc_LatmGetFrame()
761 hAss->subFrameCnt = 0; in transportEnc_LatmGetFrame()
766 if (hAss->muxConfigPeriod > 0) { in transportEnc_LatmGetFrame()
767 hAss->latmFrameCounter++; in transportEnc_LatmGetFrame()
769 if (hAss->latmFrameCounter >= hAss->muxConfigPeriod) { in transportEnc_LatmGetFrame()
770 hAss->latmFrameCounter = 0; in transportEnc_LatmGetFrame()
771 hAss->noSubframes = hAss->noSubframes_next; in transportEnc_LatmGetFrame()
786 TRANSPORTENC_ERROR transportEnc_Latm_Init(HANDLE_LATM_STREAM hAss, in transportEnc_Latm_Init() argument
802 hAss->config[prog][layer] = NULL; in transportEnc_Latm_Init()
803 hAss->m_linfo[prog][layer].streamID = -1; in transportEnc_Latm_Init()
807 hAss->config[0][0] = layerConfig; in transportEnc_Latm_Init()
808 hAss->m_linfo[0][0].streamID = 0; in transportEnc_Latm_Init()
810 ErrorStatus = transportEnc_InitLatmStream(hAss, fractDelayPresent, in transportEnc_Latm_Init()
816 transportEnc_LatmSetNrOfSubframes(hAss, layerConfig->nSubFrames); in transportEnc_Latm_Init()
821 (ErrorStatus = AdvanceAudioMuxElement(hAss, hBs, 0, 0, cb))) { in transportEnc_Latm_Init()
831 TRANSPORTENC_ERROR transportEnc_LatmAddOtherDataBits(HANDLE_LATM_STREAM hAss, in transportEnc_LatmAddOtherDataBits() argument
835 if ((hAss->otherDataLenBits != 0) || (otherDataBits % 8 != 0)) { in transportEnc_LatmAddOtherDataBits()
841 if (hAss->tt == TT_MP4_LATM_MCP0) { in transportEnc_LatmAddOtherDataBits()
842 hAss->otherDataLenBits = otherDataBits; in transportEnc_LatmAddOtherDataBits()
844 hAss->otherDataLenBits = otherDataBits - 9; in transportEnc_LatmAddOtherDataBits()
845 hAss->streamMuxConfigBits += 9; in transportEnc_LatmAddOtherDataBits()