Revision ee155011

View differences:

libavutil/internal.h
56 56
#endif
57 57

  
58 58
#ifndef INT16_MIN
59
#define INT16_MIN       (-0x7fff-1)
59
#define INT16_MIN       (-0x7fff - 1)
60 60
#endif
61 61

  
62 62
#ifndef INT16_MAX
......
64 64
#endif
65 65

  
66 66
#ifndef INT32_MIN
67
#define INT32_MIN       (-0x7fffffff-1)
67
#define INT32_MIN       (-0x7fffffff - 1)
68 68
#endif
69 69

  
70 70
#ifndef INT32_MAX
......
76 76
#endif
77 77

  
78 78
#ifndef INT64_MIN
79
#define INT64_MIN       (-0x7fffffffffffffffLL-1)
79
#define INT64_MIN       (-0x7fffffffffffffffLL - 1)
80 80
#endif
81 81

  
82 82
#ifndef INT64_MAX
......
96 96
#endif
97 97

  
98 98
#ifndef offsetof
99
#    define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F))
99
#    define offsetof(T, F) ((unsigned int)((char *)&((T *)0)->F))
100 100
#endif
101 101

  
102 102
/* Use to export labels from asm. */
......
129 129
#if ARCH_X86
130 130
#    define FASTDIV(a,b) \
131 131
    ({\
132
        int ret,dmy;\
132
        int ret, dmy;\
133 133
        __asm__ volatile(\
134 134
            "mull %3"\
135
            :"=d"(ret),"=a"(dmy)\
136
            :"1"(a),"g"(ff_inverse[b])\
135
            :"=d"(ret), "=a"(dmy)\
136
            :"1"(a), "g"(ff_inverse[b])\
137 137
            );\
138 138
        ret;\
139 139
    })
......
152 152
static inline av_const int FASTDIV(int a, int b)
153 153
{
154 154
    int r, t;
155
    __asm__ volatile ("umull %1, %0, %2, %3"
156
                      : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b]));
155
    __asm__ volatile("umull %1, %0, %2, %3"
156
                     : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b]));
157 157
    return r;
158 158
}
159 159
#elif CONFIG_FASTDIV
160
#    define FASTDIV(a,b)   ((uint32_t)((((uint64_t)a)*ff_inverse[b])>>32))
160
#    define FASTDIV(a,b)   ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
161 161
#else
162
#    define FASTDIV(a,b)   ((a)/(b))
162
#    define FASTDIV(a,b)   ((a) / (b))
163 163
#endif
164 164

  
165 165
extern const uint8_t ff_sqrt_tab[256];
......
168 168
{
169 169
    unsigned int b;
170 170

  
171
    if(a<255) return (ff_sqrt_tab[a+1]-1)>>4;
172
    else if(a<(1<<12)) b= ff_sqrt_tab[a>>4 ]>>2;
171
    if (a < 255) return (ff_sqrt_tab[a + 1] - 1) >> 4;
172
    else if (a < (1 << 12)) b = ff_sqrt_tab[a >> 4] >> 2;
173 173
#if !CONFIG_SMALL
174
    else if(a<(1<<14)) b= ff_sqrt_tab[a>>6 ]>>1;
175
    else if(a<(1<<16)) b= ff_sqrt_tab[a>>8 ]   ;
174
    else if (a < (1 << 14)) b = ff_sqrt_tab[a >> 6] >> 1;
175
    else if (a < (1 << 16)) b = ff_sqrt_tab[a >> 8]   ;
176 176
#endif
177
    else{
178
        int s= av_log2_16bit(a>>16)>>1;
179
        unsigned int c= a>>(s+2);
180
        b= ff_sqrt_tab[c>>(s+8)];
181
        b= FASTDIV(c,b) + (b<<s);
177
    else {
178
        int s = av_log2_16bit(a >> 16) >> 1;
179
        unsigned int c = a >> (s + 2);
180
        b = ff_sqrt_tab[c >> (s + 8)];
181
        b = FASTDIV(c,b) + (b << s);
182 182
    }
183 183

  
184
    return b - (a<b*b);
184
    return b - (a < b * b);
185 185
}
186 186

  
187 187
#if ARCH_X86
......
194 194
            );
195 195
#else
196 196
#define MASK_ABS(mask, level)\
197
            mask= level>>31;\
198
            level= (level^mask)-mask;
197
            mask  = level >> 31;\
198
            level = (level ^ mask) - mask;
199 199
#endif
200 200

  
201 201
#if HAVE_CMOV
202
#define COPY3_IF_LT(x,y,a,b,c,d)\
203
__asm__ volatile (\
204
    "cmpl %0, %3        \n\t"\
202
#define COPY3_IF_LT(x, y, a, b, c, d)\
203
__asm__ volatile(\
204
    "cmpl  %0, %3       \n\t"\
205 205
    "cmovl %3, %0       \n\t"\
206 206
    "cmovl %4, %1       \n\t"\
207 207
    "cmovl %5, %2       \n\t"\
......
209 209
    : "r" (y), "r" (b), "r" (d)\
210 210
);
211 211
#else
212
#define COPY3_IF_LT(x,y,a,b,c,d)\
213
if((y)<(x)){\
214
     (x)=(y);\
215
     (a)=(b);\
216
     (c)=(d);\
212
#define COPY3_IF_LT(x, y, a, b, c, d)\
213
if ((y) < (x)) {\
214
    (x) = (y);\
215
    (a) = (b);\
216
    (c) = (d);\
217 217
}
218 218
#endif
219 219

  
......
251 251

  
252 252
#define CHECKED_ALLOC(p, size)\
253 253
{\
254
    p= av_malloc(size);\
255
    if(p==NULL && (size)!=0){\
254
    p = av_malloc(size);\
255
    if (p == NULL && (size) != 0) {\
256 256
        av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory.");\
257 257
        goto fail;\
258 258
    }\
......
260 260

  
261 261
#define CHECKED_ALLOCZ(p, size)\
262 262
{\
263
    p= av_mallocz(size);\
264
    if(p==NULL && (size)!=0){\
263
    p = av_mallocz(size);\
264
    if (p == NULL && (size) != 0) {\
265 265
        av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory.");\
266 266
        goto fail;\
267 267
    }\

Also available in: Unified diff