Revision 27af15dc

View differences:

libavutil/bswap.h
42 42
static av_always_inline uint16_t bswap_16(uint16_t x)
43 43
{
44 44
#if defined(ARCH_X86)
45
  __asm("rorw $8, %0"   :
46
        LEGACY_REGS (x) :
47
        "0" (x));
45
    __asm("rorw $8, %0"   :
46
          LEGACY_REGS (x) :
47
          "0" (x));
48 48
#elif defined(ARCH_SH4)
49
        __asm__("swap.b %0,%0":"=r"(x):"0"(x));
49
    __asm__("swap.b %0,%0":"=r"(x):"0"(x));
50 50
#else
51 51
    x= (x>>8) | (x<<8);
52 52
#endif
......
57 57
{
58 58
#if defined(ARCH_X86)
59 59
#if __CPU__ != 386
60
 __asm("bswap   %0":
61
      "=r" (x)     :
60
    __asm("bswap   %0":
61
          "=r" (x)    :
62 62
#else
63
 __asm("xchgb   %b0,%h0\n"
64
      "         rorl    $16,%0\n"
65
      "         xchgb   %b0,%h0":
66
      LEGACY_REGS (x)                :
63
    __asm("xchgb   %b0,%h0\n"
64
          "rorl    $16,%0 \n"
65
          "xchgb   %b0,%h0":
66
          LEGACY_REGS (x)  :
67 67
#endif
68
      "0" (x));
68
          "0" (x));
69 69
#elif defined(ARCH_SH4)
70
        __asm__(
71
        "swap.b %0,%0\n"
72
        "swap.w %0,%0\n"
73
        "swap.b %0,%0\n"
74
        :"=r"(x):"0"(x));
70
    __asm__("swap.b %0,%0\n"
71
            "swap.w %0,%0\n"
72
            "swap.b %0,%0\n"
73
            :"=r"(x):"0"(x));
75 74
#elif defined(ARCH_ARM)
76 75
    uint32_t t;
77
    __asm__ (
78
      "eor %1, %0, %0, ror #16 \n\t"
79
      "bic %1, %1, #0xFF0000   \n\t"
80
      "mov %0, %0, ror #8      \n\t"
81
      "eor %0, %0, %1, lsr #8  \n\t"
82
      : "+r"(x), "+r"(t));
76
    __asm__ ("eor %1, %0, %0, ror #16 \n\t"
77
             "bic %1, %1, #0xFF0000   \n\t"
78
             "mov %0, %0, ror #8      \n\t"
79
             "eor %0, %0, %1, lsr #8  \n\t"
80
             : "+r"(x), "+r"(t));
83 81
#elif defined(ARCH_BFIN)
84 82
    unsigned tmp;
85
    asm("%1 = %0 >> 8 (V);\n\t"
86
        "%0 = %0 << 8 (V);\n\t"
87
        "%0 = %0 | %1;\n\t"
88
        "%0 = PACK(%0.L, %0.H);\n\t"
83
    asm("%1 = %0 >> 8 (V);      \n\t"
84
        "%0 = %0 << 8 (V);      \n\t"
85
        "%0 = %0 | %1;          \n\t"
86
        "%0 = PACK(%0.L, %0.H); \n\t"
89 87
        : "+d"(x), "=&d"(tmp));
90 88
#else
91 89
    x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
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
libavutil/x86_cpu.h
22 22
#define FFMPEG_X86CPU_H
23 23

  
24 24
#ifdef ARCH_X86_64
25
#  define REG_a "rax"
26
#  define REG_b "rbx"
27
#  define REG_c "rcx"
28
#  define REG_d "rdx"
29
#  define REG_D "rdi"
30
#  define REG_S "rsi"
31
#  define PTR_SIZE "8"
25
#    define REG_a "rax"
26
#    define REG_b "rbx"
27
#    define REG_c "rcx"
28
#    define REG_d "rdx"
29
#    define REG_D "rdi"
30
#    define REG_S "rsi"
31
#    define PTR_SIZE "8"
32 32

  
33
#  define REG_SP "rsp"
34
#  define REG_BP "rbp"
35
#  define REGBP   rbp
36
#  define REGa    rax
37
#  define REGb    rbx
38
#  define REGc    rcx
39
#  define REGSP   rsp
33
#    define REG_SP "rsp"
34
#    define REG_BP "rbp"
35
#    define REGBP   rbp
36
#    define REGa    rax
37
#    define REGb    rbx
38
#    define REGc    rcx
39
#    define REGSP   rsp
40 40

  
41 41
#else
42 42

  
43
#  define REG_a "eax"
44
#  define REG_b "ebx"
45
#  define REG_c "ecx"
46
#  define REG_d "edx"
47
#  define REG_D "edi"
48
#  define REG_S "esi"
49
#  define PTR_SIZE "4"
43
#    define REG_a "eax"
44
#    define REG_b "ebx"
45
#    define REG_c "ecx"
46
#    define REG_d "edx"
47
#    define REG_D "edi"
48
#    define REG_S "esi"
49
#    define PTR_SIZE "4"
50 50

  
51
#  define REG_SP "esp"
52
#  define REG_BP "ebp"
53
#  define REGBP   ebp
54
#  define REGa    eax
55
#  define REGb    ebx
56
#  define REGc    ecx
57
#  define REGSP   esp
51
#    define REG_SP "esp"
52
#    define REG_BP "ebp"
53
#    define REGBP   ebp
54
#    define REGa    eax
55
#    define REGb    ebx
56
#    define REGc    ecx
57
#    define REGSP   esp
58 58
#endif
59 59

  
60 60
#if defined(ARCH_X86_64) || (defined(ARCH_X86_32) && defined(HAVE_EBX_AVAILABLE) && defined(HAVE_EBP_AVAILABLE))
61
#  define HAVE_7REGS 1
61
#    define HAVE_7REGS 1
62 62
#endif
63 63

  
64 64
#if defined(ARCH_X86_64) && defined(PIC)
65
#  define BROKEN_RELOCATIONS 1
65
#    define BROKEN_RELOCATIONS 1
66 66
#endif
67 67

  
68 68
#endif /* FFMPEG_X86CPU_H */

Also available in: Unified diff