rtoss - Diff between revs 14 and 26

Subversion Repositories:
Rev:
Show entire file - Ignore whitespace
Rev 14 Rev 26
Line 1... Line 1...
1 /* 1 /*
2  * libmad - MPEG audio decoder library 2  * libmad - MPEG audio decoder library
3  * Copyright (C) 2000-2003 Underbit Technologies, Inc. -  
-   3  * Copyright (C) 2000-2004 Underbit Technologies, Inc.
4  * 4  *
5  * This program is free software; you can redistribute it and/or modify 5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by 6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or 7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version. 8  * (at your option) any later version.
Line 14... Line 14...
14  * 14  *
15  * You should have received a copy of the GNU General Public License 15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software 16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  * 18  *
19  * $Id: layer12.c,v 1.15 2003/05/27 22:40:36 rob Exp $ -  
-   19  * $Id: layer12.c,v 1.17 2004/02/05 09:02:39 rob Exp $
20  */ 20  */
21 21
22 # ifdef HAVE_CONFIG_H 22 # ifdef HAVE_CONFIG_H
23 #  include "config.h" 23 #  include "config.h"
24 # endif 24 # endif
Line 339... Line 339...
339 339
340   nch = MAD_NCHANNELS(header); 340   nch = MAD_NCHANNELS(header);
341 341
342   if (header->flags & MAD_FLAG_LSF_EXT) 342   if (header->flags & MAD_FLAG_LSF_EXT)
343     index = 4; 343     index = 4;
-   344   else if (header->flags & MAD_FLAG_FREEFORMAT)
-   345     goto freeformat;
344   else { 346   else {
345     switch (nch == 2 ? header->bitrate / 2 : header->bitrate) { -  
346     case 32000: -  
347     case 48000: -  
348       index = (header->samplerate == 32000) ? 3 : 2; -  
349       break; -  
-   347     unsigned long bitrate_per_channel;
350 348
351     case 56000: -  
352     case 64000: -  
353     case 80000: -  
354       index = 0; -  
355       break; -  
-   349     bitrate_per_channel = header->bitrate;
-   350     if (nch == 2) {
-   351       bitrate_per_channel /= 2;
356 352
357     default: -  
-   353 # if defined(OPT_STRICT)
-   354       /*
-   355        * ISO/IEC 11172-3 allows only single channel mode for 32, 48, 56, and
-   356        * 80 kbps bitrates in Layer II, but some encoders ignore this
-   357        * restriction. We enforce it if OPT_STRICT is defined.
-   358        */
-   359       if (bitrate_per_channel <= 28000 || bitrate_per_channel == 40000) {
-   360         stream->error = MAD_ERROR_BADMODE;
-   361         return -1;
-   362       }
-   363 # endif
-   364     }
-   365     else {  /* nch == 1 */
-   366       if (bitrate_per_channel > 192000) {
-   367         /*
-   368          * ISO/IEC 11172-3 does not allow single channel mode for 224, 256,
-   369          * 320, or 384 kbps bitrates in Layer II.
-   370          */
-   371         stream->error = MAD_ERROR_BADMODE;
-   372         return -1;
-   373       }
-   374     }
-   375
-   376     if (bitrate_per_channel <= 48000)
-   377       index = (header->samplerate == 32000) ? 3 : 2;
-   378     else if (bitrate_per_channel <= 80000)
-   379       index = 0;
-   380     else {
-   381     freeformat:
358       index = (header->samplerate == 48000) ? 0 : 1; 382       index = (header->samplerate == 48000) ? 0 : 1;
359     } 383     }
360   } 384   }
361 385
362   sblimit = sbquant_table[index].sblimit; 386   sblimit = sbquant_table[index].sblimit;