Revision 199436b9 libavutil/common.h

View differences:

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