FFmpeg
2.6.9
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
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
#include "
libavutil/mips/asmdefs.h
"
59
60
#if HAVE_INLINE_ASM
61
static
void
compute_antialias_mips_float(
MPADecodeContext
*
s
,
62
GranuleDef
*
g
)
63
{
64
float
*ptr, *ptr_end;
65
float
*csa = &
csa_table
[0][0];
66
/* temporary variables */
67
float
in1, in2, in3, in4, in5, in6, in7, in8;
68
float
out1, out2, out3, out4;
69
70
ptr = g->
sb_hybrid
+ 18;
71
/* we antialias only "long" bands */
72
if
(g->
block_type
== 2) {
73
if
(!g->
switch_point
)
74
return
;
75
/* XXX: check this for 8000Hz case */
76
ptr_end = ptr + 18;
77
}
else
{
78
ptr_end = ptr + 558;
79
}
80
81
/**
82
* instructions are scheduled to minimize pipeline stall.
83
*/
84
85
__asm__
volatile
(
86
"compute_antialias_float_loop%=: \t\n"
87
"lwc1 %[in1], -1*4(%[ptr]) \t\n"
88
"lwc1 %[in2], 0(%[csa]) \t\n"
89
"lwc1 %[in3], 1*4(%[csa]) \t\n"
90
"lwc1 %[in4], 0(%[ptr]) \t\n"
91
"lwc1 %[in5], -2*4(%[ptr]) \t\n"
92
"lwc1 %[in6], 4*4(%[csa]) \t\n"
93
"mul.s %[out1], %[in1], %[in2] \t\n"
94
"mul.s %[out2], %[in1], %[in3] \t\n"
95
"lwc1 %[in7], 5*4(%[csa]) \t\n"
96
"lwc1 %[in8], 1*4(%[ptr]) \t\n"
97
"nmsub.s %[out1], %[out1], %[in3], %[in4] \t\n"
98
"madd.s %[out2], %[out2], %[in2], %[in4] \t\n"
99
"mul.s %[out3], %[in5], %[in6] \t\n"
100
"mul.s %[out4], %[in5], %[in7] \t\n"
101
"lwc1 %[in1], -3*4(%[ptr]) \t\n"
102
"swc1 %[out1], -1*4(%[ptr]) \t\n"
103
"swc1 %[out2], 0(%[ptr]) \t\n"
104
"nmsub.s %[out3], %[out3], %[in7], %[in8] \t\n"
105
"madd.s %[out4], %[out4], %[in6], %[in8] \t\n"
106
"lwc1 %[in2], 8*4(%[csa]) \t\n"
107
"swc1 %[out3], -2*4(%[ptr]) \t\n"
108
"swc1 %[out4], 1*4(%[ptr]) \t\n"
109
"lwc1 %[in3], 9*4(%[csa]) \t\n"
110
"lwc1 %[in4], 2*4(%[ptr]) \t\n"
111
"mul.s %[out1], %[in1], %[in2] \t\n"
112
"lwc1 %[in5], -4*4(%[ptr]) \t\n"
113
"lwc1 %[in6], 12*4(%[csa]) \t\n"
114
"mul.s %[out2], %[in1], %[in3] \t\n"
115
"lwc1 %[in7], 13*4(%[csa]) \t\n"
116
"nmsub.s %[out1], %[out1], %[in3], %[in4] \t\n"
117
"lwc1 %[in8], 3*4(%[ptr]) \t\n"
118
"mul.s %[out3], %[in5], %[in6] \t\n"
119
"madd.s %[out2], %[out2], %[in2], %[in4] \t\n"
120
"mul.s %[out4], %[in5], %[in7] \t\n"
121
"swc1 %[out1], -3*4(%[ptr]) \t\n"
122
"lwc1 %[in1], -5*4(%[ptr]) \t\n"
123
"nmsub.s %[out3], %[out3], %[in7], %[in8] \t\n"
124
"swc1 %[out2], 2*4(%[ptr]) \t\n"
125
"madd.s %[out4], %[out4], %[in6], %[in8] \t\n"
126
"lwc1 %[in2], 16*4(%[csa]) \t\n"
127
"lwc1 %[in3], 17*4(%[csa]) \t\n"
128
"swc1 %[out3], -4*4(%[ptr]) \t\n"
129
"lwc1 %[in4], 4*4(%[ptr]) \t\n"
130
"swc1 %[out4], 3*4(%[ptr]) \t\n"
131
"mul.s %[out1], %[in1], %[in2] \t\n"
132
"mul.s %[out2], %[in1], %[in3] \t\n"
133
"lwc1 %[in5], -6*4(%[ptr]) \t\n"
134
"lwc1 %[in6], 20*4(%[csa]) \t\n"
135
"lwc1 %[in7], 21*4(%[csa]) \t\n"
136
"nmsub.s %[out1], %[out1], %[in3], %[in4] \t\n"
137
"madd.s %[out2], %[out2], %[in2], %[in4] \t\n"
138
"lwc1 %[in8], 5*4(%[ptr]) \t\n"
139
"mul.s %[out3], %[in5], %[in6] \t\n"
140
"mul.s %[out4], %[in5], %[in7] \t\n"
141
"swc1 %[out1], -5*4(%[ptr]) \t\n"
142
"swc1 %[out2], 4*4(%[ptr]) \t\n"
143
"lwc1 %[in1], -7*4(%[ptr]) \t\n"
144
"nmsub.s %[out3], %[out3], %[in7], %[in8] \t\n"
145
"madd.s %[out4], %[out4], %[in6], %[in8] \t\n"
146
"lwc1 %[in2], 24*4(%[csa]) \t\n"
147
"lwc1 %[in3], 25*4(%[csa]) \t\n"
148
"lwc1 %[in4], 6*4(%[ptr]) \t\n"
149
"swc1 %[out3], -6*4(%[ptr]) \t\n"
150
"swc1 %[out4], 5*4(%[ptr]) \t\n"
151
"mul.s %[out1], %[in1], %[in2] \t\n"
152
"lwc1 %[in5], -8*4(%[ptr]) \t\n"
153
"mul.s %[out2], %[in1], %[in3] \t\n"
154
"lwc1 %[in6], 28*4(%[csa]) \t\n"
155
"lwc1 %[in7], 29*4(%[csa]) \t\n"
156
"nmsub.s %[out1], %[out1], %[in3], %[in4] \t\n"
157
"lwc1 %[in8], 7*4(%[ptr]) \t\n"
158
"madd.s %[out2], %[out2], %[in2], %[in4] \t\n"
159
"mul.s %[out3], %[in5], %[in6] \t\n"
160
"mul.s %[out4], %[in5], %[in7] \t\n"
161
"swc1 %[out1], -7*4(%[ptr]) \t\n"
162
"swc1 %[out2], 6*4(%[ptr]) \t\n"
163
PTR_ADDIU
"%[ptr],%[ptr], 72 \t\n"
164
"nmsub.s %[out3], %[out3], %[in7], %[in8] \t\n"
165
"madd.s %[out4], %[out4], %[in6], %[in8] \t\n"
166
"swc1 %[out3], -26*4(%[ptr]) \t\n"
167
"swc1 %[out4], -11*4(%[ptr]) \t\n"
168
"bne %[ptr], %[ptr_end], compute_antialias_float_loop%= \t\n"
169
170
: [ptr]
"+r"
(ptr),
171
[in1]
"=&f"
(in1), [in2]
"=&f"
(in2),
172
[in3]
"=&f"
(in3), [in4]
"=&f"
(in4),
173
[in5]
"=&f"
(in5), [in6]
"=&f"
(in6),
174
[in7]
"=&f"
(in7), [in8]
"=&f"
(in8),
175
[out1]
"=&f"
(out1), [out2]
"=&f"
(out2),
176
[out3]
"=&f"
(out3), [out4]
"=&f"
(out4)
177
: [csa]
"r"
(csa), [ptr_end]
"r"
(ptr_end)
178
:
"memory"
179
);
180
}
181
#define compute_antialias compute_antialias_mips_float
182
#endif
/* HAVE_INLINE_ASM */
183
184
#endif
/* AVCODEC_MIPS_COMPUTE_ANTIALIAS_FLOAT_H */
s
const char * s
Definition:
avisynth_c.h:669
asmdefs.h
MIPS assembly defines from sys/asm.h but rewritten for use with C inline assembly (rather than from w...
g
const char * g
Definition:
vf_curves.c:108
GranuleDef::switch_point
uint8_t switch_point
Definition:
mpegaudiodec_template.c:58
csa_table
static INTFLOAT csa_table[8][4]
Definition:
mpegaudiodec_template.c:116
MPADecodeContext
Definition:
mpegaudiodec_template.c:70
GranuleDef::sb_hybrid
int sb_hybrid[SBLIMIT *18]
Definition:
mpegaudiodec_template.c:67
PTR_ADDIU
#define PTR_ADDIU
Definition:
asmdefs.h:41
GranuleDef
Definition:
mpegaudiodec_template.c:51
GranuleDef::block_type
uint8_t block_type
Definition:
mpegaudiodec_template.c:57
Generated on Thu Sep 30 2021 22:58:01 for FFmpeg by
1.8.8