3394
|
1 /*
|
|
2 * imdct_mlib.c
|
|
3 * Copyright (C) 2000-2001 Michel Lespinasse <walken@zoy.org>
|
|
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
|
|
5 *
|
|
6 * This file is part of a52dec, a free ATSC A-52 stream decoder.
|
|
7 * See http://liba52.sourceforge.net/ for updates.
|
|
8 *
|
|
9 * a52dec is free software; you can redistribute it and/or modify
|
|
10 * it under the terms of the GNU General Public License as published by
|
|
11 * the Free Software Foundation; either version 2 of the License, or
|
|
12 * (at your option) any later version.
|
|
13 *
|
|
14 * a52dec is distributed in the hope that it will be useful,
|
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 * GNU General Public License for more details.
|
|
18 *
|
|
19 * You should have received a copy of the GNU General Public License
|
|
20 * along with this program; if not, write to the Free Software
|
|
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
22 */
|
|
23
|
|
24 #include "config.h"
|
|
25
|
|
26 #ifdef LIBA52_MLIB
|
|
27
|
|
28 #include <mlib_types.h>
|
|
29 #include <mlib_status.h>
|
|
30 #include <mlib_signal.h>
|
|
31 #include <string.h>
|
|
32 #include <inttypes.h>
|
|
33
|
|
34 #include "a52.h"
|
|
35 #include "a52_internal.h"
|
|
36
|
|
37 extern sample_t imdct_window[];
|
|
38
|
|
39 void
|
|
40 imdct_do_512_mlib(sample_t data[], sample_t delay[], sample_t bias)
|
|
41 {
|
|
42 sample_t *buf_real;
|
|
43 sample_t *buf_imag;
|
|
44 sample_t *data_ptr;
|
|
45 sample_t *delay_ptr;
|
|
46 sample_t *window_ptr;
|
3493
|
47 sample_t tmp[256] __attribute__((aligned(16)));
|
3394
|
48 int i;
|
|
49
|
|
50 memcpy(tmp, data, 256 * sizeof(sample_t));
|
|
51 mlib_SignalIMDCT_F32(tmp);
|
|
52
|
|
53 buf_real = tmp;
|
|
54 buf_imag = tmp + 128;
|
|
55 data_ptr = data;
|
|
56 delay_ptr = delay;
|
|
57 window_ptr = imdct_window;
|
|
58
|
|
59 /* Window and convert to real valued signal */
|
|
60 for(i=0; i< 64; i++)
|
|
61 {
|
|
62 *data_ptr++ = -buf_imag[64+i] * *window_ptr++ + *delay_ptr++ + bias;
|
|
63 *data_ptr++ = buf_real[64-i-1] * *window_ptr++ + *delay_ptr++ + bias;
|
|
64 }
|
|
65
|
|
66 for(i=0; i< 64; i++)
|
|
67 {
|
|
68 *data_ptr++ = -buf_real[i] * *window_ptr++ + *delay_ptr++ + bias;
|
|
69 *data_ptr++ = buf_imag[128-i-1] * *window_ptr++ + *delay_ptr++ + bias;
|
|
70 }
|
|
71
|
|
72 /* The trailing edge of the window goes into the delay line */
|
|
73 delay_ptr = delay;
|
|
74
|
|
75 for(i=0; i< 64; i++)
|
|
76 {
|
|
77 *delay_ptr++ = -buf_real[64+i] * *--window_ptr;
|
|
78 *delay_ptr++ = buf_imag[64-i-1] * *--window_ptr;
|
|
79 }
|
|
80
|
|
81 for(i=0; i<64; i++)
|
|
82 {
|
|
83 *delay_ptr++ = buf_imag[i] * *--window_ptr;
|
|
84 *delay_ptr++ = -buf_real[128-i-1] * *--window_ptr;
|
|
85 }
|
|
86 }
|
|
87
|
|
88 void
|
|
89 imdct_do_256_mlib(sample_t data[], sample_t delay[], sample_t bias)
|
|
90 {
|
|
91 sample_t *buf1_real, *buf1_imag;
|
|
92 sample_t *buf2_real, *buf2_imag;
|
|
93 sample_t *data_ptr;
|
|
94 sample_t *delay_ptr;
|
|
95 sample_t *window_ptr;
|
3493
|
96 sample_t tmp[256] __attribute__((aligned(16)));
|
3394
|
97 int i;
|
|
98
|
|
99 memcpy(tmp, data, 256 * sizeof(sample_t));
|
|
100 mlib_SignalIMDCTSplit_F32(tmp);
|
|
101
|
|
102 buf1_real = tmp;
|
|
103 buf1_imag = tmp + 128 + 64;
|
|
104 buf2_real = tmp + 64;
|
|
105 buf2_imag = tmp + 128;
|
|
106 data_ptr = data;
|
|
107 delay_ptr = delay;
|
|
108 window_ptr = imdct_window;
|
|
109
|
|
110 /* Window and convert to real valued signal */
|
|
111 for(i=0; i< 64; i++)
|
|
112 {
|
|
113 *data_ptr++ = -buf1_imag[i] * *window_ptr++ + *delay_ptr++ + bias;
|
|
114 *data_ptr++ = buf1_real[64-i-1] * *window_ptr++ + *delay_ptr++ + bias;
|
|
115 }
|
|
116
|
|
117 for(i=0; i< 64; i++)
|
|
118 {
|
|
119 *data_ptr++ = -buf1_real[i] * *window_ptr++ + *delay_ptr++ + bias;
|
|
120 *data_ptr++ = buf1_imag[64-i-1] * *window_ptr++ + *delay_ptr++ + bias;
|
|
121 }
|
|
122
|
|
123 delay_ptr = delay;
|
|
124
|
|
125 for(i=0; i< 64; i++)
|
|
126 {
|
|
127 *delay_ptr++ = -buf2_real[i] * *--window_ptr;
|
|
128 *delay_ptr++ = buf2_imag[64-i-1] * *--window_ptr;
|
|
129 }
|
|
130
|
|
131 for(i=0; i< 64; i++)
|
|
132 {
|
|
133 *delay_ptr++ = buf2_imag[i] * *--window_ptr;
|
|
134 *delay_ptr++ = -buf2_real[64-i-1] * *--window_ptr;
|
|
135 }
|
|
136 }
|
|
137
|
|
138 #endif
|