Lines Matching defs:sfb
122 INT j, sfb, sfbGrp;
129 for (sfb = 0; sfb < tmp1; sfb++) {
132 for(j=psyOutChan->sfbOffsets[sfbGrp+sfb]; j<psyOutChan->sfbOffsets[sfbGrp+sfb+1]; j++ ) {
135 sfbFormFactorLdData[sfbGrp+sfb] = CalcLdData(formFactor);
138 for ( ; sfb < psyOutChan->sfbPerGroup; sfb++) {
139 sfbFormFactorLdData[sfbGrp+sfb] = FL2FXCONST_DBL(-1.0f);
178 INT sfbOffs, sfb;
188 for(sfb=0; sfb<maxSfbPerGroup; sfb++) {
190 if((FIXP_DBL)sfbEnergyLdData[sfbOffs+sfb] > (FIXP_DBL)sfbThresholdLdData[sfbOffs+sfb]) {
191 INT sfbWidth = sfbOffsets[sfbOffs+sfb+1] - sfbOffsets[sfbOffs+sfb];
193 /* avgFormFactorLdData = sqrtFixp(sqrtFixp(sfbEnergyLdData[sfbOffs+sfb]/sfbWidth)); */
194 /* sfbNRelevantLines[sfbOffs+sfb] = sfbFormFactor[sfbOffs+sfb] / avgFormFactorLdData; */
198 accu = sfbEnergyLdData[sfbOffs+sfb] - sfbWidthLdData - asPeFacLdData;
199 accu = sfbFormFactorLdData[sfbOffs+sfb] - (accu >> 2);
201 sfbNRelevantLines[sfbOffs+sfb] = CalcInvLdData(accu) >> 1;
264 INT sfb = 0, sfbLast;
267 /* search for first relevant sfb */
271 /* search for previous relevant sfb and count diff */
279 for (sfb=sfbLast+1; sfb<stopSfb; sfb++) {
280 if (scfOld[sfb]!=FDK_INT_MIN) {
281 scfBitsDiff += FDKaacEnc_bitCountScalefactorDelta(scfNew[sfbLast]-scfNew[sfb]) -
282 FDKaacEnc_bitCountScalefactorDelta(scfOld[sfbLast]-scfOld[sfb]);
283 sfbLast = sfb;
286 /* search for next relevant sfb and count diff */
316 INT sfb;
319 for (sfb=startSfb; sfb<stopSfb; sfb++) {
320 if (scfOld[sfb]!=FDK_INT_MIN) {
323 /* sfbConstPePart[sfb] = (float)log(psyOutChan->sfbEnergy[sfb] * 6.75f / sfbFormFactor[sfb]) * LOG2_1; */
326 if (sfbConstPePart[sfb] == (FIXP_DBL)FDK_INT_MIN)
327 sfbConstPePart[sfb] = ((psyOutChan->sfbEnergyLdData[sfb] - sfbFormFactorLdData[sfb] - FL2FXCONST_DBL(0.09375f)) >> 1) + FL2FXCONST_DBL(0.02152255861f);
329 scfFract = (FIXP_DBL) (scfOld[sfb] << (DFRACT_BITS-1-AS_PE_FAC_SHIFT));
330 ldRatioOld = sfbConstPePart[sfb] - fMult(FL2FXCONST_DBL(0.375f),scfFract);
332 scfFract = (FIXP_DBL) (scfNew[sfb] << (DFRACT_BITS-1-AS_PE_FAC_SHIFT));
333 ldRatioNew = sfbConstPePart[sfb] - fMult(FL2FXCONST_DBL(0.375f),scfFract);
345 specPeDiff += fMult(FL2FXCONST_DBL(0.7f),fMult(sfbNRelevantLines[sfb],(pNew - pOld)));
494 /* search for new relevant sfb */
599 /* save parameters to avoid multiple computations of the same sfb */
606 /* start again at first sfb */
639 INT sfb, startSfb, stopSfb;
653 for (sfb=0; sfb<sfbCnt; sfb++) {
654 if (scf[sfb]!=FDK_INT_MIN) {
655 scfMin = fixMin(scfMin, scf[sfb]);
656 scfMax = fixMax(scfMax, scf[sfb]);
672 sfb = stopSfb;
673 while (sfb<sfbCnt && (scf[sfb]==FDK_INT_MIN || scf[sfb] <= scfAct))
674 sfb++;
675 startSfb = sfb;
676 sfb++;
677 while (sfb<sfbCnt && (scf[sfb]==FDK_INT_MIN || scf[sfb] > scfAct))
678 sfb++;
679 stopSfb = sfb;
681 /* check if in all sfb of a valid region scfAct >= minScf[sfb] */
685 for (sfb=startSfb; sfb<stopSfb; sfb++) {
686 if (scf[sfb] != FDK_INT_MIN)
687 if (scfAct < minScf[sfb]) {
697 for (sfb=startSfb; sfb<stopSfb; sfb++) {
698 if (scfTmp[sfb] != FDK_INT_MIN)
699 scfTmp[sfb] = scfAct;
717 for (sfb=startSfb; sfb<stopSfb; sfb++) {
718 if (scfTmp[sfb] != FDK_INT_MIN) {
719 distOldSum += CalcInvLdData(sfbDist[sfb]) >> DIST_FAC_SHIFT;
721 sfbWidth = psyOutChan->sfbOffsets[sfb+1] - psyOutChan->sfbOffsets[sfb];
722 sfbOffs = psyOutChan->sfbOffsets[sfb];
724 sfbDistNew[sfb] = FDKaacEnc_calcSfbDist(qcOutChannel->mdctSpectrum+sfbOffs,
729 if (sfbDistNew[sfb] >qcOutChannel->sfbThresholdLdData[sfb]) {
734 distNewSum += CalcInvLdData(sfbDistNew[sfb]) >> DIST_FAC_SHIFT;
740 for (sfb=startSfb; sfb<stopSfb; sfb++) {
741 if (scf[sfb] != FDK_INT_MIN) {
742 sfbWidth = psyOutChan->sfbOffsets[sfb+1] -
743 psyOutChan->sfbOffsets[sfb];
744 sfbOffs = psyOutChan->sfbOffsets[sfb];
745 scf[sfb] = scfAct;
746 sfbDist[sfb] = sfbDistNew[sfb];
778 INT sfb, startSfb, stopSfb;
796 for (sfb=0; sfb<sfbCnt; sfb++) {
797 if (scf[sfb]!=FDK_INT_MIN) {
798 scfMin = fixMin(scfMin, scf[sfb]);
799 scfMax = fixMax(scfMax, scf[sfb]);
809 sfb = stopSfb;
810 while (sfb<sfbCnt && (scf[sfb]==FDK_INT_MIN))
811 sfb++;
812 startSfb = sfb;
814 sfb++;
815 while (sfb<sfbCnt && ((scf[sfb]==FDK_INT_MIN) || (scf[sfb]==scf[startSfb])))
816 sfb++;
817 stopSfb = sfb;
844 for (sfb=startSfb; sfb<stopSfb; sfb++) {
845 if (scf[sfb] != FDK_INT_MIN) {
846 /* sfbDistMax[sfb] = (float)pow(qcOutChannel->sfbThreshold[sfb]*sfbDist[sfb]*sfbDist[sfb],1.0f/3.0f); */
847 /* sfbDistMax[sfb] = fixMax(sfbDistMax[sfb],qcOutChannel->sfbEnergy[sfb]*FL2FXCONST_DBL(1.e-3f)); */
849 sfbDistMax[sfb] = fMult(FL2FXCONST_DBL(1.0f/3.0f),qcOutChannel->sfbThresholdLdData[sfb])+fMult(FL2FXCONST_DBL(1.0f/3.0f),sfbDist[sfb])+fMult(FL2FXCONST_DBL(1.0f/3.0f),sfbDist[sfb]);
850 sfbDistMax[sfb] = fixMax(sfbDistMax[sfb],qcOutChannel->sfbEnergyLdData[sfb]-FL2FXCONST_DBL(0.15571537944));
851 sfbDistMax[sfb] = fixMin(sfbDistMax[sfb],qcOutChannel->sfbThresholdLdData[sfb]);
862 for (sfb=startSfb; sfb<stopSfb; sfb++) {
863 if (scfTmp[sfb] != FDK_INT_MIN)
864 scfTmp[sfb] = scfNew;
881 for (sfb=startSfb; sfb<stopSfb; sfb++) {
882 if (scfTmp[sfb] != FDK_INT_MIN) {
883 sfbDistNew[sfb] = FDKaacEnc_calcSfbDist(qcOutChannel->mdctSpectrum+sfbOffs[sfb],
884 quantSpecTmp+sfbOffs[sfb],
885 sfbOffs[sfb+1]-sfbOffs[sfb],
888 if (sfbDistNew[sfb] > sfbDistMax[sfb]) {
891 if (sfbDistNew[sfb] == qcOutChannel->sfbEnergyLdData[sfb]) {
892 /* if whole sfb is already quantized to 0, further
905 for (sfb=startSfb; sfb<stopSfb; sfb++) {
906 if (scf[sfb] != FDK_INT_MIN) {
907 scf[sfb] = scfNew;
908 sfbDist[sfb] = sfbDistNew[sfb];
910 for (k=0; k<sfbOffs[sfb+1]-sfbOffs[sfb]; k++)
911 quantSpec[sfbOffs[sfb]+k] = quantSpecTmp[sfbOffs[sfb]+k];
934 check if in all sfb scfNew >= minScf[sfb] */
935 for (sfb=startSfb; sfb<stopSfb; sfb++) {
936 if (scfTmp[sfb] != FDK_INT_MIN) {
937 scfTmp[sfb] = scfNew;
938 if (scfNew < minScf[sfb])
959 for (sfb=startSfb; sfb<stopSfb; sfb++) {
960 if (scfTmp[sfb] != FDK_INT_MIN) {
961 distOldSum += CalcInvLdData(sfbDist[sfb]) >> DIST_FAC_SHIFT;
963 sfbDistNew[sfb] = FDKaacEnc_calcSfbDist(qcOutChannel->mdctSpectrum+sfbOffs[sfb],
964 quantSpecTmp+sfbOffs[sfb],
965 sfbOffs[sfb+1]-sfbOffs[sfb],
968 if (sfbDistNew[sfb] > qcOutChannel->sfbThresholdLdData[sfb]) {
973 distNewSum += CalcInvLdData(sfbDistNew[sfb]) >> DIST_FAC_SHIFT;
979 for (sfb=startSfb; sfb<stopSfb; sfb++) {
980 if (scf[sfb] != FDK_INT_MIN) {
981 scf[sfb] = scfNew;
982 sfbDist[sfb] = sfbDistNew[sfb];
984 for (k=0; k<sfbOffs[sfb+1]-sfbOffs[sfb]; k++)
985 quantSpec[sfbOffs[sfb]+k] = quantSpecTmp[sfbOffs[sfb]+k];
1003 for (sfb=startSfb; sfb<stopSfb; sfb++) {
1004 if (scfTmp[sfb] != FDK_INT_MIN)
1005 scfTmp[sfb] = scfNew;
1015 for (sfb=startSfb; sfb<stopSfb; sfb++) {
1016 if (scfTmp[sfb] != FDK_INT_MIN) {
1020 FDKaacEnc_calcSfbQuantEnergyAndDist(qcOutChannel->mdctSpectrum+sfbOffs[sfb],
1021 quantSpec+sfbOffs[sfb],
1022 sfbOffs[sfb+1]-sfbOffs[sfb], scfNew,
1023 &sfbEnQ, &sfbDistNew[sfb]);
1025 distOldSum += CalcInvLdData(sfbDist[sfb]) >> DIST_FAC_SHIFT;
1026 distNewSum += CalcInvLdData(sfbDistNew[sfb]) >> DIST_FAC_SHIFT;
1030 if ((sfbDistNew[sfb] > (sfbDist[sfb]+FL2FXCONST_DBL(0.00259488556167f))) || (sfbEnQ < (qcOutChannel->sfbEnergyLdData[sfb] - FL2FXCONST_DBL(0.00778722686652f)))){
1039 for (sfb=startSfb; sfb<stopSfb; sfb++) {
1040 if (scf[sfb] != FDK_INT_MIN) {
1041 scf[sfb] = scfNew;
1042 sfbDist[sfb] = sfbDistNew[sfb];
1064 INT i, j, sfb, sfbOffs;
1100 for(sfb=0; sfb<psyOutChannel->maxSfbPerGroup; sfb++) {
1102 threshLdData = qcOutChannel->sfbThresholdLdData[sfbOffs+sfb];
1103 energyLdData = qcOutChannel->sfbEnergyLdData[sfbOffs+sfb];
1105 sfbDistLdData[sfbOffs+sfb] = energyLdData;
1111 /* energyPart = (float)log10(sfbFormFactor[sfbOffs+sfb]); */
1113 energyPartLdData = sfbFormFactorLdData[sfbOffs+sfb] + FL2FXCONST_DBL(0.09375f);
1134 for(j=psyOutChannel->sfbOffsets[sfbOffs+sfb]; j<psyOutChannel->sfbOffsets[sfbOffs+sfb+1]; j++ ){
1141 /* minSfMaxQuant[sfbOffs+sfb] = (int)ceil(C1 + C2*log(maxSpec)); */
1144 //minSfMaxQuant[sfbOffs+sfb] = ((INT) ((c1Const + CalcLdData(maxSpec)) >> ((DFRACT_BITS-1)-8))) + 1;
1147 minSfMaxQuant[sfbOffs+sfb] = ((INT) ((c1Const + tmp) >> ((DFRACT_BITS-1)-8))) + 1;
1150 minSfMaxQuant[sfbOffs+sfb] = ((INT) (FL2FXCONST_DBL(-1.f) >> ((DFRACT_BITS-1)-8))) + 1;
1153 scfInt = fixMax(scfInt, minSfMaxQuant[sfbOffs+sfb]);
1158 scfInt = FDKaacEnc_improveScf(qcOutChannel->mdctSpectrum+psyOutChannel->sfbOffsets[sfbOffs+sfb],
1159 quantSpec+psyOutChannel->sfbOffsets[sfbOffs+sfb],
1160 quantSpecTmp+psyOutChannel->sfbOffsets[sfbOffs+sfb],
1161 psyOutChannel->sfbOffsets[sfbOffs+sfb+1]-psyOutChannel->sfbOffsets[sfbOffs+sfb],
1162 threshLdData, scfInt, minSfMaxQuant[sfbOffs+sfb],
1163 &sfbDistLdData[sfbOffs+sfb], &minScfCalculated[sfbOffs+sfb]
1166 scf[sfbOffs+sfb] = scfInt;
1210 for (sfb = 0; sfb < psyOutChannel->maxSfbPerGroup; sfb++) {
1211 if (scf[sfbOffs+sfb]!=FDK_INT_MIN)
1212 minSf = fixMin(minSf,scf[sfbOffs+sfb]);
1218 for (sfb = 0; sfb < psyOutChannel->maxSfbPerGroup; sfb++) {
1219 if ((scf[sfbOffs+sfb] != FDK_INT_MIN) && (minSf+MAX_SCF_DELTA) < scf[sfbOffs+sfb]) {
1220 scf[sfbOffs+sfb] = minSf + MAX_SCF_DELTA;
1222 sfbDistLdData[sfbOffs+sfb] =
1223 FDKaacEnc_calcSfbDist(qcOutChannel->mdctSpectrum+psyOutChannel->sfbOffsets[sfbOffs+sfb],
1224 quantSpec+psyOutChannel->sfbOffsets[sfbOffs+sfb],
1225 psyOutChannel->sfbOffsets[sfbOffs+sfb+1]-psyOutChannel->sfbOffsets[sfbOffs+sfb],
1226 scf[sfbOffs+sfb]
1237 for (sfb = 0; sfb < psyOutChannel->maxSfbPerGroup; sfb++) {
1238 maxSf = fixMax(maxSf,scf[sfbOffs+sfb]);
1246 for (sfb = 0; sfb < psyOutChannel->maxSfbPerGroup; sfb++) {
1247 if( scf[sfbOffs+sfb] == FDK_INT_MIN ) {
1248 scf[sfbOffs+sfb] = 0;
1250 for(j=psyOutChannel->sfbOffsets[sfbOffs+sfb]; j<psyOutChannel->sfbOffsets[sfbOffs+sfb+1]; j++ ) {
1255 scf[sfbOffs+sfb] = maxSf - scf[sfbOffs+sfb];
1264 for (sfb = 0; sfb < psyOutChannel->maxSfbPerGroup; sfb++) {
1265 scf[sfbOffs+sfb] = 0;
1267 for(j=psyOutChannel->sfbOffsets[sfbOffs+sfb]; j<psyOutChannel->sfbOffsets[sfbOffs+sfb+1]; j++ ) {