Click here to Skip to main content
15,895,777 members
Articles / High Performance Computing / Vectorization

SSE2 Vectorization of Alphablend Code

Rate me:
Please Sign up or sign in to vote.
4.97/5 (20 votes)
12 Apr 2016Ms-PL9 min read 77.2K   1.2K   56  
Using SSE2 to speed up alphablending.
/*
SIMD class to detect presence of SIMD version 1.4.0

Copyright (c) 2010 Wong Shao Voon
1.1.0 - Contains the 3DNow, 3DNow+ and MMX+ detection bug fix by Leonardo Tazzini
1.2.0 - Added AMD's SSE4a and SSE5
1.3.0 - Use 2 unsigned shorts to store SIMD info, instead of 1 boolean for each SIMD type.
1.4.0 - Added the detection of Intel AES instructions

The Code Project Open License (CPOL)
http://www.codeproject.com/info/cpol10.aspx
*/


// Get SIMD information from CPU.

#ifndef __SIMD_H__
#define __SIMD_H__

class SIMD
{
public:
	SIMD();
// Intel SIMDs
	bool HasMMX();
	bool HasSSE();
	bool HasSSE2();
	bool HasSSE3();
	bool HasSSSE3();
	bool HasSSE41();
	bool HasSSE42();
	bool HasAES();
	bool HasAVX();
	bool HasHyperThreading();
// AMD SIMDs
	bool HasMMXplus();
	bool Has3Dnow();
	bool Has3DnowExt();
	bool HasSSE4a();
	bool HasSSE5();

private:
	void InitParams();
	unsigned short m_nIntelSIMDs;
	unsigned short m_nAMD_SIMDs;
};

#endif // __SIMD_H__

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer (Senior)
Singapore Singapore
Shao Voon is from Singapore. His interest lies primarily in computer graphics, software optimization, concurrency, security, and Agile methodologies.

In recent years, he shifted focus to software safety research. His hobby is writing a free C++ DirectX photo slideshow application which can be viewed here.

Comments and Discussions