在vs2008下使用ffmpeg(2):readtime的问题

 

快乐虾

http://blog.csdn.net/lights_joy/

[email protected]

   

本文适用于

ffmpeg-checkout-20081210

vs2008

Windows XP

 

欢迎转载,但请保留作者信息

 

 

libavutil/common.h(330)文件中定义了一个readtime函数:

static inline uint64_t read_time(void)

{

    uint32_t a, d;

    __asm__ volatile("rdtsc/n/t"

                 : "=a" (a), "=d" (d));

    return ((uint64_t)d << 32) + a;

}

因为它使用的是gcc语法的嵌入汇编,故此需要进行修改。

Vs2008提供了一个叫__rdtsc()的函数,MSDN这样解释:

Generates the rdtsc instruction, which returns the processor time stamp. The processor time stamp records the number of clock cycles since the last reset.

unsigned __int64 __rdtsc();

它的返回值:

A 64-bit unsigned integer representing a tick count.

因此这个函数可以修改为:

#include <intrin.h>

#pragma intrinsic(__rdtsc)

static inline uint64_t read_time(void)

{

    return __rdtsc();

}

 

 

参考资料

vs2008下使用ffmpeg1):inttypes.h的问题( 2008-12-11 )

你可能感兴趣的:(windows,汇编,XP,gcc,Integer)