ref: 6d1a5cff3f992e07718299eaa62cfc01ab2baacb
parent: 9eaa1e967348f1c24a351d4cd523c3eb54e42456
author: menno <menno>
date: Wed Jan 19 10:13:14 EST 2000
LTP fixed and some other bugs.
--- a/enc_tf.c
+++ b/enc_tf.c
@@ -84,6 +84,8 @@
if (reconstructed_spectrum[chanNum]) free(reconstructed_spectrum[chanNum]);
if (overlap_buffer[chanNum]) free(overlap_buffer[chanNum]);
+ if (nok_lt_status[chanNum].delay) free(nok_lt_status[chanNum].delay);
+ if (nok_tmp_DTimeSigBuf[chanNum]) free(nok_tmp_DTimeSigBuf[chanNum]);
}
for (chanNum=0;chanNum<MAX_TIME_CHANNELS+2;chanNum++) {
if (DTimeSigLookAheadBuf[chanNum]) free(DTimeSigLookAheadBuf[chanNum]);
@@ -423,7 +425,7 @@
);
if (block_type[chanNum] == ONLY_SHORT_WINDOW) {
- for( k=0; k<8; k++ ) {
+ for (k = 0; k < 8; k++) {
specFilter(spectral_line_vector[chanNum]+k*BLOCK_LEN_SHORT, spectral_line_vector[chanNum]+k*BLOCK_LEN_SHORT, as->out_sampling_rate, as->cut_off, BLOCK_LEN_SHORT);
}
} else {
@@ -550,7 +552,7 @@
int i;
int leftChan=chanNum;
int rightChan=channelInfo[chanNum].paired_ch;
-
+
nok_ltp_enc(spectral_line_vector[leftChan],
nok_tmp_DTimeSigBuf[leftChan],
block_type[leftChan],
@@ -572,11 +574,8 @@
nok_lt_status[leftChan].sfb_prediction_used[i];
nok_lt_status[rightChan].weight = nok_lt_status[leftChan].weight;
nok_lt_status[rightChan].delay[0] = nok_lt_status[leftChan].delay[0];
-// for(i = 0; i < NOK_MAX_BLOCK_LEN_LONG; i++)
-// spectral_line_vector[rightChan][i] -=
-// nok_lt_status[rightChan].pred_mdct[i];
- if(block_type[leftChan] != block_type[rightChan])
+ if (!channelInfo[leftChan].common_window) {
nok_ltp_enc(spectral_line_vector[rightChan],
nok_tmp_DTimeSigBuf[rightChan],
block_type[rightChan],
@@ -587,7 +586,7 @@
&sfb_offset_table[rightChan][0],
nr_of_sfb[rightChan],
&nok_lt_status[rightChan]);
-
+ }
} /* if(channelInfo[chanNum].ch_is_left) */
} /* if(channelInfo[chanNum].cpe) */
else
@@ -695,16 +694,6 @@
&sfb_offset_table[chanNum][0],
nr_of_sfb[chanNum],
&nok_lt_status[chanNum]);
- }
-
- /* If short window, reconstruction not needed for prediction */
- for (chanNum=0;chanNum<max_ch;chanNum++) {
- if ((block_type[chanNum]==ONLY_SHORT_WINDOW)) {
- int sind;
- for (sind=0;sind<1024;sind++) {
- reconstructed_spectrum[chanNum][sind]=0.0;
- }
- }
}
/**********************************/
--- a/encoder.c
+++ b/encoder.c
@@ -36,8 +36,6 @@
return NULL;
}
-// if (ac->sampling_rate != 44100)
-// return NULL;
if((ac->bit_rate % 1000)||(ac->bit_rate < 16000)) {
return NULL;
}
@@ -142,7 +140,8 @@
data = malloc((samplesOut)*sizeof(float));
for (i = 0; i < samplesOut; i++)
data[i] = Buffer[i];
- }
+ } else
+ samplesOut = 1024*as->channels;
while(samplesOut >= 1024*as->channels)
{
@@ -157,12 +156,12 @@
as->inputBuffer[0][i] = data[curSample+(i*2)];
as->inputBuffer[1][i] = data[curSample+(i*2)+1];
}
- else // (Samples == 0) when called by faacEncodeFinish
- for (i = 0; i < 1024; i++)
- {
- as->inputBuffer[0][i] = 0;
- as->inputBuffer[1][i] = 0;
- }
+ else // (Samples == 0) when called by faacEncodeFinish
+ for (i = 0; i < 1024; i++)
+ {
+ as->inputBuffer[0][i] = 0;
+ as->inputBuffer[1][i] = 0;
+ }
} else {
// No mono supported yet (basically only a problem with decoder
// the encoder in fact supports it).
@@ -170,7 +169,6 @@
}
}
-#if 0
if (as->is_first_frame) {
EncTfFrame(as, (BsBitStream*)NULL);
@@ -179,9 +177,11 @@
*bitBufSize = 0;
- return FNO_ERROR;
+ samplesOut -= (as->channels*1024);
+ curSample += (as->channels*1024);
+
+ continue;
}
-#endif
bitBuf = BsOpenWrite(as->frame_bits * 10);