IPP is a good thing. The functions in IPP are excellent and complete. I hope you can make good use of them. Because IPP currently has few Chinese documents, we can only find it by ourselves. The following describes the basic usage of IPP in VC2005.
Assume that your IPP is installed in the "D:/Intel/IPP" directory.
First, configure the VC2005 environment. Open VC2005, click "tools-Options" in the menu bar, and find "project and solution-VC ++ directory" on the left ", add "D:/Intel/IPP/bin" to the "executable file" directory and add "D: /Intel/IPP/include, add "D:/Intel/IPP/stublib" and "D:/Intel/IPP/lib" to the "library file", and click OK.
Then, you can use IPP in the project. This project mainly uses IPP's image processing functions. The specific descriptions of these functions can be found in the "D:/Intel/IPP/doc/ippiman.pdf" file. The name of a function is also quite regular, for example, a copied function, that is, "4. the Copy function in Image Data Exchange and Initialization Functions. For different images, different Copy Functions should be used. The name is as follows: the prefix is "ippi ", all image processing functions start with "ippi", followed by the function name "Copy", and are connected to "ippiCopy "; then an underline is connected to the corresponding pattern "ippiCopy _ <mod>", and the "<mod>" is replaced with the corresponding color pattern, such as "8u_C1R ", "C1R" indicates that the image has only one color channel, while "8u" indicates that the color data type of each pixel is 8-bit unsigned, that is to say, this image represents a pixel in bytes. We usually use "8u_C3R", which is three color channels. The data type of each channel is 8-bit unsigned. However, the display usually requires four channels, that is, in addition to RGB, there is also an Alpha channel (transparency), because our computers are generally set to 32-bit color depth. In this case, we need to convert the 24-bit image into a 32-bit image, and use the "ippiCopy_8u_C3AC4R" function. "8u_C3" indicates that the original image is 8-bit unsigned data and 3 channels, while "AC4R" indicates that the target image is a 4-channel image with an Alpha channel. Let's take a look at the complete form of the function:
IppStatus ippiCopy_8u_C3AC4R (const Ipp <datatype> * pSrc, int srcStep,
Ipp <datatype> * pDst, int dstStep, IppiSize roiSize );
The returned value is ippstatus. You only need to check the description of the returned value. It is actually an integer value, but the IPP assigns a name to replace these values with macros for convenience, I will not go into details here. Let's take a look at the function parameters. Both psrc and pdst come from pointers. psrc is the Image Data Pointer of the source image, while pdst points to the data of the target image. The datatype in the previous IPP <datatype> * must be replaced with the corresponding data type code. For example, the 8-bit unsigned number is "ipp8u, let's take a look at the data types section in function naming in the previous manual. Srcstep and dststep refer to the row scan width, that is, the number of bytes occupied by an image row. this parameter is used in many image processing functions. For example, for an 8u_c3r image of 320*240, its row scan width is 320*(3*8)/8 = 960. It should be noted that the line scan width must be an integer multiple of 4, that is, the DWORD is aligned. If the line scan width does not meet the integer multiple of 4, it should be zero-aligned. The above formula cannot apply to all images, but you can use the following code to correctly calculate the row scan width:
(Width * channels * 8) + 31)> 5) <2
Width indicates the image width, and channels indicates the number of channels.
The final roisize is actually an ippisize struct, which is defined as follows:
Typedef struct {
Int width;
Int height;
} Ippisize;
It is obviously the image width and height. Basic types such as struct are described in detail in function naming in the manual.
Which header file does this function need to contain? We can see that The "the function ippiCopy is declared in The ippi. h file." is good, # include "ippi. h. However, in this case, the linker will tell you that ippiCopy_8u_C3AC4R is an external symbol that cannot be parsed. This is because we haven't linked the library file yet. The library file corresponding to ippi. h is ippi. lib. Click "project -- xxx properties -- configuration properties -- linker -- input" in the menu, and fill in ippi. lib in "additional dependencies" on the right. If multiple databases need to be used, separate them with carriage return. In addition, to be compatible with VC6.0 programs, select "Multi-Byte Character Set" in "project -- xxx properties -- configuration properties -- General ".
In "project -- xxx properties -- configuration properties -- debugging", the "working directory" should be set to "D:/Intel/IPP/bin ", in this way, the program can call the dynamic link library of IPP, or copy the required dll file to your Debug or Release folder.
Now our program can be compiled and run. I feel that IPP is relatively simple to use, and the instructions in this document are also very comprehensive, that is, there are few examples. It is easier to get started with many practical practices. Or that sentence, while learning and using, deep dive, high efficiency.
This article from the CSDN blog, reproduced please indicate the source: http://blog.csdn.net/comeonface/archive/2008/03/05/2148486.aspx