Rearrange mode structure to avoid wasting memory from padding.

This commit is contained in:
Gregory Maxwell 2011-08-12 19:03:29 -04:00
parent e866ee559a
commit 86dd98409f
5 changed files with 22 additions and 24 deletions

View file

@ -162,15 +162,15 @@ struct CELTEncoder {
#endif
int consec_transient;
opus_val32 preemph_memE[2];
opus_val32 preemph_memD[2];
/* VBR-related parameters */
opus_int32 vbr_reservoir;
opus_int32 vbr_drift;
opus_int32 vbr_offset;
opus_int32 vbr_count;
opus_val32 preemph_memE[2];
opus_val32 preemph_memD[2];
#ifdef RESYNTH
celt_sig syn_mem[2][2*MAX_PERIOD];
#endif

View file

@ -211,22 +211,24 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes)
fprintf(file, "eband5ms,\t/* eBands */\n");
else
fprintf(file, "eBands%d_%d,\t/* eBands */\n", mode->Fs, mdctSize);
fprintf(file, "%d,\t/* maxLM */\n", mode->maxLM);
fprintf(file, "%d,\t/* nbShortMdcts */\n", mode->nbShortMdcts);
fprintf(file, "%d,\t/* shortMdctSize */\n", mode->shortMdctSize);
fprintf(file, "%d,\t/* nbAllocVectors */\n", mode->nbAllocVectors);
if (standard)
fprintf(file, "band_allocation,\t/* allocVectors */\n");
else
fprintf(file, "allocVectors%d_%d,\t/* allocVectors */\n", mode->Fs, mdctSize);
fprintf(file, "logN%d,\t/* logN */\n", framerate);
fprintf(file, "window%d,\t/* window */\n", mode->overlap);
fprintf(file, "{%d, %d, {", mode->mdct.n, mode->mdct.maxshift);
for (k=0;k<=mode->mdct.maxshift;k++)
fprintf(file, "&fft_state%d_%d_%d, ", mode->Fs, mdctSize, k);
fprintf (file, "}, mdct_twiddles%d},\t/* mdct */\n", mdctSize);
fprintf(file, "window%d,\t/* window */\n", mode->overlap);
fprintf(file, "%d,\t/* maxLM */\n", mode->maxLM);
fprintf(file, "%d,\t/* nbShortMdcts */\n", mode->nbShortMdcts);
fprintf(file, "%d,\t/* shortMdctSize */\n", mode->shortMdctSize);
fprintf(file, "logN%d,\t/* logN */\n", framerate);
fprintf(file, "{%d, cache_index%d, cache_bits%d, cache_caps%d},\t/* cache */\n",
mode->cache.size, mode->Fs/mdctSize, mode->Fs/mdctSize, mode->Fs/mdctSize);
fprintf(file, "};\n");

View file

@ -74,20 +74,16 @@ struct CELTMode {
opus_val16 preemph[4];
const opus_int16 *eBands; /**< Definition for each "pseudo-critical band" */
int nbAllocVectors; /**< Number of lines in the matrix below */
const unsigned char *allocVectors; /**< Number of bits in each band for several rates */
/* Stuff that could go in the {en,de}coder, but we save space this way */
mdct_lookup mdct;
const opus_val16 *window;
int maxLM;
int nbShortMdcts;
int shortMdctSize;
int nbAllocVectors; /**< Number of lines in the matrix below */
const unsigned char *allocVectors; /**< Number of bits in each band for several rates */
const opus_int16 *logN;
const opus_val16 *window;
mdct_lookup mdct;
PulseCache cache;
};

View file

@ -112,14 +112,14 @@ static const CELTMode mode48000_960_120 = {
21, /* effEBands */
{27853, 0, 4096, 8192, }, /* preemph */
eband5ms, /* eBands */
11, /* nbAllocVectors */
band_allocation, /* allocVectors */
{1920, 3, {&fft_state48000_960_0, &fft_state48000_960_1, &fft_state48000_960_2, &fft_state48000_960_3, }, mdct_twiddles960}, /* mdct */
window120, /* window */
3, /* maxLM */
8, /* nbShortMdcts */
120, /* shortMdctSize */
11, /* nbAllocVectors */
band_allocation, /* allocVectors */
logN400, /* logN */
window120, /* window */
{1920, 3, {&fft_state48000_960_0, &fft_state48000_960_1, &fft_state48000_960_2, &fft_state48000_960_3, }, mdct_twiddles960}, /* mdct */
{392, cache_index50, cache_bits50, cache_caps50}, /* cache */
};

View file

@ -116,14 +116,14 @@ static const CELTMode mode48000_960_120 = {
21, /* effEBands */
{0.85000610f, 0.0000000f, 1.0000000f, 1.0000000f, }, /* preemph */
eband5ms, /* eBands */
11, /* nbAllocVectors */
band_allocation, /* allocVectors */
{1920, 3, {&fft_state48000_960_0, &fft_state48000_960_1, &fft_state48000_960_2, &fft_state48000_960_3, }, mdct_twiddles960}, /* mdct */
window120, /* window */
3, /* maxLM */
8, /* nbShortMdcts */
120, /* shortMdctSize */
11, /* nbAllocVectors */
band_allocation, /* allocVectors */
logN400, /* logN */
window120, /* window */
{1920, 3, {&fft_state48000_960_0, &fft_state48000_960_1, &fft_state48000_960_2, &fft_state48000_960_3, }, mdct_twiddles960}, /* mdct */
{392, cache_index50, cache_bits50, cache_caps50}, /* cache */
};