Ipp - User Guide 8.0 U1
Ipp - User Guide 8.0 U1
Primitives
User's Guide
328847-002US
Legal Information
Legal Information
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE,
EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS
GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR
SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR
IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR
WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT
OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or
indirectly, in personal injury or death. SHOULD YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH
MISSION CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES,
SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH,
HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSES AND REASONABLE ATTORNEYS' FEES
ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR
DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR
ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL
PRODUCT OR ANY OF ITS PARTS.
Intel may make changes to specifications and product descriptions at any time, without notice. Designers
must not rely on the absence or characteristics of any features or instructions marked "reserved" or
"undefined". Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts
or incompatibilities arising from future changes to them. The information here is subject to change without
notice. Do not finalize a design with this information.
The products described in this document may contain design defects or errors known as errata which may
cause the product to deviate from published specifications. Current characterized errata are available on
request. Contact your local Intel sales office or your distributor to obtain the latest specifications and before
placing your product order. Copies of documents which have an order number and are referenced in this
document, or other Intel literature, may be obtained by calling 1-800-548-4725, or go to: http://
www.intel.com/design/literature.htm
Software and workloads used in performance tests may have been optimized for performance only on Intel
microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using specific
computer systems, components, software, operations and functions. Any change to any of those factors may
cause the results to vary. You should consult other information and performance tests to assist you in fully
evaluating your contemplated purchases, including the performance of that product when combined with
other products.
BlueMoon, BunnyPeople, Celeron, Celeron Inside, Centrino, Centrino Inside, Cilk, Core Inside, E-GOLD,
Flexpipe, i960, Intel, the Intel logo, Intel AppUp, Intel Atom, Intel Atom Inside, Intel CoFluent, Intel Core,
Intel Inside, Intel Insider, the Intel Inside logo, Intel NetBurst, Intel NetMerge, Intel NetStructure, Intel
SingleDriver, Intel SpeedStep, Intel Sponsors of Tomorrow., the Intel Sponsors of Tomorrow. logo, Intel
StrataFlash, Intel vPro, Intel Xeon Phi, Intel XScale, InTru, the InTru logo, the InTru Inside logo, InTru
soundmark, Itanium, Itanium Inside, MCS, MMX, Pentium, Pentium Inside, Puma, skoool, the skoool logo,
SMARTi, Sound Mark, Stay With It, The Creators Project, The Journey Inside, Thunderbolt, Ultrabook, vPro
Inside, VTune, Xeon, Xeon Inside, X-GOLD, XMM, X-PMU and XPOSYS are trademarks of Intel Corporation in
the U.S. and/or other countries.
*Other names and brands may be claimed as the property of others.
Java is a registered trademark of Oracle and/or its affiliates.
Copyright © 2013, Intel Corporation. All rights reserved.
                                                                                                              3
Intel® Integrated Performance Primitives User's Guide
  4
Introducing the Intel® Integrated
Performance Primitives
Use the Intel® Integrated Performance Primitives (Intel® IPP) to improve performance of multimedia,
enterprise data, embedded, communications, and scientific/technical applications. The primitives are a
common interface for thousands of commonly used algorithms. Using these primitives enables you to
automatically tune your application to many generations of processors without changes in your application.
Intel IPP library provides high performance implementations of signal, image, and data processing functions
for several hardware/instruction set generations. Code written with Intel IPP automatically takes advantage
of available CPU capabilities. This can provide tremendous development and maintenance savings. You can
write programs with one optimized execution path, avoiding the alternative of multiple paths (Intel®
Streaming SIMD Extensions 2, Supplemental Streaming SIMD Extensions 3, Intel® Advanced Vector
Extensions , etc.) to achieve optimal performance across multiple generations of processors.
Intel IPP provides a set of examples to help you get started with common operations like resize and fast
Fourier transform (FFT).
         NOTE
         The high-level multimedia API samples from previous versions of Intel IPP are no longer in active
         development.
The goal of the Intel IPP software is to provide algorithmic building blocks with
•    a simple "primitive" C interface and data structures to enhance usability and portability
•    faster time-to-market
•    scalability with Intel® hardware
Optimization Notice
    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
                                                                                                             5
Intel® Integrated Performance Primitives User's Guide
  6
What's New
This User's Guide documents the Intel® Integrated Performance Primitives (Intel® IPP) 8.0 Update 1 release.
Multiple fixes have been made in the document.
                                                                                                      7
Intel® Integrated Performance Primitives User's Guide
  8
Getting Help and Support
If you did not register your Intel® software product during installation, please do so now at the Intel®
Software Development Products Registration Center. Registration entitles you to free technical support,
product updates, and upgrades for the duration of the support term.
For general information about Intel technical support, product updates, user forums, FAQs, tips and tricks
and other support questions, please visit http://www.intel.com/software/products/support/.
      NOTE
      If your distributor provides technical support for this product, please contact them rather than Intel.
For technical information about the Intel IPP library, including FAQ's, tips and tricks, and other support
information, please visit the Intel IPP forum: http://software.intel.com/en-us/forums/intel-integrated-
performance-primitives/ and browse the Intel IPP knowledge base: http://software.intel.com/en-us/articles/
intel-ipp-kb/all/.
                                                                                                           9
Intel® Integrated Performance Primitives User's Guide
 10
Notational Conventions
The following font and symbols conventions are used in this document:
 Italic                            Italic is used for emphasis and also indicates document names in body
                                   text, for example:
                                   see Intel IPP Reference Manual.
 Monospace lowercase               Indicates filenames, directory names, and pathnames, for example:
                                   /tools/ia32/perfsys
[ items ] Square brackets indicate that the items enclosed in brackets are optional.
 { item | item }                   Braces indicate that only one of the items listed between braces can be
                                   selected. A vertical bar ( | ) separates the items.
 <parent product                   The installation directory for the larger product that includes Intel IPP; for
 directory>                        example, Intel® C++ Composer XE.
                                                                                                           11
Intel® Integrated Performance Primitives User's Guide
 12
Getting Started with Intel®
Integrated Performance
Primitives                                                                                        1
This chapter helps you start using Intel® Integrated Performance Primitives (Intel® IPP) by giving a quick
overview of some fundamental concepts and showing how to build an Intel® IPP program.
• On Windows* OS: C:/Program Files (x86)/Intel/Composer XE 2013 SP1/ipp (on certain systems,
     instead of Program Files (x86), the directory name is Program Files)
• On Linux* OS and OS X*: /opt/intel/composer_xe_2013_sp1/ipp
The tables below describe the structure of the high-level directories on:
•    Windows* OS
•    Linux* OS
•    OS X*
Windows* OS:
    Directory                                            Contents
    Subdirectories of <ipp directory>
    bin
                                                         Batch files to set environmental variables in the
                                                         user shell
    bin/ia32
                                                         Batch files for the IA-32 architecture
    bin/intel64
                                                         Batch files for the Intel® 64 architecture
    include
                                                         Header files for the library functions
    lib/ia32
                                                         Single-threaded static and dynamic libraries for the
                                                         IA-32 architecture
    lib/intel64
                                                         Single-threaded static and dynamic libraries for the
                                                         Intel® 64 architecture
    lib/<arch>/threaded, where <arch> is one of
                                                         Multi-threaded libraries
    {ia32, intel64}
    examples
                                                         Intel IPP example files
    Subdirectories of <parent product directory>
    tool/perfsys
                                                         Command-line tools for Intel IPP performance
                                                         testing
    tool/staticlib
                                                         Header files for redefining Intel IPP functions to
                                                         processor-specific counterparts
    redist/ia32/ipp
                                                         Single-threaded DLLs for applications running on
                                                         processors with the IA-32 architecture
                                                                                                          13
1      Intel® Integrated Performance Primitives User's Guide
 Directory                                                     Contents
 redist/intel64/ipp
                                                               Single-threaded DLLs for applications running on
                                                               processors with the Intel® 64 architecture
 redist/<arch>/threaded
                                                               Multi-threaded DLLs
 redist/<arch>/1033
                                                               Intel IPP message catalog
 Documentation/<locale>/ipp, where <locale> is
                                                               Intel IPP documentation
 one of {en_US, ja_JP}
 Documentation/vshelp/1033/intel.ippdocs
                                                               Help2-format files for integration of the Intel IPP
                                                               documentation with the Microsoft Visual Studio*
                                                               2008 IDE
 Documentation/msvhelp/1033/ipp
                                                               Microsoft Help Viewer*-format files for integration
                                                               of the Intel MKL documentation with the Microsoft
                                                               Visual Studio* 2010/2012 IDE.
Linux* OS:
 Directory                                                     Contents
 Subdirectories of <ipp directory>
 bin
                                                               Scripts to set environmental variables in the user
                                                               shell
 bin/ia32
                                                               Shell scripts for the IA-32 architecture
 bin/intel64
                                                               Shell scripts for the Intel® 64 architecture
 include
                                                               Header files for the library functions
 lib/ia32
                                                               Single-threaded static and dynamic libraries for the
                                                               IA-32 architecture
 lib/intel64
                                                               Single-threaded static and dynamic libraries for the
                                                               Intel® 64 architecture
 lib/<arch>/threaded
                                                               Multi-threaded libraries
 lib/<arch>/nonpic
                                                               Non-PIC single-threaded static libraries
 lib/<arch>/<locale>
                                                               Intel IPP message catalog
 examples
                                                               Intel IPP example files
 Subdirectories of <parent product directory>
 tool/perfsys
                                                               Command-line tools for Intel IPP performance
                                                               testing
 tool/staticlib
                                                               Header files for redefining Intel IPP functions to
                                                               processor-specific counterparts
 Documentation/<locale>/ipp
                                                               Intel IPP documentation
OS X*:
 Directory                                                     Contents
 Subdirectories of <ipp directory>
 bin
                                                               Scripts to set environmental variables in the user
                                                               shell
 include
                                                               Header files for the library functions
 lib
                                                               Single-threaded static and dynamic FAT libraries
    14
                                               Getting Started with Intel® Integrated Performance Primitives        1
 Directory                                                 Contents
 lib/<arch>/threaded
                                                           Multi-threaded FAT libraries
 lib/<arch>/<locale>
                                                           Intel IPP message catalog
 examples
                                                           Intel IPP examples files
 Subdirectories of <parent product directory>
 tool/perfsys
                                                           Command-line tools for Intel IPP performance
                                                           testing
 Documentation/<locale>/ipp
                                                           Intel IPP documentation
See Also
Notational Conventions
• ippvars.bat ia32
   sets the environment for Intel IPP to use the IA-32 architecture on Windows* OS.
• . ippvars.sh intel64
   sets the environment for Intel IPP to use the Intel® 64 architecture on Linux* OS and OS X*.
                                                                                                               15
1      Intel® Integrated Performance Primitives User's Guide
Compiler Integration
Intel® C++ Compiler and Microsoft Visual Studio* compilers simplify developing with Intel® IPP.
On Windows* OS, a default installation of Intel® C++ Composer XE and Intel® IPP installs integration plug-
ins. These enable the option to configure your Microsoft Visual Studio* project for automatic linking with
Intel IPP.
Intel® C++ Compiler also provides command-line parameters to set the link/include directories:
• On Windows* OS:
   /Qipp-link and /Qipp
• On Linux* OS and OS X*:
   -ipp-link and -ipp
See Also
Automatically Linking Your Microsoft* Visual Studio* Project with Intel IPP
Linking Your Application with Intel® Integrated Performance Primitives
    16
                                                 Getting Started with Intel® Integrated Performance Primitives        1
        printf("AES              :%c\n",   (fm>>10)&1?'Y':'N');
        printf("CLMUL            :%c\n",   (fm>>11)&1?'Y':'N');
        printf("RDRAND           :%c\n",   (fm>>13)&1?'Y':'N');
        printf("F16C             :%c\n",   (fm>>14)&1?'Y':'N');
        return 0;
}
This application consists of three sections:
1.   IPP initialization. This stage is required to take advantage of full IPP optimization. If the Intel IPP
     program runs without ippInit(), by default the least optimized implementation is chosen. With
     ippInit() the best optimization layer will be dispatched at runtime. In certain debugging scenarios, it
     is helpful to force a specific implementation layer by using ippInitCpu, instead of the best as chosen
     by the dispatcher.
2.   Get the library layer name and version. You can also get the version information by using the
     ippversion.h file located in the /include directory.
3.   Show the hardware optimizations used by this library layer.
Building the First Example with Microsoft Visual Studio* 2010/2012 Integration on Windows* OS
On Windows* OS, Intel IPP applications are significantly easier to build with Microsoft* Visual Studio* 2010
and Microsoft* Visual Studio* 2012. To build the code example above, follow the steps:
If you did not install the integration plug-in, configure your Microsoft* Visual Studio* IDE to build Intel IPP
applications following the instructions provided in Configuring the Microsoft Visual Studio* IDE to Link with
Intel® IPP.
      NOTE
      Internally threaded (multi-threaded) version of Intel® IPP library is deprecated but still available for
      legacy applications. It is strongly recommended to use the single-threaded version of the libraries for
      new development.
See Also
Automatically Linking Your Microsoft* Visual Studio* Project with Intel IPP
Configuring the Microsoft* Visual Studio* IDE to Link with Intel® IPP
Setting Environment Variables
Library Dependencies by Domain
Linking Options
Dispatching
                                                                                                                 17
1      Intel® Integrated Performance Primitives User's Guide
           NOTE
           Intel® IPP samples are no longer in active development and available as a separate download.
See Also
Finding Intel® IPP on Your System
See Also
Intel® IPP Examples Directory Structure
      18
                                               Getting Started with Intel® Integrated Performance Primitives        1
Finding the Intel® IPP Documentation
The <ipp directory>/Documentation/en_US/ipp directory, set up during installation, includes a lot of
helpful documentation related to Intel® IPP. See the ipp_documentation.htm file for a listing of all the
available documents with links or pointers to their locations.
Additional documentation on the Intel IPP examples (documentation/ipp-examples.html) is available in
the <ipp directory>/examples/ipp-examples.zip archive.
The Intel IPP forum and knowledge base can be useful locations to search for questions not answered by the
documents above. Please see: http://software.intel.com/en-us/forums/intel-integrated-performance-
primitives/ .
See Also
Finding Intel® IPP on Your System
                                                                                                               19
1    Intel® Integrated Performance Primitives User's Guide
    20
Intel® Integrated Performance
Primitives Theory of Operation                                                                     2
This section discusses dispatching of the Intel® Integrated Performance Primitives (Intel® IPP) libraries to
specific processors, provides functions and parameters naming conventions, and explains the data types on
which Intel IPP performs operations. This section also provides Intel IPP domain details, including existing
library dependencies by domain.
Dispatching
Intel® IPP uses multiple function implementations optimized for various CPUs. Dispatching refers to detection
of your CPU and selecting the corresponding Intel IPP binary path. For example, the ippie9-8.0 library in
the /redist/intel64/ipp directory contains the image processing libraries optimized for 64-bit
applications on processors with Intel® Advanced Vector Extensions (Intel® AVX) enabled such as the 2nd
Generation Intel® Core™ processor family.
A single Intel IPP function, for example ippsCopy_8u(), may have many versions, each one optimized to
run on a specific Intel® processor with specific architecture, for example, the 64-bit version of this function
optimized for the 2nd Generation Intel® Core™ processor is e9_ippsCopy_8u(), and version optimized for
64-bit applications on processors with Intel® Streaming SIMD Extensions 4.1 (Intel® SSE 4.1) is
y8_ippsCopy_8u(). This means that a prefix before the function name determines CPU model. However,
during normal operation the dispatcher determines the best version and you can call a generic function
(ippsCopy_8u in this example).
Intel® IPP is designed to support application development on various Intel® architectures. This means that the
API definition is common for all processors, while the underlying function implementation takes into account
the strengths of each hardware generation.
By providing a single cross-architecture API, Intel IPP enables you to port features across Intel® processor-
based desktop, server, and mobile platforms. You can use your code developed for one processor
architecture for many processor generations.
The following table shows processor-specific codes that Intel IPP uses:
Description of Codes Associated with Processor-Specific Libraries
  IA-32          Intel® 64     Description
 Intel®         architectu
 architectu     re
 re
 px             mx             Generic code optimized for processors with Intel® Streaming SIMD Extensions
                               (Intel® SSE)
 g9             e9             Optimized for processors with Intel® Advanced Vector Extensions (Intel® AVX)
                               and Intel® Advanced Encryption Standard New Instructions (Intel® AES-NI)
                                                                                                           21
2     Intel® Integrated Performance Primitives User's Guide
Optimization Notice
 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
          NOTE
          The core functions in Intel IPP do not need an input data type. These functions have ipp as a prefix
          without the data-domain field. For example, ippGetStatusString.
See Also
Core and Support Functions
Data-domain
The data-domain element is a single character indicating type of input data. Intel IPP supports the following
data-domains:
     22
                                                 Intel® Integrated Performance Primitives Theory of Operation        2
Data Types
The datatype element indicates data types used by the function, in the following format:
<bit depth><bit interpretation>,
where
bit depth = <1|8|16|32|64>
and
bit interpretation<u| s|f>[ c]
Here u indicates “unsigned integer”, s indicates “signed integer”, f indicates “floating point”, and c indicates
“complex”.
For functions that operate on a single data type, the datatype element contains only one value.
If a function operates on source and destination signals that have different data types, the respective data
type identifiers are listed in the function name in order of source and destination as follows:
<datatype> = <src1Datatype>[src2Datatype][dstDatatype]
For more information about supported data types see the Intel® IPP Reference Manual available in the Intel®
Software Documentation Library.
See Also
Intel® Software Documentation Library
Descriptor
The optional descriptor element describes the data associated with the operation. Descriptors are
individual characters that indicate additional details of the operation.
The Intel IPP functions use the following descriptors:
 Descriptor             Description                                        Example
                                                                           ippiFilterMax_8u_AC4R
 A                      Image data contains an alpha channel as the
                        last channel, requires C4, alpha-channel is
                        not processed.
                                                                           ippiLUTPalette_8u_C3A0C4R
 A0                     Image data contains an alpha channel as the
                        first channel, requires C4, alpha-channel is
                        not processed.
                                                                           ippsPowx_32f_A11
 Axx                    Advanced arithmetic operations with xx bits
                        of accuracy.
                                                                           ippiSet_8u_C3CR
 C                      The function operates on a specified channel
                        of interest (COI) for each source image.
                                                                                                                23
2      Intel® Integrated Performance Primitives User's Guide
The descriptors in function names are presented in the function name in alphabetical order.
Some data descriptors are default for certain operations and not added to the function names. For example,
the image processing functions always operate on a two-dimensional image and saturate the results without
scaling them. In these cases, the implied descriptors D2 (two-dimensional signal) and s (saturation and no
scaling) are not included in the function name.
Parameters
The parameters element specifies the function parameters (arguments).
The order of parameters is as follows:
• All parameters defined as pointers start with p, for example, pPhase, pSrc; parameters defined as double
  pointers start with pp, for example, ppState. All parameters defined as values start with a lowercase
  letter, for example, val, src, srcLen.
• Each new part of a parameter name starts with an uppercase character, without underscore; for example,
  pSrc, lenSrc, pDlyLine.
• Each parameter name specifies its functionality. Source parameters are named pSrc or src, in some
  cases followed by names or numbers, for example, pSrc2, srcLen. Output parameters are named pDst
  or dst followed by names or numbers, for example, pDst2, dstLen. For in-place operations, the input/
  output parameter contains the name pSrcDst or srcDst.
      24
                                                Intel® Integrated Performance Primitives Theory of Operation        2
 Code of Domain           Header file                Prefix                           Description
 CC                       ippcc.h                    ippi
                                                                                     color conversion
 CH                       ippch.h                    ipps
                                                                                     string operations
 CP                       ippcp.h                    ipps
                                                                                     cryptography
 CV                       ippcv.h                    ippi
                                                                                     computer vision
 DC                       ippdc.h                    ipps
                                                                                     data compression
 DI*                      ippdi.h                    ipps
                                                                                     data integrity
 GEN*                     ippgen.h                   ippg
                                                                                     spiral generated
 I                        ippi.h                     ippi
                                                                                     image processing
 J                        ippj.h                     ippi
                                                                                     JPEG compression
 M                        ippm.h                     ippm
                                                                                     small matrix operations
 R*                       ippr.h                     ippr
                                                                                     realistic rendering and 3D
                                                                                     data processing
 S                        ipps.h                     ipps
                                                                                     signal processing
 SC                       ippsc.h                    ipps
                                                                                     speech codecs
 VC                       ippvc.h                    ippi
                                                                                     video codecs
 VM                       ippvm.h                    ipps
                                                                                     vector math
        NOTE
        The data integrity, generated, and rendering domains are deprecated. Please avoid starting any new
        projects with these domains.
Cryptography CP Core
                                                                                                               25
2    Intel® Integrated Performance Primitives User's Guide
To find which domain your function belongs to, refer to the Intel® IPP Reference Manual available in the
Intel® Software Documentation Library.
See Also
Intel® Software Documentation Library
    26
Linking Your Application with
Intel® Integrated Performance
Primitives                                                                                               3
This section discusses linking options available in Intel® Integrated Performance Primitives (Intel® IPP).
The current version of Intel IPP introduces several changes in linking approaches by starting the deprecation
for internal threading.
The Intel IPP library supports the following linking options:
•    Single-threaded dynamic
•    Single-threaded static
•    Multi-threaded dynamic (deprecated)
•    Multi-threaded static (deprecated)
Optimization Notice
    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
Linking Options
Intel® Integrated Performance Primitives (Intel® IPP) is distributed as:
                                                                                                                27
3         Intel® Integrated Performance Primitives User's Guide
           NOTE
           Internally threaded (multi-threaded) versions of Intel® IPP libraries are deprecated but made available
           for legacy applications. It is strongly recommended to use the single-threaded version of the libraries
           for new development.
See Also
Automatically Linking Your Microsoft* Visual Studio* Project with Intel IPP
Configuring the Microsoft* Visual Studio* IDE to Link with Intel® IPP
      28
Programming Considerations                                                                       4
Core and Support Functions
There are several general purpose functions that simplify using the library and report information on how it is
working:
•   Init/InitCPU
•   GetStatusString
•   GetLibVersion
•   Malloc/Free
Init/InitCpu
The ippInit function detects the processor type and sets the dispatcher to use the processor-specific code
of the Intel® IPP library corresponding to the instruction set capabilities available.
In some cases like debugging and performance analysis, you may want to get the data on the difference
between various processor-specific codes on the same machine. Use the ippInitCpu function for this. This
function sets the dispatcher to use the processor-specific code according to the specified processor type
without querying the system.
The ippInit and ippInitCpu functions are a part of the ippCore library.
GetStatusString
The ippGetStatusString function decodes the numeric status return value of Intel® IPP functions and
converts them to a human readable text:
        status= ippInit();
        if( status != ippStsNoErr ) {
                printf("IppInit() Error:\n");
                printf("%s\n", ippGetStatusString(status) );
                return -1;
        }
The ippGetStatusString function is a part of the ippCore library.
GetLibVersion
Each domain has its own GetLibVersion function that returns information about the library layer in use
from the dispatcher. The code snippet below demonstrates the usage of the ippiGetLibVersion from the
image processing domain:
const IppLibraryVersion* lib = ippiGetLibVersion();
printf(“%s %s %d.%d.%d.%d\n”, lib->Name, lib->Version,
lib->major, lib->minor, lib->majorBuild, lib->build);
Use this function in combination with ippInitCpu to compare the output of different implementations on the
same machine.
                                                                                                        29
4    Intel® Integrated Performance Primitives User's Guide
Malloc/Free
Intel IPP functions provide better performance if they process data with aligned pointers. Intel IPP provides
the following functions to ensure that data is 32-byte aligned:
void* ippMalloc(int length)
void ippFree(void* ptr)
The ippMalloc function provides a 32-byte aligned buffer, and the ippFree function frees it.
The signal and image processing libraries provide ippsMalloc and ippiMalloc functions, respectively, to
allocate a 32-byte aligned buffer that can be freed by the ippsFree and ippiFree functions.
NOTE
         •   When using buffers allocated with routines different from Intel IPP, you may get better
             performance if the starting address is aligned. If the buffer is created without alignment, use the
             ippAlignPtr function.
         •   Intel® IPP Malloc functions fail to allocate buffers of size more than 2GB-1 because the size
             parameters are 32-bit signed integers. It is not recommended to use larger buffers from other
             allocators. See Cache Optimizations for more details.
For more information about the Intel IPP functions see the Inte® Integrated Performance Primitives for Intel®
Architecture Reference Manual available in Intel® Software Documentation Library.
See Also
Cache Optimizations
Intel® Software Documentation Library
    30
                                                                             Programming Considerations        4
For planar format, there is one value per pixel but potentially several related planes. Functions working with
planar data have a _Pn descriptor, where n can take one of the following values: 1, 2, 3, or 4. The figure
below shows 24 bit per pixel RGB data represented as _P3.
      NOTE
      For many video and image processing formats planes may have different sizes.
Regions of Interest
Many Intel® IPP image processing functions operate with a region of interest (ROI). These functions include
an R descriptor in their names.
A ROI can be the full image or a subset. This can simplify thread or cache blocking.
Many functions sample a neighborhood and cannot provide values for an entire image. In this case a ROI
must be defined for the subset of the destination image that can be computed.
                                                                                                          31
4     Intel® Integrated Performance Primitives User's Guide
Cache Optimizations
To get better performance, work should be grouped to take advantage of locality in the lowest/fastest level
of cache possible. This is the same for threading or cache blocking optimizations.
For example, when operations on each pixels in an image processing pipeline are independent, the entire
image is processed before moving to the next step. This may cause many inefficiencies, as shown in a figure
below.
In this case cache may contain wrong data, requiring re-reading from memory. If threading is used, the
number of synchronization point/barriers is more than the algorithm requires.
You can get better performance after combining steps on local data, as shown in a figure below. In this case
each thread or cache-blocking iteration operates with ROIs, not full image.
          NOTE
          It is recommended to subdivide work into smaller regions considering cache sizes, especially for very
          large images/buffers.
     32
Programming with Intel®
Integrated Performance
Primitives in the Microsoft*
Visual Studio* IDE                                                                                     5
This section provides instructions on how to configure your Microsoft* Visual Studio* IDE to link with the
Intel® IPP, explains how to access Intel IPP documentation and use IntelliSense* Sense features.
•    If you installed the integration component, see Automatically Linking Your Microsoft* Visual Studio*
     Project with Intel IPP
•    If you did not install the integration component or need more control over Intel IPP libraries to link, you
     can configure the Microsoft Visual Studio* by performing the following steps. Though some versions of the
     Visual Studio* development system may vary slightly in the menu items mentioned below, the
     fundamental configuring steps are applicable to all these versions.
     1.        In Solution Explorer, right-click your project and click Properties (for Visual Studio* 2010 or
               higher) or select Tools>Options (for Visual Studio* 2008)
     2.        Select Configuration Properties>VC++ Directories (for Visual Studio* 2010 or higher) or
               select Projects and Solutions (for Visual Studio* 2008) and set the following from the Select
               directories for drop down menu:
               •   Include Files menu item, and then type in the directory for the Intel IPP include files (default
                   is <ipp directory>\include)
               •   Library Files menu item, and then type in the directory for the Intel IPP library files (default is
                   <ipp directory>\lib)
               •   Executable Files menu item, and then type in the directory for the Intel IPP executable files
                   (default is <parent product directory>\redist\<arch>\ipp\ )
To open the help index, select Help>Index from the menu. To search for help topics, select Help>Search
from the menu and enter a search string.
                                                                                                               33
5      Intel® Integrated Performance Primitives User's Guide
You can filter Visual Studio help collections to show only content related to installed Intel tools. To do this,
select "Intel" from the Filtered by list. This hides the contents and index entries for all collections that do
not refer to Intel.
•    Configure the IDE to use local help. To do this, go to Help>Manage Help Settings and check I want to
     use local help.
•    Select Help>View Help menu item to view a list of available help collections and open Intel IPP
     documentation.
•    Configure the IDE to use local help. To do this, go to Help>Set Help Preference and check Launch in
     Help Viewer.
•    Select Help>View Help menu item to view a list of available help collections and open Intel IPP
     documentation.
       •     Click F1
       •     Click the link to the description in the Dynamic Help window.
The topic with the function description opens in the window that displays search results.
           NOTE
           Both features require header files. Therefore, to benefit from IntelliSense, make sure the path to the
           include files is specified in the Visual Studio solution settings. On how to do this, see Configuring the
           Microsoft Visual Studio* IDE to Link with Intel® IPP.
Complete Word
For a software library, the Complete Word feature types or prompts for the rest of the name defined in the
header file once you type the first few characters of the name in your code.
Provided your C/C++ code contains the include statement with the appropriate Intel IPP header file, to
complete the name of the function or named constant specified in the header file, follow these steps:
1. Type the first few characters of the name (for example, ippsFFT).
     34
                 Programming with Intel® Integrated Performance Primitives in the Microsoft* Visual Studio* IDE        5
2.   Press Alt + RIGHT ARROW or Ctrl + SPACEBAR If you have typed enough characters to eliminate
     ambiguity in the name, the rest of the name is typed automatically. Otherwise, the pop-up list of the
     names specified in the header file opens - see the figure below.
Parameter Info
The Parameter Info feature displays the parameter list for a function to give information on the number and
types of parameters.
To get the list of parameters of a function specified in the header file, follow these steps:
                                                                                                                  35
5    Intel® Integrated Performance Primitives User's Guide
A tooltip appears with the function API prototype, and the current parameter in the API prototype is
highlighted - see the figure below.
See Also
Configuring the Microsoft* Visual Studio* IDE to Link with Intel® IPP
    36
Appendix A: Performance Test Tool
(perfsys) Command Line Options                                                                          A
Intel® Integrated Performance Primitives (Intel® IPP) installation includes command-line tools for
performance testing in the <parent product directory>/tools/perfsys directory. There is one perfsys
tool for each domain. For example, ps_ipps executable measures performance for all Intel IPP signal
processing domain functions.
Many factors may affect Intel IPP performance. One of the best way to understand them is to run multiple
tests in the specific environment you are targeting for optimization. The purpose of the perfsys tools is to
simplify performance experiments and empower developers with useful information to get the best
performance from Intel IPP functions.
With the command-line options you can:
•    Create a list of functions to test
•    Set parameters for each function
•    Set image/buffer sizes
To simplify re-running specific tests, you can define the functions and parameters in the initialization file, or
enter them directly from the console.
The command-line format is:
ps_ipp*.exe [option_1] [option_2] ... [option_n]
To invoke the short reference for the command-line options, use -? or -h commands:
ps_ipp*.exe -h
The command-line options are divided into several groups by functionality. You can enter options in arbitrary
order with at least one space between each option name. Some options (like -r, -R, -o, -O) may be entered
several times with different file names, and option -f may be entered several times with different function
patterns. For detailed descriptions of the perfsys command-line options see the following table:
Performance Test Tool Command Line Options
    Group                                 Option                              Description
    Set optimization layer to test        -T[cpu-name]                        Call
                                                                              ippInitStaticCpu(ippCpu<cp
                                                                              u-name>)
    Report Configuration                  -A<Timing|Params|Misalign|          Prompt for the parameters before
                                          All>                                every test from console
                                                                                                             37
A     Intel® Integrated Performance Primitives User's Guide
   38
             Appendix A: Performance Test Tool (perfsys) Command Line Options    A
Group   Option                                  Description
                                                                                39
A   Intel® Integrated Performance Primitives User's Guide
40
Appendix B: DEPRECATED. Intel®
IPP Threading and OpenMP*
Support                                                                                              B
All Intel® Integrated Performance Primitives functions are thread-safe. They support multithreading in both
dynamic and static libraries and can be used in multi-threaded applications. However, if an application has its
own threading model or if other threaded applications are expected to run at the same time on the system, it
is strongly recommended to use non-threaded/single-threaded libraries.
Multi-threaded static and dynamic libraries are available as a separate download to support legacy
applications. For new development, please use the single-threaded versions with application-level threading.
One way to add application-level threading is to use Intel® Threading Building Blocks (Intel® TBB).
Some Intel IPP functions contain OpenMP* code, which increases performance on multi-processor and multi-
core systems. These functions include color conversion, filtering, convolution, cryptography, cross-
correlation, matrix computation, square distance, and bit reduction.
To see the list of all threaded APIs, refer to the ThreadedFunctionsList.txt file located in the documentation
directory of the Intel IPP installation.
      NOTE
      Internally threaded (multi-threaded) versions of Intel® IPP libraries are deprecated but made available
      for legacy applications. It is strongly recommended to use single-threaded version of the library.
Optimization Notice
 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
                                                                                                          41
B     Intel® Integrated Performance Primitives User's Guide
Optimization Notice
 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
Optimization Notice
 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
    42
                                      Appendix B: DEPRECATED. Intel® IPP Threading and OpenMP* Support    B
Optimization Notice
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
                                                                                                         43
B   Intel® Integrated Performance Primitives User's Guide
44
                                                                                                         Index
Index
A                                                                    dependencies 25
                                                      linking options 27
avoiding nested parallelization 42                    linking visual studio project with Intel IPP 28
B                                                     M
building code examples 18                             memory allocation 32
building first application 16                         multithreading
building ipp examples 18                                  support
C                                                     N
cache optimizations 32                                nested parallelization, avoiding 42
channel and planar image layouts 30                   notational conventions 11
command line options                                  number of threads
compiler integration 16                                   getting 41
configuring visual studio to link with Intel IPP 33       setting 41
core and support functions 29
                                                      O
D
                                                      OpenMP support
data types 23
data-domain 22
descriptor 23                                         P
directory structure 13
                                                      parameters 24
dispatching 21
                                                      performance test tool
domains 24
                                                          command line options
dynamic linking 27
                                                          perfsys options
                                                      primitive vs. variant name 22
E                                                     processor-specific codes 21
                                                      programming with intel ipp in visual studio
Enter index keyword
environment variables 15
examples build system 18                              R
examples directory structure 18
                                                      regions of interest 31
F                                                     S
finding ipp on your system 13
                                                      shared L2 cache, using 42
function name 22
                                                      static linking 27
function names 22
function naming conventions 22
                                                      T
G                                                     technical support 9
                                                      threading
GetSize, Init, operation pattern 32
I                                                     U
                                                      using shared L2 cache 42
image data layouts 30
introducing Intel IPP 5
IPP documentation 19                                  V
IPP theory of operation
                                                      viewing Intel IPP documentation 33
L
                                                      W
library dependencies by domain 25
linking                                               what's new 7
          static
                                                                                                        45
Intel® Integrated Performance Primitives User's Guide
46