• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavcodec/arm/mathops.h

Go to the documentation of this file.
00001 /*
00002  * simple math operations
00003  * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al
00004  *
00005  * This file is part of Libav.
00006  *
00007  * Libav is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * Libav is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with Libav; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #ifndef AVCODEC_ARM_MATHOPS_H
00023 #define AVCODEC_ARM_MATHOPS_H
00024 
00025 #include <stdint.h>
00026 #include "config.h"
00027 #include "libavutil/common.h"
00028 
00029 #if HAVE_INLINE_ASM
00030 
00031 #if HAVE_ARMV6
00032 #define MULH MULH
00033 static inline av_const int MULH(int a, int b)
00034 {
00035     int r;
00036     __asm__ ("smmul %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
00037     return r;
00038 }
00039 #endif
00040 
00041 #define MLS64(d, a, b) MAC64(d, -(a), b)
00042 
00043 #if HAVE_ARMV5TE
00044 
00045 /* signed 16x16 -> 32 multiply add accumulate */
00046 #   define MAC16(rt, ra, rb)                                            \
00047     __asm__ ("smlabb %0, %1, %2, %0" : "+r"(rt) : "r"(ra), "r"(rb));
00048 
00049 /* signed 16x16 -> 32 multiply */
00050 #   define MUL16 MUL16
00051 static inline av_const int MUL16(int ra, int rb)
00052 {
00053     int rt;
00054     __asm__ ("smulbb %0, %1, %2" : "=r"(rt) : "r"(ra), "r"(rb));
00055     return rt;
00056 }
00057 
00058 #endif
00059 
00060 #define mid_pred mid_pred
00061 static inline av_const int mid_pred(int a, int b, int c)
00062 {
00063     int m;
00064     __asm__ (
00065         "mov   %0, %2  \n\t"
00066         "cmp   %1, %2  \n\t"
00067         "itt   gt      \n\t"
00068         "movgt %0, %1  \n\t"
00069         "movgt %1, %2  \n\t"
00070         "cmp   %1, %3  \n\t"
00071         "it    le      \n\t"
00072         "movle %1, %3  \n\t"
00073         "cmp   %0, %1  \n\t"
00074         "it    gt      \n\t"
00075         "movgt %0, %1  \n\t"
00076         : "=&r"(m), "+r"(a)
00077         : "r"(b), "r"(c)
00078         : "cc");
00079     return m;
00080 }
00081 
00082 #endif /* HAVE_INLINE_ASM */
00083 
00084 #endif /* AVCODEC_ARM_MATHOPS_H */
Generated on Sun Apr 22 2012 21:53:59 for Libav by doxygen 1.7.1