annotate liba52/imdct_mlib.c @ 7161:13bc391fc19c

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