annotate libfaad2/sbr_tf_grid.c @ 28621:2464c1a4f2f8

Spelling: capitalize pronouns.
author bircoph
date Thu, 19 Feb 2009 02:24:03 +0000
parents 59b6fa5b4201
children e83eef58b30a
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 **
18141
59b6fa5b4201 Update to faad2 cvs 20040915+MPlayer fixes
rtognimp
parents: 14727
diff changeset
25 ** $Id: sbr_tf_grid.c,v 1.15 2004/09/04 14:56:28 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
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
40
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
41 /* static function declarations */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
42 #if 0
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
43 static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
44 static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
45 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
46 static uint8_t middleBorder(sbr_info *sbr, uint8_t ch);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
47
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
48
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
49 /* function constructs new time border vector */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
50 /* first build into temp vector to be able to use previous vector on error */
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
51 uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
52 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
53 uint8_t l, border, temp;
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
54 uint8_t t_E_temp[6] = {0};
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
55
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
56 t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
57 t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
58
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
59 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
60 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
61 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
62 switch (sbr->L_E[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
63 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
64 case 4:
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
65 temp = (int) (sbr->numTimeSlots / 4);
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
66 t_E_temp[3] = sbr->rate * 3 * temp;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
67 t_E_temp[2] = sbr->rate * 2 * temp;
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
68 t_E_temp[1] = sbr->rate * temp;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
69 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
70 case 2:
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
71 t_E_temp[1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
72 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
73 default:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
74 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
75 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
76 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
77
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
78 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
79 if (sbr->L_E[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
80 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
81 int8_t i = sbr->L_E[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
82 border = sbr->abs_bord_trail[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
83
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
84 for (l = 0; l < (sbr->L_E[ch] - 1); l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
85 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
86 if (border < sbr->bs_rel_bord[ch][l])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
87 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
88
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
89 border -= sbr->bs_rel_bord[ch][l];
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
90 t_E_temp[--i] = sbr->rate * border;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
91 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
92 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
93 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
94
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
95 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
96 if (sbr->L_E[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
97 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
98 int8_t i = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
99 border = sbr->abs_bord_lead[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
100
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
101 for (l = 0; l < (sbr->L_E[ch] - 1); l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
102 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
103 border += sbr->bs_rel_bord[ch][l];
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
104
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
105 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
106 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
107
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
108 t_E_temp[i++] = sbr->rate * border;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
109 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
110 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
111 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
112
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
113 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
114 if (sbr->bs_num_rel_0[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
115 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
116 int8_t i = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
117 border = sbr->abs_bord_lead[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
118
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
119 for (l = 0; l < sbr->bs_num_rel_0[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
120 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
121 border += sbr->bs_rel_bord_0[ch][l];
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
122
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
123 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
124 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
125
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
126 t_E_temp[i++] = sbr->rate * border;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
127 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
128 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
129
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
130 if (sbr->bs_num_rel_1[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
131 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
132 int8_t i = sbr->L_E[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
133 border = sbr->abs_bord_trail[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
134
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
135 for (l = 0; l < sbr->bs_num_rel_1[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
136 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
137 if (border < sbr->bs_rel_bord_1[ch][l])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
138 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
139
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
140 border -= sbr->bs_rel_bord_1[ch][l];
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
141 t_E_temp[--i] = sbr->rate * border;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
142 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
143 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
144 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
145 }
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
146
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
147 /* no error occured, we can safely use this t_E vector */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
148 for (l = 0; l < 6; l++)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
149 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
150 sbr->t_E[ch][l] = t_E_temp[l];
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
151 }
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
152
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
153 return 0;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
154 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
155
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
156 void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
157 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
158 sbr->t_Q[ch][0] = sbr->t_E[ch][0];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
159
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
160 if (sbr->L_E[ch] == 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
161 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
162 sbr->t_Q[ch][1] = sbr->t_E[ch][1];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
163 sbr->t_Q[ch][2] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
164 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
165 uint8_t index = middleBorder(sbr, ch);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
166 sbr->t_Q[ch][1] = sbr->t_E[ch][index];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
167 sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
168 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
169 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
170
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
171 #if 0
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
172 static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
173 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
174 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
175 int16_t acc = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
177 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
178 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
179 case FIXFIX:
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
180 return sbr->numTimeSlots/sbr->L_E[ch];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
181 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
182 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
186 acc += sbr->bs_rel_bord[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
187 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
188 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
189 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
190 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
191 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
192 acc += sbr->bs_rel_bord_0[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
193 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
197 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
198 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
199
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
200 static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
201 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203 int16_t acc = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
205 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
206 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
207 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
208 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
209 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
210 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
211 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
212 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
213 acc += sbr->bs_rel_bord[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
214 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
216 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
217 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
218 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
219 acc += sbr->bs_rel_bord_1[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
220 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
221 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
222 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
223
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
224 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
225 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
226 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
227
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
228 static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
229 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
230 int8_t retval = 0;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
231
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
232 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
233 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
234 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
235 retval = sbr->L_E[ch]/2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
236 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
237 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
238 if (sbr->bs_pointer[ch] == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
239 retval = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
240 else if (sbr->bs_pointer[ch] == 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
241 retval = sbr->L_E[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
242 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
243 retval = sbr->bs_pointer[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
244 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
245 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
246 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
247 if (sbr->bs_pointer[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
248 retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
249 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
250 retval = sbr->L_E[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
251 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
252 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
253
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
254 return (retval > 0) ? retval : 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
255 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
256
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
257
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
258 #endif