3 * Copyright (C) 2000-2001 Michel Lespinasse <walken@zoy.org>
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
6 * This file is part of a52dec, a free ATSC A-52 stream decoder.
7 * See http://liba52.sourceforge.net/ for updates.
9 * Modified for use with MPlayer, changes contained in liba52_changes.diff.
10 * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
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.
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.
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
32 #include <mlib_types.h>
33 #include <mlib_status.h>
34 #include <mlib_signal.h>
39 #include "a52_internal.h"
41 extern sample_t imdct_window
[];
44 imdct_do_512_mlib(sample_t data
[], sample_t delay
[], sample_t bias
)
51 sample_t tmp
[256] __attribute__((aligned(16)));
54 memcpy(tmp
, data
, 256 * sizeof(sample_t
));
55 mlib_SignalIMDCT_F32(tmp
);
61 window_ptr
= imdct_window
;
63 /* Window and convert to real valued signal */
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
;
72 *data_ptr
++ = -buf_real
[i
] * *window_ptr
++ + *delay_ptr
++ + bias
;
73 *data_ptr
++ = buf_imag
[128-i
-1] * *window_ptr
++ + *delay_ptr
++ + bias
;
76 /* The trailing edge of the window goes into the delay line */
81 *delay_ptr
++ = -buf_real
[64+i
] * *--window_ptr
;
82 *delay_ptr
++ = buf_imag
[64-i
-1] * *--window_ptr
;
87 *delay_ptr
++ = buf_imag
[i
] * *--window_ptr
;
88 *delay_ptr
++ = -buf_real
[128-i
-1] * *--window_ptr
;
93 imdct_do_256_mlib(sample_t data
[], sample_t delay
[], sample_t bias
)
95 sample_t
*buf1_real
, *buf1_imag
;
96 sample_t
*buf2_real
, *buf2_imag
;
100 sample_t tmp
[256] __attribute__((aligned(16)));
103 memcpy(tmp
, data
, 256 * sizeof(sample_t
));
104 mlib_SignalIMDCTSplit_F32(tmp
);
107 buf1_imag
= tmp
+ 128 + 64;
108 buf2_real
= tmp
+ 64;
109 buf2_imag
= tmp
+ 128;
112 window_ptr
= imdct_window
;
114 /* Window and convert to real valued signal */
117 *data_ptr
++ = -buf1_imag
[i
] * *window_ptr
++ + *delay_ptr
++ + bias
;
118 *data_ptr
++ = buf1_real
[64-i
-1] * *window_ptr
++ + *delay_ptr
++ + bias
;
123 *data_ptr
++ = -buf1_real
[i
] * *window_ptr
++ + *delay_ptr
++ + bias
;
124 *data_ptr
++ = buf1_imag
[64-i
-1] * *window_ptr
++ + *delay_ptr
++ + bias
;
131 *delay_ptr
++ = -buf2_real
[i
] * *--window_ptr
;
132 *delay_ptr
++ = buf2_imag
[64-i
-1] * *--window_ptr
;
137 *delay_ptr
++ = buf2_imag
[i
] * *--window_ptr
;
138 *delay_ptr
++ = -buf2_real
[64-i
-1] * *--window_ptr
;