summaryrefslogtreecommitdiff
path: root/apps/codecs/libwmapro/mathops.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libwmapro/mathops.h')
-rw-r--r--apps/codecs/libwmapro/mathops.h136
1 files changed, 0 insertions, 136 deletions
diff --git a/apps/codecs/libwmapro/mathops.h b/apps/codecs/libwmapro/mathops.h
deleted file mode 100644
index f6555dda21..0000000000
--- a/apps/codecs/libwmapro/mathops.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * simple math operations
3 * Copyright (c) 2001, 2002 Fabrice Bellard
4 * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22#ifndef AVCODEC_MATHOPS_H
23#define AVCODEC_MATHOPS_H
24
25#include "libavutil/common.h"
26
27/* generic implementation */
28
29#ifndef MULL
30# define MULL(a,b,s) (((int64_t)(a) * (int64_t)(b)) >> (s))
31#endif
32
33#ifndef MULH
34//gcc 3.4 creates an incredibly bloated mess out of this
35//# define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32)
36
37static av_always_inline int MULH(int a, int b){
38 return ((int64_t)(a) * (int64_t)(b))>>32;
39}
40#endif
41
42#ifndef UMULH
43static av_always_inline unsigned UMULH(unsigned a, unsigned b){
44 return ((uint64_t)(a) * (uint64_t)(b))>>32;
45}
46#endif
47
48#ifndef MUL64
49# define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
50#endif
51
52#ifndef MAC64
53# define MAC64(d, a, b) ((d) += MUL64(a, b))
54#endif
55
56#ifndef MLS64
57# define MLS64(d, a, b) ((d) -= MUL64(a, b))
58#endif
59
60/* signed 16x16 -> 32 multiply add accumulate */
61#ifndef MAC16
62# define MAC16(rt, ra, rb) rt += (ra) * (rb)
63#endif
64
65/* signed 16x16 -> 32 multiply */
66#ifndef MUL16
67# define MUL16(ra, rb) ((ra) * (rb))
68#endif
69
70#ifndef MLS16
71# define MLS16(rt, ra, rb) ((rt) -= (ra) * (rb))
72#endif
73
74/* median of 3 */
75#ifndef mid_pred
76#define mid_pred mid_pred
77static inline av_const int mid_pred(int a, int b, int c)
78{
79#if 0
80 int t= (a-b)&((a-b)>>31);
81 a-=t;
82 b+=t;
83 b-= (b-c)&((b-c)>>31);
84 b+= (a-b)&((a-b)>>31);
85
86 return b;
87#else
88 if(a>b){
89 if(c>b){
90 if(c>a) b=a;
91 else b=c;
92 }
93 }else{
94 if(b>c){
95 if(c>a) b=c;
96 else b=a;
97 }
98 }
99 return b;
100#endif
101}
102#endif
103
104#ifndef sign_extend
105static inline av_const int sign_extend(int val, unsigned bits)
106{
107 return (val << (INT_BIT - bits)) >> (INT_BIT - bits);
108}
109#endif
110
111#ifndef zero_extend
112static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
113{
114 return (val << (INT_BIT - bits)) >> (INT_BIT - bits);
115}
116#endif
117
118#ifndef COPY3_IF_LT
119#define COPY3_IF_LT(x, y, a, b, c, d)\
120if ((y) < (x)) {\
121 (x) = (y);\
122 (a) = (b);\
123 (c) = (d);\
124}
125#endif
126
127#ifndef NEG_SSR32
128# define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s)))
129#endif
130
131#ifndef NEG_USR32
132# define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s)))
133#endif
134
135#endif /* AVCODEC_MATHOPS_H */
136