diff --git a/libcelt/celt.h b/libcelt/celt.h index 86ab49ae639b50e9540cacb1179a5d9b3aeeb568..6223512b970eaf05d7f4d222ae2e1be260bc0b3c 100644 --- a/libcelt/celt.h +++ b/libcelt/celt.h @@ -53,10 +53,13 @@ typedef struct CELTDecoder CELTDecoder; typedef struct CELTMode CELTMode; -extern const CELTMode *celt_mono; +/*extern const CELTMode *celt_mono; extern const CELTMode *celt_stereo; -extern const CELTMode *celt_ld51; +extern const CELTMode *celt_ld51;*/ +#define celt_mono celt_mode_create(44100, 1, 256, 128) +#define celt_stereo celt_mode_create(44100, 2, 256, 128) + /* Encoder stuff */ CELTMode *celt_mode_create(int Fs, int channels, int frame_size, int overlap); diff --git a/libcelt/modes.c b/libcelt/modes.c index 7eb2e02881e4156e43f4a00e299e481bade3fe95..286548f79eade4dc1a153eb5eea10a7fc88a4381 100644 --- a/libcelt/modes.c +++ b/libcelt/modes.c @@ -103,8 +103,8 @@ static const CELTMode stereo_mode = { bitalloc0, /**< allocVectors */ }; -const CELTMode const *celt_mono = &mono_mode; -const CELTMode const *celt_stereo = &stereo_mode; +//const CELTMode const *celt_mono = &mono_mode; +//const CELTMode const *celt_stereo = &stereo_mode; #define NBANDS51 17 @@ -230,9 +230,9 @@ static int *compute_ebands(int Fs, int frame_size, int *nbEBands) eBands[*nbEBands] = eBands[*nbEBands+1]; /* FIXME: Remove last band if too small */ - for (i=0;i<*nbEBands+2;i++) + /*for (i=0;i<*nbEBands+2;i++) printf("%d ", eBands[i]); - printf ("\n"); + printf ("\n");*/ return eBands; } @@ -265,9 +265,9 @@ static void compute_pbands(CELTMode *mode, int res) pBands[i] = mode->eBands[j+1]; } } - for (i=0;i<mode->nbPBands+2;i++) + /*for (i=0;i<mode->nbPBands+2;i++) printf("%d ", pBands[i]); - printf ("\n"); + printf ("\n");*/ mode->pBands = pBands; mode->pitchEnd = pBands[PBANDS]; } @@ -301,12 +301,12 @@ static void compute_allocation_table(CELTMode *mode, int res) } } } - for (i=0;i<BITALLOC_SIZE;i++) + /*for (i=0;i<BITALLOC_SIZE;i++) { for (j=0;j<mode->nbEBands;j++) printf ("%2d ", allocVectors[i*mode->nbEBands+j]); printf ("\n"); - } + }*/ mode->allocVectors = allocVectors; } @@ -314,7 +314,7 @@ CELTMode *celt_mode_create(int Fs, int channels, int frame_size, int overlap) { int res; CELTMode *mode; - + res = (Fs+frame_size)/(2*frame_size); mode = celt_alloc(sizeof(CELTMode)); @@ -328,13 +328,13 @@ CELTMode *celt_mode_create(int Fs, int channels, int frame_size, int overlap) compute_allocation_table(mode, res); - printf ("%d bands\n", mode->nbEBands); + //printf ("%d bands\n", mode->nbEBands); return mode; } -/*int main() +void celt_mode_destroy(CELTMode *mode) { - celt_mode_create(44100, 1, 256, 128); - return 0; -}*/ - + celt_free((int*)mode->eBands); + celt_free((int*)mode->pBands); + celt_free((int*)mode->allocVectors); +} diff --git a/libcelt/testcelt.c b/libcelt/testcelt.c index 6ad7312e596d9cba2264928fa2b6312392774f8b..a73f7cd9e5f467b96c69c33c4f426358c300ab1d 100644 --- a/libcelt/testcelt.c +++ b/libcelt/testcelt.c @@ -41,7 +41,7 @@ int main(int argc, char *argv[]) int i; char *inFile, *outFile; FILE *fin, *fout; - const CELTMode *mode = celt_mono; + const CELTMode *mode; CELTEncoder *enc; CELTDecoder *dec; int len; @@ -61,8 +61,6 @@ int main(int argc, char *argv[]) mode = celt_mono; else if (strcmp(argv[1], "-stereo")==0) mode = celt_stereo; - else if (strcmp(argv[1], "-ld51")==0) - mode = celt_ld51; else { fprintf (stderr, "mode must be -mono or -stereo\n"); return 1; @@ -89,7 +87,7 @@ int main(int argc, char *argv[]) return 1; } - //mode = celt_mode_create(44100, 1, 256, 128); + //mode = celt_mode_create(44100, 1, 192, 64); /* Use mode4 for stereo and don't forget to change the value of CHANNEL above */ enc = celt_encoder_new(mode); dec = celt_decoder_new(mode);