annotate libfaad2/filtbank.c @ 13390:1f415687a3f7

switch_ratio may not work with some filter chains
author faust3
date Sun, 19 Sep 2004 18:36:18 +0000
parents d81145997036
children 6d50ef45a058
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
1 /*
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
4 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
5 ** This program is free software; you can redistribute it and/or modify
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
6 ** it under the terms of the GNU General Public License as published by
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
7 ** the Free Software Foundation; either version 2 of the License, or
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
8 ** (at your option) any later version.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
9 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
10 ** This program is distributed in the hope that it will be useful,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
13 ** GNU General Public License for more details.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
14 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
15 ** You should have received a copy of the GNU General Public License
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
16 ** along with this program; if not, write to the Free Software
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
18 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
19 ** Any non-GPL usage of this software or parts of this software is strictly
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
20 ** forbidden.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
21 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
22 ** Commercial non-GPL licensing of this software is possible.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
24 **
12625
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
25 ** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
26 ** $Id: filtbank.c,v 1.3 2004/06/02 22:59:02 diego Exp $
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
27 ** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
28 **/
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
29
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
30 #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
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
220 #ifdef LD_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
221 if (object_type == LD)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
222 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
223 window_long = fb->ld_window[window_shape];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
224 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
225 } else {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
226 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
227 window_long = fb->long_window[window_shape];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
228 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
229 window_short = fb->short_window[window_shape];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
230 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
231 #ifdef LD_DEC
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
232 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
233 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
234
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
235
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
236 switch (window_sequence)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
237 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
238 case ONLY_LONG_SEQUENCE:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
239 imdct_long(fb, freq_in, transf_buf, 2*nlong);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
240 for (i = 0; i < nlong; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
241 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
242 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
243 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
244 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
245 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
246 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
247 for (i = 0; i < nlong; i+=4)
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 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
250 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
251 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
252 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
253 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
254 break;
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 case LONG_START_SEQUENCE:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
257 imdct_long(fb, freq_in, transf_buf, 2*nlong);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
258 for (i = 0; i < nlong; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
259 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
260 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
261 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
262 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
263 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
264 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
265 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
266 overlap[i] = transf_buf[nlong+i];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
267 for (i = 0; i < nshort; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
268 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
269 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
270 overlap[nflat_ls+nshort+i] = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
271 break;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
272
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
273 case EIGHT_SHORT_SEQUENCE:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
274 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
275 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
276 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
277 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
278 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
279 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
280 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
281 faad_imdct(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
282 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
283 time_out[i] = overlap[i];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
284 for(i = 0; i < nshort; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
285 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
286 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
287 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
288 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
289 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
290 if (i < trans)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
291 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
292 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
293 for(i = 0; i < nshort; i++)
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 if (i >= trans)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
296 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
297 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
298 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
299 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
300 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
301 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
302 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
303 overlap[nflat_ls+nshort+i] = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
304 break;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
305
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
306 case LONG_STOP_SEQUENCE:
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
307 imdct_long(fb, freq_in, transf_buf, 2*nlong);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
308 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
309 time_out[i] = overlap[i];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
310 for (i = 0; i < nshort; i++)
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[nflat_ls+i],window_short_prev[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
312 for (i = 0; i < nflat_ls; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
313 time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
314 for (i = 0; i < nlong; i++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
315 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
316 break;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
317 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
318
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
319 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
320 count = faad_get_ts() - count;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
321 fb->cycles += count;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
322 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
323 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
324
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
325 #ifdef USE_SSE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
326 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
327 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
328 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
329 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
330 int16_t i;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
331 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
332
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
333 const real_t *window_long = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
334 const real_t *window_long_prev = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
335 const real_t *window_short = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
336 const real_t *window_short_prev = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
337
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
338 uint16_t nlong = frame_len;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
339 uint16_t nshort = frame_len/8;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
340 uint16_t trans = nshort/2;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
341
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
342 uint16_t nflat_ls = (nlong-nshort)/2;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
343
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
344 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
345 int64_t count = faad_get_ts();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
346 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
347
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
348 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
349 if (object_type == LD)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
350 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
351 window_long = fb->ld_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
352 window_long_prev = fb->ld_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
353 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
354 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
355 window_long = fb->long_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
356 window_long_prev = fb->long_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
357 window_short = fb->short_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
358 window_short_prev = fb->short_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
359 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
360 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
361 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
362
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
363 switch (window_sequence)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
364 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
365 case ONLY_LONG_SEQUENCE:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
366 imdct_long_sse(fb, freq_in, transf_buf, 2*nlong);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
367 for (i = 0; i < nlong; i+=4)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
368 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
369 __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
370
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
371 m1 = _mm_load_ps(&transf_buf[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
372 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
373 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
374 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
375 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
376
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
377 m4 = _mm_mul_ps(m1, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
378 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
379
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
380 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
381 m8 = _mm_mul_ps(m5, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
382
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
383 _mm_store_ps(&time_out[i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
384 _mm_store_ps(&time_out[nlong+i], m8);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
385 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
386 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
387
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
388 case LONG_START_SEQUENCE:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
389 imdct_long_sse(fb, freq_in, transf_buf, 2*nlong);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
390 for (i = 0; i < nlong; i+=4)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
391 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
392 __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
393 __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
394 __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
395
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
396 __m128 m4 = _mm_mul_ps(m1, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
397 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
398
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
399 _mm_store_ps(&time_out[i], m4);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
400 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
401 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
402 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
403 __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
404 _mm_store_ps(&time_out[nlong+i], m1);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
405 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
406 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
407 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
408 __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
409 __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
410 __m128 m3, m4;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
411
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
412 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
413
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
414 m4 = _mm_mul_ps(m1, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
415
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
416 _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
417 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
418 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
419 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
420 __m128 m1 = _mm_setzero_ps();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
421 _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
422 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
423 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
424
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
425 case EIGHT_SHORT_SEQUENCE:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 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
434 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
435 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
436 __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
437 _mm_store_ps(&time_out[i], m1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
438 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
439 for (i = 0; i < nshort; i+=4)
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 __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
442 __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
443 __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
444
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
445 __m128 m4 = _mm_mul_ps(m1, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
446 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
447
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
448 _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
449 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
450 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
451 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
452 __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
453 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
454 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
455 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
456 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
457 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
458
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
459 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
460
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
461 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
462 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
463 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
464 m4 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
465
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
466 _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
467 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
468 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
469 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
470 __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
471 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
472 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
473 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
474 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
475 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
476
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
477 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
478
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
479 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
480 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
481 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
482 m4 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
483
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
484 _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
485 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
486 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
487 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
488 __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
489 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
490 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
491 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
492 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
493 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
494
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
495 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
496
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
497 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
498 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
499 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
500 m4 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
501
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
502 _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
503 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
504 for(i = 0; i < trans; i+=4)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
505 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
506 __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
507 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
508 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
509 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
510 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
511 m7 = _mm_load_ps(&window_short[i]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
512
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
513 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
514
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
515 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
516 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
517 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
518 m4 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
519
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
520 _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
521 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
522 for (i = trans; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
523 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
524 __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
525 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
526 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
527 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
528 m7 = _mm_load_ps(&window_short[i]);
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 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
531
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
532 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
533 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
534 m3 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
535
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
536 _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
537 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
538 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
539 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
540 __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
541 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
542 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
543 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
544 m7 = _mm_load_ps(&window_short[i]);
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 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
547
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
548 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
549 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
550 m3 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
551
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
552 _mm_store_ps(&time_out[nflat_ls+5*nshort+i], m3);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
553 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
554 for (i = 0; i < nshort; i+=4)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
555 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
556 __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
557 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
558 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
559 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
560 m7 = _mm_load_ps(&window_short[i]);
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 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
563
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
564 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
565 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
566 m3 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
567
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
568 _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
569 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
570 for (i = 0; i < nshort; i+=4)
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 __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
573 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
574 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
575 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
576 m7 = _mm_load_ps(&window_short[i]);
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 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
579
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
580 m4 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
581 m8 = _mm_mul_ps(m6, m7);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
582 m3 = _mm_add_ps(m4, m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
583
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
584 _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
585 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
586 for (i = 0; i < nshort; i+=4)
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 __m128 m1, m2, m3, m5;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
589 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
590 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
591
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
592 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
593
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
594 m3 = _mm_mul_ps(m1, m5);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
595
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
596 _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
597 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
598 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
599 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
600 __m128 m1 = _mm_setzero_ps();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
601 _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
602 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
603 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
604
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
605 case LONG_STOP_SEQUENCE:
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
606 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
607 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
608 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
609 __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
610 _mm_store_ps(&time_out[i], m1);
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 = _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
615 __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
616 __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
617
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
618 __m128 m4 = _mm_mul_ps(m1, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
619 m4 = _mm_add_ps(m4, m3);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
620
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
621 _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
622 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
623 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
624 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
625 __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
626 __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
627
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
628 __m128 m3 = _mm_add_ps(m1, m2);
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 _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
631 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
632 for (i = 0; i < nlong; i+=4)
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 __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
635 __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
636 __m128 m3, m4;
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 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
639
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
640 m4 = _mm_mul_ps(m1, m3);
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 _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
643 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
644 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
645 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
646
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
647 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
648 count = faad_get_ts() - count;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
649 fb->cycles += count;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
650 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
651 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
652 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
653
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
654 #ifdef LTP_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
655 /* only works for LTP -> no overlapping, no short blocks */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
656 void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
657 uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
658 uint8_t object_type, uint16_t frame_len)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
659 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
660 int16_t i;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
661 ALIGN real_t windowed_buf[2*1024] = {0};
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
662
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
663 const real_t *window_long = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
664 const real_t *window_long_prev = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
665 const real_t *window_short = NULL;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
666 const real_t *window_short_prev = NULL;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
667
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
668 uint16_t nlong = frame_len;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
669 uint16_t nshort = frame_len/8;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
670 uint16_t nflat_ls = (nlong-nshort)/2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
671
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
672 assert(window_sequence != EIGHT_SHORT_SEQUENCE);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
673
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
674 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
675 if (object_type == LD)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
676 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
677 window_long = fb->ld_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
678 window_long_prev = fb->ld_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
679 } else {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
680 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
681 window_long = fb->long_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
682 window_long_prev = fb->long_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
683 window_short = fb->short_window[window_shape];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
684 window_short_prev = fb->short_window[window_shape_prev];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
685 #ifdef LD_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
686 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
687 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
688
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
689 switch(window_sequence)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
690 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
691 case ONLY_LONG_SEQUENCE:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
692 for (i = nlong-1; i >= 0; i--)
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 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
695 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
696 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
697 mdct(fb, windowed_buf, out_mdct, 2*nlong);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
698 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
699
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
700 case LONG_START_SEQUENCE:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
701 for (i = 0; i < nlong; i++)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
702 windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
703 for (i = 0; i < nflat_ls; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
704 windowed_buf[i+nlong] = in_data[i+nlong];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
705 for (i = 0; i < nshort; i++)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
706 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
707 for (i = 0; i < nflat_ls; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
708 windowed_buf[i+nlong+nflat_ls+nshort] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
709 mdct(fb, windowed_buf, out_mdct, 2*nlong);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
710 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
711
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
712 case LONG_STOP_SEQUENCE:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
713 for (i = 0; i < nflat_ls; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
714 windowed_buf[i] = 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
715 for (i = 0; i < nshort; i++)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
716 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
717 for (i = 0; i < nflat_ls; i++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
718 windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
719 for (i = 0; i < nlong; i++)
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
720 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
721 mdct(fb, windowed_buf, out_mdct, 2*nlong);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
722 break;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
723 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
724 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
725 #endif