Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Introduction to MMX Programming

, 25 Jul 2013
An article shows an example of image processing using the Intel MMX™ technology
#pragma once


#include <emmintrin.h>		// MMX, SSE, SSE2 intrinsic support


// Image processing operations with 32 bits per pixel RGB image
//
// For each image processing operation there are 3 functions:
// C++, C++ with MMX, Assembly with MMX
class CImg32Operations
{
public:
    CImg32Operations(void);
    ~CImg32Operations(void);

    // Invert image
    typedef void (CImg32Operations:: *INVERT_IMAGE)(BYTE* pSource, BYTE* pDest, int nNumberOfPixels);

    void InvertImageCPlusPlus(BYTE* pSource, BYTE* pDest, int nNumberOfPixels);
    void InvertImageC_MMX(BYTE* pSource, BYTE* pDest, int nNumberOfPixels);
    void InvertImageAssembly_MMX(BYTE* pSource, BYTE* pDest, int nNumberOfPixels);


    // Change colors
    typedef void (CImg32Operations::* COMPUTE_COLORS)(BYTE* pSource, BYTE* pDest, int nNumberOfPixels, 
        float fRedCoefficient, float fGreenCoefficient, float fBlueCoefficient);

    void ColorsCPlusPlus(BYTE* pSource, BYTE* pDest, int nNumberOfPixels, 
        float fRedCoefficient, float fGreenCoefficient, float fBlueCoefficient);
    void ColorsC_MMX(BYTE* pSource, BYTE* pDest, int nNumberOfPixels, 
        float fRedCoefficient, float fGreenCoefficient, float fBlueCoefficient);
    void ColorsAssembly_MMX(BYTE* pSource, BYTE* pDest, int nNumberOfPixels, 
        float fRedCoefficient, float fGreenCoefficient, float fBlueCoefficient);

protected:
    __m64 Get_m64(__int64 n);


};

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 Code Project Open License (CPOL)

About the Author

Alex Fr
Software Developer
Israel Israel
No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 25 Jul 2013
Article Copyright 2003 by Alex Fr
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid