diff libavcodec/cell/mathops_spu.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/cell/mathops_spu.h	Tue Sep 25 15:55:33 2012 +0200
     1.3 @@ -0,0 +1,137 @@
     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 +#ifndef AVCODEC_MATHOPS_H
    1.26 +#define AVCODEC_MATHOPS_H
    1.27 +
    1.28 +// #include "libavutil/common.h"
    1.29 +// #include "libavutil/internal.h"
    1.30 +// 
    1.31 +// /* generic implementation */
    1.32 +// 
    1.33 +// #ifndef MULL
    1.34 +// #   define MULL(a,b,s) (((int64_t)(a) * (int64_t)(b)) >> (s))
    1.35 +// #endif
    1.36 +// 
    1.37 +// #ifndef MULH
    1.38 +// //gcc 3.4 creates an incredibly bloated mess out of this
    1.39 +// //#    define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32)
    1.40 +// 
    1.41 +// static av_always_inline int MULH(int a, int b){
    1.42 +//     return ((int64_t)(a) * (int64_t)(b))>>32;
    1.43 +// }
    1.44 +// #endif
    1.45 +// 
    1.46 +// #ifndef UMULH
    1.47 +// static av_always_inline unsigned UMULH(unsigned a, unsigned b){
    1.48 +//     return ((uint64_t)(a) * (uint64_t)(b))>>32;
    1.49 +// }
    1.50 +// #endif
    1.51 +// 
    1.52 +// #ifndef MUL64
    1.53 +// #   define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
    1.54 +// #endif
    1.55 +// 
    1.56 +// #ifndef MAC64
    1.57 +// #   define MAC64(d, a, b) ((d) += MUL64(a, b))
    1.58 +// #endif
    1.59 +// 
    1.60 +// #ifndef MLS64
    1.61 +// #   define MLS64(d, a, b) ((d) -= MUL64(a, b))
    1.62 +// #endif
    1.63 +// 
    1.64 +// /* signed 16x16 -> 32 multiply add accumulate */
    1.65 +// #ifndef MAC16
    1.66 +// #   define MAC16(rt, ra, rb) rt += (ra) * (rb)
    1.67 +// #endif
    1.68 +// 
    1.69 +// /* signed 16x16 -> 32 multiply */
    1.70 +// #ifndef MUL16
    1.71 +// #   define MUL16(ra, rb) ((ra) * (rb))
    1.72 +// #endif
    1.73 +// 
    1.74 +// #ifndef MLS16
    1.75 +// #   define MLS16(rt, ra, rb) ((rt) -= (ra) * (rb))
    1.76 +// #endif
    1.77 +
    1.78 +/* median of 3 */
    1.79 +#ifndef mid_pred
    1.80 +#define mid_pred mid_pred
    1.81 +static inline av_const int mid_pred(int a, int b, int c)
    1.82 +{
    1.83 +#if 0
    1.84 +    int t= (a-b)&((a-b)>>31);
    1.85 +    a-=t;
    1.86 +    b+=t;
    1.87 +    b-= (b-c)&((b-c)>>31);
    1.88 +    b+= (a-b)&((a-b)>>31);
    1.89 +
    1.90 +    return b;
    1.91 +#else
    1.92 +    if(a>b){
    1.93 +        if(c>b){
    1.94 +            if(c>a) b=a;
    1.95 +            else    b=c;
    1.96 +        }
    1.97 +    }else{
    1.98 +        if(b>c){
    1.99 +            if(c>a) b=c;
   1.100 +            else    b=a;
   1.101 +        }
   1.102 +    }
   1.103 +    return b;
   1.104 +#endif
   1.105 +}
   1.106 +#endif
   1.107 +
   1.108 +// #ifndef sign_extend
   1.109 +// static inline av_const int sign_extend(int val, unsigned bits)
   1.110 +// {
   1.111 +//     return (val << (INT_BIT - bits)) >> (INT_BIT - bits);
   1.112 +// }
   1.113 +// #endif
   1.114 +// 
   1.115 +// #ifndef zero_extend
   1.116 +// static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
   1.117 +// {
   1.118 +//     return (val << (INT_BIT - bits)) >> (INT_BIT - bits);
   1.119 +// }
   1.120 +// #endif
   1.121 +// 
   1.122 +// #ifndef COPY3_IF_LT
   1.123 +// #define COPY3_IF_LT(x, y, a, b, c, d)\
   1.124 +// if ((y) < (x)) {\
   1.125 +//     (x) = (y);\
   1.126 +//     (a) = (b);\
   1.127 +//     (c) = (d);\
   1.128 +// }
   1.129 +// #endif
   1.130 +// 
   1.131 +// #ifndef NEG_SSR32
   1.132 +// #   define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s)))
   1.133 +// #endif
   1.134 +// 
   1.135 +// #ifndef NEG_USR32
   1.136 +// #   define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s)))
   1.137 +// #endif
   1.138 +
   1.139 +#endif /* AVCODEC_MATHOPS_H */
   1.140 +