FFmpeg
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libavcodec
mips
compute_antialias_float.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012
3
* MIPS Technologies, Inc., California.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. Neither the name of the MIPS Technologies, Inc., nor the names of its
14
* contributors may be used to endorse or promote products derived from
15
* this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
18
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
21
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
* SUCH DAMAGE.
28
*
29
* Author: Bojan Zivkovic (bojan@mips.com)
30
*
31
* Compute antialias function optimised for MIPS floating-point architecture
32
*
33
* This file is part of FFmpeg.
34
*
35
* FFmpeg is free software; you can redistribute it and/or
36
* modify it under the terms of the GNU Lesser General Public
37
* License as published by the Free Software Foundation; either
38
* version 2.1 of the License, or (at your option) any later version.
39
*
40
* FFmpeg is distributed in the hope that it will be useful,
41
* but WITHOUT ANY WARRANTY; without even the implied warranty of
42
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
43
* Lesser General Public License for more details.
44
*
45
* You should have received a copy of the GNU Lesser General Public
46
* License along with FFmpeg; if not, write to the Free Software
47
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
48
*/
49
50
/**
51
* @file
52
* Reference: libavcodec/mpegaudiodec.c
53
*/
54
55
#ifndef AVCODEC_MIPS_COMPUTE_ANTIALIAS_FLOAT_H
56
#define AVCODEC_MIPS_COMPUTE_ANTIALIAS_FLOAT_H
57
58
#if HAVE_INLINE_ASM
59
static
void
compute_antialias_mips_float(
MPADecodeContext
*s,
60
GranuleDef
*
g
)
61
{
62
float
*ptr, *ptr_end;
63
float
*csa = &
csa_table
[0][0];
64
int
n;
65
/* temporary variables */
66
float
in1, in2, in3, in4, in5, in6, in7, in8;
67
float
out1, out2, out3, out4;
68
69
ptr = g->
sb_hybrid
+ 18;
70
/* we antialias only "long" bands */
71
if
(g->
block_type
== 2) {
72
if
(!g->
switch_point
)
73
return
;
74
/* XXX: check this for 8000Hz case */
75
n = 1;
76
ptr_end = ptr + 18;
77
}
else
{
78
n = 31;
79
ptr_end = ptr + 558;
80
}
81
82
/**
83
* instructions are scheduled to minimize pipeline stall.
84
*/
85
86
__asm__
volatile
(
87
"compute_antialias_float_loop%=: \t\n"
88
"lwc1 %[in1], -1*4(%[ptr]) \t\n"
89
"lwc1 %[in2], 0(%[csa]) \t\n"
90
"lwc1 %[in3], 1*4(%[csa]) \t\n"
91
"lwc1 %[in4], 0(%[ptr]) \t\n"
92
"lwc1 %[in5], -2*4(%[ptr]) \t\n"
93
"lwc1 %[in6], 4*4(%[csa]) \t\n"
94
"mul.s %[out1], %[in1], %[in2] \t\n"
95
"mul.s %[out2], %[in1], %[in3] \t\n"
96
"lwc1 %[in7], 5*4(%[csa]) \t\n"
97
"lwc1 %[in8], 1*4(%[ptr]) \t\n"
98
"nmsub.s %[out1], %[out1], %[in3], %[in4] \t\n"
99
"madd.s %[out2], %[out2], %[in2], %[in4] \t\n"
100
"mul.s %[out3], %[in5], %[in6] \t\n"
101
"mul.s %[out4], %[in5], %[in7] \t\n"
102
"lwc1 %[in1], -3*4(%[ptr]) \t\n"
103
"swc1 %[out1], -1*4(%[ptr]) \t\n"
104
"swc1 %[out2], 0(%[ptr]) \t\n"
105
"nmsub.s %[out3], %[out3], %[in7], %[in8] \t\n"
106
"madd.s %[out4], %[out4], %[in6], %[in8] \t\n"
107
"lwc1 %[in2], 8*4(%[csa]) \t\n"
108
"swc1 %[out3], -2*4(%[ptr]) \t\n"
109
"swc1 %[out4], 1*4(%[ptr]) \t\n"
110
"lwc1 %[in3], 9*4(%[csa]) \t\n"
111
"lwc1 %[in4], 2*4(%[ptr]) \t\n"
112
"mul.s %[out1], %[in1], %[in2] \t\n"
113
"lwc1 %[in5], -4*4(%[ptr]) \t\n"
114
"lwc1 %[in6], 12*4(%[csa]) \t\n"
115
"mul.s %[out2], %[in1], %[in3] \t\n"
116
"lwc1 %[in7], 13*4(%[csa]) \t\n"
117
"nmsub.s %[out1], %[out1], %[in3], %[in4] \t\n"
118
"lwc1 %[in8], 3*4(%[ptr]) \t\n"
119
"mul.s %[out3], %[in5], %[in6] \t\n"
120
"madd.s %[out2], %[out2], %[in2], %[in4] \t\n"
121
"mul.s %[out4], %[in5], %[in7] \t\n"
122
"swc1 %[out1], -3*4(%[ptr]) \t\n"
123
"lwc1 %[in1], -5*4(%[ptr]) \t\n"
124
"nmsub.s %[out3], %[out3], %[in7], %[in8] \t\n"
125
"swc1 %[out2], 2*4(%[ptr]) \t\n"
126
"madd.s %[out4], %[out4], %[in6], %[in8] \t\n"
127
"lwc1 %[in2], 16*4(%[csa]) \t\n"
128
"lwc1 %[in3], 17*4(%[csa]) \t\n"
129
"swc1 %[out3], -4*4(%[ptr]) \t\n"
130
"lwc1 %[in4], 4*4(%[ptr]) \t\n"
131
"swc1 %[out4], 3*4(%[ptr]) \t\n"
132
"mul.s %[out1], %[in1], %[in2] \t\n"
133
"mul.s %[out2], %[in1], %[in3] \t\n"
134
"lwc1 %[in5], -6*4(%[ptr]) \t\n"
135
"lwc1 %[in6], 20*4(%[csa]) \t\n"
136
"lwc1 %[in7], 21*4(%[csa]) \t\n"
137
"nmsub.s %[out1], %[out1], %[in3], %[in4] \t\n"
138
"madd.s %[out2], %[out2], %[in2], %[in4] \t\n"
139
"lwc1 %[in8], 5*4(%[ptr]) \t\n"
140
"mul.s %[out3], %[in5], %[in6] \t\n"
141
"mul.s %[out4], %[in5], %[in7] \t\n"
142
"swc1 %[out1], -5*4(%[ptr]) \t\n"
143
"swc1 %[out2], 4*4(%[ptr]) \t\n"
144
"lwc1 %[in1], -7*4(%[ptr]) \t\n"
145
"nmsub.s %[out3], %[out3], %[in7], %[in8] \t\n"
146
"madd.s %[out4], %[out4], %[in6], %[in8] \t\n"
147
"lwc1 %[in2], 24*4(%[csa]) \t\n"
148
"lwc1 %[in3], 25*4(%[csa]) \t\n"
149
"lwc1 %[in4], 6*4(%[ptr]) \t\n"
150
"swc1 %[out3], -6*4(%[ptr]) \t\n"
151
"swc1 %[out4], 5*4(%[ptr]) \t\n"
152
"mul.s %[out1], %[in1], %[in2] \t\n"
153
"lwc1 %[in5], -8*4(%[ptr]) \t\n"
154
"mul.s %[out2], %[in1], %[in3] \t\n"
155
"lwc1 %[in6], 28*4(%[csa]) \t\n"
156
"lwc1 %[in7], 29*4(%[csa]) \t\n"
157
"nmsub.s %[out1], %[out1], %[in3], %[in4] \t\n"
158
"lwc1 %[in8], 7*4(%[ptr]) \t\n"
159
"madd.s %[out2], %[out2], %[in2], %[in4] \t\n"
160
"mul.s %[out3], %[in5], %[in6] \t\n"
161
"mul.s %[out4], %[in5], %[in7] \t\n"
162
"swc1 %[out1], -7*4(%[ptr]) \t\n"
163
"swc1 %[out2], 6*4(%[ptr]) \t\n"
164
"addiu %[ptr], %[ptr], 72 \t\n"
165
"nmsub.s %[out3], %[out3], %[in7], %[in8] \t\n"
166
"madd.s %[out4], %[out4], %[in6], %[in8] \t\n"
167
"swc1 %[out3], -26*4(%[ptr]) \t\n"
168
"swc1 %[out4], -11*4(%[ptr]) \t\n"
169
"bne %[ptr], %[ptr_end], compute_antialias_float_loop%= \t\n"
170
171
: [ptr]
"+r"
(ptr),
172
[in1]
"=&f"
(in1), [in2]
"=&f"
(in2),
173
[in3]
"=&f"
(in3), [in4]
"=&f"
(in4),
174
[in5]
"=&f"
(in5), [in6]
"=&f"
(in6),
175
[in7]
"=&f"
(in7), [in8]
"=&f"
(in8),
176
[out1]
"=&f"
(out1), [out2]
"=&f"
(out2),
177
[out3]
"=&f"
(out3), [out4]
"=&f"
(out4)
178
: [csa]
"r"
(csa), [ptr_end]
"r"
(ptr_end)
179
);
180
}
181
#define compute_antialias compute_antialias_mips_float
182
#endif
/* HAVE_INLINE_ASM */
183
184
#endif
/* AVCODEC_MIPS_COMPUTE_ANTIALIAS_FLOAT_H */
Generated on Sat May 25 2013 04:01:06 for FFmpeg by
1.8.2