Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VSs > VSs__H264__App
diff libavcodec/arm/mathops.h @ 2:897f711a7157
rearrange to work with autoconf
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 25 Sep 2012 15:55:33 +0200 |
| parents | |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libavcodec/arm/mathops.h Tue Sep 25 15:55:33 2012 +0200 1.3 @@ -0,0 +1,116 @@ 1.4 +/* 1.5 + * simple math operations 1.6 + * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al 1.7 + * 1.8 + * This file is part of FFmpeg. 1.9 + * 1.10 + * FFmpeg is free software; you can redistribute it and/or 1.11 + * modify it under the terms of the GNU Lesser General Public 1.12 + * License as published by the Free Software Foundation; either 1.13 + * version 2.1 of the License, or (at your option) any later version. 1.14 + * 1.15 + * FFmpeg is distributed in the hope that it will be useful, 1.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 1.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.18 + * Lesser General Public License for more details. 1.19 + * 1.20 + * You should have received a copy of the GNU Lesser General Public 1.21 + * License along with FFmpeg; if not, write to the Free Software 1.22 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 1.23 + */ 1.24 + 1.25 +#ifndef AVCODEC_ARM_MATHOPS_H 1.26 +#define AVCODEC_ARM_MATHOPS_H 1.27 + 1.28 +#include <stdint.h> 1.29 +#include "config.h" 1.30 +#include "libavutil/common.h" 1.31 + 1.32 +#if HAVE_INLINE_ASM 1.33 + 1.34 +# define MULL MULL 1.35 +static inline av_const int MULL(int a, int b, unsigned shift) 1.36 +{ 1.37 + int lo, hi; 1.38 + __asm__("smull %0, %1, %2, %3 \n\t" 1.39 + "mov %0, %0, lsr %4 \n\t" 1.40 + "add %1, %0, %1, lsl %5 \n\t" 1.41 + : "=&r"(lo), "=&r"(hi) 1.42 + : "r"(b), "r"(a), "ir"(shift), "ir"(32-shift)); 1.43 + return hi; 1.44 +} 1.45 + 1.46 +#define MULH MULH 1.47 +#if HAVE_ARMV6 1.48 +static inline av_const int MULH(int a, int b) 1.49 +{ 1.50 + int r; 1.51 + __asm__ ("smmul %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); 1.52 + return r; 1.53 +} 1.54 +#else 1.55 +static inline av_const int MULH(int a, int b) 1.56 +{ 1.57 + int lo, hi; 1.58 + __asm__ ("smull %0, %1, %2, %3" : "=&r"(lo), "=&r"(hi) : "r"(b), "r"(a)); 1.59 + return hi; 1.60 +} 1.61 +#endif 1.62 + 1.63 +static inline av_const int64_t MUL64(int a, int b) 1.64 +{ 1.65 + union { uint64_t x; unsigned hl[2]; } x; 1.66 + __asm__ ("smull %0, %1, %2, %3" 1.67 + : "=r"(x.hl[0]), "=r"(x.hl[1]) : "r"(a), "r"(b)); 1.68 + return x.x; 1.69 +} 1.70 +#define MUL64 MUL64 1.71 + 1.72 +static inline av_const int64_t MAC64(int64_t d, int a, int b) 1.73 +{ 1.74 + union { uint64_t x; unsigned hl[2]; } x = { d }; 1.75 + __asm__ ("smlal %0, %1, %2, %3" 1.76 + : "+r"(x.hl[0]), "+r"(x.hl[1]) : "r"(a), "r"(b)); 1.77 + return x.x; 1.78 +} 1.79 +#define MAC64(d, a, b) ((d) = MAC64(d, a, b)) 1.80 +#define MLS64(d, a, b) MAC64(d, -(a), b) 1.81 + 1.82 +#if HAVE_ARMV5TE 1.83 + 1.84 +/* signed 16x16 -> 32 multiply add accumulate */ 1.85 +# define MAC16(rt, ra, rb) \ 1.86 + __asm__ ("smlabb %0, %1, %2, %0" : "+r"(rt) : "r"(ra), "r"(rb)); 1.87 + 1.88 +/* signed 16x16 -> 32 multiply */ 1.89 +# define MUL16 MUL16 1.90 +static inline av_const int MUL16(int ra, int rb) 1.91 +{ 1.92 + int rt; 1.93 + __asm__ ("smulbb %0, %1, %2" : "=r"(rt) : "r"(ra), "r"(rb)); 1.94 + return rt; 1.95 +} 1.96 + 1.97 +#endif 1.98 + 1.99 +#define mid_pred mid_pred 1.100 +static inline av_const int mid_pred(int a, int b, int c) 1.101 +{ 1.102 + int m; 1.103 + __asm__ volatile ( 1.104 + "mov %0, %2 \n\t" 1.105 + "cmp %1, %2 \n\t" 1.106 + "movgt %0, %1 \n\t" 1.107 + "movgt %1, %2 \n\t" 1.108 + "cmp %1, %3 \n\t" 1.109 + "movle %1, %3 \n\t" 1.110 + "cmp %0, %1 \n\t" 1.111 + "movgt %0, %1 \n\t" 1.112 + : "=&r"(m), "+r"(a) 1.113 + : "r"(b), "r"(c)); 1.114 + return m; 1.115 +} 1.116 + 1.117 +#endif /* HAVE_INLINE_ASM */ 1.118 + 1.119 +#endif /* AVCODEC_ARM_MATHOPS_H */
