Revision 27af15dc libavutil/common.h

View differences:

libavutil/common.h
172 172
 */
173 173
static inline int av_clip(int a, int amin, int amax)
174 174
{
175
    if (a < amin)      return amin;
175
    if      (a < amin) return amin;
176 176
    else if (a > amax) return amax;
177 177
    else               return a;
178 178
}
......
285 285
#if defined(ARCH_X86_64)
286 286
static inline uint64_t read_time(void)
287 287
{
288
        uint64_t a, d;
289
        asm volatile(   "rdtsc\n\t"
290
                : "=a" (a), "=d" (d)
291
        );
292
        return (d << 32) | (a & 0xffffffff);
288
    uint64_t a, d;
289
    asm volatile("rdtsc\n\t"
290
                 : "=a" (a), "=d" (d));
291
    return (d << 32) | (a & 0xffffffff);
293 292
}
294 293
#elif defined(ARCH_X86_32)
295 294
static inline long long read_time(void)
296 295
{
297
        long long l;
298
        asm volatile(   "rdtsc\n\t"
299
                : "=A" (l)
300
        );
301
        return l;
296
    long long l;
297
    asm volatile("rdtsc\n\t"
298
                 : "=A" (l));
299
    return l;
302 300
}
303 301
#elif ARCH_BFIN
304 302
static inline uint64_t read_time(void)
......
345 343
#define STOP_TIMER(id) \
346 344
tend= AV_READ_TIME();\
347 345
{\
348
  static uint64_t tsum=0;\
349
  static int tcount=0;\
350
  static int tskip_count=0;\
351
  if(tcount<2 || tend - tstart < FFMAX(8*tsum/tcount, 2000)){\
352
      tsum+= tend - tstart;\
353
      tcount++;\
354
  }else\
355
      tskip_count++;\
356
  if(((tcount+tskip_count)&(tcount+tskip_count-1))==0){\
357
      av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" dezicycles in %s, %d runs, %d skips\n", tsum*10/tcount, id, tcount, tskip_count);\
358
  }\
346
    static uint64_t tsum=0;\
347
    static int tcount=0;\
348
    static int tskip_count=0;\
349
    if(tcount<2 || tend - tstart < FFMAX(8*tsum/tcount, 2000)){\
350
        tsum+= tend - tstart;\
351
        tcount++;\
352
    }else\
353
        tskip_count++;\
354
    if(((tcount+tskip_count)&(tcount+tskip_count-1))==0){\
355
        av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" dezicycles in %s, %d runs, %d skips\n",\
356
               tsum*10/tcount, id, tcount, tskip_count);\
357
    }\
359 358
}
360 359
#else
361 360
#define START_TIMER

Also available in: Unified diff