Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VSs > VSs__H264__App
diff libavcodec/ppc/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/ppc/mathops.h Tue Sep 25 15:55:33 2012 +0200 1.3 @@ -0,0 +1,79 @@ 1.4 +/* 1.5 + * simple math operations 1.6 + * Copyright (c) 2001, 2002 Fabrice Bellard 1.7 + * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al 1.8 + * 1.9 + * This file is part of FFmpeg. 1.10 + * 1.11 + * FFmpeg is free software; you can redistribute it and/or 1.12 + * modify it under the terms of the GNU Lesser General Public 1.13 + * License as published by the Free Software Foundation; either 1.14 + * version 2.1 of the License, or (at your option) any later version. 1.15 + * 1.16 + * FFmpeg is distributed in the hope that it will be useful, 1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1.19 + * Lesser General Public License for more details. 1.20 + * 1.21 + * You should have received a copy of the GNU Lesser General Public 1.22 + * License along with FFmpeg; if not, write to the Free Software 1.23 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 1.24 + */ 1.25 + 1.26 +#ifndef AVCODEC_PPC_MATHOPS_H 1.27 +#define AVCODEC_PPC_MATHOPS_H 1.28 + 1.29 +#include <stdint.h> 1.30 +#include "config.h" 1.31 +#include "libavutil/common.h" 1.32 + 1.33 +#if HAVE_PPC4XX 1.34 +/* signed 16x16 -> 32 multiply add accumulate */ 1.35 +#define MAC16(rt, ra, rb) \ 1.36 + __asm__ ("maclhw %0, %2, %3" : "=r" (rt) : "0" (rt), "r" (ra), "r" (rb)); 1.37 + 1.38 +/* signed 16x16 -> 32 multiply */ 1.39 +#define MUL16(ra, rb) \ 1.40 + ({ int __rt; \ 1.41 + __asm__ ("mullhw %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); \ 1.42 + __rt; }) 1.43 +#endif 1.44 + 1.45 +#define MULH MULH 1.46 +static inline av_const int MULH(int a, int b){ 1.47 + int r; 1.48 + __asm__ ("mulhw %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); 1.49 + return r; 1.50 +} 1.51 + 1.52 +#if !ARCH_PPC64 1.53 +static inline av_const int64_t MAC64(int64_t d, int a, int b) 1.54 +{ 1.55 + union { uint64_t x; unsigned hl[2]; } x = { d }; 1.56 + int h, l; 1.57 + __asm__ ("mullw %3, %4, %5 \n\t" 1.58 + "mulhw %2, %4, %5 \n\t" 1.59 + "addc %1, %1, %3 \n\t" 1.60 + "adde %0, %0, %2 \n\t" 1.61 + : "+r"(x.hl[0]), "+r"(x.hl[1]), "=&r"(h), "=&r"(l) 1.62 + : "r"(a), "r"(b)); 1.63 + return x.x; 1.64 +} 1.65 +#define MAC64(d, a, b) ((d) = MAC64(d, a, b)) 1.66 + 1.67 +static inline av_const int64_t MLS64(int64_t d, int a, int b) 1.68 +{ 1.69 + union { uint64_t x; unsigned hl[2]; } x = { d }; 1.70 + int h, l; 1.71 + __asm__ ("mullw %3, %4, %5 \n\t" 1.72 + "mulhw %2, %4, %5 \n\t" 1.73 + "subfc %1, %3, %1 \n\t" 1.74 + "subfe %0, %2, %0 \n\t" 1.75 + : "+r"(x.hl[0]), "+r"(x.hl[1]), "=&r"(h), "=&r"(l) 1.76 + : "r"(a), "r"(b)); 1.77 + return x.x; 1.78 +} 1.79 +#define MLS64(d, a, b) ((d) = MLS64(d, a, b)) 1.80 +#endif 1.81 + 1.82 +#endif /* AVCODEC_PPC_MATHOPS_H */
