annotate libfaad2/sbr_tf_grid.c @ 13639:12028d59e650

10l to me, noticed by Torinthiel
author diego
date Thu, 14 Oct 2004 12:23:42 +0000
parents 6d50ef45a058
children 2ae5ab4331ca
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 **
12625
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
25 ** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
26 ** $Id: sbr_tf_grid.c,v 1.4 2004/06/23 13:50:52 diego Exp $
12625
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
27 ** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
28 **/
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
29
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
30 /* Time/Frequency grid */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
31
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
32 #include "common.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
33 #include "structs.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
34
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
35 #ifdef SBR_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
36
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
37 #include <stdlib.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
38
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
39 #include "sbr_syntax.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
40 #include "sbr_tf_grid.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
41
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
42
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
43 /* static function declarations */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
44 #if 0
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
45 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
46 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
47 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
48 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
49
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
50
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
51 /* 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
52 /* 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
53 uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
54 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
55 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
56 uint8_t t_E_temp[6] = {0};
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
57
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
58 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
59 t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
60
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
61 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
62 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
63 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
64 switch (sbr->L_E[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
65 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
66 case 4:
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
67 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
68 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
69 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
70 t_E_temp[1] = sbr->rate * temp;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
71 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
72 case 2:
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
73 t_E_temp[1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
74 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
75 default:
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 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
79
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
80 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
81 if (sbr->L_E[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
82 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
83 int8_t i = sbr->L_E[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
84 border = sbr->abs_bord_trail[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
85
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
86 for (l = 0; l < (sbr->L_E[ch] - 1); l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
87 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
88 if (border < sbr->bs_rel_bord[ch][l])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
89 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
90
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
91 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
92 t_E_temp[--i] = sbr->rate * border;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
93 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
94 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
95 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
96
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
97 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
98 if (sbr->L_E[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
99 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
100 int8_t i = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
101 border = sbr->abs_bord_lead[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
102
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
103 for (l = 0; l < (sbr->L_E[ch] - 1); l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
104 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
105 border += sbr->bs_rel_bord[ch][l];
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
106
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
107 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
108 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
109
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
110 t_E_temp[i++] = sbr->rate * border;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
111 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
112 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
113 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
114
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
115 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
116 if (sbr->bs_num_rel_0[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
117 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
118 int8_t i = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
119 border = sbr->abs_bord_lead[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
120
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
121 for (l = 0; l < sbr->bs_num_rel_0[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
122 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
123 border += sbr->bs_rel_bord_0[ch][l];
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
124
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
125 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
126 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
127
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
128 t_E_temp[i++] = sbr->rate * border;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
129 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
130 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
131
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
132 if (sbr->bs_num_rel_1[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
133 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
134 int8_t i = sbr->L_E[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
135 border = sbr->abs_bord_trail[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
136
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
137 for (l = 0; l < sbr->bs_num_rel_1[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
138 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
139 if (border < sbr->bs_rel_bord_1[ch][l])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
140 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
141
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
142 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
143 t_E_temp[--i] = sbr->rate * border;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
144 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
145 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
146 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
147 }
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
148
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
149 /* 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
150 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
151 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
152 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
153 }
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
154
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
155 return 0;
10725
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 void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
159 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
160 sbr->t_Q[ch][0] = sbr->t_E[ch][0];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
161
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
162 if (sbr->L_E[ch] == 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
163 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
164 sbr->t_Q[ch][1] = sbr->t_E[ch][1];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
165 sbr->t_Q[ch][2] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
166 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
167 uint8_t index = middleBorder(sbr, ch);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
168 sbr->t_Q[ch][1] = sbr->t_E[ch][index];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
169 sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
170 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
171 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
172
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
173 #if 0
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
174 static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
175 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
177 int16_t acc = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
178
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
179 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
180 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
181 case FIXFIX:
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
182 return sbr->numTimeSlots/sbr->L_E[ch];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
186 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
187 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
188 acc += sbr->bs_rel_bord[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
189 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
190 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
191 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
192 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
193 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194 acc += sbr->bs_rel_bord_0[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
197 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
198
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
199 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
200 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
201
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
205 int16_t acc = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
206
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
207 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
208 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
209 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
210 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
211 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
212 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
213 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
214 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215 acc += sbr->bs_rel_bord[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
216 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
217 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
218 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
219 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
220 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
221 acc += sbr->bs_rel_bord_1[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
222 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
223 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
224 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
225
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
226 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
227 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
228 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
229
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
230 static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
231 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
232 int8_t retval = 0;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
233
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
234 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
235 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
236 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
237 retval = sbr->L_E[ch]/2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
238 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
239 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
240 if (sbr->bs_pointer[ch] == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
241 retval = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
242 else if (sbr->bs_pointer[ch] == 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
243 retval = sbr->L_E[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
244 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
245 retval = sbr->bs_pointer[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
246 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
247 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
248 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
249 if (sbr->bs_pointer[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
250 retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
251 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
252 retval = sbr->L_E[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
253 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
254 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
255
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
256 return (retval > 0) ? retval : 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
257 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
258
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
259
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
260 #endif