summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad/layer12.c
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/libmad/layer12.c') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/layer12.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/libmad/layer12.c b/core/multimedia/opieplayer/libmad/layer12.c
index 41b17ca..d291174 100644
--- a/core/multimedia/opieplayer/libmad/layer12.c
+++ b/core/multimedia/opieplayer/libmad/layer12.c
@@ -1,98 +1,98 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
# ifdef HAVE_CONFIG_H
# include "libmad_config.h"
# endif
# include "libmad_global.h"
# ifdef HAVE_LIMITS_H
# include <limits.h>
# else
# define CHAR_BIT 8
# endif
# include "fixed.h"
# include "bit.h"
# include "stream.h"
# include "frame.h"
# include "layer12.h"
/*
* scalefactor table
* used in both Layer I and Layer II decoding
*/
static
mad_fixed_t const sf_table[63] = {
# include "sf_table.dat"
};
/* --- Layer I ------------------------------------------------------------- */
/* linear scaling table */
static
mad_fixed_t const linear_table[14] = {
MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */
MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */
MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */
MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */
MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */
MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */
MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */
MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */
MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */
MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */
MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */
MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */
MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */
MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */
};
/*
* NAME: I_sample()
* DESCRIPTION: decode one requantized Layer I sample from a bitstream
*/
static
mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb)
{
mad_fixed_t sample;
sample = mad_bit_read(ptr, nb);
/* invert most significant bit, extend sign, then scale to fixed format */
sample ^= 1 << (nb - 1);
sample |= -(sample & (1 << (nb - 1)));
sample <<= MAD_F_FRACBITS - (nb - 1);
/* requantize the sample */
/* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */
sample += MAD_F_ONE >> (nb - 1);
return mad_f_mul(sample, linear_table[nb - 2]);
/* s' = factor * s'' */
/* (to be performed by caller) */
}