annotate liba52/imdct_mlib.c @ 17051:c2fc23703ef9

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