Home | History | Annotate | Download | only in src

Lines Matching refs:hQC

327   QC_STATE* hQC = GetRam_aacEnc_QCstate();
328 *phQC = hQC;
329 if (hQC == NULL) {
334 if (FDKaacEnc_AdjThrNew(&hQC->hAdjThr, nElements)) {
339 if (FDKaacEnc_BCNew(&(hQC->hBitCounter), dynamic_RAM)) {
345 hQC->elementBits[i] = GetRam_aacEnc_ElementBits(i);
346 if (hQC->elementBits[i] == NULL) {
366 AAC_ENCODER_ERROR FDKaacEnc_QCInit(QC_STATE *hQC,
370 hQC->maxBitsPerFrame = init->maxBits;
371 hQC->minBitsPerFrame = init->minBits;
372 hQC->nElements = init->channelMapping->nElements;
373 hQC->bitResTotMax = init->bitRes;
374 hQC->bitResTot = init->bitRes;
375 hQC->maxBitFac = init->maxBitFac;
376 hQC->bitrateMode = init->bitrateMode;
377 hQC->invQuant = init->invQuant;
378 hQC->maxIterations = init->maxIterations;
380 if ( isConstantBitrateMode(hQC->bitrateMode) ) {
381 INT bitresPerChannel = (hQC->bitResTotMax / init->channelMapping->nChannelsEff);
383 hQC->bitDistributionMode = (bitresPerChannel>BITRES_MIN_LD) ? 0 : (bitresPerChannel>0) ? 1 : 2;
386 hQC->bitDistributionMode = 0; /* full bitreservoir */
390 hQC->padding.paddingRest = init->padding.paddingRest;
392 hQC->globHdrBits = init->staticBits; /* Bit overhead due to transport */
394 FDKaacEnc_InitElementBits(hQC,
397 (init->averageBits/init->nSubFrames) - hQC->globHdrBits,
398 hQC->maxBitsPerFrame/init->channelMapping->nChannelsEff);
400 hQC->vbrQualFactor = FL2FXCONST_DBL(0.f);
402 if (hQC->bitrateMode==tableVbrQualFactor[i].bitrateMode) {
403 hQC->vbrQualFactor = (FIXP_DBL)tableVbrQualFactor[i].vbrQualFactor;
413 hQC->dZoneQuantEnable = 1;
415 hQC->dZoneQuantEnable = 0;
419 hQC->hAdjThr,
421 hQC->elementBits, /* or channelBitrates, was: channelBitrate */
422 hQC->invQuant,
427 hQC->vbrQualFactor,
428 hQC->dZoneQuantEnable
483 AAC_ENCODER_ERROR FDKaacEnc_AdjustBitrate(QC_STATE *RESTRICT hQC,
497 &hQC->padding.paddingRest);
509 static AAC_ENCODER_ERROR FDKaacEnc_distributeElementDynBits(QC_STATE* hQC,
522 qcElement[i]->grantedDynBits = (INT)fMult(hQC->elementBits[i]->relativeBitsEl, (FIXP_DBL)codeBits);
605 static AAC_ENCODER_ERROR FDKaacEnc_prepareBitDistribution(QC_STATE* hQC,
616 qcOut[0]->grantedDynBits = (fixMin(hQC->maxBitsPerFrame, avgTotalBits) - hQC->globHdrBits)&~7;
618 qcOut[0]->maxDynBits = ((hQC->maxBitsPerFrame)&~7) - (qcOut[0]->globalExtBits + qcOut[0]->staticBits + qcOut[0]->elementExtBits);
620 if ((qcOut[0]->grantedDynBits+hQC->bitResTot) < 0) {
622 if ( (qcOut[0]->grantedDynBits+hQC->bitResTot) < (FDKaacEnc_getMinimalStaticBitdemand(cm, psyOut)-qcOut[0]->staticBits) )
627 FDKaacEnc_distributeElementDynBits(hQC,
648 FDKaacEnc_DistributeBits(hQC->hAdjThr,
649 hQC->hAdjThr->adjThrStateElem[i],
657 hQC->elementBits[i]->bitResLevelEl,
658 hQC->elementBits[i]->maxBitResBitsEl,
659 hQC->maxBitFac,
660 hQC->bitDistributionMode);
662 *totalAvailableBits += hQC->elementBits[i]->bitResLevelEl;
669 *totalAvailableBits = FDKmin(hQC->maxBitsPerFrame, (*totalAvailableBits));
747 QC_STATE *const hQC,
753 if (hQC->bitResTot < 0) {
756 else if (hQC->bitResTot > hQC->bitResTotMax) {
763 int totalBitreservoir = FDKmin(hQC->bitResTot, (hQC->maxBitsPerFrame-avgTotalBits));
764 int totalBitreservoirMax = FDKmin(hQC->bitResTotMax, (hQC->maxBitsPerFrame-avgTotalBits));
773 hQC->elementBits[i]->bitResLevelEl = (INT)fMult(hQC->elementBits[i]->relativeBitsEl, (FIXP_DBL)(totalBitreservoir<<sc_bitResTot))>>sc_bitResTot;
774 totalBits += hQC->elementBits[i]->bitResLevelEl;
776 hQC->elementBits[i]->maxBitResBitsEl = (INT)fMult(hQC->elementBits[i]->relativeBitsEl, (FIXP_DBL)(totalBitreservoirMax<<sc_bitResTotMax))>>sc_bitResTotMax;
777 totalBits_max += hQC->elementBits[i]->maxBitResBitsEl;
782 hQC->elementBits[firstEl]->bitResLevelEl += totalBitreservoir - totalBits;
783 hQC->elementBits[firstEl]->maxBitResBitsEl += totalBitreservoirMax - totalBits_max;
790 AAC_ENCODER_ERROR FDKaacEnc_QCMain(QC_STATE* RESTRICT hQC,
808 ErrorStatus = FDKaacEnc_BitResRedistribution(hQC, cm, avgTotalBits);
841 if ( isConstantBitrateMode(hQC->bitrateMode) )
846 hQC,
860 qcOut[0]->grantedDynBits = ((hQC->maxBitsPerFrame - (hQC->globHdrBits))&~7)
864 totalAvailableBits = hQC->maxBitsPerFrame;
886 FDKaacEnc_AdjustThresholds(hQC->hAdjThr->adjThrStateElem,
890 isConstantBitrateMode(hQC->bitrateMode),
891 hQC->hAdjThr->maxIter2ndGuess,
918 hQC->invQuant,
919 hQC->dZoneQuantEnable,
972 hQC->maxIterations,
980 hQC->elementBits[i],
1015 hQC->dZoneQuantEnable);
1056 INT chDynBits = FDKaacEnc_dynBitCount(hQC->hBitCounter,
1076 if(hQC->hAdjThr->adjThrStateElem[i]->dynBitsLast==-1) {
1077 hQC->hAdjThr->adjThrStateElem[i]->dynBitsLast = qcElement[c][i]->dynBitsUsed;
1097 int sumBitsConsumedTotal = FDKaacEnc_getTotalConsumedBits(qcOut, qcElement, cm, hQC->globHdrBits, nSubFrames);
1100 if ( ((sumBitsConsumedTotal < totalAvailableBits) || qcOut[c]->usedDynBits==0) && (decreaseBitConsumption==1) && checkMinFrameBitsDemand(qcOut,hQC->minBitsPerFrame,nSubFrames)
1129 emergencyIterations &= ((iterations[c][i] < hQC->maxIterations) ? 0 : 1);
1139 int sumBitsConsumedTotal = FDKaacEnc_getTotalConsumedBits(qcOut, qcElement, cm, hQC->globHdrBits, nSubFrames);
1147 if ((sumBitsConsumedTotal > totalAvailableBits) || !checkMinFrameBitsDemand(qcOut,hQC->minBitsPerFrame,nSubFrames)) {
1150 if ((sumBitsConsumedTotal < totalAvailableBits) && checkMinFrameBitsDemand(qcOut,hQC->minBitsPerFrame,nSubFrames)) {
1608 QC_OUT *hQC = phQC[n];
1613 if (hQC->qcElement[i])
1614 FreeRam_aacEnc_QCelement(&hQC->qcElement[i]);