ref: bf94045f4126f4ae90c6491e0d66d173cdb92e16
parent: ffa13474efdc59f0ddc095c7c5e389b37ec9c946
author: Jean-Marc Valin <[email protected]>
date: Mon Dec 10 12:10:29 EST 2007
Stereo almost works now (still need to fix the pitch estimate and add more pulses)
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -164,7 +164,7 @@
float x[2*N];
float tmp[N];
for (j=0;j<2*N;j++)
- x[j] = window[j]*in[(B+1)*N*c+i*N+j];
+ x[j] = window[j]*in[C*i*N+C*j+c];
mdct_forward(mdct_lookup, x, tmp);
/* Interleaving the sub-frames */
for (j=0;j<N;j++)
@@ -249,8 +249,11 @@
for (j=0;j<B*N;j++)
printf ("%f ", P[j]);
printf ("\n");*/
- //haar1(X, B*N);
- //haar1(P, B*N);
+ if (C==2)
+ {
+ haar1(X, B*N);
+ haar1(P, B*N);
+ }
/* Band normalisation */
compute_band_energies(st->mode, X, bandE);
@@ -295,7 +298,8 @@
/* Synthesis */
denormalise_bands(st->mode, X, bandE);
- //inv_haar1(X, B*N);
+ if (C==2)
+ inv_haar1(X, B*N);
CELT_MOVE(st->out_mem, st->out_mem+C*B*N, C*(MAX_PERIOD-B*N));
/* Compute inverse MDCTs */
@@ -479,7 +483,8 @@
/* Pitch MDCT */
compute_mdcts(&st->mdct_lookup, st->window, st->out_mem+pitch_index*C, P, N, B, C);
- //haar1(P, B*N);
+ if (C==2)
+ haar1(P, B*N);
{
float bandEp[st->mode->nbEBands];
@@ -499,7 +504,8 @@
/* Synthesis */
denormalise_bands(st->mode, X, bandE);
- //inv_haar1(X, B*N);
+ if (C==2)
+ inv_haar1(X, B*N);
CELT_MOVE(st->out_mem, st->out_mem+C*B*N, C*(MAX_PERIOD-B*N));
/* Compute inverse MDCTs */
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -93,6 +93,7 @@
qpulses2 /**< nbPulses */
};
+/* Stereo mode (doesn't work yet) */
const CELTMode mode4 = {
256, /**< frameSize */
128, /**< mdctSize */
@@ -105,7 +106,7 @@
qbank1, /**< eBands */
pbank1, /**< pBands*/
- qpulses2 /**< nbPulses */
+ qpulses1 /**< nbPulses */
};
const CELTMode const *celt_mode1 = &mode1;
--- a/libcelt/testcelt.c
+++ b/libcelt/testcelt.c
@@ -35,12 +35,13 @@
#include <stdlib.h>
#define FRAME_SIZE 256
+#define CHANNELS 1
int main(int argc, char *argv[])
{
char *inFile, *outFile;
FILE *fin, *fout;
- short in[FRAME_SIZE];
+ short in[FRAME_SIZE*CHANNELS];
CELTEncoder *enc;
CELTDecoder *dec;
int len;
@@ -56,7 +57,7 @@
while (!feof(fin))
{
- fread(in, sizeof(short), FRAME_SIZE, fin);
+ fread(in, sizeof(short), FRAME_SIZE*CHANNELS, fin);
celt_encode(enc, in);
data = celt_encoder_get_bytes(enc, &len);
//printf ("%d\n", len);
@@ -66,8 +67,8 @@
celt_decode(dec, NULL, len, in);
else
celt_decode(dec, data, len, in);
- fwrite(in, sizeof(short), FRAME_SIZE, fout);
#endif
+ fwrite(in, sizeof(short), FRAME_SIZE*CHANNELS, fout);
}
//data = celt_encoder_get_bytes(enc, &len);
//printf ("%d bytes total\n", len);