annotate libfaad2/lt_predict.c @ 12720:0eddf78981ed

Zsolt Barat maintains all the new ALSA drivers.
author diego
date Mon, 28 Jun 2004 16:36:50 +0000
parents d81145997036
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
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
26 ** $Id: lt_predict.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
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
30
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
31 #include "common.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
32 #include "structs.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
33
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
34 #ifdef LTP_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
35
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
36 #include <stdlib.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
37 #include "syntax.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
38 #include "lt_predict.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
39 #include "filtbank.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
40 #include "tns.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 static int16_t real_to_int16(real_t sig_in);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
45
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
46
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
47 /* check if the object type is an object type that can have LTP */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
48 uint8_t is_ltp_ot(uint8_t object_type)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
49 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
50 #ifdef LTP_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
51 if ((object_type == LTP)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
52 #ifdef ERROR_RESILIENCE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
53 || (object_type == ER_LTP)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
54 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
55 #ifdef LD_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
56 || (object_type == LD)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
57 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
58 #ifdef SCALABLE_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
59 || (object_type == 6) /* TODO */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
60 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
61 )
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
62 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
63 return 1;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
64 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
65 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
66
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
67 return 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
68 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
69
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
70 ALIGN static const real_t codebook[8] =
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
71 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
72 REAL_CONST(0.570829),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
73 REAL_CONST(0.696616),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
74 REAL_CONST(0.813004),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
75 REAL_CONST(0.911304),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
76 REAL_CONST(0.984900),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
77 REAL_CONST(1.067894),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
78 REAL_CONST(1.194601),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
79 REAL_CONST(1.369533)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
80 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
81
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
82 void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
83 int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape,
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
84 uint8_t win_shape_prev, uint8_t sr_index,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
85 uint8_t object_type, uint16_t frame_len)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
86 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
87 uint8_t sfb;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
88 uint16_t bin, i, num_samples;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
89 ALIGN real_t x_est[2048];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
90 ALIGN real_t X_est[2048];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
91
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
92 if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
93 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
94 if (ltp->data_present)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
95 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
96 num_samples = frame_len << 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
97
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
98 for(i = 0; i < num_samples; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
99 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
100 /* The extra lookback M (N/2 for LD, 0 for LTP) is handled
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
101 in the buffer updating */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
102
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
103 #if 0
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
104 x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag],
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
105 codebook[ltp->coef]);
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
106 #else
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
107 /* lt_pred_stat is a 16 bit int, multiplied with the fixed point real
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
108 this gives a real for x_est
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
109 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
110 x_est[i] = (real_t)lt_pred_stat[num_samples + i - ltp->lag] * codebook[ltp->coef];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
111 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
112 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
113
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
114 filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
115 x_est, X_est, object_type, frame_len);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
116
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
117 tns_encode_frame(ics, &(ics->tns), sr_index, object_type, X_est,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
118 frame_len);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
119
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
120 for (sfb = 0; sfb < ltp->last_band; sfb++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
121 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
122 if (ltp->long_used[sfb])
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
123 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
124 uint16_t low = ics->swb_offset[sfb];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
125 uint16_t high = ics->swb_offset[sfb+1];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
126
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
127 for (bin = low; bin < high; bin++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
128 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
129 spec[bin] += X_est[bin];
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 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
133 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
134 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
135 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
136
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
137 #ifdef FIXED_POINT
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
138 static INLINE int16_t real_to_int16(real_t sig_in)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
139 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
140 if (sig_in >= 0)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
141 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
142 sig_in += (1 << (REAL_BITS-1));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
143 if (sig_in >= REAL_CONST(32768))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
144 return 32767;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
145 } else {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
146 sig_in += -(1 << (REAL_BITS-1));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
147 if (sig_in <= REAL_CONST(-32768))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
148 return -32768;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
149 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
150
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
151 return (sig_in >> REAL_BITS);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
152 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
153 #else
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
154 static INLINE int16_t real_to_int16(real_t sig_in)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
155 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
156 if (sig_in >= 0)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
157 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
158 #ifndef HAS_LRINTF
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
159 sig_in += 0.5f;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
160 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
161 if (sig_in >= 32768.0f)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
162 return 32767;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
163 } else {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
164 #ifndef HAS_LRINTF
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
165 sig_in += -0.5f;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
166 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
167 if (sig_in <= -32768.0f)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
168 return -32768;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
169 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
170
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
171 return lrintf(sig_in);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
172 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
173 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
174
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
175 void lt_update_state(int16_t *lt_pred_stat, real_t *time, real_t *overlap,
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176 uint16_t frame_len, uint8_t object_type)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
177 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
178 uint16_t i;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
179
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
180 /*
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
181 * The reference point for index i and the content of the buffer
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
182 * lt_pred_stat are arranged so that lt_pred_stat(0 ... N/2 - 1) contains the
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183 * last aliased half window from the IMDCT, and lt_pred_stat(N/2 ... N-1)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184 * is always all zeros. The rest of lt_pred_stat (i<0) contains the previous
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185 * fully reconstructed time domain samples, i.e., output of the decoder.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
186 *
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
187 * These values are shifted up by N*2 to avoid (i<0)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
188 *
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
189 * For the LD object type an extra 512 samples lookback is accomodated here.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
190 */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
191 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
192 if (object_type == LD)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
193 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194 for (i = 0; i < frame_len; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196 lt_pred_stat[i] /* extra 512 */ = lt_pred_stat[i + frame_len];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
197 lt_pred_stat[frame_len + i] = lt_pred_stat[i + (frame_len * 2)];
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
198 lt_pred_stat[(frame_len * 2) + i] = real_to_int16(time[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
199 lt_pred_stat[(frame_len * 3) + i] = real_to_int16(overlap[i]);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
200 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
201 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203 for (i = 0; i < frame_len; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
205 lt_pred_stat[i] = lt_pred_stat[i + frame_len];
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
206 lt_pred_stat[frame_len + i] = real_to_int16(time[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
207 lt_pred_stat[(frame_len * 2) + i] = real_to_int16(overlap[i]);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
208 #if 0 /* set to zero once upon initialisation */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
209 lt_pred_stat[(frame_len * 3) + i] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
210 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
211 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
212 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
213 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
214 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
216
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
217 #endif