annotate libfaad2/sbr_tf_grid.c @ 12929:e31bab90b91c

Preliminary Support for building MPlayer with Intel C++ compiler. Still needs some work to use the proper optimization parameters. I haven't yet fixed the loader/dmo/dshow code so compile those dirs using make -C loader CC=gcc [...] for the meantime. To try use CC=icc ./configure with ICC 8.0 or later.
author atmos4
date Mon, 02 Aug 2004 04:24:36 +0000
parents d81145997036
children 6d50ef45a058
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
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
26 ** $Id: sbr_tf_grid.c,v 1.3 2004/06/02 22:59:03 diego Exp $
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
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;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
54
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
55 for (l = 0; l <= sbr->L_E[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
56 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
57 sbr->t_E[ch][l] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
58 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
59
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
60 sbr->t_E[ch][0] = sbr->rate * sbr->abs_bord_lead[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
61 sbr->t_E[ch][sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
62
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
63 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
64 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
65 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
66 switch (sbr->L_E[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
67 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
68 case 4:
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
69 temp = (int) (sbr->numTimeSlots / 4);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
70 sbr->t_E[ch][3] = sbr->rate * 3 * temp;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
71 sbr->t_E[ch][2] = sbr->rate * 2 * temp;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
72 sbr->t_E[ch][1] = sbr->rate * temp;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
73 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
74 case 2:
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
75 sbr->t_E[ch][1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
76 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
77 default:
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 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
81
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
82 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
83 if (sbr->L_E[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
84 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
85 int8_t i = sbr->L_E[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
86 border = sbr->abs_bord_trail[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
87
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
88 for (l = 0; l < (sbr->L_E[ch] - 1); l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
89 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
90 if (border < sbr->bs_rel_bord[ch][l])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
91 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
92
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
93 border -= sbr->bs_rel_bord[ch][l];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
94 sbr->t_E[ch][--i] = sbr->rate * border;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
95 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
96 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
97 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
98
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
99 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
100 if (sbr->L_E[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
101 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
102 int8_t i = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
103 border = sbr->abs_bord_lead[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
104
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
105 for (l = 0; l < (sbr->L_E[ch] - 1); l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
106 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
107 border += sbr->bs_rel_bord[ch][l];
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
108
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
109 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
110 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
111
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
112 sbr->t_E[ch][i++] = sbr->rate * border;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
113 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
114 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
115 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
116
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
117 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
118 if (sbr->bs_num_rel_0[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
119 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
120 int8_t i = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
121 border = sbr->abs_bord_lead[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
122
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
123 for (l = 0; l < sbr->bs_num_rel_0[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
124 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
125 border += sbr->bs_rel_bord_0[ch][l];
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
126
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
127 if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
128 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
129
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
130 sbr->t_E[ch][i++] = sbr->rate * border;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
131 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
132 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
133
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
134 if (sbr->bs_num_rel_1[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
135 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
136 int8_t i = sbr->L_E[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
137 border = sbr->abs_bord_trail[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
138
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
139 for (l = 0; l < sbr->bs_num_rel_1[ch]; l++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
140 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
141 if (border < sbr->bs_rel_bord_1[ch][l])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
142 return 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
143
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
144 border -= sbr->bs_rel_bord_1[ch][l];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
145 sbr->t_E[ch][--i] = sbr->rate * border;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
146 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
147 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
148 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
149 }
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
150
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
151 return 0;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
152 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
153
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
154 void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
155 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
156 sbr->t_Q[ch][0] = sbr->t_E[ch][0];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
157
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
158 if (sbr->L_E[ch] == 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
159 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
160 sbr->t_Q[ch][1] = sbr->t_E[ch][1];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
161 sbr->t_Q[ch][2] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
162 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
163 uint8_t index = middleBorder(sbr, ch);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
164 sbr->t_Q[ch][1] = sbr->t_E[ch][index];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
165 sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
166 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
167 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
168
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
169 #if 0
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
170 static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
171 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
172 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
173 int16_t acc = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
174
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
175 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
177 case FIXFIX:
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
178 return sbr->numTimeSlots/sbr->L_E[ch];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
179 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
180 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
181 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
182 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184 acc += sbr->bs_rel_bord[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
186 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
187 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
188 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
189 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
190 acc += sbr->bs_rel_bord_0[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
191 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
192 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
193 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
197
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
198 static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
199 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
200 uint8_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
201 int16_t acc = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
205 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
206 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
207 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
208 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
209 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
210 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
211 acc += sbr->bs_rel_bord[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
212 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
213 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
214 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215 for (i = 0; i < l; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
216 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
217 acc += sbr->bs_rel_bord_1[ch][i];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
218 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
219 return acc;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
220 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
221
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
222 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
223 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
224 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
225
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
226 static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
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 int8_t retval = 0;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
229
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
230 switch (sbr->bs_frame_class[ch])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
231 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
232 case FIXFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
233 retval = sbr->L_E[ch]/2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
234 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
235 case VARFIX:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
236 if (sbr->bs_pointer[ch] == 0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
237 retval = 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
238 else if (sbr->bs_pointer[ch] == 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
239 retval = sbr->L_E[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
240 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
241 retval = sbr->bs_pointer[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
242 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
243 case FIXVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
244 case VARVAR:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
245 if (sbr->bs_pointer[ch] > 1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
246 retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
247 else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
248 retval = sbr->L_E[ch] - 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
249 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
250 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
251
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
252 return (retval > 0) ? retval : 0;
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
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
256 #endif