mirror of
https://github.com/xiph/opus.git
synced 2025-06-03 00:57:43 +00:00
fix STATIC_MODES for stereo (with a few fixes by JMV)
This commit is contained in:
parent
b6f9061343
commit
7bf550ead4
1 changed files with 36 additions and 2 deletions
|
@ -154,7 +154,35 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes)
|
|||
fprintf(file, "#endif\n");
|
||||
fprintf(file, "\n");
|
||||
|
||||
|
||||
|
||||
if (mode->bits_stereo)
|
||||
{
|
||||
fprintf(file, "#ifndef DEF_ALLOC_STEREO_CACHE%d_%d_%d\n", mode->Fs, mode->mdctSize, mode->nbChannels);
|
||||
fprintf(file, "#define DEF_ALLOC_STEREO_CACHE%d_%d_%d\n", mode->Fs, mode->mdctSize, mode->nbChannels);
|
||||
for (j=0;j<mode->nbEBands;j++)
|
||||
{
|
||||
int k;
|
||||
if (j==0 || (mode->bits[j] != mode->bits_stereo[j-1]))
|
||||
{
|
||||
fprintf (file, "static const celt_int16_t allocStereoCache_band%d_%d_%d_%d[MAX_PULSES] = {\n", j, mode->Fs, mode->mdctSize, mode->nbChannels);
|
||||
for (k=0;k<MAX_PULSES;k++)
|
||||
fprintf (file, "%2d, ", mode->bits_stereo[j][k]);
|
||||
fprintf (file, "};\n");
|
||||
} else {
|
||||
fprintf (file, "#define allocStereoCache_band%d_%d_%d_%d allocStereoCache_band%d_%d_%d_%d\n", j, mode->Fs, mode->mdctSize, mode->nbChannels, j-1, mode->Fs, mode->mdctSize, mode->nbChannels);
|
||||
}
|
||||
}
|
||||
fprintf (file, "static const celt_int16_t *allocStereoCache%d_%d_%d[%d] = {\n", mode->Fs, mode->mdctSize, mode->nbChannels, mode->nbEBands);
|
||||
for (j=0;j<mode->nbEBands;j++)
|
||||
{
|
||||
fprintf (file, "allocStereoCache_band%d_%d_%d_%d, ", j, mode->Fs, mode->mdctSize, mode->nbChannels);
|
||||
}
|
||||
fprintf (file, "};\n");
|
||||
fprintf(file, "#endif\n");
|
||||
fprintf(file, "\n");
|
||||
}
|
||||
|
||||
|
||||
fprintf(file, "static const CELTMode mode%d_%d_%d_%d = {\n", mode->Fs, mode->nbChannels, mode->mdctSize, mode->overlap);
|
||||
fprintf(file, "0x%x,\t/* marker */\n", 0xa110ca7e);
|
||||
fprintf(file, INT32 ",\t/* Fs */\n", mode->Fs);
|
||||
|
@ -170,7 +198,10 @@ void dump_modes(FILE *file, CELTMode **modes, int nb_modes)
|
|||
fprintf(file, "%d,\t/* nbAllocVectors */\n", mode->nbAllocVectors);
|
||||
fprintf(file, "allocVectors%d_%d_%d,\t/* allocVectors */\n", mode->Fs, mode->mdctSize, mode->nbChannels);
|
||||
fprintf(file, "allocCache%d_%d_%d,\t/* bits */\n", mode->Fs, mode->mdctSize, mode->nbChannels);
|
||||
fprintf(file, "0,\t/* bits_stereo */\n");
|
||||
if (mode->bits_stereo)
|
||||
fprintf(file, "allocStereoCache%d_%d_%d,\t/* bits_stereo */\n", mode->Fs, mode->mdctSize, mode->nbChannels);
|
||||
else
|
||||
fprintf(file, "0,\t/* bits_stereo */\n");
|
||||
fprintf(file, "{%d, 0, 0},\t/* mdct */\n", 2*mode->mdctSize);
|
||||
fprintf(file, "0,\t/* fft */\n");
|
||||
fprintf(file, "window%d,\t/* window */\n", mode->overlap);
|
||||
|
@ -261,5 +292,8 @@ int main(int argc, char **argv)
|
|||
file = fopen("static_modes.h", "w");
|
||||
dump_header(file, m, nb);
|
||||
fclose(file);
|
||||
for (i=0;i<nb;i++)
|
||||
celt_mode_destroy(m[i]);
|
||||
free(m);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue