[xiph-cvs] cvs commit: ices/src mp3.c

Brendan brendan at xiph.org
Mon Mar 10 13:32:05 PST 2003



brendan     03/03/10 16:32:05

  Modified:    src      mp3.c
  Log:
  Save a few statically allocated bytes

Revision  Changes    Path
1.19      +7 -7      ices/src/mp3.c

Index: mp3.c
===================================================================
RCS file: /cvs/ice/ices/src/mp3.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- mp3.c	10 Mar 2003 20:43:45 -0000	1.18
+++ mp3.c	10 Mar 2003 21:32:05 -0000	1.19
@@ -47,23 +47,20 @@
   int pos;
 } ices_mp3_in_t;
 
-static unsigned int bitrates[3][3][15] =
+static unsigned int bitrates[2][3][15] =
 {
+  /* MPEG-1 */
   {
     {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448},
     {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384},
     {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320}
   },
+  /* MPEG-2 LSF, MPEG-2.5 */
   {
     {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256},
     {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160},
     {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160}
   },
-  {
-    {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256},
-    {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160},
-    {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160}
-  }
 };
 
 static unsigned int s_freq[3][4] =
@@ -311,7 +308,10 @@
     return 0;
 
   header->error_protection = !(buf[1] & 0x1);
-  header->bitrate = bitrates[header->version][header->layer-1][bitrate_idx];
+  if (header->version == 0)
+    header->bitrate = bitrates[0][header->layer-1][bitrate_idx];
+  else
+    header->bitrate = bitrates[1][header->layer-1][bitrate_idx];
   header->samplerate = s_freq[header->version][samplerate_idx];
   header->padding = (buf[2] >> 1) & 0x01;
   header->extension = buf[2] & 0x01;

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list