annotate libfaad2/sbr_tf_grid.c @ 11701:8ab2028e6ed9

Sync to original FLAC. Main reason from their CVS log: add support for synthesis to big-endian in plugins.
author lumag
date Mon, 29 Dec 2003 18:10:49 +0000
parents 3185f64f6350
children 4a370c80fe5c
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
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
3 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
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 **
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
25 ** $Id: sbr_tf_grid.c,v 1.4 2003/09/30 16:32:02 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 /* Time/Frequency grid */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
29
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
30 #include "common.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
31 #include "structs.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
32
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
33 #ifdef SBR_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
34
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
35 #include <stdlib.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
36
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
37 #include "sbr_syntax.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
38 #include "sbr_tf_grid.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
39
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
40 uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
41 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
42 uint8_t l, border, temp;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
43
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
44 for (l = 0; l <= sbr->L_E[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
45 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
46 sbr->t_E[ch][l] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
47 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
48
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
49 sbr->t_E[ch][0] = sbr->rate * sbr->abs_bord_lead[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
50 sbr->t_E[ch][sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
51
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
52 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
53 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
54 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
55 switch (sbr->L_E[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
56 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
57 case 4:
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
58 temp = (int) (sbr->numTimeSlots / 4);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
59 sbr->t_E[ch][3] = sbr->rate * 3 * temp;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
60 sbr->t_E[ch][2] = sbr->rate * 2 * temp;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
61 sbr->t_E[ch][1] = sbr->rate * temp;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
62 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
63 case 2:
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
64 sbr->t_E[ch][1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
65 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
66 default:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
67 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
68 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
69 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
70
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
71 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
72 if (sbr->L_E[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
73 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
74 int8_t i = sbr->L_E[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
75 border = sbr->abs_bord_trail[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
76
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
77 for (l = 0; l < (sbr->L_E[ch] - 1); l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
78 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
79 if (border < sbr->bs_rel_bord[ch][l])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
80 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
81
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
82 border -= sbr->bs_rel_bord[ch][l];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
83 sbr->t_E[ch][--i] = sbr->rate * border;
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 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
87
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
88 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
89 if (sbr->L_E[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
90 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
91 int8_t i = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
92 border = sbr->abs_bord_lead[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
93
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
94 for (l = 0; l < (sbr->L_E[ch] - 1); l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
95 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
96 border += sbr->bs_rel_bord[ch][l];
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
97
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
98 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
99 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
100
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
101 sbr->t_E[ch][i++] = sbr->rate * border;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
102 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
103 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
104 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
105
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
106 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
107 if (sbr->bs_num_rel_0[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
108 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
109 int8_t i = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
110 border = sbr->abs_bord_lead[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
111
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
112 for (l = 0; l < sbr->bs_num_rel_0[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
113 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
114 border += sbr->bs_rel_bord_0[ch][l];
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
115
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
116 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
117 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
118
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
119 sbr->t_E[ch][i++] = sbr->rate * border;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
120 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
121 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
122
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
123 if (sbr->bs_num_rel_1[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
124 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
125 int8_t i = sbr->L_E[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
126 border = sbr->abs_bord_trail[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
127
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
128 for (l = 0; l < sbr->bs_num_rel_1[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
129 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
130 if (border < sbr->bs_rel_bord_1[ch][l])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
131 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
132
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
133 border -= sbr->bs_rel_bord_1[ch][l];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
134 sbr->t_E[ch][--i] = sbr->rate * border;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
135 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
136 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
137 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
138 }
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
139
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
140 return 0;
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 void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
144 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
145 sbr->t_Q[ch][0] = sbr->t_E[ch][0];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
146
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
147 if (sbr->L_E[ch] == 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
148 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
149 sbr->t_Q[ch][1] = sbr->t_E[ch][1];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
150 sbr->t_Q[ch][2] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
151 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
152 uint8_t index = middleBorder(sbr, ch);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
153 sbr->t_Q[ch][1] = sbr->t_E[ch][index];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
154 sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
155 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
156 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
157
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
158 static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
159 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
160 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
161 int16_t acc = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
162
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
163 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
164 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
165 case FIXFIX:
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
166 return sbr->numTimeSlots/sbr->L_E[ch];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
167 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
168 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
169 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
170 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
171 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
172 acc += sbr->bs_rel_bord[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
173 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
174 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
175 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
177 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
178 acc += sbr->bs_rel_bord_0[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
179 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
180 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
181 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
182
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
186 static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
187 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
188 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
189 int16_t acc = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
190
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
191 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
192 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
193 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
197 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
198 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
199 acc += sbr->bs_rel_bord[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
200 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
201 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
205 acc += sbr->bs_rel_bord_1[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
206 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
207 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
208 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
209
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
210 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
211 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
212
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
213 static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
214 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215 int8_t retval;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
216
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
217 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
218 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
219 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
220 retval = sbr->L_E[ch]/2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
221 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
222 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
223 if (sbr->bs_pointer[ch] == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
224 retval = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
225 else if (sbr->bs_pointer[ch] == 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
226 retval = sbr->L_E[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
227 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
228 retval = sbr->bs_pointer[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
229 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
230 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
231 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
232 if (sbr->bs_pointer[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
233 retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
234 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
235 retval = sbr->L_E[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
236 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
237 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
238
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
239 return (retval > 0) ? retval : 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
240 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
241
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
242
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
243 #endif