comparison libfaad2/drc.c @ 12527:4a370c80fe5c

update to the 2.0 release of faad, patch by adland
author diego
date Wed, 02 Jun 2004 22:59:04 +0000
parents 3185f64f6350
children d81145997036
comparison
equal deleted inserted replaced
12526:e183ad37d24c 12527:4a370c80fe5c
1 /* 1 /*
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding 2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
3 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com 3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
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.
20 ** forbidden. 20 ** forbidden.
21 ** 21 **
22 ** Commercial non-GPL licensing of this software is possible. 22 ** Commercial non-GPL licensing of this software is possible.
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. 23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
24 ** 24 **
25 ** $Id: drc.c,v 1.1 2003/08/30 22:30:21 arpi Exp $ 25 ** $Id: drc.c,v 1.2 2003/10/03 22:22:27 alex Exp $
26 **/ 26 **/
27 27
28 #include "common.h" 28 #include "common.h"
29 #include "structs.h" 29 #include "structs.h"
30 30
33 #include "syntax.h" 33 #include "syntax.h"
34 #include "drc.h" 34 #include "drc.h"
35 35
36 drc_info *drc_init(real_t cut, real_t boost) 36 drc_info *drc_init(real_t cut, real_t boost)
37 { 37 {
38 drc_info *drc = (drc_info*)malloc(sizeof(drc_info)); 38 drc_info *drc = (drc_info*)faad_malloc(sizeof(drc_info));
39 memset(drc, 0, sizeof(drc_info)); 39 memset(drc, 0, sizeof(drc_info));
40 40
41 drc->ctrl1 = cut; 41 drc->ctrl1 = cut;
42 drc->ctrl2 = boost; 42 drc->ctrl2 = boost;
43 43
49 return drc; 49 return drc;
50 } 50 }
51 51
52 void drc_end(drc_info *drc) 52 void drc_end(drc_info *drc)
53 { 53 {
54 if (drc) free(drc); 54 if (drc) faad_free(drc);
55 } 55 }
56 56
57 #ifdef FIXED_POINT 57 #ifdef FIXED_POINT
58 static real_t drc_pow2_table[] = 58 static real_t drc_pow2_table[] =
59 { 59 {
151 { 151 {
152 for (i = bottom; i < top; i++) 152 for (i = bottom; i < top; i++)
153 { 153 {
154 spec[i] >>= -exp; 154 spec[i] >>= -exp;
155 if (frac) 155 if (frac)
156 spec[i] = MUL(spec[i],drc_pow2_table[frac+23]); 156 spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
157 } 157 }
158 } else { 158 } else {
159 for (i = bottom; i < top; i++) 159 for (i = bottom; i < top; i++)
160 { 160 {
161 spec[i] <<= exp; 161 spec[i] <<= exp;
162 if (frac) 162 if (frac)
163 spec[i] = MUL(spec[i],drc_pow2_table[frac+23]); 163 spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
164 } 164 }
165 } 165 }
166 #endif 166 #endif
167 167
168 bottom = top; 168 bottom = top;