comparison libfaad2/is.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: is.c,v 1.12 2003/09/09 18:09:52 menno Exp $ 25 ** $Id: is.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
45 45
46 void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, 46 void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
47 uint16_t frame_len) 47 uint16_t frame_len)
48 { 48 {
49 uint8_t g, sfb, b; 49 uint8_t g, sfb, b;
50 uint16_t i, k; 50 uint16_t i;
51 #ifndef FIXED_POINT 51 #ifndef FIXED_POINT
52 real_t scale; 52 real_t scale;
53 #else 53 #else
54 int32_t exp, frac; 54 int32_t exp, frac;
55 #endif 55 #endif
74 icsr->pred.prediction_used[sfb] = 0; 74 icsr->pred.prediction_used[sfb] = 0;
75 75
76 #ifndef FIXED_POINT 76 #ifndef FIXED_POINT
77 scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb])); 77 scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb]));
78 #else 78 #else
79 exp = icsr->scale_factors[g][sfb] / 4; 79 exp = icsr->scale_factors[g][sfb] >> 2;
80 frac = icsr->scale_factors[g][sfb] % 4; 80 frac = icsr->scale_factors[g][sfb] & 3;
81 #endif 81 #endif
82 82
83 /* Scale from left to right channel, 83 /* Scale from left to right channel,
84 do not touch left channel */ 84 do not touch left channel */
85 for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++) 85 for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++)
86 { 86 {
87 k = (group*nshort)+i;
88 #ifndef FIXED_POINT 87 #ifndef FIXED_POINT
89 r_spec[k] = MUL(l_spec[k], scale); 88 r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale);
90 #else 89 #else
91 if (exp < 0) 90 if (exp < 0)
92 r_spec[k] = l_spec[k] << -exp; 91 r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp;
93 else 92 else
94 r_spec[k] = l_spec[k] >> exp; 93 r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp;
95 r_spec[k] = MUL_R_C(r_spec[k], pow05_table[frac + 3]); 94 r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]);
96 #endif 95 #endif
97 if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb)) 96 if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
98 r_spec[k] = -r_spec[k]; 97 r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i];
99 } 98 }
100 } 99 }
101 } 100 }
102 group++; 101 group++;
103 } 102 }