[Libav-user] [libav-user] Using MSVC++ intrinsics

wl2776 wl2776 at gmail.com
Wed Jan 18 15:21:37 CET 2012

I've found that when a Windows application, developed with MS Visual Studio,
uses bit-reading macros like AV_RB16, AV_RB32, etc, they are expanded to
conventional C bit operations ( >> | << &).

Inline functions av_bswapNN (where NN are numbers) are among them.

I've added some code to the libavutil/bswap.h which checks for _MSC_VER
macro and in positive case calls MSVC intrincics _byteswap_ushort,
_byteswap_ulong etc, instead of bit operations.
These intrinsics generate processor instructions, like bswap, instead of bit

I wonder if it would give any benefit?

My application uses these macros to get timestamps from RTP headers and
sometimes - to parse video stream. Therefore the affect is minimal. I
could'nt see any difference in the processor load, while observed the
application in the Process Explorer.

View this message in context: http://libav-users.943685.n4.nabble.com/libav-user-Using-MSVC-intrinsics-tp4306767p4306767.html
Sent from the libav-users mailing list archive at Nabble.com.

More information about the Libav-user mailing list