Developer Reference

  • 2020
  • 10/21/2020
  • Public Content
Contents

Code Examples

The document contains a number of code examples that use the Intel IPP functions. These examples show both some particular features of the primitives and how the primitives can be called. Many of these code examples output result data together with the status code and associated messages in case of an error or a warning condition.
To keep the example code simpler, special definitions of print statements are used that get output strings look exactly the way it is needed for better representation of results of different format, as well as print status codes and messages.
The code definitions given below make it possible to build the examples contained in the document by straightforward copying and pasting the example code fragments.
#define genPRINT(TYPE,FMT) \ void printf_##TYPE(const char* msg, Ipp##TYPE* buf, int len, IppStatus st ) { \ int n; \ if( st > ippStsNoErr ) \ printf( "\n-- warning %d, %s", st, ippGetStatusString( st )); \ else if( st < ippStsNoErr ) \ printf( "\n-- error %d, %s", st, ippGetStatusString( st )); \ printf("\n %s \n", msg ); \ for( n=0; n<len; ++n ) printf( FMT, buf[n] ); \ printf("\n" ); \ } genPRINT( 64f, " %f" ) genPRINT( 32f, " %f" ) genPRINT( 32u, " %u" ) genPRINT( 16s, " %d" ) genPRINT( 8u, " %u" ) #define genPRINTcplx(TYPE,FMT) \ void printf_##TYPE(const char* msg, Ipp##TYPE* buf, int len, IppStatus st ) { \ int n; \ if( st > ippStsNoErr ) \ printf( "\n-- warning %d, %s", st, ippGetStatusString( st )); \ else if( st < ippStsNoErr ) \ printf( "\n-- error %d, %s", st, ippGetStatusString( st )); \ printf(" %s ", msg ); \ for( n=0; n<len; ++n ) printf( FMT, buf[n].re, buf[n].im ); \ printf("\n" ); \ } genPRINTcplx( 64fc, " {%f,%f}" ) genPRINTcplx( 32fc, " {%f,%f}" ) genPRINTcplx( 16sc, " {%d,%d}" ) #define genPRINT_2D(TYPE,FMT) \ void printf_##TYPE##_2D(const char* msg, Ipp##TYPE* buf, IppiSize roi, int step, IppStatus st ) { \ int i, j; \ if ( st > ippStsNoErr ) { \ printf( "\n-- warning %d, %s", st, ippGetStatusString( st )); \ } else if ( st < ippStsNoErr ) { \ printf( "\n-- error %d, %s", st, ippGetStatusString( st )); \ } \ printf("\n %s \n", msg ); \ for ( i=0; i<roi.height; i++ ) { \ for ( j=0; j<roi.width; j++ ) { \ printf( FMT, ((Ipp##TYPE*)(((Ipp8u*)buf) + i*step))[j] ); \ } \ printf("\n"); \ } \ printf("\n" ); \ } genPRINT_2D( 8u, " %u" ) genPRINT_2D( 32f, " %.1f" )

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804