summaryrefslogtreecommitdiffstats
path: root/libAACenc/src
diff options
context:
space:
mode:
Diffstat (limited to 'libAACenc/src')
-rw-r--r--libAACenc/src/aacenc.cpp32
-rw-r--r--libAACenc/src/aacenc_lib.cpp38
2 files changed, 33 insertions, 37 deletions
diff --git a/libAACenc/src/aacenc.cpp b/libAACenc/src/aacenc.cpp
index 16e28a2..96668cc 100644
--- a/libAACenc/src/aacenc.cpp
+++ b/libAACenc/src/aacenc.cpp
@@ -137,7 +137,7 @@ INT FDKaacEnc_LimitBitrate(
do {
prevBitRate = bitRate;
averageBitsPerFrame = (bitRate*(frameLength>>shift)) / (coreSamplingRate>>shift) / nSubFrames;
- fprintf(stderr, "FDKaacEnc_LimitBitrate(): averageBitsPerFrame=%d, prevBitRate=%d, nSubFrames=%d\n", averageBitsPerFrame, prevBitRate, bitRate);
+ //fprintf(stderr, "FDKaacEnc_LimitBitrate(): averageBitsPerFrame=%d, prevBitRate=%d, nSubFrames=%d\n", averageBitsPerFrame, prevBitRate, bitRate);
if (pAverageBitsPerFrame != NULL) {
*pAverageBitsPerFrame = averageBitsPerFrame;
@@ -145,27 +145,23 @@ INT FDKaacEnc_LimitBitrate(
if (hTpEnc != NULL) {
transportBits = transportEnc_GetStaticBits(hTpEnc, averageBitsPerFrame);
- //if(hTpEnc->transportFmt == TT_DABPLUS) {
- fprintf(stderr, "FDKaacEnc_LimitBitrate(): hTpEnc != NULL\n");
- //transportBits +=
- //}
} else {
/* Assume some worst case */
transportBits = 208;
}
- fprintf(stderr, "FDKaacEnc_LimitBitrate(): transportBits=%d, FDKmax(%d, %d)\n", transportBits, bitRate,
- ((((40 * nChannels) + transportBits) * (coreSamplingRate)) / frameLength));
+ //fprintf(stderr, "FDKaacEnc_LimitBitrate(): transportBits=%d, FDKmax(%d, %d)\n", transportBits, bitRate,
+ // ((((40 * nChannels) + transportBits) * (coreSamplingRate)) / frameLength));
bitRate = FDKmax(bitRate, ((((40 * nChannels) + transportBits) * (coreSamplingRate)) / frameLength) );
FDK_ASSERT(bitRate >= 0);
- fprintf(stderr, "FDKaacEnc_LimitBitrate(): FDKmin(%d, %d)\n", bitRate, ((nChannelsEff * MIN_BUFSIZE_PER_EFF_CHAN)*(coreSamplingRate>>shift)) / (frameLength>>shift));
+ //fprintf(stderr, "FDKaacEnc_LimitBitrate(): FDKmin(%d, %d)\n", bitRate, ((nChannelsEff * MIN_BUFSIZE_PER_EFF_CHAN)*(coreSamplingRate>>shift)) / (frameLength>>shift));
bitRate = FDKmin(bitRate, ((nChannelsEff * MIN_BUFSIZE_PER_EFF_CHAN)*(coreSamplingRate>>shift)) / (frameLength>>shift)) ;
FDK_ASSERT(bitRate >= 0);
} while (prevBitRate != bitRate && iter++ < 3) ;
- fprintf(stderr, "FDKaacEnc_LimitBitrate(): bitRate=%d\n", bitRate);
+ //fprintf(stderr, "FDKaacEnc_LimitBitrate(): bitRate=%d\n", bitRate);
return bitRate;
}
@@ -452,13 +448,13 @@ AAC_ENCODER_ERROR FDKaacEnc_Initialize(HANDLE_AAC_ENC hAacEnc,
}
//config->nSubFrames = frames_per_superframe;
- fprintf(stderr, "DAB+ superframe size=%d\n", superframe_size);
- config->bitRate = (superframe_size - 16*(frames_per_superframe-1) - staticBits) * 1000/120;
- fprintf(stderr, "DAB+ tuned bitrate=%d\n", config->bitRate);
- config->maxBitsPerFrame = (superframe_size - 16*(frames_per_superframe-1) - staticBits) / frames_per_superframe;
- config->maxBitsPerFrame += 7; /*padding*/
+ //fprintf(stderr, "DAB+ superframe size=%d\n", superframe_size);
+ config->bitRate = (superframe_size - 16*(frames_per_superframe-1) - staticBits) * 1000/120;
+ //fprintf(stderr, "DAB+ tuned bitrate=%d\n", config->bitRate);
+ config->maxBitsPerFrame = (superframe_size - 16*(frames_per_superframe-1) - staticBits) / frames_per_superframe;
+ config->maxBitsPerFrame += 7; /*padding*/
//config->bitreservoir=(superframe_size - 16*(frames_per_superframe-1) - staticBits - 2*8)/frames_per_superframe;
- fprintf(stderr, "DAB+ tuned maxBitsPerFrame=%d\n", (superframe_size - 16*(frames_per_superframe-1) - staticBits)/frames_per_superframe);
+ //fprintf(stderr, "DAB+ tuned maxBitsPerFrame=%d\n", (superframe_size - 16*(frames_per_superframe-1) - staticBits)/frames_per_superframe);
}
/* check bit rate */
@@ -610,15 +606,15 @@ AAC_ENCODER_ERROR FDKaacEnc_Initialize(HANDLE_AAC_ENC hAacEnc,
qcInit.averageBits = (averageBitsPerFrame+7)&~7;
maxBitres = (MIN_BUFSIZE_PER_EFF_CHAN*cm->nChannelsEff) - qcInit.averageBits;
qcInit.bitRes = (config->bitreservoir!=-1) ? FDKmin(config->bitreservoir, maxBitres) : maxBitres;
- fprintf(stderr, "qcInit.bitRes=%d\n", qcInit.bitRes);
+ //fprintf(stderr, "qcInit.bitRes=%d\n", qcInit.bitRes);
qcInit.maxBits = fixMin(MIN_BUFSIZE_PER_EFF_CHAN*cm->nChannelsEff, ((averageBitsPerFrame+7)&~7)+qcInit.bitRes);
qcInit.maxBits = (config->maxBitsPerFrame!=-1) ? fixMin(qcInit.maxBits, config->maxBitsPerFrame) : qcInit.maxBits;
- fprintf(stderr, "qcInit.maxBits=%d\n", qcInit.maxBits);
+ //fprintf(stderr, "qcInit.maxBits=%d\n", qcInit.maxBits);
qcInit.minBits = fixMax(0, ((averageBitsPerFrame-1)&~7)-qcInit.bitRes-transportEnc_GetStaticBits(hTpEnc, ((averageBitsPerFrame+7)&~7)+qcInit.bitRes));
qcInit.minBits = (config->minBitsPerFrame!=-1) ? fixMax(qcInit.minBits, config->minBitsPerFrame) : qcInit.minBits;
- fprintf(stderr, "qcInit.minBits=%d\n", qcInit.minBits);
+ //fprintf(stderr, "qcInit.minBits=%d\n", qcInit.minBits);
}
qcInit.sampleRate = config->sampleRate;
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index edda485..6b77155 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -486,21 +486,21 @@ static void FDKaacEnc_MapConfig(
cc->channelMode = hAacConfig->channelMode;
if(extCfg->userTpType == TT_DABPLUS && hAacConfig->nSubFrames==1) {
- switch(hAacConfig->sampleRate) {
- case 48000:
- cc->nSubFrames=6;
- break;
- case 32000:
- cc->nSubFrames=4;
- break;
- case 24000:
- cc->nSubFrames=3;
- break;
- case 16000:
- cc->nSubFrames=2;
- break;
- }
- fprintf(stderr, "hAacConfig->nSubFrames=%d hAacConfig->sampleRate=%d\n", hAacConfig->nSubFrames, hAacConfig->sampleRate);
+ switch(hAacConfig->sampleRate) {
+ case 48000:
+ cc->nSubFrames=6;
+ break;
+ case 32000:
+ cc->nSubFrames=4;
+ break;
+ case 24000:
+ cc->nSubFrames=3;
+ break;
+ case 16000:
+ cc->nSubFrames=2;
+ break;
+ }
+ //fprintf(stderr, "hAacConfig->nSubFrames=%d hAacConfig->sampleRate=%d\n", hAacConfig->nSubFrames, hAacConfig->sampleRate);
} else {
cc->nSubFrames = (hAacConfig->nSubFrames > 1 && extCfg->userTpNsubFrames == 1)
? hAacConfig->nSubFrames
@@ -770,7 +770,7 @@ INT aacEncoder_LimitBitrate(
FDK_ASSERT(bitRate > 0);
- fprintf(stderr, "aacEncoder_LimitBitrate(): bitRate=%d\n", bitRate);
+ //fprintf(stderr, "aacEncoder_LimitBitrate(): bitRate=%d\n", bitRate);
return bitRate;
}
@@ -981,7 +981,7 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
- fprintf(stderr, "config->userBitrate=%d\n", config->userBitrate);
+ //fprintf(stderr, "config->userBitrate=%d\n", config->userBitrate);
/* We need the frame length to call aacEncoder_LimitBitrate() */
hAacConfig->bitRate = aacEncoder_LimitBitrate(
NULL,
@@ -995,7 +995,7 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
hAacConfig->sbrRatio,
hAacConfig->audioObjectType
);
- fprintf(stderr, "hAacConfig->bitRate=%d\n", hAacConfig->bitRate);
+ //fprintf(stderr, "hAacConfig->bitRate=%d\n", hAacConfig->bitRate);
/* Configure PNS */
if ( ((hAacConfig->bitrateMode>=1) && (hAacConfig->bitrateMode<=5)) /* VBR without PNS. */
@@ -1040,7 +1040,7 @@ AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
hAacEncoder->metaDataAllowed = 0;
}
- fprintf(stderr, "hAacEncoder->metaDataAllowed=%d\n", hAacEncoder->metaDataAllowed);
+ //fprintf(stderr, "hAacEncoder->metaDataAllowed=%d\n", hAacEncoder->metaDataAllowed);
return err;
}