Commit bf94045f authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Stereo almost works now (still need to fix the pitch estimate and add more

pulses)
parent ffa13474
......@@ -164,7 +164,7 @@ static void compute_mdcts(mdct_lookup *mdct_lookup, float *window, float *in, fl
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 @@ int celt_encode(CELTEncoder *st, short *pcm)
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 @@ int celt_encode(CELTEncoder *st, short *pcm)
/* 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 @@ int celt_decode(CELTDecoder *st, char *data, int len, short *pcm)
/* 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 @@ int celt_decode(CELTDecoder *st, char *data, int len, short *pcm)
/* 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 */
......
......@@ -93,6 +93,7 @@ const CELTMode mode3 = {
qpulses2 /**< nbPulses */
};
/* Stereo mode (doesn't work yet) */
const CELTMode mode4 = {
256, /**< frameSize */
128, /**< mdctSize */
......@@ -105,7 +106,7 @@ const CELTMode mode4 = {
qbank1, /**< eBands */
pbank1, /**< pBands*/
qpulses2 /**< nbPulses */
qpulses1 /**< nbPulses */
};
const CELTMode const *celt_mode1 = &mode1;
......
......@@ -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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment