ref: 3cfcd0594afa1edc7137586d2951fd74f3938763
parent: a76a0b23eb7001411c898fecee39744d605d9d09
author: Jean-Marc Valin <[email protected]>
date: Fri Jan 18 08:56:08 EST 2008
Big mode cleanup. Keeping only one mono and one stereo mode
--- a/libcelt/celt.h
+++ b/libcelt/celt.h
@@ -43,11 +43,8 @@
typedef struct CELTMode CELTMode;
-extern const CELTMode const *celt_mode0;
-extern const CELTMode const *celt_mode1;
-extern const CELTMode const *celt_mode2;
-extern const CELTMode const *celt_mode3;
-extern const CELTMode const *celt_mode4;
+extern const CELTMode const *celt_mono;
+extern const CELTMode const *celt_stereo;
/* Encoder stuff */
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -97,7 +97,7 @@
//const int pbank3[PBANDS256+2] = {0, 8, 16, 24, 40, PITCH_END256, 256};
const int pbank3[PBANDS256+2] = {0, 4, 8, 12, 16, 24, 40, 56, PITCH_END256, 256};
-const CELTMode mode0 = {
+static const CELTMode mono_mode = {
128, /**< overlap */
256, /**< mdctSize */
1, /**< nbMdctBlocks */
@@ -115,93 +115,21 @@
means18, /**< eMeans */
decay18, /**< eDecay */
- 32, /**< defaultRate */
- 7, /**< nbAllocVectors */
+ NALLOCS, /**< nbAllocVectors */
bitalloc0, /**< allocVectors */
};
-/* Approx 38 kbps @ 44.1 kHz */
-const CELTMode mode1 = {
+/* Stereo mode around 120 kbps */
+static const CELTMode stereo_mode = {
128, /**< overlap */
- 128, /**< mdctSize */
- 2, /**< nbMdctBlocks */
- 1, /**< channels */
-
- NBANDS128, /**< nbEBands */
- PBANDS128, /**< nbPBands */
- PITCH_END128,/**< pitchEnd */
-
- qbank1, /**< eBands */
- pbank1, /**< pBands*/
- qpulses1, /**< nbPulses */
-
- 0.7, /**< ePredCoef */
- means, /**< eMeans */
- decay, /**< eDecay */
-
- 32, /**< defaultRate */
- 7, /**< nbAllocVectors */
- bitalloc0, /**< allocVectors */
-};
-
-/* Approx 58 kbps @ 44.1 kHz */
-const CELTMode mode2 = {
- 256, /**< overlap */
256, /**< mdctSize */
1, /**< nbMdctBlocks */
- 1, /**< channels */
-
- NBANDS, /**< nbEBands */
- PBANDS, /**< nbPBands */
- PITCH_END,/**< pitchEnd */
-
- qbank0, /**< eBands */
- pbank0, /**< pBands*/
- qpulses2, /**< nbPulses */
-
- 0.8, /**< ePredCoef */
- means18, /**< eMeans */
- decay18, /**< eDecay */
-
- 48, /**< defaultRate */
- 7, /**< nbAllocVectors */
- bitalloc0, /**< allocVectors */
-};
-
-const CELTMode mode3 = {
- 128, /**< overlap */
- 256, /**< mdctSize */
- 1, /**< nbMdctBlocks */
- 1, /**< channels */
-
- NBANDS256, /**< nbEBands */
- PBANDS256, /**< nbPBands */
- PITCH_END256,/**< pitchEnd */
-
- qbank3, /**< eBands */
- pbank3, /**< pBands*/
- qpulses1, /**< nbPulses */
-
- 0.7, /**< ePredCoef */
- means, /**< eMeans */
- decay, /**< eDecay */
-
- 32, /**< defaultRate */
- 7, /**< nbAllocVectors */
- bitalloc0, /**< allocVectors */
-};
-
-/* Stereo mode around 120 kbps */
-const CELTMode mode4 = {
- 256, /**< overlap */
- 256, /**< mdctSize */
- 1, /**< nbMdctBlocks */
2, /**< channels */
- NBANDS, /**< nbEBands */
- PBANDS, /**< nbPBands */
- PITCH_END,/**< pitchEnd */
+ NBANDS, /**< nbEBands */
+ PBANDS, /**< nbPBands */
+ PITCH_END, /**< pitchEnd */
qbank0, /**< eBands */
pbank0, /**< pBands*/
@@ -208,16 +136,12 @@
qpulses4s, /**< nbPulses */
0.8, /**< ePredCoef */
- means18, /**< eMeans */
- decay18, /**< eDecay */
+ means18, /**< eMeans */
+ decay18, /**< eDecay */
- 92, /**< defaultRate */
- 7, /**< nbAllocVectors */
+ NALLOCS, /**< nbAllocVectors */
bitalloc0, /**< allocVectors */
};
-const CELTMode const *celt_mode0 = &mode0;
-const CELTMode const *celt_mode1 = &mode1;
-const CELTMode const *celt_mode2 = &mode2;
-const CELTMode const *celt_mode3 = &mode3;
-const CELTMode const *celt_mode4 = &mode4;
+const CELTMode const *celt_mono = &mono_mode;
+const CELTMode const *celt_stereo = &stereo_mode;
--- a/libcelt/modes.h
+++ b/libcelt/modes.h
@@ -52,7 +52,6 @@
const float *eMeans;
const int *eDecay;
- int defaultRate;
int nbAllocVectors;
const int *allocVectors;
};
--- a/libcelt/testcelt.c
+++ b/libcelt/testcelt.c
@@ -53,8 +53,8 @@
fout = fopen(outFile, "wb+");
/* Use mode4 for stereo and don't forget to change the value of CHANNEL above */
- enc = celt_encoder_new(celt_mode0);
- dec = celt_decoder_new(celt_mode0);
+ enc = celt_encoder_new(celt_mono);
+ dec = celt_decoder_new(celt_mono);
while (!feof(fin))
{