annotate libfaad2/filtbank.c @ 14212:540903a59fc0

add missing registers in clobber list, fixes bug #169 Patch by basic basic (at) mozdev [dot] org
author reimar
date Tue, 21 Dec 2004 23:26:45 +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: filtbank.c,v 1.4 2004/06/23 13:50:49 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 #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 #include <stdlib.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
34 #include <string.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
35 #ifdef _WIN32_WCE
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
36 #define assert(x)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
37 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
38 #include <assert.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
39 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
40
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
41 #include "filtbank.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
42 #include "decoder.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
43 #include "syntax.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
44 #include "kbd_win.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
45 #include "sine_win.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
46 #include "mdct.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
47
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
48
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
49 fb_info *filter_bank_init(uint16_t frame_len)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
50 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
51 uint16_t nshort = frame_len/8;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
52 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
53 uint16_t frame_len_ld = frame_len/2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
54 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
55
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
56 fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
57 memset(fb, 0, sizeof(fb_info));
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
58
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
59 /* normal */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
60 fb->mdct256 = faad_mdct_init(2*nshort);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
61 fb->mdct2048 = faad_mdct_init(2*frame_len);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
62 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
63 /* LD */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
64 fb->mdct1024 = faad_mdct_init(2*frame_len_ld);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
65 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
66
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
67 #ifdef ALLOW_SMALL_FRAMELENGTH
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
68 if (frame_len == 1024)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
69 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
70 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
71 fb->long_window[0] = sine_long_1024;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
72 fb->short_window[0] = sine_short_128;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
73 fb->long_window[1] = kbd_long_1024;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
74 fb->short_window[1] = kbd_short_128;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
75 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
76 fb->ld_window[0] = sine_mid_512;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
77 fb->ld_window[1] = ld_mid_512;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
78 #endif
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
79 #ifdef ALLOW_SMALL_FRAMELENGTH
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
80 } else /* (frame_len == 960) */ {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
81 fb->long_window[0] = sine_long_960;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
82 fb->short_window[0] = sine_short_120;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
83 fb->long_window[1] = kbd_long_960;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
84 fb->short_window[1] = kbd_short_120;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
85 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
86 fb->ld_window[0] = sine_mid_480;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
87 fb->ld_window[1] = ld_mid_480;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
88 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
89 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
90 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
91
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
92 #ifdef USE_SSE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
93 if (cpu_has_sse())
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
94 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
95 fb->if_func = ifilter_bank_sse;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
96 } else {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
97 fb->if_func = ifilter_bank;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
98 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
99 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
100
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
101 return fb;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
102 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
103
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
104 void filter_bank_end(fb_info *fb)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
105 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
106 if (fb != NULL)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
107 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
108 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
109 printf("FB: %I64d cycles\n", fb->cycles);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
110 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
111
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
112 faad_mdct_end(fb->mdct256);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
113 faad_mdct_end(fb->mdct2048);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
114 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
115 faad_mdct_end(fb->mdct1024);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
116 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
117
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
118 faad_free(fb);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
119 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
120 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
121
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
122 static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
123 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
124 #ifdef LD_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
125 mdct_info *mdct = NULL;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
126
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
127 switch (len)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
128 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
129 case 2048:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
130 case 1920:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
131 mdct = fb->mdct2048;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
132 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
133 case 1024:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
134 case 960:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
135 mdct = fb->mdct1024;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
136 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
137 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
138
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
139 faad_imdct(mdct, in_data, out_data);
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
140 #else
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
141 faad_imdct(fb->mdct2048, in_data, out_data);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
142 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
143 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
144
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
145 #ifdef USE_SSE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
146 static INLINE void imdct_long_sse(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
147 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
148 #ifdef LD_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
149 mdct_info *mdct = NULL;
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 switch (len)
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 case 2048:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
154 case 1920:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
155 mdct = fb->mdct2048;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
156 break;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
157 case 1024:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
158 case 960:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
159 mdct = fb->mdct1024;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
160 break;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
161 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
162
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
163 faad_imdct_sse(mdct, in_data, out_data);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
164 #else
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
165 faad_imdct_sse(fb->mdct2048, in_data, out_data);
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 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
168 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
169
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
170 #ifdef LTP_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
171 static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
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 mdct_info *mdct = NULL;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
174
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
175 switch (len)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
177 case 2048:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
178 case 1920:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
179 mdct = fb->mdct2048;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
180 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
181 case 256:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
182 case 240:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183 mdct = fb->mdct256;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
186 case 1024:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
187 case 960:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
188 mdct = fb->mdct1024;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
189 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
190 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
191 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
192
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
193 faad_mdct(mdct, in_data, out_data);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
197 void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
198 uint8_t window_shape_prev, real_t *freq_in,
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
199 real_t *time_out, real_t *overlap,
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
200 uint8_t object_type, uint16_t frame_len)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
201 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 int16_t i;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
203 ALIGN real_t transf_buf[2*1024] = {0};
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
205 const real_t *window_long = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
206 const real_t *window_long_prev = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
207 const real_t *window_short = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
208 const real_t *window_short_prev = NULL;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
209
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
210 uint16_t nlong = frame_len;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
211 uint16_t nshort = frame_len/8;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
212 uint16_t trans = nshort/2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
213
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
214 uint16_t nflat_ls = (nlong-nshort)/2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
216 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
217 int64_t count = faad_get_ts();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
218 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
219
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
220 /* select windows of current frame and previous frame (Sine or KBD) */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
221 #ifdef LD_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
222 if (object_type == LD)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
223 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
224 window_long = fb->ld_window[window_shape];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
225 window_long_prev = fb->ld_window[window_shape_prev];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
226 } else {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
227 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
228 window_long = fb->long_window[window_shape];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
229 window_long_prev = fb->long_window[window_shape_prev];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
230 window_short = fb->short_window[window_shape];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
231 window_short_prev = fb->short_window[window_shape_prev];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
232 #ifdef LD_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
233 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
234 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
235
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
236 #if 0
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
237 for (i = 0; i < 1024; i++)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
238 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
239 printf("%d\n", freq_in[i]);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
240 }
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
241 #endif
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
242
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
243 #if 0
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
244 printf("%d %d\n", window_sequence, window_shape);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
245 #endif
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
246
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
247 switch (window_sequence)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
248 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
249 case ONLY_LONG_SEQUENCE:
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
250 /* perform iMDCT */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
251 imdct_long(fb, freq_in, transf_buf, 2*nlong);
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
252
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
253 /* add second half output of previous frame to windowed output of current frame */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
254 for (i = 0; i < nlong; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
255 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
256 time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
257 time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
258 time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
259 time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
260 }
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
261
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
262 /* window the second half and save as overlap for next frame */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
263 for (i = 0; i < nlong; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
264 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
265 overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
266 overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
267 overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
268 overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
269 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
270 break;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
271
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
272 case LONG_START_SEQUENCE:
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
273 /* perform iMDCT */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
274 imdct_long(fb, freq_in, transf_buf, 2*nlong);
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
275
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
276 /* add second half output of previous frame to windowed output of current frame */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
277 for (i = 0; i < nlong; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
278 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
279 time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
280 time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
281 time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
282 time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
283 }
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
284
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
285 /* window the second half and save as overlap for next frame */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
286 /* construct second half window using padding with 1's and 0's */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
287 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
288 overlap[i] = transf_buf[nlong+i];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
289 for (i = 0; i < nshort; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
290 overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
291 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
292 overlap[nflat_ls+nshort+i] = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
293 break;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
294
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
295 case EIGHT_SHORT_SEQUENCE:
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
296 /* perform iMDCT for each short block */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
297 faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
298 faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
299 faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
300 faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
301 faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
302 faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
303 faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
304 faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7);
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
305
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
306 /* add second half output of previous frame to windowed output of current frame */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
307 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
308 time_out[i] = overlap[i];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
309 for(i = 0; i < nshort; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
310 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
311 time_out[nflat_ls+ i] = overlap[nflat_ls+ i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
312 time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
313 time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
314 time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
315 if (i < trans)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
316 time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
317 }
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
318
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
319 /* window the second half and save as overlap for next frame */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
320 for(i = 0; i < nshort; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
321 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
322 if (i >= trans)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
323 overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
324 overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
325 overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
326 overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
327 overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
328 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
329 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
330 overlap[nflat_ls+nshort+i] = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
331 break;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
332
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
333 case LONG_STOP_SEQUENCE:
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
334 /* perform iMDCT */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
335 imdct_long(fb, freq_in, transf_buf, 2*nlong);
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
336
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
337 /* add second half output of previous frame to windowed output of current frame */
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
338 /* construct first half window using padding with 1's and 0's */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
339 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
340 time_out[i] = overlap[i];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
341 for (i = 0; i < nshort; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
342 time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
343 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
344 time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
345
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
346 /* window the second half and save as overlap for next frame */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
347 for (i = 0; i < nlong; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
348 overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
349 break;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
350 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
351
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
352 #if 0
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
353 for (i = 0; i < 1024; i++)
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
354 {
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
355 //printf("%d\n", time_out[i]);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
356 printf("0x%.8X\n", time_out[i]);
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
357 }
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
358 #endif
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
359
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
360
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
361 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
362 count = faad_get_ts() - count;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
363 fb->cycles += count;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
364 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
365 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
366
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
367 #ifdef USE_SSE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
368 void ifilter_bank_sse(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
369 uint8_t window_shape_prev, real_t *freq_in,
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
370 real_t *time_out, uint8_t object_type, uint16_t frame_len)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
371 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
372 int16_t i;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
373 ALIGN real_t transf_buf[2*1024] = {0};
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
374
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
375 const real_t *window_long = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
376 const real_t *window_long_prev = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
377 const real_t *window_short = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
378 const real_t *window_short_prev = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
379
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
380 uint16_t nlong = frame_len;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
381 uint16_t nshort = frame_len/8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
382 uint16_t trans = nshort/2;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
383
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
384 uint16_t nflat_ls = (nlong-nshort)/2;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
385
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
386 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
387 int64_t count = faad_get_ts();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
388 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
389
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
390 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
391 if (object_type == LD)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
392 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
393 window_long = fb->ld_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
394 window_long_prev = fb->ld_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
395 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
396 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
397 window_long = fb->long_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
398 window_long_prev = fb->long_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
399 window_short = fb->short_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
400 window_short_prev = fb->short_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
401 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
402 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
403 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
404
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
405 switch (window_sequence)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
406 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
407 case ONLY_LONG_SEQUENCE:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
408 imdct_long_sse(fb, freq_in, transf_buf, 2*nlong);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
409 for (i = 0; i < nlong; i+=4)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
410 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
411 __m128 m1, m2, m3, m4, m5, m6, m7, m8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
412
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
413 m1 = _mm_load_ps(&transf_buf[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
414 m2 = _mm_load_ps(&window_long_prev[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
415 m6 = _mm_load_ps(&window_long[nlong-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
416 m3 = _mm_load_ps(&time_out[nlong+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
417 m5 = _mm_load_ps(&transf_buf[nlong+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
418
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
419 m4 = _mm_mul_ps(m1, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
420 m7 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
421
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
422 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
423 m8 = _mm_mul_ps(m5, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
424
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
425 _mm_store_ps(&time_out[i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
426 _mm_store_ps(&time_out[nlong+i], m8);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
427 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
428 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
429
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
430 case LONG_START_SEQUENCE:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
431 imdct_long_sse(fb, freq_in, transf_buf, 2*nlong);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
432 for (i = 0; i < nlong; i+=4)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
433 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
434 __m128 m1 = _mm_load_ps(&transf_buf[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
435 __m128 m2 = _mm_load_ps(&window_long_prev[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
436 __m128 m3 = _mm_load_ps(&time_out[nlong+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
437
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
438 __m128 m4 = _mm_mul_ps(m1, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
439 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
440
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
441 _mm_store_ps(&time_out[i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
442 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
443 for (i = 0; i < nflat_ls; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
444 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
445 __m128 m1 = _mm_load_ps(&transf_buf[nlong+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
446 _mm_store_ps(&time_out[nlong+i], m1);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
447 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
448 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
449 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
450 __m128 m1 = _mm_load_ps(&transf_buf[nlong+nflat_ls+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
451 __m128 m2 = _mm_load_ps(&window_short[nshort-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
452 __m128 m3, m4;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
453
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
454 m3 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
455
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
456 m4 = _mm_mul_ps(m1, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
457
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
458 _mm_store_ps(&time_out[nlong+nflat_ls+i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
459 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
460 for (i = 0; i < nflat_ls; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
461 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
462 __m128 m1 = _mm_setzero_ps();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
463 _mm_store_ps(&time_out[nlong+nflat_ls+nshort+i], m1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
464 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
465 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
466
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
467 case EIGHT_SHORT_SEQUENCE:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
468 faad_imdct_sse(fb->mdct256, &freq_in[0*nshort], &transf_buf[2*nshort*0]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
469 faad_imdct_sse(fb->mdct256, &freq_in[1*nshort], &transf_buf[2*nshort*1]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
470 faad_imdct_sse(fb->mdct256, &freq_in[2*nshort], &transf_buf[2*nshort*2]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
471 faad_imdct_sse(fb->mdct256, &freq_in[3*nshort], &transf_buf[2*nshort*3]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
472 faad_imdct_sse(fb->mdct256, &freq_in[4*nshort], &transf_buf[2*nshort*4]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
473 faad_imdct_sse(fb->mdct256, &freq_in[5*nshort], &transf_buf[2*nshort*5]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
474 faad_imdct_sse(fb->mdct256, &freq_in[6*nshort], &transf_buf[2*nshort*6]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
475 faad_imdct_sse(fb->mdct256, &freq_in[7*nshort], &transf_buf[2*nshort*7]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
476 for (i = 0; i < nflat_ls; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
477 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
478 __m128 m1 = _mm_load_ps(&time_out[nlong+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
479 _mm_store_ps(&time_out[i], m1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
480 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
481 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
482 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
483 __m128 m1 = _mm_load_ps(&transf_buf[nshort*0+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
484 __m128 m2 = _mm_load_ps(&window_short_prev[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
485 __m128 m3 = _mm_load_ps(&time_out[nlong+nflat_ls+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
486
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
487 __m128 m4 = _mm_mul_ps(m1, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
488 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
489
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
490 _mm_store_ps(&time_out[nflat_ls+i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
491 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
492 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
493 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
494 __m128 m1, m2, m3, m4, m5, m6, m7, m8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
495 m1 = _mm_load_ps(&transf_buf[nshort*1+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
496 m2 = _mm_load_ps(&window_short[nshort-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
497 m3 = _mm_load_ps(&time_out[nlong+nflat_ls+nshort*1+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
498 m6 = _mm_load_ps(&transf_buf[nshort*2+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
499 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
500
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
501 m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
502
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
503 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
504 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
505 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
506 m4 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
507
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
508 _mm_store_ps(&time_out[nflat_ls+1*nshort+i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
509 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
510 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
511 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
512 __m128 m1, m2, m3, m4, m5, m6, m7, m8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
513 m1 = _mm_load_ps(&transf_buf[nshort*3+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
514 m2 = _mm_load_ps(&window_short[nshort-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
515 m3 = _mm_load_ps(&time_out[nlong+nflat_ls+nshort*2+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
516 m6 = _mm_load_ps(&transf_buf[nshort*4+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
517 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
518
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
519 m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
520
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
521 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
522 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
523 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
524 m4 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
525
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
526 _mm_store_ps(&time_out[nflat_ls+2*nshort+i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
527 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
528 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
529 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
530 __m128 m1, m2, m3, m4, m5, m6, m7, m8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
531 m1 = _mm_load_ps(&transf_buf[nshort*5+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
532 m2 = _mm_load_ps(&window_short[nshort-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
533 m3 = _mm_load_ps(&time_out[nlong+nflat_ls+nshort*3+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
534 m6 = _mm_load_ps(&transf_buf[nshort*6+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
535 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
536
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
537 m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
538
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
539 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
540 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
541 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
542 m4 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
543
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
544 _mm_store_ps(&time_out[nflat_ls+3*nshort+i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
545 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
546 for(i = 0; i < trans; i+=4)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
547 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
548 __m128 m1, m2, m3, m4, m5, m6, m7, m8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
549 m1 = _mm_load_ps(&transf_buf[nshort*7+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
550 m2 = _mm_load_ps(&window_short[nshort-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
551 m3 = _mm_load_ps(&time_out[nlong+nflat_ls+nshort*4+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
552 m6 = _mm_load_ps(&transf_buf[nshort*8+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
553 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
554
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
555 m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
556
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
557 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
558 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
559 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
560 m4 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
561
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
562 _mm_store_ps(&time_out[nflat_ls+4*nshort+i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
563 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
564 for (i = trans; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
565 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
566 __m128 m1, m2, m3, m4, m5, m6, m7, m8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
567 m1 = _mm_load_ps(&transf_buf[nshort*7+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
568 m2 = _mm_load_ps(&window_short[nshort-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
569 m6 = _mm_load_ps(&transf_buf[nshort*8+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
570 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
571
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
572 m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
573
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
574 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
575 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
576 m3 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
577
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
578 _mm_store_ps(&time_out[nflat_ls+4*nshort+i], m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
579 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
580 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
581 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
582 __m128 m1, m2, m3, m4, m5, m6, m7, m8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
583 m1 = _mm_load_ps(&transf_buf[nshort*9+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
584 m2 = _mm_load_ps(&window_short[nshort-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
585 m6 = _mm_load_ps(&transf_buf[nshort*10+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
586 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
587
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
588 m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
589
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
590 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
591 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
592 m3 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
593
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
594 _mm_store_ps(&time_out[nflat_ls+5*nshort+i], m3);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
595 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
596 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
597 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
598 __m128 m1, m2, m3, m4, m5, m6, m7, m8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
599 m1 = _mm_load_ps(&transf_buf[nshort*11+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
600 m2 = _mm_load_ps(&window_short[nshort-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
601 m6 = _mm_load_ps(&transf_buf[nshort*12+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
602 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
603
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
604 m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
605
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
606 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
607 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
608 m3 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
609
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
610 _mm_store_ps(&time_out[nflat_ls+6*nshort+i], m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
611 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
612 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
613 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
614 __m128 m1, m2, m3, m4, m5, m6, m7, m8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
615 m1 = _mm_load_ps(&transf_buf[nshort*13+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
616 m2 = _mm_load_ps(&window_short[nshort-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
617 m6 = _mm_load_ps(&transf_buf[nshort*14+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
618 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
619
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
620 m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
621
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
622 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
623 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
624 m3 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
625
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
626 _mm_store_ps(&time_out[nflat_ls+7*nshort+i], m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
627 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
628 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
629 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
630 __m128 m1, m2, m3, m5;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
631 m1 = _mm_load_ps(&transf_buf[nshort*15+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
632 m2 = _mm_load_ps(&window_short[nshort-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
633
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
634 m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
635
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
636 m3 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
637
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
638 _mm_store_ps(&time_out[nflat_ls+8*nshort+i], m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
639 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
640 for (i = 0; i < nflat_ls; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
641 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
642 __m128 m1 = _mm_setzero_ps();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
643 _mm_store_ps(&time_out[nlong+nflat_ls+nshort+i], m1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
644 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
645 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
646
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
647 case LONG_STOP_SEQUENCE:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
648 imdct_long_sse(fb, freq_in, transf_buf, 2*nlong);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
649 for (i = 0; i < nflat_ls; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
650 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
651 __m128 m1 = _mm_load_ps(&time_out[nlong+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
652 _mm_store_ps(&time_out[i], m1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
653 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
654 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
655 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
656 __m128 m1 = _mm_load_ps(&transf_buf[nflat_ls+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
657 __m128 m2 = _mm_load_ps(&window_short_prev[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
658 __m128 m3 = _mm_load_ps(&time_out[nlong+nflat_ls+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
659
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
660 __m128 m4 = _mm_mul_ps(m1, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
661 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
662
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
663 _mm_store_ps(&time_out[nflat_ls+i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
664 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
665 for (i = 0; i < nflat_ls; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
666 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
667 __m128 m1 = _mm_load_ps(&transf_buf[nflat_ls+nshort+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
668 __m128 m2 = _mm_load_ps(&time_out[nlong+nflat_ls+nshort+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
669
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
670 __m128 m3 = _mm_add_ps(m1, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
671
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
672 _mm_store_ps(&time_out[nflat_ls+nshort+i], m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
673 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
674 for (i = 0; i < nlong; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
675 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
676 __m128 m1 = _mm_load_ps(&transf_buf[nlong+i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
677 __m128 m2 = _mm_load_ps(&window_long[nlong-4-i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
678 __m128 m3, m4;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
679
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
680 m3 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(0, 1, 2, 3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
681
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
682 m4 = _mm_mul_ps(m1, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
683
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
684 _mm_store_ps(&time_out[nlong+i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
685 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
686 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
687 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
688
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
689 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
690 count = faad_get_ts() - count;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
691 fb->cycles += count;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
692 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
693 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
694 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
695
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
696 #ifdef LTP_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
697 /* only works for LTP -> no overlapping, no short blocks */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
698 void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
699 uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
700 uint8_t object_type, uint16_t frame_len)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
701 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
702 int16_t i;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
703 ALIGN real_t windowed_buf[2*1024] = {0};
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
704
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
705 const real_t *window_long = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
706 const real_t *window_long_prev = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
707 const real_t *window_short = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
708 const real_t *window_short_prev = NULL;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
709
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
710 uint16_t nlong = frame_len;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
711 uint16_t nshort = frame_len/8;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
712 uint16_t nflat_ls = (nlong-nshort)/2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
713
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
714 assert(window_sequence != EIGHT_SHORT_SEQUENCE);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
715
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
716 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
717 if (object_type == LD)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
718 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
719 window_long = fb->ld_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
720 window_long_prev = fb->ld_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
721 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
722 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
723 window_long = fb->long_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
724 window_long_prev = fb->long_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
725 window_short = fb->short_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
726 window_short_prev = fb->short_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
727 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
728 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
729 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
730
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
731 switch(window_sequence)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
732 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
733 case ONLY_LONG_SEQUENCE:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
734 for (i = nlong-1; i >= 0; i--)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
735 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
736 windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
737 windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
738 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
739 mdct(fb, windowed_buf, out_mdct, 2*nlong);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
740 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
741
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
742 case LONG_START_SEQUENCE:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
743 for (i = 0; i < nlong; i++)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
744 windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
745 for (i = 0; i < nflat_ls; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
746 windowed_buf[i+nlong] = in_data[i+nlong];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
747 for (i = 0; i < nshort; i++)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
748 windowed_buf[i+nlong+nflat_ls] = MUL_F(in_data[i+nlong+nflat_ls], window_short[nshort-1-i]);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
749 for (i = 0; i < nflat_ls; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
750 windowed_buf[i+nlong+nflat_ls+nshort] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
751 mdct(fb, windowed_buf, out_mdct, 2*nlong);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
752 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
753
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
754 case LONG_STOP_SEQUENCE:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
755 for (i = 0; i < nflat_ls; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
756 windowed_buf[i] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
757 for (i = 0; i < nshort; i++)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
758 windowed_buf[i+nflat_ls] = MUL_F(in_data[i+nflat_ls], window_short_prev[i]);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
759 for (i = 0; i < nflat_ls; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
760 windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
761 for (i = 0; i < nlong; i++)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
762 windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
763 mdct(fb, windowed_buf, out_mdct, 2*nlong);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
764 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
765 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
766 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
767 #endif