devxlogo

MMX code in C++

MMX code in C++

Question:
I am involved in a project the aim of which is to demonstrate the effectiveness of MMX for image manipulation. For this project I need to write some MMX code in C++ (MS Visual C++ 5) to simulate how MMX could improve the performance of filters such as Blur, Gaussian Blur, and Unsharp.

I am unsure where to start and would be very grateful for any example source code or advice.

Answer:
For the most part, the actual machine instructions generated by C and C++ code are determined by the compiler. You have no control over this from your C and C++ language statements. You would need a compiler that had an option to enable these instructions. (They would not be enabled by default, because any code compiled that way would not run on older Pentiums.) Even then, it may not implement them in a way that would demonstrate what your program is trying to show.

The only other hope is if you can use inline assembler. VC++ 5 supports inline assembler, but I’m not sure it supports MMX instructions. I’m also wondering if you are prepared to write your demo using inline assembler.

See also  How to Avoid Money Transfer Scams  
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist