yading@11: /* yading@11: * Copyright (c) 2012 yading@11: * MIPS Technologies, Inc., California. yading@11: * yading@11: * Redistribution and use in source and binary forms, with or without yading@11: * modification, are permitted provided that the following conditions yading@11: * are met: yading@11: * 1. Redistributions of source code must retain the above copyright yading@11: * notice, this list of conditions and the following disclaimer. yading@11: * 2. Redistributions in binary form must reproduce the above copyright yading@11: * notice, this list of conditions and the following disclaimer in the yading@11: * documentation and/or other materials provided with the distribution. yading@11: * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its yading@11: * contributors may be used to endorse or promote products derived from yading@11: * this software without specific prior written permission. yading@11: * yading@11: * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND yading@11: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE yading@11: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE yading@11: * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE yading@11: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL yading@11: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS yading@11: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) yading@11: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT yading@11: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY yading@11: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF yading@11: * SUCH DAMAGE. yading@11: * yading@11: * Author: Nedeljko Babic (nbabic@mips.com) yading@11: * yading@11: * This file is part of FFmpeg. yading@11: * yading@11: * FFmpeg is free software; you can redistribute it and/or yading@11: * modify it under the terms of the GNU Lesser General Public yading@11: * License as published by the Free Software Foundation; either yading@11: * version 2.1 of the License, or (at your option) any later version. yading@11: * yading@11: * FFmpeg is distributed in the hope that it will be useful, yading@11: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@11: * Lesser General Public License for more details. yading@11: * yading@11: * You should have received a copy of the GNU Lesser General Public yading@11: * License along with FFmpeg; if not, write to the Free Software yading@11: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@11: */ yading@11: yading@11: /** yading@11: * @file yading@11: * MIPS optimization for some libm functions yading@11: */ yading@11: yading@11: #ifndef AVUTIL_LIBM_MIPS_H yading@11: #define AVUTIL_LIBM_MIPS_H yading@11: yading@11: static av_always_inline av_const long int lrintf_mips(float x) yading@11: { yading@11: register int ret_int; yading@11: yading@11: __asm__ volatile ( yading@11: "cvt.w.s %[x], %[x] \n\t" yading@11: "mfc1 %[ret_int], %[x] \n\t" yading@11: yading@11: :[x]"+f"(x), [ret_int]"=r"(ret_int) yading@11: ); yading@11: return ret_int; yading@11: } yading@11: yading@11: #undef lrintf yading@11: #define lrintf(x) lrintf_mips(x) yading@11: yading@11: #define HAVE_LRINTF 1 yading@11: #endif /* AVUTIL_LIBM_MIPS_H */