annotate libfaad2/sbr_syntax.c @ 16341:04d7da697677

aRts, ESD consistent spelling
author diego
date Thu, 01 Sep 2005 23:53:57 +0000
parents 2ae5ab4331ca
children 59b6fa5b4201
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
1 /*
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
4 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
5 ** This program is free software; you can redistribute it and/or modify
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
6 ** it under the terms of the GNU General Public License as published by
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
7 ** the Free Software Foundation; either version 2 of the License, or
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
8 ** (at your option) any later version.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
9 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
10 ** This program is distributed in the hope that it will be useful,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
13 ** GNU General Public License for more details.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
14 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
15 ** You should have received a copy of the GNU General Public License
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
16 ** along with this program; if not, write to the Free Software
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
18 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
19 ** Any non-GPL usage of this software or parts of this software is strictly
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
20 ** forbidden.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
21 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
22 ** Commercial non-GPL licensing of this software is possible.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
24 **
14727
2ae5ab4331ca Remove modification notice from files that have not been locally modified.
diego
parents: 13453
diff changeset
25 ** $Id: sbr_syntax.c,v 1.31 2004/05/17 10:18:03 menno Exp $
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
26 **/
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
27
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
28 #include "common.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
29 #include "structs.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
30
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
31 #ifdef SBR_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
32
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
33 #include "sbr_syntax.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
34 #include "syntax.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
35 #include "sbr_huff.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
36 #include "sbr_fbt.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
37 #include "sbr_tf_grid.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
38 #include "sbr_e_nf.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
39 #include "bits.h"
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
40 #ifdef PS_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
41 #include "ps_dec.h"
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
42 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
43 #ifdef DRM_PS
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
44 #include "drm_dec.h"
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
45 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
46 #include "analysis.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
47
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
48 /* static function declarations */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
49 static void sbr_header(bitfile *ld, sbr_info *sbr);
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
50 static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq,
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
51 uint8_t samplerate_mode, uint8_t freq_scale,
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
52 uint8_t alter_scale, uint8_t xover_band);
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
53 static uint8_t sbr_data(bitfile *ld, sbr_info *sbr);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
54 static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
55 uint8_t bs_extension_id, uint16_t num_bits_left);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
56 static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
57 static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
58 static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
59 static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
60 static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
61 static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
62
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
63
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
64 static void sbr_reset(sbr_info *sbr)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
65 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
66 #if 0
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
67 printf("%d\n", sbr->bs_start_freq_prev);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
68 printf("%d\n", sbr->bs_stop_freq_prev);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
69 printf("%d\n", sbr->bs_freq_scale_prev);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
70 printf("%d\n", sbr->bs_alter_scale_prev);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
71 printf("%d\n", sbr->bs_xover_band_prev);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
72 printf("%d\n\n", sbr->bs_noise_bands_prev);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
73 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
74
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
75 /* if these are different from the previous frame: Reset = 1 */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
76 if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) ||
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
77 (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) ||
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
78 (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) ||
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
79 (sbr->bs_alter_scale != sbr->bs_alter_scale_prev))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
80 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
81 sbr->Reset = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
82 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
83 sbr->Reset = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
84 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
85
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
86 if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) ||
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
87 (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) ||
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
88 (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) ||
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
89 (sbr->bs_alter_scale != sbr->bs_alter_scale_prev) ||
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
90 (sbr->bs_xover_band != sbr->bs_xover_band_prev) ||
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
91 (sbr->bs_noise_bands != sbr->bs_noise_bands_prev))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
92 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
93 sbr->Reset = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
94 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
95 sbr->Reset = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
96 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
97
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
98 sbr->bs_start_freq_prev = sbr->bs_start_freq;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
99 sbr->bs_stop_freq_prev = sbr->bs_stop_freq;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
100 sbr->bs_freq_scale_prev = sbr->bs_freq_scale;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
101 sbr->bs_alter_scale_prev = sbr->bs_alter_scale;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
102 sbr->bs_xover_band_prev = sbr->bs_xover_band;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
103 sbr->bs_noise_bands_prev = sbr->bs_noise_bands;
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
104 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
105
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
106 static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq,
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
107 uint8_t samplerate_mode, uint8_t freq_scale,
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
108 uint8_t alter_scale, uint8_t xover_band)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
109 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
110 uint8_t result = 0;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
111 uint8_t k2;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
112
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
113 /* calculate the Master Frequency Table */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
114 sbr->k0 = qmf_start_channel(start_freq, samplerate_mode, sbr->sample_rate);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
115 k2 = qmf_stop_channel(stop_freq, sbr->sample_rate, sbr->k0);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
116
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
117 /* check k0 and k2 */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
118 if (sbr->sample_rate >= 48000)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
119 {
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
120 if ((k2 - sbr->k0) > 32)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
121 result += 1;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
122 } else if (sbr->sample_rate <= 32000) {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
123 if ((k2 - sbr->k0) > 48)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
124 result += 1;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
125 } else { /* (sbr->sample_rate == 44100) */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
126 if ((k2 - sbr->k0) > 45)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
127 result += 1;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
128 }
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
129
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
130 if (freq_scale == 0)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
131 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
132 result += master_frequency_table_fs0(sbr, sbr->k0, k2, alter_scale);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
133 } else {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
134 result += master_frequency_table(sbr, sbr->k0, k2, freq_scale, alter_scale);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
135 }
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
136 result += derived_frequency_table(sbr, xover_band, k2);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
137
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
138 result = (result > 0) ? 1 : 0;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
139
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
140 return result;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
141 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
142
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
143 /* table 2 */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
144 uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
145 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
146 uint8_t result = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
147 uint16_t num_align_bits = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
148 uint16_t num_sbr_bits = (uint16_t)faad_get_processed_bits(ld);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
149
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
150 uint8_t saved_start_freq, saved_samplerate_mode;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
151 uint8_t saved_stop_freq, saved_freq_scale;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
152 uint8_t saved_alter_scale, saved_xover_band;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
153
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
154 #ifdef DRM
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
155 if (!sbr->Is_DRM_SBR)
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
156 #endif
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
157 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
158 uint8_t bs_extension_type = (uint8_t)faad_getbits(ld, 4
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
159 DEBUGVAR(1,198,"sbr_bitstream(): bs_extension_type"));
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
160
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
161 if (bs_extension_type == EXT_SBR_DATA_CRC)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
162 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
163 sbr->bs_sbr_crc_bits = (uint16_t)faad_getbits(ld, 10
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
164 DEBUGVAR(1,199,"sbr_bitstream(): bs_sbr_crc_bits"));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
165 }
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
166 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
167
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
168 /* save old header values, in case the new ones are corrupted */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
169 saved_start_freq = sbr->bs_start_freq;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
170 saved_samplerate_mode = sbr->bs_samplerate_mode;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
171 saved_stop_freq = sbr->bs_stop_freq;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
172 saved_freq_scale = sbr->bs_freq_scale;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
173 saved_alter_scale = sbr->bs_alter_scale;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
174 saved_xover_band = sbr->bs_xover_band;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
175
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176 sbr->bs_header_flag = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
177 DEBUGVAR(1,200,"sbr_bitstream(): bs_header_flag"));
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
178
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
179 if (sbr->bs_header_flag)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
180 sbr_header(ld, sbr);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
181
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
182 /* Reset? */
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183 sbr_reset(sbr);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185 /* first frame should have a header */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
186 //if (!(sbr->frame == 0 && sbr->bs_header_flag == 0))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
187 if (sbr->header_count != 0)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
188 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
189 if (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
190 {
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
191 uint8_t rt = calc_sbr_tables(sbr, sbr->bs_start_freq, sbr->bs_stop_freq,
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
192 sbr->bs_samplerate_mode, sbr->bs_freq_scale,
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
193 sbr->bs_alter_scale, sbr->bs_xover_band);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
195 /* if an error occured with the new header values revert to the old ones */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
196 if (rt > 0)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
197 {
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
198 calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq,
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
199 saved_samplerate_mode, saved_freq_scale,
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
200 saved_alter_scale, saved_xover_band);
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
201 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
204 if (result == 0)
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
205 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
206 result = sbr_data(ld, sbr);
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
207
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
208 /* sbr_data() returning an error means that there was an error in
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
209 envelope_time_border_vector().
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
210 In this case the old time border vector is saved and all the previous
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
211 data normally read after sbr_grid() is saved.
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
212 */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
213 /* to be on the safe side, calculate old sbr tables in case of error */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
214 if ((result > 0) &&
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
215 (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked)))
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
216 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
217 calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq,
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
218 saved_samplerate_mode, saved_freq_scale,
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
219 saved_alter_scale, saved_xover_band);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
220 }
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
221
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
222 /* we should be able to safely set result to 0 now */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
223 result = 0;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
224 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
225 } else {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
226 result = 1;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
227 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
228
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
229 #ifdef DRM
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
230 if (!sbr->Is_DRM_SBR)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
231 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
232 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
233 num_sbr_bits = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits;
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
234
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
235 /* check if we read more bits then were available for sbr */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
236 if (8*cnt < num_sbr_bits)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
237 return 1;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
238
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
239 /* -4 does not apply, bs_extension_type is re-read in this function */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
240 num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
241
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
242 while (num_align_bits > 7)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
243 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
244 faad_getbits(ld, 8
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
245 DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
246 num_align_bits -= 8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
247 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
248 faad_getbits(ld, num_align_bits
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
249 DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
250 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
251
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
252 return result;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
253 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
254
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
255 /* table 3 */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
256 static void sbr_header(bitfile *ld, sbr_info *sbr)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
257 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
258 uint8_t bs_header_extra_1, bs_header_extra_2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
259
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
260 sbr->header_count++;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
261
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
262 sbr->bs_amp_res = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
263 DEBUGVAR(1,203,"sbr_header(): bs_amp_res"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
264
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
265 /* bs_start_freq and bs_stop_freq must define a fequency band that does
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
266 not exceed 48 channels */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
267 sbr->bs_start_freq = (uint8_t)faad_getbits(ld, 4
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
268 DEBUGVAR(1,204,"sbr_header(): bs_start_freq"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
269 sbr->bs_stop_freq = (uint8_t)faad_getbits(ld, 4
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
270 DEBUGVAR(1,205,"sbr_header(): bs_stop_freq"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
271 sbr->bs_xover_band = (uint8_t)faad_getbits(ld, 3
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
272 DEBUGVAR(1,206,"sbr_header(): bs_xover_band"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
273 faad_getbits(ld, 2
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
274 DEBUGVAR(1,207,"sbr_header(): bs_reserved_bits_hdr"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
275 bs_header_extra_1 = (uint8_t)faad_get1bit(ld
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
276 DEBUGVAR(1,208,"sbr_header(): bs_header_extra_1"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
277 bs_header_extra_2 = (uint8_t)faad_get1bit(ld
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
278 DEBUGVAR(1,209,"sbr_header(): bs_header_extra_2"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
279
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
280 if (bs_header_extra_1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
281 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
282 sbr->bs_freq_scale = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
283 DEBUGVAR(1,211,"sbr_header(): bs_freq_scale"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
284 sbr->bs_alter_scale = (uint8_t)faad_get1bit(ld
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
285 DEBUGVAR(1,212,"sbr_header(): bs_alter_scale"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
286 sbr->bs_noise_bands = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
287 DEBUGVAR(1,213,"sbr_header(): bs_noise_bands"));
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
288 } else {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
289 /* Default values */
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
290 sbr->bs_freq_scale = 2;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
291 sbr->bs_alter_scale = 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
292 sbr->bs_noise_bands = 2;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
293 }
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
294
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
295 if (bs_header_extra_2)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
296 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
297 sbr->bs_limiter_bands = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
298 DEBUGVAR(1,214,"sbr_header(): bs_limiter_bands"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
299 sbr->bs_limiter_gains = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
300 DEBUGVAR(1,215,"sbr_header(): bs_limiter_gains"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
301 sbr->bs_interpol_freq = (uint8_t)faad_get1bit(ld
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
302 DEBUGVAR(1,216,"sbr_header(): bs_interpol_freq"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
303 sbr->bs_smoothing_mode = (uint8_t)faad_get1bit(ld
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
304 DEBUGVAR(1,217,"sbr_header(): bs_smoothing_mode"));
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
305 } else {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
306 /* Default values */
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
307 sbr->bs_limiter_bands = 2;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
308 sbr->bs_limiter_gains = 2;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
309 sbr->bs_interpol_freq = 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
310 sbr->bs_smoothing_mode = 1;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
311 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
312
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
313 #if 0
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
314 /* print the header to screen */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
315 printf("bs_amp_res: %d\n", sbr->bs_amp_res);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
316 printf("bs_start_freq: %d\n", sbr->bs_start_freq);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
317 printf("bs_stop_freq: %d\n", sbr->bs_stop_freq);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
318 printf("bs_xover_band: %d\n", sbr->bs_xover_band);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
319 if (bs_header_extra_1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
320 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
321 printf("bs_freq_scale: %d\n", sbr->bs_freq_scale);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
322 printf("bs_alter_scale: %d\n", sbr->bs_alter_scale);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
323 printf("bs_noise_bands: %d\n", sbr->bs_noise_bands);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
324 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
325 if (bs_header_extra_2)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
326 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
327 printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
328 printf("bs_limiter_gains: %d\n", sbr->bs_limiter_gains);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
329 printf("bs_interpol_freq: %d\n", sbr->bs_interpol_freq);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
330 printf("bs_smoothing_mode: %d\n", sbr->bs_smoothing_mode);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
331 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
332 printf("\n");
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
333 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
334 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
335
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
336 /* table 4 */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
337 static uint8_t sbr_data(bitfile *ld, sbr_info *sbr)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
338 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
339 uint8_t result;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
340 #if 0
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
341 sbr->bs_samplerate_mode = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
342 DEBUGVAR(1,219,"sbr_data(): bs_samplerate_mode"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
343 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
344
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
345 sbr->rate = (sbr->bs_samplerate_mode) ? 2 : 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
346
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
347 switch (sbr->id_aac)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
348 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
349 case ID_SCE:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
350 if ((result = sbr_single_channel_element(ld, sbr)) > 0)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
351 return result;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
352 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
353 case ID_CPE:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
354 if ((result = sbr_channel_pair_element(ld, sbr)) > 0)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
355 return result;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
356 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
357 }
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
358
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
359 return 0;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
360 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
361
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
362 /* table 5 */
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
363 static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
364 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
365 uint8_t result;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
366
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
367 if (faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
368 DEBUGVAR(1,220,"sbr_single_channel_element(): bs_data_extra")))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
369 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
370 faad_getbits(ld, 4
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
371 DEBUGVAR(1,221,"sbr_single_channel_element(): bs_reserved_bits_data"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
372 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
373
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
374 #ifdef DRM
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
375 /* bs_coupling, from sbr_channel_pair_base_element(bs_amp_res) */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
376 if (sbr->Is_DRM_SBR)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
377 faad_get1bit(ld);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
378 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
379
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
380 if ((result = sbr_grid(ld, sbr, 0)) > 0)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
381 return result;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
382 sbr_dtdf(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
383 invf_mode(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
384 sbr_envelope(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
385 sbr_noise(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
386
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
387 #ifndef FIXED_POINT
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
388 envelope_noise_dequantisation(sbr, 0);
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
389 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
390
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
391 memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
392
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
393 sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
394 DEBUGVAR(1,223,"sbr_single_channel_element(): bs_add_harmonic_flag[0]"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
395 if (sbr->bs_add_harmonic_flag[0])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
396 sinusoidal_coding(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
397
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
398 sbr->bs_extended_data = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
399 DEBUGVAR(1,224,"sbr_single_channel_element(): bs_extended_data[0]"));
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
400
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
401 if (sbr->bs_extended_data)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
402 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
403 uint16_t nr_bits_left;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
404 uint16_t cnt = (uint16_t)faad_getbits(ld, 4
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
405 DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
406 if (cnt == 15)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
407 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
408 cnt += (uint16_t)faad_getbits(ld, 8
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
409 DEBUGVAR(1,226,"sbr_single_channel_element(): bs_esc_count"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
410 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
411
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
412 nr_bits_left = 8 * cnt;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
413 while (nr_bits_left > 7)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
414 {
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
415 uint16_t tmp_nr_bits = 0;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
416
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
417 sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
418 DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id"));
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
419 tmp_nr_bits += 2;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
420 tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
421
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
422 /* check if the data read is bigger than the number of available bits */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
423 if (tmp_nr_bits > nr_bits_left)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
424 return 1;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
425
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
426 nr_bits_left -= tmp_nr_bits;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
427 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
428
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
429 /* Corrigendum */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
430 if (nr_bits_left > 0)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
431 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
432 faad_getbits(ld, nr_bits_left
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
433 DEBUGVAR(1,280,"sbr_single_channel_element(): nr_bits_left"));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
434 }
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
435 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
436
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
437 return 0;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
438 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
439
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
440 /* table 6 */
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
441 static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
442 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
443 uint8_t n, result;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
444
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
445 if (faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
446 DEBUGVAR(1,228,"sbr_single_channel_element(): bs_data_extra")))
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
447 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
448 faad_getbits(ld, 4
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
449 DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
450 faad_getbits(ld, 4
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
451 DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
452 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
453
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
454 sbr->bs_coupling = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
455 DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_coupling"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
456
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
457 if (sbr->bs_coupling)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
458 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
459 if ((result = sbr_grid(ld, sbr, 0)) > 0)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
460 return result;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
461
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
462 /* need to copy some data from left to right */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
463 sbr->bs_frame_class[1] = sbr->bs_frame_class[0];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
464 sbr->L_E[1] = sbr->L_E[0];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
465 sbr->L_Q[1] = sbr->L_Q[0];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
466 sbr->bs_pointer[1] = sbr->bs_pointer[0];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
467
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
468 for (n = 0; n <= sbr->L_E[0]; n++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
469 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
470 sbr->t_E[1][n] = sbr->t_E[0][n];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
471 sbr->f[1][n] = sbr->f[0][n];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
472 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
473 for (n = 0; n <= sbr->L_Q[0]; n++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
474 sbr->t_Q[1][n] = sbr->t_Q[0][n];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
475
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
476 sbr_dtdf(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
477 sbr_dtdf(ld, sbr, 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
478 invf_mode(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
479
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
480 /* more copying */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
481 for (n = 0; n < sbr->N_Q; n++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
482 sbr->bs_invf_mode[1][n] = sbr->bs_invf_mode[0][n];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
483
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
484 sbr_envelope(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
485 sbr_noise(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
486 sbr_envelope(ld, sbr, 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
487 sbr_noise(ld, sbr, 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
488
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
489 memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
490 memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
491
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
492 sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
493 DEBUGVAR(1,231,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
494 if (sbr->bs_add_harmonic_flag[0])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
495 sinusoidal_coding(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
496
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
497 sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
498 DEBUGVAR(1,232,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
499 if (sbr->bs_add_harmonic_flag[1])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
500 sinusoidal_coding(ld, sbr, 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
501 } else {
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
502 uint8_t saved_t_E[6] = {0}, saved_t_Q[3] = {0};
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
503 uint8_t saved_L_E = sbr->L_E[0];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
504 uint8_t saved_L_Q = sbr->L_Q[0];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
505 uint8_t saved_frame_class = sbr->bs_frame_class[0];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
506
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
507 for (n = 0; n < saved_L_E; n++)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
508 saved_t_E[n] = sbr->t_E[0][n];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
509 for (n = 0; n < saved_L_Q; n++)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
510 saved_t_Q[n] = sbr->t_Q[0][n];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
511
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
512 if ((result = sbr_grid(ld, sbr, 0)) > 0)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
513 return result;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
514 if ((result = sbr_grid(ld, sbr, 1)) > 0)
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
515 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
516 /* restore first channel data as well */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
517 sbr->bs_frame_class[0] = saved_frame_class;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
518 sbr->L_E[0] = saved_L_E;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
519 sbr->L_Q[0] = saved_L_Q;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
520 for (n = 0; n < 6; n++)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
521 sbr->t_E[0][n] = saved_t_E[n];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
522 for (n = 0; n < 3; n++)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
523 sbr->t_Q[0][n] = saved_t_Q[n];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
524
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
525 return result;
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
526 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
527 sbr_dtdf(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
528 sbr_dtdf(ld, sbr, 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
529 invf_mode(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
530 invf_mode(ld, sbr, 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
531 sbr_envelope(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
532 sbr_envelope(ld, sbr, 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
533 sbr_noise(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
534 sbr_noise(ld, sbr, 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
535
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
536 memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
537 memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
538
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
539 sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
540 DEBUGVAR(1,239,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
541 if (sbr->bs_add_harmonic_flag[0])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
542 sinusoidal_coding(ld, sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
543
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
544 sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
545 DEBUGVAR(1,240,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
546 if (sbr->bs_add_harmonic_flag[1])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
547 sinusoidal_coding(ld, sbr, 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
548 }
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
549 #ifndef FIXED_POINT
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
550 envelope_noise_dequantisation(sbr, 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
551 envelope_noise_dequantisation(sbr, 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
552
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
553 if (sbr->bs_coupling)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
554 unmap_envelope_noise(sbr);
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
555 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
556
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
557 sbr->bs_extended_data = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
558 DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
559 if (sbr->bs_extended_data)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
560 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
561 uint16_t nr_bits_left;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
562 uint16_t cnt = (uint16_t)faad_getbits(ld, 4
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
563 DEBUGVAR(1,234,"sbr_channel_pair_element(): bs_extension_size"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
564 if (cnt == 15)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
565 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
566 cnt += (uint16_t)faad_getbits(ld, 8
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
567 DEBUGVAR(1,235,"sbr_channel_pair_element(): bs_esc_count"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
568 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
569
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
570 nr_bits_left = 8 * cnt;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
571 while (nr_bits_left > 7)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
572 {
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
573 uint16_t tmp_nr_bits = 0;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
574
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
575 sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
576 DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id"));
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
577 tmp_nr_bits += 2;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
578 tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
579
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
580 /* check if the data read is bigger than the number of available bits */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
581 if (tmp_nr_bits > nr_bits_left)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
582 return 1;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
583
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
584 nr_bits_left -= tmp_nr_bits;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
585 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
586
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
587 /* Corrigendum */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
588 if (nr_bits_left > 0)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
589 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
590 faad_getbits(ld, nr_bits_left
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
591 DEBUGVAR(1,280,"sbr_channel_pair_element(): nr_bits_left"));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
592 }
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
593 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
594
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
595 return 0;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
596 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
597
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
598 /* integer log[2](x): input range [0,10) */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
599 static int8_t sbr_log2(const int8_t val)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
600 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
601 int8_t log2tab[] = { 0, 0, 1, 2, 2, 3, 3, 3, 3, 4 };
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
602 if (val < 10 && val >= 0)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
603 return log2tab[val];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
604 else
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
605 return 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
606 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
607
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
608
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
609 /* table 7 */
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
610 static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
611 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
612 uint8_t i, env, rel, result;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
613 uint8_t bs_abs_bord, bs_abs_bord_1;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
614 uint8_t bs_num_env = 0;
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
615 uint8_t saved_L_E = sbr->L_E[ch];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
616 uint8_t saved_L_Q = sbr->L_Q[ch];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
617 uint8_t saved_frame_class = sbr->bs_frame_class[ch];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
618
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
619 sbr->bs_frame_class[ch] = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
620 DEBUGVAR(1,248,"sbr_grid(): bs_frame_class"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
621
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
622 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
623 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
624 case FIXFIX:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
625 i = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
626 DEBUGVAR(1,249,"sbr_grid(): bs_num_env_raw"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
627
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
628 bs_num_env = min(1 << i, 5);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
629
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
630 i = (uint8_t)faad_get1bit(ld
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
631 DEBUGVAR(1,250,"sbr_grid(): bs_freq_res_flag"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
632 for (env = 0; env < bs_num_env; env++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
633 sbr->f[ch][env] = i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
634
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
635 sbr->abs_bord_lead[ch] = 0;
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
636 sbr->abs_bord_trail[ch] = sbr->numTimeSlots;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
637 sbr->n_rel_lead[ch] = bs_num_env - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
638 sbr->n_rel_trail[ch] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
639 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
640
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
641 case FIXVAR:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
642 bs_abs_bord = (uint8_t)faad_getbits(ld, 2
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
643 DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
644 bs_num_env = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
645 DEBUGVAR(1,252,"sbr_grid(): bs_num_env")) + 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
646
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
647 for (rel = 0; rel < bs_num_env-1; rel++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
648 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
649 sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
650 DEBUGVAR(1,253,"sbr_grid(): bs_rel_bord")) + 2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
651 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
652 i = sbr_log2(bs_num_env + 1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
653 sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
654 DEBUGVAR(1,254,"sbr_grid(): bs_pointer"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
655
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
656 for (env = 0; env < bs_num_env; env++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
657 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
658 sbr->f[ch][bs_num_env - env - 1] = (uint8_t)faad_get1bit(ld
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
659 DEBUGVAR(1,255,"sbr_grid(): bs_freq_res"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
660 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
661
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
662 sbr->abs_bord_lead[ch] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
663 sbr->abs_bord_trail[ch] = bs_abs_bord;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
664 sbr->n_rel_lead[ch] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
665 sbr->n_rel_trail[ch] = bs_num_env - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
666 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
667
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
668 case VARFIX:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
669 bs_abs_bord = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
670 DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
671 bs_num_env = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
672 DEBUGVAR(1,257,"sbr_grid(): bs_num_env")) + 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
673
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
674 for (rel = 0; rel < bs_num_env-1; rel++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
675 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
676 sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
677 DEBUGVAR(1,258,"sbr_grid(): bs_rel_bord")) + 2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
678 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
679 i = sbr_log2(bs_num_env + 1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
680 sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
681 DEBUGVAR(1,259,"sbr_grid(): bs_pointer"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
682
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
683 for (env = 0; env < bs_num_env; env++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
684 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
685 sbr->f[ch][env] = (uint8_t)faad_get1bit(ld
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
686 DEBUGVAR(1,260,"sbr_grid(): bs_freq_res"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
687 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
688
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
689 sbr->abs_bord_lead[ch] = bs_abs_bord;
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
690 sbr->abs_bord_trail[ch] = sbr->numTimeSlots;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
691 sbr->n_rel_lead[ch] = bs_num_env - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
692 sbr->n_rel_trail[ch] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
693 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
694
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
695 case VARVAR:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
696 bs_abs_bord = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
697 DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
698 bs_abs_bord_1 = (uint8_t)faad_getbits(ld, 2
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
699 DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + sbr->numTimeSlots;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
700 sbr->bs_num_rel_0[ch] = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
701 DEBUGVAR(1,263,"sbr_grid(): bs_num_rel_0"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
702 sbr->bs_num_rel_1[ch] = (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
703 DEBUGVAR(1,264,"sbr_grid(): bs_num_rel_1"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
704
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
705 bs_num_env = min(5, sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
706
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
707 for (rel = 0; rel < sbr->bs_num_rel_0[ch]; rel++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
708 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
709 sbr->bs_rel_bord_0[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
710 DEBUGVAR(1,265,"sbr_grid(): bs_rel_bord")) + 2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
711 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
712 for(rel = 0; rel < sbr->bs_num_rel_1[ch]; rel++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
713 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
714 sbr->bs_rel_bord_1[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
715 DEBUGVAR(1,266,"sbr_grid(): bs_rel_bord")) + 2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
716 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
717 i = sbr_log2(sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
718 sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
719 DEBUGVAR(1,267,"sbr_grid(): bs_pointer"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
720
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
721 for (env = 0; env < bs_num_env; env++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
722 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
723 sbr->f[ch][env] = (uint8_t)faad_get1bit(ld
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
724 DEBUGVAR(1,268,"sbr_grid(): bs_freq_res"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
725 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
726
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
727 sbr->abs_bord_lead[ch] = bs_abs_bord;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
728 sbr->abs_bord_trail[ch] = bs_abs_bord_1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
729 sbr->n_rel_lead[ch] = sbr->bs_num_rel_0[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
730 sbr->n_rel_trail[ch] = sbr->bs_num_rel_1[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
731 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
732 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
733
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
734 if (sbr->bs_frame_class[ch] == VARVAR)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
735 sbr->L_E[ch] = min(bs_num_env, 5);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
736 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
737 sbr->L_E[ch] = min(bs_num_env, 4);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
738
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
739 if (sbr->L_E[ch] <= 0)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
740 return 1;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
741
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
742 if (sbr->L_E[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
743 sbr->L_Q[ch] = 2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
744 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
745 sbr->L_Q[ch] = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
746
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
747 /* TODO: this code can probably be integrated into the code above! */
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
748 if ((result = envelope_time_border_vector(sbr, ch)) > 0)
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
749 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
750 sbr->bs_frame_class[ch] = saved_frame_class;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
751 sbr->L_E[ch] = saved_L_E;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
752 sbr->L_Q[ch] = saved_L_Q;
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
753 return result;
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
754 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
755 noise_floor_time_border_vector(sbr, ch);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
756
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
757 #if 0
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
758 for (env = 0; env < bs_num_env; env++)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
759 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
760 printf("freq_res[ch:%d][env:%d]: %d\n", ch, env, sbr->f[ch][env]);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
761 }
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
762 #endif
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
763
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
764 return 0;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
765 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
766
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
767 /* table 8 */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
768 static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
769 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
770 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
771
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
772 for (i = 0; i < sbr->L_E[ch]; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
773 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
774 sbr->bs_df_env[ch][i] = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
775 DEBUGVAR(1,269,"sbr_dtdf(): bs_df_env"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
776 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
777
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
778 for (i = 0; i < sbr->L_Q[ch]; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
779 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
780 sbr->bs_df_noise[ch][i] = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
781 DEBUGVAR(1,270,"sbr_dtdf(): bs_df_noise"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
782 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
783 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
784
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
785 /* table 9 */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
786 static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
787 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
788 uint8_t n;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
789
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
790 for (n = 0; n < sbr->N_Q; n++)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
791 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
792 sbr->bs_invf_mode[ch][n] = (uint8_t)faad_getbits(ld, 2
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
793 DEBUGVAR(1,271,"invf_mode(): bs_invf_mode"));
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
794 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
795 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
796
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
797 static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
798 uint8_t bs_extension_id, uint16_t num_bits_left)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
799 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
800 switch (bs_extension_id)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
801 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
802 #ifdef PS_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
803 case EXTENSION_ID_PS:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
804 sbr->ps_used = 1;
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
805 if (!sbr->ps)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
806 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
807 sbr->ps = ps_init(get_sr_index(sbr->sample_rate));
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
808 }
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
809 return ps_data(sbr->ps, ld);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
810 #endif
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
811 #ifdef DRM_PS
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
812 case DRM_PARAMETRIC_STEREO:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
813 sbr->ps_used = 1;
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
814 if (!sbr->drm_ps)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
815 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
816 sbr->drm_ps = drm_ps_init();
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
817 }
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
818 return drm_ps_data(sbr->drm_ps, ld);
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
819 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
820 default:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
821 sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
822 DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
823 return 6;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
824 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
825 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
826
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
827 /* table 12 */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
828 static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
829 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
830 uint8_t n;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
831
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
832 for (n = 0; n < sbr->N_high; n++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
833 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
834 sbr->bs_add_harmonic[ch][n] = faad_get1bit(ld
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
835 DEBUGVAR(1,278,"sinusoidal_coding(): bs_add_harmonic"));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
836 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
837 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
838
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
839
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
840 #endif /* SBR_DEC */