yading@11
|
1 /*
|
yading@11
|
2 * Copyright (c) 2012
|
yading@11
|
3 * MIPS Technologies, Inc., California.
|
yading@11
|
4 *
|
yading@11
|
5 * Redistribution and use in source and binary forms, with or without
|
yading@11
|
6 * modification, are permitted provided that the following conditions
|
yading@11
|
7 * are met:
|
yading@11
|
8 * 1. Redistributions of source code must retain the above copyright
|
yading@11
|
9 * notice, this list of conditions and the following disclaimer.
|
yading@11
|
10 * 2. Redistributions in binary form must reproduce the above copyright
|
yading@11
|
11 * notice, this list of conditions and the following disclaimer in the
|
yading@11
|
12 * documentation and/or other materials provided with the distribution.
|
yading@11
|
13 * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its
|
yading@11
|
14 * contributors may be used to endorse or promote products derived from
|
yading@11
|
15 * this software without specific prior written permission.
|
yading@11
|
16 *
|
yading@11
|
17 * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
|
yading@11
|
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
yading@11
|
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
yading@11
|
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
|
yading@11
|
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
yading@11
|
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
yading@11
|
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
yading@11
|
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
yading@11
|
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
yading@11
|
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
yading@11
|
27 * SUCH DAMAGE.
|
yading@11
|
28 *
|
yading@11
|
29 * Author: Nedeljko Babic (nbabic@mips.com)
|
yading@11
|
30 *
|
yading@11
|
31 * This file is part of FFmpeg.
|
yading@11
|
32 *
|
yading@11
|
33 * FFmpeg is free software; you can redistribute it and/or
|
yading@11
|
34 * modify it under the terms of the GNU Lesser General Public
|
yading@11
|
35 * License as published by the Free Software Foundation; either
|
yading@11
|
36 * version 2.1 of the License, or (at your option) any later version.
|
yading@11
|
37 *
|
yading@11
|
38 * FFmpeg is distributed in the hope that it will be useful,
|
yading@11
|
39 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@11
|
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@11
|
41 * Lesser General Public License for more details.
|
yading@11
|
42 *
|
yading@11
|
43 * You should have received a copy of the GNU Lesser General Public
|
yading@11
|
44 * License along with FFmpeg; if not, write to the Free Software
|
yading@11
|
45 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@11
|
46 */
|
yading@11
|
47
|
yading@11
|
48 /**
|
yading@11
|
49 * @file
|
yading@11
|
50 * MIPS optimization for some libm functions
|
yading@11
|
51 */
|
yading@11
|
52
|
yading@11
|
53 #ifndef AVUTIL_LIBM_MIPS_H
|
yading@11
|
54 #define AVUTIL_LIBM_MIPS_H
|
yading@11
|
55
|
yading@11
|
56 static av_always_inline av_const long int lrintf_mips(float x)
|
yading@11
|
57 {
|
yading@11
|
58 register int ret_int;
|
yading@11
|
59
|
yading@11
|
60 __asm__ volatile (
|
yading@11
|
61 "cvt.w.s %[x], %[x] \n\t"
|
yading@11
|
62 "mfc1 %[ret_int], %[x] \n\t"
|
yading@11
|
63
|
yading@11
|
64 :[x]"+f"(x), [ret_int]"=r"(ret_int)
|
yading@11
|
65 );
|
yading@11
|
66 return ret_int;
|
yading@11
|
67 }
|
yading@11
|
68
|
yading@11
|
69 #undef lrintf
|
yading@11
|
70 #define lrintf(x) lrintf_mips(x)
|
yading@11
|
71
|
yading@11
|
72 #define HAVE_LRINTF 1
|
yading@11
|
73 #endif /* AVUTIL_LIBM_MIPS_H */
|