devxlogo

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.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  Five Early Architecture Decisions That Quietly Get Expensive

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.