shithub: opus

Download patch

ref: 6a0d97ebbc5d9147a1a6857df07a1a3e26b06855
parent: b76ee706068c1630d11252629772f8b9d7f2691e
author: Jean-Marc Valin <[email protected]>
date: Mon Mar 10 12:10:15 EDT 2008

No longer include redundent entries in the bit allocation cache

--- a/libcelt/dump_modes.c
+++ b/libcelt/dump_modes.c
@@ -119,10 +119,15 @@
       for (j=0;j<mode->nbEBands;j++)
       {
          int k;
-         fprintf (file, "const int allocCache_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[j][k]);
-         fprintf (file, "};\n");
+         if (j==0 || (mode->bits[j] != mode->bits[j-1]))
+         {
+            fprintf (file, "const int allocCache_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[j][k]);
+            fprintf (file, "};\n");
+         } else {
+            fprintf (file, "#define allocCache_band%d_%d_%d_%d allocCache_band%d_%d_%d_%d\n", j, mode->Fs, mode->mdctSize, mode->nbChannels, j-1, mode->Fs, mode->mdctSize, mode->nbChannels);
+         }
       }
       fprintf (file, "const int *allocCache%d_%d_%d[%d] = {\n", mode->Fs, mode->mdctSize, mode->nbChannels, mode->nbEBands);
       for (j=0;j<mode->nbEBands;j++)