Revision 199436b9

View differences:

libavcodec/cavs.c
28 28
#include "avcodec.h"
29 29
#include "bitstream.h"
30 30
#include "golomb.h"
31
#include "mathops.h"
31 32
#include "cavs.h"
32 33
#include "cavsdata.h"
33 34

  
libavcodec/dsputil.c
32 32
#include "simple_idct.h"
33 33
#include "faandct.h"
34 34
#include "faanidct.h"
35
#include "mathops.h"
35 36
#include "h263.h"
36 37
#include "snow.h"
37 38

  
libavcodec/ffv1.c
30 30
#include "dsputil.h"
31 31
#include "rangecoder.h"
32 32
#include "golomb.h"
33
#include "mathops.h"
33 34

  
34 35
#define MAX_PLANES 4
35 36
#define CONTEXT_SIZE 32
libavcodec/h263.c
39 39
#include "mpegvideo.h"
40 40
#include "h263data.h"
41 41
#include "mpeg4data.h"
42
#include "mathops.h"
42 43

  
43 44
//#undef NDEBUG
44 45
//#include <assert.h>
libavcodec/h264.c
32 32
#include "h264data.h"
33 33
#include "h264_parser.h"
34 34
#include "golomb.h"
35
#include "mathops.h"
35 36
#include "rectangle.h"
36 37
#include "vdpau_internal.h"
37 38

  
libavcodec/huffyuv.c
31 31
#include "avcodec.h"
32 32
#include "bitstream.h"
33 33
#include "dsputil.h"
34
#include "mathops.h"
34 35

  
35 36
#define VLC_BITS 11
36 37

  
libavcodec/jpeglsdec.c
28 28
#include "avcodec.h"
29 29
#include "bitstream.h"
30 30
#include "golomb.h"
31
#include "mathops.h"
31 32
#include "mjpeg.h"
32 33
#include "mjpegdec.h"
33 34
#include "jpegls.h"
libavcodec/jpeglsenc.c
28 28
#include "avcodec.h"
29 29
#include "bitstream.h"
30 30
#include "golomb.h"
31
#include "mathops.h"
31 32
#include "dsputil.h"
32 33
#include "mjpeg.h"
33 34
#include "jpegls.h"
libavcodec/loco.c
27 27
#include "avcodec.h"
28 28
#include "bitstream.h"
29 29
#include "golomb.h"
30
#include "mathops.h"
30 31

  
31 32
enum LOCO_MODE {LOCO_UNKN=0, LOCO_CYUY2=-1, LOCO_CRGB=-2, LOCO_CRGBA=-3, LOCO_CYV12=-4,
32 33
 LOCO_YUY2=1, LOCO_UYVY=2, LOCO_RGB=3, LOCO_RGBA=4, LOCO_YV12=5};
libavcodec/mathops.h
83 83
#   define MLS16(rt, ra, rb) ((rt) -= (ra) * (rb))
84 84
#endif
85 85

  
86
/* median of 3 */
87
#ifndef mid_pred
88
#define mid_pred mid_pred
89
static inline av_const int mid_pred(int a, int b, int c)
90
{
91
#if 0
92
    int t= (a-b)&((a-b)>>31);
93
    a-=t;
94
    b+=t;
95
    b-= (b-c)&((b-c)>>31);
96
    b+= (a-b)&((a-b)>>31);
97

  
98
    return b;
99
#else
100
    if(a>b){
101
        if(c>b){
102
            if(c>a) b=a;
103
            else    b=c;
104
        }
105
    }else{
106
        if(b>c){
107
            if(c>a) b=c;
108
            else    b=a;
109
        }
110
    }
111
    return b;
112
#endif
113
}
114
#endif
115

  
86 116
#endif /* AVCODEC_MATHOPS_H */
87 117

  
libavcodec/motion_est.c
32 32
#include <limits.h>
33 33
#include "avcodec.h"
34 34
#include "dsputil.h"
35
#include "mathops.h"
35 36
#include "mpegvideo.h"
36 37

  
37 38
#undef NDEBUG
libavcodec/roqvideoenc.c
60 60
#include "roqvideo.h"
61 61
#include "bytestream.h"
62 62
#include "elbg.h"
63
#include "mathops.h"
63 64

  
64 65
#define CHROMA_BIAS 1
65 66

  
libavcodec/rv34.c
28 28
#include "dsputil.h"
29 29
#include "mpegvideo.h"
30 30
#include "golomb.h"
31
#include "mathops.h"
31 32
#include "rectangle.h"
32 33

  
33 34
#include "rv34vlc.h"
libavcodec/snow.c
23 23
#include "snow.h"
24 24

  
25 25
#include "rangecoder.h"
26
#include "mathops.h"
26 27

  
27 28
#include "mpegvideo.h"
28 29

  
libavcodec/svq1dec.c
37 37
#include "avcodec.h"
38 38
#include "dsputil.h"
39 39
#include "mpegvideo.h"
40
#include "mathops.h"
40 41

  
41 42
#include "svq1.h"
42 43

  
libavcodec/vc1.c
34 34
#include "msmpeg4data.h"
35 35
#include "unary.h"
36 36
#include "simple_idct.h"
37
#include "mathops.h"
37 38

  
38 39
#undef NDEBUG
39 40
#include <assert.h>
libavcodec/wmv2dec.c
21 21
#include "avcodec.h"
22 22
#include "dsputil.h"
23 23
#include "mpegvideo.h"
24
#include "mathops.h"
24 25
#include "msmpeg4.h"
25 26
#include "msmpeg4data.h"
26 27
#include "intrax8.h"
libavcodec/x86/dsputilenc_mmx.c
25 25
#include "libavutil/x86_cpu.h"
26 26
#include "libavcodec/dsputil.h"
27 27
#include "libavcodec/mpegvideo.h"
28
#include "libavcodec/mathops.h"
28 29
#include "dsputil_mmx.h"
29 30

  
30 31

  
libavcodec/x86/mathops.h
22 22
#ifndef AVCODEC_X86_MATHOPS_H
23 23
#define AVCODEC_X86_MATHOPS_H
24 24

  
25
#include "config.h"
26
#include "libavutil/common.h"
27

  
25 28
#define MULL(ra, rb, shift) \
26 29
        ({ int rt, dummy; __asm__ (\
27 30
            "imull %3               \n\t"\
......
40 43
     __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)ra), "g" ((int)rb));\
41 44
     rt; })
42 45

  
46
#if HAVE_CMOV
47
/* median of 3 */
48
#define mid_pred mid_pred
49
static inline av_const int mid_pred(int a, int b, int c)
50
{
51
    int i=b;
52
    __asm__ volatile(
53
        "cmp    %2, %1 \n\t"
54
        "cmovg  %1, %0 \n\t"
55
        "cmovg  %2, %1 \n\t"
56
        "cmp    %3, %1 \n\t"
57
        "cmovl  %3, %1 \n\t"
58
        "cmp    %1, %0 \n\t"
59
        "cmovg  %1, %0 \n\t"
60
        :"+&r"(i), "+&r"(a)
61
        :"r"(b), "r"(c)
62
    );
63
    return i;
64
}
65
#endif
66

  
43 67
#endif /* AVCODEC_X86_MATHOPS_H */
libavutil/common.h
151 151
    return n;
152 152
}
153 153

  
154
/* median of 3 */
155
static inline av_const int mid_pred(int a, int b, int c)
156
{
157
#if HAVE_CMOV
158
    int i=b;
159
    __asm__ volatile(
160
        "cmp    %2, %1 \n\t"
161
        "cmovg  %1, %0 \n\t"
162
        "cmovg  %2, %1 \n\t"
163
        "cmp    %3, %1 \n\t"
164
        "cmovl  %3, %1 \n\t"
165
        "cmp    %1, %0 \n\t"
166
        "cmovg  %1, %0 \n\t"
167
        :"+&r"(i), "+&r"(a)
168
        :"r"(b), "r"(c)
169
    );
170
    return i;
171
#elif 0
172
    int t= (a-b)&((a-b)>>31);
173
    a-=t;
174
    b+=t;
175
    b-= (b-c)&((b-c)>>31);
176
    b+= (a-b)&((a-b)>>31);
177

  
178
    return b;
179
#else
180
    if(a>b){
181
        if(c>b){
182
            if(c>a) b=a;
183
            else    b=c;
184
        }
185
    }else{
186
        if(b>c){
187
            if(c>a) b=c;
188
            else    b=a;
189
        }
190
    }
191
    return b;
192
#endif
193
}
194

  
195 154
/**
196 155
 * clip a signed integer value into the amin-amax range
197 156
 * @param a value to clip

Also available in: Unified diff