[libav-user] Using MSVC++ intrinsics

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[libav-user] Using MSVC++ intrinsics

wl2776
Administrator
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 operations.
http://msdn.microsoft.com/en-us/library/a3140177(v=vs.100).aspx

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.
Reply | Threaded
Open this post in threaded view
|

Re: [libav-user] Using MSVC++ intrinsics

wl2776
Administrator
wl2776 wrote
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.
The difference exists, it is about 0.5% of the CPU load, as the Process Explorer shows it (such a great value :) ).

When original FFmpeg code is used, the CPU load is lower, compared to using MSVC intrinsics.
Reply | Threaded
Open this post in threaded view
|

Re: [libav-user] Using MSVC++ intrinsics

Carl Eugen Hoyos
In reply to this post by wl2776
wl2776 <wl2776@...> writes:

> 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.

I suspect this belongs into libavutil/x86/bswap.h and please send your (clean!)
patches to ffmpeg-devel.

Carl Eugen

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user