Mercurial > mplayer.hg
annotate liba52/imdct_mlib.c @ 16115:69eadbd92faa
added missing license header
author | alex |
---|---|
date | Wed, 27 Jul 2005 11:09:42 +0000 |
parents | 07f1e7669772 |
children |
rev | line source |
---|---|
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 * | |
14991
07f1e7669772
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
3493
diff
changeset
|
9 * Modified for use with MPlayer, changes contained in liba52_changes.diff. |
07f1e7669772
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
3493
diff
changeset
|
10 * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ |
07f1e7669772
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
3493
diff
changeset
|
11 * $Id$ |
07f1e7669772
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
3493
diff
changeset
|
12 * |
3394 | 13 * a52dec is free software; you can redistribute it and/or modify |
14 * it under the terms of the GNU General Public License as published by | |
15 * the Free Software Foundation; either version 2 of the License, or | |
16 * (at your option) any later version. | |
17 * | |
18 * a52dec is distributed in the hope that it will be useful, | |
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 * GNU General Public License for more details. | |
22 * | |
23 * You should have received a copy of the GNU General Public License | |
24 * along with this program; if not, write to the Free Software | |
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
26 */ | |
27 | |
28 #include "config.h" | |
29 | |
30 #ifdef LIBA52_MLIB | |
31 | |
32 #include <mlib_types.h> | |
33 #include <mlib_status.h> | |
34 #include <mlib_signal.h> | |
35 #include <string.h> | |
36 #include <inttypes.h> | |
37 | |
38 #include "a52.h" | |
39 #include "a52_internal.h" | |
40 | |
41 extern sample_t imdct_window[]; | |
42 | |
43 void | |
44 imdct_do_512_mlib(sample_t data[], sample_t delay[], sample_t bias) | |
45 { | |
46 sample_t *buf_real; | |
47 sample_t *buf_imag; | |
48 sample_t *data_ptr; | |
49 sample_t *delay_ptr; | |
50 sample_t *window_ptr; | |
3493 | 51 sample_t tmp[256] __attribute__((aligned(16))); |
3394 | 52 int i; |
53 | |
54 memcpy(tmp, data, 256 * sizeof(sample_t)); | |
55 mlib_SignalIMDCT_F32(tmp); | |
56 | |
57 buf_real = tmp; | |
58 buf_imag = tmp + 128; | |
59 data_ptr = data; | |
60 delay_ptr = delay; | |
61 window_ptr = imdct_window; | |
62 | |
63 /* Window and convert to real valued signal */ | |
64 for(i=0; i< 64; i++) | |
65 { | |
66 *data_ptr++ = -buf_imag[64+i] * *window_ptr++ + *delay_ptr++ + bias; | |
67 *data_ptr++ = buf_real[64-i-1] * *window_ptr++ + *delay_ptr++ + bias; | |
68 } | |
69 | |
70 for(i=0; i< 64; i++) | |
71 { | |
72 *data_ptr++ = -buf_real[i] * *window_ptr++ + *delay_ptr++ + bias; | |
73 *data_ptr++ = buf_imag[128-i-1] * *window_ptr++ + *delay_ptr++ + bias; | |
74 } | |
75 | |
76 /* The trailing edge of the window goes into the delay line */ | |
77 delay_ptr = delay; | |
78 | |
79 for(i=0; i< 64; i++) | |
80 { | |
81 *delay_ptr++ = -buf_real[64+i] * *--window_ptr; | |
82 *delay_ptr++ = buf_imag[64-i-1] * *--window_ptr; | |
83 } | |
84 | |
85 for(i=0; i<64; i++) | |
86 { | |
87 *delay_ptr++ = buf_imag[i] * *--window_ptr; | |
88 *delay_ptr++ = -buf_real[128-i-1] * *--window_ptr; | |
89 } | |
90 } | |
91 | |
92 void | |
93 imdct_do_256_mlib(sample_t data[], sample_t delay[], sample_t bias) | |
94 { | |
95 sample_t *buf1_real, *buf1_imag; | |
96 sample_t *buf2_real, *buf2_imag; | |
97 sample_t *data_ptr; | |
98 sample_t *delay_ptr; | |
99 sample_t *window_ptr; | |
3493 | 100 sample_t tmp[256] __attribute__((aligned(16))); |
3394 | 101 int i; |
102 | |
103 memcpy(tmp, data, 256 * sizeof(sample_t)); | |
104 mlib_SignalIMDCTSplit_F32(tmp); | |
105 | |
106 buf1_real = tmp; | |
107 buf1_imag = tmp + 128 + 64; | |
108 buf2_real = tmp + 64; | |
109 buf2_imag = tmp + 128; | |
110 data_ptr = data; | |
111 delay_ptr = delay; | |
112 window_ptr = imdct_window; | |
113 | |
114 /* Window and convert to real valued signal */ | |
115 for(i=0; i< 64; i++) | |
116 { | |
117 *data_ptr++ = -buf1_imag[i] * *window_ptr++ + *delay_ptr++ + bias; | |
118 *data_ptr++ = buf1_real[64-i-1] * *window_ptr++ + *delay_ptr++ + bias; | |
119 } | |
120 | |
121 for(i=0; i< 64; i++) | |
122 { | |
123 *data_ptr++ = -buf1_real[i] * *window_ptr++ + *delay_ptr++ + bias; | |
124 *data_ptr++ = buf1_imag[64-i-1] * *window_ptr++ + *delay_ptr++ + bias; | |
125 } | |
126 | |
127 delay_ptr = delay; | |
128 | |
129 for(i=0; i< 64; i++) | |
130 { | |
131 *delay_ptr++ = -buf2_real[i] * *--window_ptr; | |
132 *delay_ptr++ = buf2_imag[64-i-1] * *--window_ptr; | |
133 } | |
134 | |
135 for(i=0; i< 64; i++) | |
136 { | |
137 *delay_ptr++ = buf2_imag[i] * *--window_ptr; | |
138 *delay_ptr++ = -buf2_real[64-i-1] * *--window_ptr; | |
139 } | |
140 } | |
141 | |
142 #endif |