---------------------Page 1---------------------

 

 
Intel  ® Query Processing
Library

Reference Manual, Volume 2: Image and Video Processing

QPL 8.1
 
 
 
Document Number: A70805-038US
Legal Information
---------------------Page 2---------------------

    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

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
MPEG-1, MPEG-2, MPEG-4, H.261, H.263, H.264, MP3, DV, VC-1, MJPEG, AC3, AAC, G.711, G.722, G.722.1,
G.722.2, AMRWB, Extended AMRWB (AMRWB+), G.167, G.168, G.169, G.723.1, G.726, G.728, G.729, G.
729.1, GSM AMR, GSM FR are international standards promoted by ISO, IEC, ITU, ETSI, 3GPP and other
organizations. Implementations of these standards, or the standard enabled platforms may require licenses
from various entities, including Intel Corporation.
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.

    2
---------------------Page 3---------------------

                                                                                           Legal Information   
Microsoft, Windows, and the Windows logo are trademarks, or registered trademarks of Microsoft Corporation
in the United States and/or other countries.
Java is a registered trademark of Oracle and/or its affiliates.
Copyright© 2000-2014, Intel Corporation. All rights reserved.

                                                                                                         3
---------------------Page 4---------------------

 1    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Volume Overview                                                                      1

This manual describes the structure, operation, and functions of the Intel® Query Processing Library
(Intel® QPL) that operate on two-dimensional signals and are used for image and video processing. The
manual explains the Intel QPL concepts, as well as specific data type definitions and operation models used in
the image and video processing domain, and provides detailed descriptions of the Intel QPL image and video
processing functions. The Intel QPL functions are combined in groups by their functionality. Each group of
functions is described in a separate chapter (chapters 3 through 16).
For more information about image and video processing concepts and algorithms, refer to the books and
materials listed in the Bibliography.

What's New
This Reference Manual documents Intel® Query Processing Library (Intel® QPL) 8.1 release.
Added the following functions:
   Filtering Functions:
  •  FilterBilateralBorder
  •  FilterBilateralBorderGetBufferSize
  •  FilterBilateralBorderInit
  •  FilterGaussianBorder
  •  FilterGaussianGetBufferSize
  •  FilterGaussianInit
  •  FilterSobel
  •  FilterSobelGetBufferSize
   Image Statistics Functions:
  •  Integral_32f_C1R
  •  SAD
  •  SADGetBufferSize
   Image Color Conversion:
  •  YCrCb420ToRGB_8u_P2C4R
  •  YCrCb420ToRGB_8u_P2C3R
  •  YCrCb420ToBGR_8u_P2C4R
  •  YCrCb420ToBGR_8u_P2C4R
  •  YCbCr420ToBGR_8u_P2C3R
  •  YCbCr420ToBGR_8u_P2C4R
  •  YCrCb422ToBGR_8u_C2C3R
  •  YCrCb422ToRGB_8u_C2C4R
  •  YCrCb422ToBGR_8u_C2C4R
  •  YCbCr422ToGray
  •  YCbCr422ToRGB_8u_C2C4R
  •  GrayToRGB
   Computer Vision:
  •  LabelMarkers_8u32s_C1R
  •  LabelMarkersGetBufferSize_8u32s_C1R
  •  HarrisCorner

    4
---------------------Page 5---------------------

                                                                                Volume Overview  1    

  •  HarrisCornerGetBufferSize
  •  CannyBorder
  •  CannyBorderGetSize
  •  MarkSpeckles
  •  MarkSpecklesGetBufferSize
   Morphological Operations:
  •  MorphTophatBorder_{16u_C1R | 16s_C1R | 1u_C1R}
  •  MorphBlackhatBorder_{16u_C1R | 16s_C1R | 1u_C1R}
  •  MorphGradientBorder_{16u_C1R | 16s_C1R | 1u_C1R}

Notational Conventions

The code and syntax used in this manual for function and variable declarations are written in the ANSI C
style. However, versions of Intel QPL for different processors or operating systems may, of necessity, vary
slightly.

 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

This manual uses the following notational conventions:

 Convention                        Explanation                        Example

 THIS TYPE STYLE                   Used in the text for the Intel QPLQPLI_INTER_LINEAR
                                   constant identifiers.
 This type style                   Mixed with the uppercase in       QpliSize  ,
                                   structure names; also used in     qpliMomentInitAlloc()
                                   function names, code examples
                                   and call statements.
 This type style                   Parameters in function prototypes value , srcStep
                                   and parameters description.
 x(n)  and x[n                     Used to represent a discrete 1D   x[n], 0 ≤ n< len
                                   signal. The notation x(n) refers
                                                                     Typically, the number of
                                   to a conceptual signal, while the
                                                                     elements in vectors is denoted by
                                   notation x[n] refers to an actual
                                                                     len . Vector names contain
                                   vector. Both of these are
                                                                     square brackets as distinct from
                                   annotated to indicate a specific
                                                                     vector elements with current
                                   finite range of values.
                                                                     index n.
                                                                     The expression pDst [n] =
                                                                     pSrc [n] + val implies that each
                                                                     element pDst [n] of the vector
                                                                     pDst  is computed for each n in
                                                                     the range from 0 to len-1.
                                                                     Special cases are regarded and
                                                                     described separately.

                                                                                                 5
---------------------Page 6---------------------

 1    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 Convention                         Explanation                       Example

 Qpl<data-domain>    and Qpl       All structures and enumerators,    QpliPoint  , QplDitherType
 prefixes                          specific for the image and video
                                   processing domain have the Qpli
                                   prefix, while those common for
                                   entire Intel QPL software have the
                                   Qpl  prefix.

See Also
Function Naming

    6
---------------------Page 7---------------------

Intel® Query Processing

Library Concepts                                                                    2

This chapter explains the purpose and structure of the Intel® Query Processing Library (Intel® QPL)
for Intel® Architecture software and looks over some of the basic concepts used in the image and video
processing part of Intel QPL. It also describes the supported data formats and operation modes, and defines
function naming conventions in the manual.

Function Naming
Naming conventions for the Intel QPL functions are similar for all covered domains.
Function names in Intel QPL have the following general format:
qpl<data-domain><name>_<    datatype>[_<descriptors    >](<parameters>);
The elements of this format are explained in the sections that follow.

Data-Domain
The data-domain  is a single character that denotes the subset of functionality to which a given function
belongs. The current version of Intel QPL supports the following data-domains:
s                        for signals (expected data type is a 1D signal)
i                        for images and video (expected data type is a 2D image)
m                        for matrices (expected data type is a matrix)
r                        for realistic rendering functionality and 3D data processing (expected data type
                         depends on supported rendering techniques)
g                        for signals of fixed length

For example, function names that begin with qpli signify that respective functions are used for image or
video processing.

Name
The name field identifies what function does and has the following format:
<name > = <operation  >[_modifier ]
The operation  component is one ore more words, acronyms, and abbreviations that describe the core
operation.
The modifier  component, if present, is a word or abbreviation that denotes a slight modification or variation
of the given function.
For example, names without modifiers: Add, RGBToYCbCr, MorphAddGetSize; with modifiers:
DCT8x8Inv_2x2 , DCT8x8Inv_4x4 , RGBToYCbCr_JPEG  .

Data Types
The datatype  field indicates data types used by the function, in the following format:

                                                                                              7
---------------------Page 8---------------------

 2    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

<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”.
Intel QPL supports the following data types for image and video processing functions:

8u                        8 bit, unsigned data

8s                        8 bit, signed data

16u                       16 bit, unsigned data

16uc                      16-bit, complex unsigned short data †

16s                       16 bit, signed data

16sc                      16-bit, complex short data

32u                       32 bit, unsigned data

32s                       32 bit, signed data

32sc                      32-bit, complex int data

32f                       32-bit, single-precision real floating point data

32fc                      32-bit, single-precision complex floating point data

64s                       64-bit, quadword signed data

64f                       64-bit, double-precision real floating point data
† - only partial support for intermediate result after transforms (in the so-called “time” domain).

      NOTE
      For image processing functions that do not support 1u data type, convert bitonal images to 8u gray
      scale images using the qpliConvert_1u8u_C1R     function.

The formats for complex data are represented in Intel QPL by structures defined as follows:
typedef struct {     Qpl16s re;     Qpl16s im; } Qpl16sc;
typedef struct {     Qpl32s re;     Qpl32s im; } Qpl32sc;
typedef struct {     Qpl32f re;     Qpl32f im; } Qpl32fc;

where re, im denote the real and imaginary parts, respectively.
Complex data formats are used by several arithmetic image processing functions. The 32fc format is also
used to store input/output data in some Fourier transform functions.
The 64-bit formats, 64s and 64f, are used for storing data computed by some image statistics functions.
For functions that operate on a single data type, the datatype field contains only one of the values listed
above.
If a function operates on source and destination images that have different data types, the respective data
type identifiers are listed in the function name in order of source and destination as follows:

    8
---------------------Page 9---------------------

                                                      Intel® Query Processing Library Concepts  2 

<datatype> = <src1Datatype>[src2Datatype][dstDatatype]
For example, the function that converts 8-bit unsigned source image data to 32-bit floating point destination
image data has the 8u32f  value for the datatype field.

      NOTE
      In the lists of function parameters (arguments), the Qpl prefix is written in the data type. For
      example, the 8-bit unsigned data is denoted as Qpl8u type. These Intel QPL-specific data types are
      defined in the respective library header files.

Descriptors
The descriptors   field further describes the operation. Descriptors are individual characters that indicate
additional details of the operation.
The following descriptors are used in image and video processing functions:
 Descriptor           Description                                             Example
 A                    Image data contains an alpha channel as the last        qpliAddC_8u_AC4R   ,
                      channel, requires C4, alpha-channel is not processed
 A0                                                                           qpliLUTPalette_8u_C3A0C4R
                      Image data contains an alpha channel as the first
                      channel, requires C4, alpha-channel is not processed
 C1, C2, C3, C4                                                               qpliFilter_32f_C1R
                      Image data is in pixel order and made up of 1, 2, 3 or
                      4 discrete interleaved channels                         qpliFilter_32f_C3R
                                                                              qpliFilter_32f_C4R
                                                                              qpliResizeCCRotate_8u_C2R
 C                                                                            qpliSet_8u_C3CR
                      Channel of interest (COI) is used in the operation
 I                                                                            qpliMulPack_32f_C3IR
                      Operation is performed in-place - that is result of
                      operation is written back into the source (default is
                      not-in-place)
 M                                                                            qpliCopy_8u_C1MR
                      Operation uses a mask to determine pixels to be
                      processed
 P2, P3, P4                                                                   qpliResizeYUV420_8u_P2R
                      Image data is in planar order and made up of 2, 3 or 4
                      discrete planar (non-interleaved) channels, with a      , qpliGammaFwd_8u_P3R  ,
                      separate pointer to each plane                          qpliCopy_32f_P4R
 R                                                                            qpliMean_8u_C4R
                      Function operates on a defined region of interest (ROI)
                      for each source image
 Sfs                                                                          qpliSubC_8u_C1RSfs
                      Saturation and fixed scaling mode is used
 s                                                                            qpliConvert_16s16u_C1Rs
                      Saturation and no scaling (default)

If more that one descriptor is used, they are presented in the function name in alphabetical order.
Every function that operates on image data has a channel count descriptor Cn (for interleaved image) or Pn
(for planar). No default channel count is defined.
If input and output channel layouts are different, both source and destination layouts are listed. For example,
the function qpliHLSToBGR_8u_C3P3R    converts three-channel interleaved HLS image to the three-plane BGR
image.

Parameters
The parameters in functions are in the following order: all source operands, all destination operands, all other
operation-specific parameters.

                                                                                                   9
---------------------Page 10---------------------

 2    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Source parameters are named  Src or SrcN, if there is more than one input image. Destination parameters
are named Dst . For in-place operations, the input/output parameter contains the name SrcDst. All
parameters defined as pointers start with lowercase p , for example, pSrc , pMean , pSpec .

Function Prototypes in Intel QPL

Function names in Intel QPL contain datatype and descriptor  fields after the name field (see Function
Naming section in this chapter). Most of the Intel QPL functions for image processing have a number of
flavors that differ in data types associated with the operation, and in some additional parameters.
Each function flavor has its unique prototype used in function definition and for calling the function from the
application program. For many flavors of a given function, these prototypes look quite similar.
To avoid listing all the similar prototypes in function description sections of some chapters in this manual,
only different templates for such prototypes followed by the table of applicable data types and descriptors for
each function may be given. For simplicity, in such cases the data type and descriptor fields in the function
name are denoted as mod :
<mod> = <datatype>_<datatype>
For example, the template for the prototype of the image dilation function that performs not-in-place
operation, looks like this:
QplStatus qpliDilate_<mod>(const Qpl<datatype>* pSrc, int srcStep, Qpl<datatype>* pDst,
int dstStep, QpliSize roiSize);
where the supported values for modare:

 8u_C1R
 8u_C3R
 8u_AC4R

This notation means that the qpliDilate function has three flavors for a not-in-place operation, which
process 8-bit unsigned data (of Qpl8u type) and differ in the number of channels in processed images. These
flavors have the following prototypes:
QplStatus qpliDilate_8u_C1R(const Qpl8u* pSrc, int srcStep,     Qpl8u* pDst, int dstStep, QpliSize 
roiSize);
QplStatus qpliDilate_8u_C3R(const Qpl8u* pSrc, int srcStep,     Qpl8u* pDst, int dstStep, QpliSize 
roiSize);
QplStatus qpliDilate_8u_AC4R(const Qpl8u* pSrc, int srcStep,     Qpl8u* pDst, int dstStep, QpliSize 
roiSize);

Thus, to obtain the full name and parameters list for the specific function flavor, not listed directly, do the
following:
1.   Choose the function operation mode (denoted in this manual as Case 1, 2 and so on) and look in the
     table for the supported data types and descriptors.
2.   Set the mod field in the function name as the concatenation of the chosen data type and descriptor,
     delimited by the underscore.
3.   Use the respective template, substituting all the datatype fields in the parameters list with the chosen
     data type. Note that Qpl prefix is written before the datatype in the parameters list (see Data Types in
     this chapter for details).

Example
To get the prototype for the qpliSet function flavor that sets each channel of a 3-channel destination image
to 16-bit signed values, choose Case 2: Setting each color channel to a specified value and use
datatype  = 16s, descriptors   = C3R.
After substituting the mod field with 16s_C3R, obtain the required prototype as
qpliSet_16s_C3R(const Qpl16svalue[3], Qpl16* pDst, int dstStep, QpliSize roiSize);

   10
---------------------Page 11---------------------

                                                       Intel® Query Processing Library Concepts  2 

Rounding Mode

As many Intel QPL functions have to meet the bit-exact requirement, image processing functions use
rounding. The default rounding mode for all functions can be described as "nearest even", that is the fixed
point number x= N + α, 0 ≤ α < 0, where N is an integer number, is rounded as given by:
 

 
For example, 1.5 is rounded to 2, and 2.5 to 2.
Some image processing functions have additional rounding modes, which are set by the parameter
roundMode.

Integer Result Scaling

The default for image processing functions is to saturate the results without scaling them.
Some image processing functions operating on integer data use scaling of the internally computed output
results by the integer scaleFactor, which is specified as one of the function parameters. These functions
have the Sfs descriptor in their names.
The scale factor can be negative, positive, or zero. Scaling is applied because internal computations are
generally performed with a higher precision than the data types used for input and output images.

      NOTE
      The result of integer operations is always saturated to the destination data type range even when
      scaling is used.

The scaling of an integer result is done by multiplying the output pixel values by 2-scaleFactor before the
function returns. This helps retain either the output data range or its precision. Usually the scaling with a
positive factor is performed by the shift operation. The result is rounded off to the nearest even integer
number (see Rounding Mode).
For example, the integer Qpl16s result of the square operation qpliSqr for the input value 200 is equal to
32767 instead of 40000, that is, the result is saturated and the exact value cannot be restored. The scaling
of the output value with the factor scaleFactor = 1 yields the result 20000, which is not saturated, and the
exact value can be restored as 20000*2. Thus, the output data range is retained.
The following example shows how the precision can be partially retained by means of scaling. The integer
square root operation qpliSqr  (without scaling) for the input value 2 gives the result equal to 1 instead of
1.414. Scaling of the internally computed output value with the factor scaleFactor = -3 gives the result 11,
and permits the more precise value to be restored as 11*2-3 = 1.375.

Error Reporting

The Intel QPL functions return status codes of the performed operation to report errors and warnings to the
calling program. Thus, it is up to the application to perform error-related actions and/or recover from the
error. The last value of the error status is not stored, and the user is to decide whether to check it or not as
the function returns. The status codes are of QplStatus type and are global constant integers.
The status codes and corresponding messages reported by Intel QPL for image and video processing are
listed in Table .

                                                                                                    11
---------------------Page 12---------------------

 2    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Status Codes and Messages
 Status Code                                Message
 qplStsNotSupportedModeErr                  The requested mode is currently not supported.
 qplStsDecimateFractionErr                  Unsupported fraction in decimate.
 qplStsWeightErr                            Incorrect value for weight.
 qplStsQualityIndexErr                      Quality Index cannot be calculated for an image filled with a constant.
 qplStsResizeNoOperationErr                 One of the output image dimensions is less than 1 pixel.
 qplStsBlockStepErr                         Step for Block is less than 8.
 qplStsMBStepErr                            Step for MB is less than 16.
 qplStsNoiseRangeErr                        Noise value for Wiener Filter is out of range.
 qplStsLPCCalcErr                           Cannot evaluate linear prediction.
 qplStsJPEG2KBadPassNumber                  Pass number exceeds the limits of [0,nOfPasses-1].
 qplStsJPEG2KDamagedCodeBlock               Codeblock for decoding is damaged.
 qplStsH263CBPYCodeErr                      Illegal Huffman code is detected during CBPY stream processing.
 qplStsH263MCBPCInterCodeErr                Illegal Huffman code is detected during MCBPC Inter stream
                                            processing.
 qplStsH263MCBPCIntraCodeErr                Illegal Huffman code is detected during MCBPC Intra stream
                                            processing.
 qplStsNotEvenStepErr                       Step value is not pixel multiple.
 qplStsHistoNofLevelsErr                    Number of levels for histogram is less than 2.
 qplStsLUTNofLevelsErr                      Number of levels for LUT is less than 2.
 qplStsMP4BitOffsetErr                      Incorrect value for bit offset.
 qplStsMP4QPErr                             Incorrect value for quantization parameter.
 qplStsMP4BlockIdxErr                       Incorrect value for block index.
 qplStsMP4BlockTypeErr                      Incorrect block type.
 qplStsMP4MVCodeErr                         Illegal Huffman code is detected during MV stream processing.
 qplStsMP4VLCCodeErr                        Illegal Huffman code is detected during VLC stream processing.
 qplStsMP4DCCodeErr                         Illegal code is detected during DC stream processing.
 qplStsMP4FcodeErr                          Incorrect value for fcode.
 qplStsMP4AlignErr                          Incorrect buffer alignment.
 qplStsMP4TempDiffErr                       Incorrect temporal difference.
 qplStsMP4BlockSizeErr                      Incorrect size of block or macroblock.
 qplStsMP4ZeroBABErr                        All BAB values are equal to zero.
 qplStsMP4PredDirErr                        Incorrect prediction direction.
 qplStsMP4BitsPerPixelErr                   Incorrect number of bits per pixel.
 qplStsMP4VideoCompModeErr                  Incorrect video component mode.
 qplStsMP4LinearModeErr                     Incorrect DC linear mode.
 qplStsH263PredModeErr                      Incorrect value for Prediction Mode.
 qplStsH263BlockStepErr                     The step value is less than 8.
 qplStsH263MBStepErr                        The step value is less than 16.
 qplStsH263FrameWidthErr                    The frame width is less than 8.
 qplStsH263FrameHeightErr                   The frame height is less than, or equal to zero.
 qplStsH263ExpandPelsErr                    The expand pixels number is less than 8.
 qplStsH263PlaneStepErr                     Step value is less than the plane width.
 qplStsH263QuantErr                         Quantizer value is less than, or equal to zero, or more than 31.
 qplStsH263MVCodeErr                        Illegal Huffman code is detetcted during MV stream processing.
 qplStsH263VLCCodeErr                       Illegal Huffman code is detetcted during VLC stream processing.
 qplStsH263DCCodeErr                        Illegal code is detetcted during DC stream processing.
 qplStsH263ZigzagLenErr                     Zigzag compact length is more than 64.
 qplStsJPEGHuffTableErr                     JPEG Huffman table is destroyed.
 qplStsJPEGDCTRangeErr                      JPEG DCT coefficient is out of range.
 qplStsJPEGOutOfBufErr                      An attempt to access out of the buffer.

    12
---------------------Page 13---------------------

                                                       Intel® Query Processing Library Concepts  2 

Status Code                                 Message
qplStsChannelOrderErr                      Incorrect order of the destination channels.
qplStsZeroMaskValueErr                     All values of the mask are equal to zero.
qplStsRangeErr                             Incorrect values for bounds: the lower bound is greater than the upper
                                           bound.
qplStsQPErr                                Incorrect value for a quantizer parameter.
qplStsQuadErr                              The quadrangle is nonconvex or degenerates into triangle, line, or
                                           point.
qplStsRectErr                              Size of the rectangular region is less than, or equal to 1.
qplStsCoeffErr                             Incorrect values for the transformation coefficients.
qplStsNoiseValErr                          Incorrect value for the noise amplitude for dithering.
qplStsDitherLevelsErr                      Number of dithering levels is out of range.
qplStsNumChannelsErr                       Incorrect or unsupported number of channels.
qplStsDataTypeErr                          Incorrect or unsupported data type.
qplStsCOIErr                               COI is out of range.
qplStsOutOfRangeErr                        Argument is out of range or point is outside the image.
qplStsDivisorErr                           Divisor is equal to zero, function is aborted.
qplStsAlphaTypeErr                         Illegal type of image composition operation.
qplStsGammaRangeErr                        Gamma range bound is less than, or equal to zero.
qplStsGrayCoefSumErr                       Sum of the conversion coefficients must be less than, or equal to 1.
qplStsChannelErr                           Illegal channel number.
qplStsJaehneErr                            Magnitude value is negative.
qplStsStepErr                              Step value is less than, or equal to zero.
qplStsStrideErr                            Stride value is less than the row length.
qplStsEpsValErr                            Negative epsilon value.
qplStsScaleRangeErr                        Scale bounds are out of range.
qplStsThresholdErr                         Invalid threshold bounds.
qplStsWtOffsetErr                          Invalid offset value for the wavelet filter.
qplStsAnchorErr                            Anchor point is outside the mask.
qplStsMaskSizeErr                          Invalid mask size.
qplStsShiftErr                             Shift value is less than zero.
qplStsSampleFactorErr                      Sampling factor is less than, or equal to zero.
qplStsResizeFactorErr                      Resize factor(s) is less than, or equal to zero.
qplStsDivByZeroErr                         An attempt to divide by zero.
qplStsInterpolationErr                     Invalid interpolation mode.
qplStsMirrorFlipErr                        Invalid flip mode.
qplStsMoment00ZeroErr                      Moment value M(0,0) is too small to continue calculations.
qplStsThreshNegLevelErr                    Negative value of the level in the threshold operation.
qplStsContextMatchErr                      Context parameter does not match the operation.
qplStsFftFlagErr                           Invalid value of the FFT flag parameter.
qplStsFftOrderErr                          Invalid value of the FFT order parameter.
qplStsMemAllocErr                          Not enough memory for the operation.
qplStsNullPtrErr                           Pointer is NULL.
qplStsSizeErr                              Wrong value fopr the data size.
qplStsBadArgErr                            Invalid or bad argument.
qplStsNoErr                                No errors.
qplStsNoOperation                          No operation has been executed.
qplStsMisalignedBuf                        Misaligned pointer in operation in which it must be aligned.
qplStsSqrtNegArg                           Negative value(s) of the argument in the function Sqrt.
qplStsInvZero                              INF  result. Zero value was met by InvThresh with zero level.
qplStsEvenMedianMaskSize                   Even size of the Median Filter mask was replaced by the odd number.
qplStsDivByZero                            Zero value(s) of the divisor in the function Div .

                                                                                                     13
---------------------Page 14---------------------

 2    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 Status Code                                Message
 qplStsLnZeroArg                            Zero value(s) of the argument in the function Ln.
 qplStsLnNegArg                             Negative value(s) of the argument in the function Ln.
 qplStsNanArg                               Argument value is not a number.
 qplStsDoubleSize                           Sizes of image are not multiples of 2.
 qplStsJPEGMarker                           JPEG marker in the bitstream.
 qplStsResFloor                             All result values are floored.
 qplStsAffineQuadChanged                    The fourth ertex of destination quad is not equal to the customer's
                                            one.
 qplStsWrongIntersectROI                    Incorrect ROI that has no intersection with the source or destination
                                            image. No operation.
 qplStsWrongIntersectQuad                   Incorrect quadrangle that has no intersection with the source or
                                            destination ROI. No operation.
 qplStsSymKernelExpected                    The kernel is not symmetric.
 qplStsEvenMedianWeight                     Even weight of the Weighted Median Filter was replaced by the odd
                                            one.
 qplStsNoAntialiasing                       The mode does not support antialiasing.
 qplStsAlgTypeErr                           The algorithm type is not supported.

The status codes ending with Err (except for the qplStsNoErr   status) indicate an error; the integer values
of these codes are negative. When an error occurs, the function execution is interrupted.
The status code qplStsNoErr   indicates no error. All other status codes indicate warnings. When a specific
case is encountered, the function execution is completed and the corresponding warning status is returned.
For example, if the function qpliDiv meets an attempt to divide a positive value by zero, the function
execution is not aborted. The result of the operation is set to the maximum value that can be represented by
the source data type, and the user is warned by the output status qplStsDivByZero  . See appendix A 
Handling of Special Cases for more information.

Structures and Enumerators

This section describes the structures and enumerators used by the Intel Query Processing Library
for image and video processing.
The QplStatus   constant enumerates the status code values returned by Intel QPL functions, indicating
whether the operation was error-free or not.
See section Error Reporting in this chapter for more information on the set of valid status codes and
corresponding error messages for image and video processing functions.
 
The structure QpliPoint  for storing the geometric position of a point is defined as
typedef struct {
    int x;
    int y;
} QpliPoint;

where x, y denote the coordinates of the point.
 
The structure QplPointPolar   for storing the geometric position of a point in polar coordinates is defined as
typedef struct {
    Qpl32f rho;
    Qpl32f theta;
} QplPointPolar;

where rho  - a radial coordinate (radial distance from the origin), theta - an angular coordinate
(counterclockwise angle from the x-axis).
 

    14
---------------------Page 15---------------------

                                                     Intel® Query Processing Library Concepts  2 

The structure QpliSize for storing the size of a rectangle is defined as
typedef struct {
    int width;
    int height;
} QpliSize;

where width  and height denote the dimensions of the rectangle in the x- and y-directions, respectively.
 
The structure QpliRect for storing the geometric position and size of a rectangle is defined as
typedef struct {
    int x;
    int y;
    int width;
    int height;
} QpliRect;

where x, y denote the coordinates of the top left corner of the rectangle that has dimensions width in the x-
direction by height in the y-direction.
 
The qpliConnectedComp   structure used in Computer Vision functions defines the connected component as
follows:
typedef struct _QpliConnectedComp {
    Qpl64f area;
    Qpl64f value[3];
    QpliRect rect;
} QpliConnectedComp;

where area - area of the segmented component; value[3]  - gray scale value of the segmented component;
rect - bounding rectangle of the segmented component.
 
The QplFourSymb  structure used in Long Term Evolution Wireless Support Functions stores the destination
data grouped by four symbols:
typedef struct {
     Qpl16sc symb[4];
} QplFourSymb;

The QpliMaskSize   enumeration defines the neighborhood area for some morphological and filtering
functions:
typedef enum {
    qplMskSize1x3 = 13,
    qplMskSize1x5 = 15,
    qplMskSize3x1 = 31,
    qplMskSize3x3 = 33,
    qplMskSize5x1 = 51,
    qplMskSize5x5 = 55
} QpliMaskSize;

 
The QplCmpOp  enumeration defines the type of compare operation to be used in image comparison
functions:
typedef enum {
    qplCmpLess,
    qplCmpLessEq,
    qplCmpEq,

                                                                                               15
---------------------Page 16---------------------

 2    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

    qplCmpGreaterEq,
    qplCmpGreater
} QplCmpOp;

 
The QplRoundMode  enumeration defines the rounding mode to be used in some conversion, filtering and
arithmetic functions:
typedef enum {
    qplRndZero,
    qplRndNear,
    qplRndFinancial
} QplRoundMode;

 
The QplHintAlgorithm   enumeration defines the type of code to be used in some image transform and
statistics functions, that is, faster but less accurate, or vice-versa, more accurate but slower. For more
information on using this enumerator, see Table Hint Arguments for Linear Transform Functions or Table Hint
Arguments for Image Moment Functions.
typedef enum {
    qplAlgHintNone,
    qplAlgHintFast,
    qplAlgHintAccurate
} QplHintAlgorithm;

 
The types of interpolation used by geometric transform functions are defined as follows:
enum {
    QPLI_INTER_NN        = 1,
    QPLI_INTER_LINEAR    = 2,
    QPLI_INTER_CUBIC     = 4,
    QPLI_INTER_CUBIC2P_BSPLINE,
    QPLI_INTER_CUBIC2P_CATMULLROM,
    QPLI_INTER_CUBIC2P_B05C03,     
    QPLI_INTER_SUPER     = 8,
    QPLI_INTER_LANCZOS   = 16,
    QPLI_ANTIALIASING    =(1 << 29)
    QPLI_SUBPIXEL_EDGE   =(1 << 30)
    QPLI_SMOOTH_EDGE     =(1 << 31)
};

 
The QpliAlphaType  enumeration defines the type of the compositing operation to be used in the alpha
composition functions:
typedef enum {
    qplAlphaOver,
    qplAlphaIn,
    qplAlphaOut,
    qplAlphaATop,
    qplAlphaXor,
    qplAlphaPlus,
    qplAlphaOverPremul,
    qplAlphaInPremul,
    qplAlphaOutPremul,
    qplAlphaATopPremul,
    qplAlphaXorPremul,
    qplAlphaPlusPremul
} QpliAlphaType;

   16
---------------------Page 17---------------------

                                                   Intel® Query Processing Library Concepts  2 

 
The QpliDitherType  enumeration defines the type of dithering to be used by the qpliReduceBits
function:
typedef enum {
    qplDitherNone,
    qplDitherFS,
    qplDitherJJN,
    qplDitherStucki,
    qplDitherBayer
} QpliDitherType;

 
The layout of the image slices used in some image format conversion functions is defined as follows:
enum {
     QPL_UPPER        = 1,
     QPL_LEFT         = 2,
     QPL_CENTER       = 4,
     QPL_RIGHT        = 8,
     QPL_LOWER        = 16,
     QPL_UPPER_LEFT   = 32,
     QPL_UPPER_RIGHT  = 64,
     QPL_LOWER_LEFT   = 128,
     QPL_LOWER_RIGHT  = 256
};

 
The QpliShape  enumeration defines shapes of the structuring element used in some morphological
functions:
typedef enum {
    qpliShapeRect    = 0,
    qpliShapeCross   = 1,
    qpliShapeEllipse = 2,
    qpliShapeCustom  = 100
} QpliShape;

 
The QpliAxis  enumeration defines the flip axes for the qpliMirror functions or direction of the image
intensity ramp for the qpliImageRamp functions:
typedef enum {
    qplAxsHorizontal, 
    qplAxsVertical,  
    qplAxsBoth,
    qplAxs45,
    qplAxs135
} QpliAxis;

 
The QpliBorderType  enumeration defines the border type that is used by some Separable Filters and Fixed
Filters with Border functions:
typedef enum _QpliBorderType {
    qplBorderConst     =  0,
    qplBorderRepl      =  1,
    qplBorderWrap      =  2,
    qplBorderMirror    =  3,
    qplBorderMirrorR   =  4,
    qplBorderMirror2   =  5,
    qplBorderInMem     =  6,

                                                                                             17
---------------------Page 18---------------------

 2    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

    qplBorderInMemTop     =  0x0010,
    qplBorderInMemBottom  =  0x0020
    qplBorderInMemLeft    =  0x0040
    qplBorderInMemRight   =  0x0080
} QpliBorderType;

 
The QpliFraction  enumeration defines shapes of the structuring element used in some decimate filter
functions:
typedef enum {
    qplPolyphase_1_2,
    qplPolyphase_3_5,
    qplPolyphase_2_3,
    qplPolyphase_7_10,
    qplPolyphase_3_4,     
} QpliFraction;

 
The QpliWTSubband  enumeration defines the appropriate wavelet transform subband used in the JPEG2000
coding functions:
typedef enum {
    qplWTSubbandLxLy,
    qplWTSubbandLxHy,
    qplWTSubbandHxLy,
    qplWTSubbandHxHy
} QpliWTSubband;

 
The QpliMQTermination   enumeration defines how the MQ-coder will be terminated during the operation of
the JPEG2000 coding functions:
typedef enum {
    qplMQTermSimple,
    qplMQTermNearOptimal,
    qplMQTermPredictable
} QpliMQTermination;

 
The QpliMQRateAppr  enumeration defines the padding-approximation model in the estimation of rate and
distortion procedures performed by the JPEG2000 coding functions:
typedef enum {
    qplMQRateApprGood
} QpliMQRateAppr;

 
The code flags used by the JPEG2000 coding functions are defined as follows:
enum
{
  QPL_JPEG2K_VERTICALLY_CAUSAL_CONTEXT,
  QPL_JPEG2K_SELECTIVE_MQ_BYPASS,
  QPL_JPEG2K_TERMINATE_ON_EVERY_PASS,
  QPL_JPEG2K_RESETCTX_ON_EVERY_PASS,
  QPL_JPEG2K_USE_SEGMENTATION_SYMBOLS,
  QPL_JPEG2K_LOSSLESS_MODE,
  QPL_JPEG2K_DEC_CONCEAL_ERRORS,
  QPL_JPEG2K_DEC_DO_NOT_CLEAR_CB,
  QPL_JPEG2K_DEC_DO_NOT_RESET_LOW_BITS,

   18
---------------------Page 19---------------------

                                                    Intel® Query Processing Library Concepts  2 

  QPL_JPEG2K_DEC_DO_NOT_CLEAR_SFBUFFER
  QPL_JPEG2K_DEC_CHECK_PRED_TERM
};

 
The QpliVLCAdaptType   enumeration defines the adaptive VLC model in the model adaptation procedure
performed by the JPEG XR coding functions:
typedef enum {
    qplVLCAdaptLowpass,
    qplVLCAdaptHighpass
} QpliVLCAdaptType;

The QpliVLCScanType   enumeration defines the VLC scan type used by the JPEG XR coding functions:
typedef enum {
    qplVLCScanVert,
    qplVLCScanHoriz,
    qplVLCScanRaster
} QpliVLCScanType;

The QpliNormOp  enumeration defines the type of normalization that should be applied to the output data:
typedef enum {
    qpliNormNone           = 0x00000000, // default
    qpliNorm          = 0x00000100, // normalized form
    qpliNormCoefficient = 0x00000200, // correlation coefficient in the range [-1.0,…,1.0]
    qpliNormMask          = 0x0000FF00,
} QpliNormOp;

The QpliROIShape  enumeration defines the window shape for the two-dimensional convolution-specific
functions:
typedef enum {
   qpliROIFull   = 0x00000000,
   qpliROIValid  = 0x00010000,
   qpliROISame   = 0x00020000,
   qpliROIMask   = 0x00FF0000
} QpliROIShape;

The QplNormType  enumeration defines the norm type that should be applied when computing the magnitude
of the gradient:
typedef enum {
    qplNormInf  =   0x00000001, // Infinity norm
    qplNormL1   =   0x00000002, // L1 normalization
    qplNormL2   =   0x00000004  // L2 normalization
} QplNormType;

Function Context Structures
Some Intel QPL functions use special structures to store function-specific (context) information. For example,
the QpliFFTSpec  structure stores twiddle factors and bit reverse indexes needed in computing the fast
Fourier transform.
Two different kinds of structures are used: structures that are not modified during function operation - they
have the suffix Spec in their names, and structures that are modified during operation - they have the suffix
State in their names.
These context-related structures are not defined in the public headers, and their fields are not accessible. It
was done because the function context interpretation is processor dependent. Thus, you may only use
context-related functions and may not create a function context as an automatic variable.

                                                                                               19
---------------------Page 20---------------------

 2    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Image Data Types and Ranges

The Intel QPL image processing functions support only absolute color images in which each pixel is
represented by its channel intensities. The data storage for an image can be either pixel-oriented or plane-
oriented (planar). For images in pixel order, all channel values for each pixel are clustered and stored
consecutively, for example, RGBRGBRGB in case of an RGB image. The number of channels in a pixel-order
image can be 1, 2, 3, or 4.
For images in planar order, all image data for each channel is stored contiguously followed by the next
channel, for example, RRR...GGG...BBB.
Functions that operate on planar images are identified by the presence of Pn descriptor in their names. In
this case, n pointers (one for each plane) may be specified.
The image data type is determined by the pixel depth in bits per channel, or bit depth. Bit depth for each
channel can be 8, 16 or 32 and is included in the function name as one of these numbers (see Function
Naming in this chapter for details). The data may be signed (s), unsigned (u), or floating-point real (f). For
some arithmetic and FFT/DFT functions, data in complex format (sc or fc) can be used, where each channel
value is represented by two numbers: real and imaginary part. All channels in an image must have the same
data type.
For example, in an absolute color 24-bit RGB image, three consecutive bytes (24 bits) per pixel represent the
three channel intensities in the pixel mode. This data type is identified in function names as the 8u_C3
descriptor, where 8u represents 8-bit unsigned data for each channel and C3 represents three channels.
Some functions operate with images in 16-bit packed RGB format (see RGB Image Formats in Chapter 6 for
more details). In this case data of all 3 channels are represented as 16u data type.
For example, in an absolute color 16-bit packed RGB image, two consecutive bytes (16 bits) per pixel
represent the three channel intensities in the pixel mode. This data type is identified in function names as the
16u_C3  descriptor, where 16u represents 16-bit unsigned data (not a bit depth) for all packed channels
together and C3 stands for three channels.
If an alpha (opacity) channel is present in image data, the image must have four channels, with alpha
channel being the last or the first one. This data type is indicated by the AC4 or A0C4 descriptors
respectively. The presence of the alpha channel can modify the function's behavior. For such functions, Intel
QPL provides versions with and without alpha. If an alpha channel is specified, the operation usually is not
performed on that channel.
The range of values that can be represented by each data type lies between the lower and upper bounds.
The following table lists data ranges and constant identifiers used in Intel QPL to denote the respective range
bounds:
Image Data Types and Ranges
 Data                      Lower Bound                                    Upper Bound
 Type
            Identifier                Value                Identifier                Value
  

 8s        QPL_MIN_8S                -128                 QPL_MAX_8S                 127

 8u                                  0                    QPL_MAX_8U                 255

 16s       QPL_MIN_16S               -32768               QPL_MAX_16S                32767

 16u                                 0                    QPL_MAX_16U                65535

 32s       QPL_MIN_32S               -2 31                QPL_MAX_32S                231-1

 32u                                 0                    QPL_MAX_32U                232-1

 32f†      QPL_MINABS_32F            1.175494351e  -38    QPL_MAXABS_32F             3.402823466e 38

† The range for absolute values

   20
---------------------Page 21---------------------

                                                       Intel® Query Processing Library Concepts  2 

Major Operation Models

Most Intel QPL image processing functions perform identical and independent operations on all channels of
the processed image (except alpha channel). It means that the same operation is applied to each channel,
and the computed results do not depend upon values of other channels. Some exceptions include the
qpliFilterMedianColor     function and color conversion functions, which process three channels together.
The Intel QPL image processing functions can be broken into two major models of operation: the functions
that operate on one pixel to compute the result (also known as point operations), for example, qpliAdd, and
the functions that operate on a group of pixels (also referred to as a neighborhood), for example,
qpliFilterBox.

Neighborhood Operations
The result of a neighborhood operation is based on values of a certain group of pixels, located near a given
input pixel. The set of neighboring pixels is typically defined by a rectangular mask (or kernel) and anchor
cell, specifying the mask alignment with respect to the position of the input pixel as shown in the following
figure.
 

 
The anchor cell is a fixed cell within the kernel, which is used for positioning the kernel with respect to the
currently processed pixel of the source image. The kernel is placed on the image in such a way that the
anchor cell coincides with the input pixel. The anchor cell is specified by its coordinates anchor.x and
anchor.y  in the coordinate system associated with the top left corner of the kernel.
If position of the anchor cell is not specified explicitly in the function description, coordinates of the anchor
are computed by the default formula:
anchor.x =( kernel.width  -1)/2
anchor.y =( kernel.height  -1)/2
where
kernel.width   and kernel.height    is the width and height of the filter kernel, respectively.

Regions of Interest in Intel QPL
Most Intel QPL image processing functions can operate not only on entire images but also on image areas.
Image region of interest (ROI) is a rectangular area that may be either some part of the image or the whole
image.

                                                                                                   21
---------------------Page 22---------------------

 2    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

The Intel QPL functions with ROI support are distinguished by the presence of an R descriptor in their names.
ROI of an image is defined by the size and offset from the image origin as shown in Figure . The origin of an
image is implied to be in the top left corner, with x values increasing from left to right and y values
increasing downwards.

Image, ROI, and Offsets

Both the source and destination images can have a region of interest. In such cases the sizes of ROIs are
assumed to be the same while offsets may differ. The image processing is then performed on data of the
source ROI, and the results are written to the destination ROI. In function call sequences, an ROI is specified
by:
•  roiSize parameter of the QpliSize  type
•  pSrc and pDst pointers to the starts of source and destination ROI buffers
•  srcStep and dstStep parameters that are equal to distances in bytes between the starts of consecutive
   lines in source and destination images, respectively.
Thus, the parameters srcStep, dstStep set steps in bytes through image buffers to start processing a new
line in the ROI of an image.
The following code example illustrates the use of the dstStep parameter in function calls:

Example
QplStatus roi( void ) {
   Qpl8u x[8*3] = {0};
   QpliSize roiSize = {3,2};
   QpliPoint roiPoint = {2,1};
   /// place the pointer to the ROI start position
   return qpliSet_8u_C1R( 7, x+8*roiPoint.y+roiPoint.x, 8, roiSize );
}

The resultant image x contains the following data:
00 00 00 00 00 00 00 00
00 00 07 07 07 00 00 00
00 00 07 07 07 00 00 00
If ROI is present,
•  source and destination images can have different sizes
•  lines may have padding at the end for aligning the line sizes
•  application must correctly define the pSrc, pDst, and roiSize parameters.
The pSrc and pDst parameters are the shifted pointers to the image data. For example, in case of ROI
operations on 3-bytes-per-pixel image data (8u_C3R ), pSrc points to the start of the source ROI buffer and
can be interpreted as follows:

   22
---------------------Page 23---------------------

                                                      Intel® Query Processing Library Concepts  2 

pSrc = pSrcImg + 3*(srcImgSize.width * srcRoiOffset.y + srcRoiOffset.x)             ,
where

pSrcImg                 points to the start of the source image buffer

srcImgSize               is the image size in pixels (of the QpliSize type)

srcRoiOffset              determines an offset of ROI relative to the start of the image as shown in
                          Figure 2-1.

Another example for operations on four-channel image of 32f data type 32f_AC4:
pSrc = (Qpl32f*)((Qpl8u*)pSrcImg + srcImgStep * srcRoiOffset.y +
4*SizeOf(Qpl32f)*srcRoiOffset.x     .
In this example the multiplier 4 is used because the AC4 pixel consists of 4 values - R, G, B, A. Pointer type
conversion is required as in Intel QPL all image steps are always in bytes, and it's not recommended to use
step/SizeOf(Qpl32f)    as in a general case step value may be not a multiple of 4.
For functions using ROI with a neighborhood, you should correctly use values of the pSrc and roiSize
parameters. These functions assume that the points in the neighborhood exist and that therefore pSrc is
almost never equal to pSrcImg. Figure  illustrates the case when neighborhood pixels can fall outside the
source image.

Using ROI with Neighborhood

To ensure valid operation when image pixels are processed, the application should correctly define additional
border pixels (see Borders).

      Warning
      If the required border pixels are not defined prior to calling neighborhood functions that attempt to
      process such pixels, you may get memory violation errors.

The following code example shows how to process an image with ROI:

Example
QplStatus alignedLine( void
) {
   Qpl8u x[8*3] = {0};

                                                                                                 23
---------------------Page 24---------------------

 2    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

   QpliSize imgSize = {5,3};
   /// The image is of size 5x3. Width 8 has been
   /// chosen by the user to align every line of the image
   return qpliSet_8u_C1R( 7, x, 8, imgSize);
}

The resultant image x contains the following data:
07 07 07 07 07 00 00 00
07 07 07 07 07 00 00 00
07 07 07 07 07 00 00 00

Tiled Image Processing
Intel QPL can process images composed from tiles, or tiled images. The specially created code sample “Tiled
Image processing” demonstrates how to do it. See Intel QPL Image Processing Samples downloadable from
http://www.intel.com/cd/software/products/asmo-na/eng/220046.htm

   24
---------------------Page 25---------------------

Support Functions                                                                       3

This chapter describes the Intel® QPL support functions that are used to:
•     retrieve information about the current Intel QPL software version
•     get a brief explanation of the returned status codes
•     allocate and free memory that is needed for the operation of other Intel QPL image and video processing
  functions.

Version Information Function
This function returns the version number and other information about the active Intel QPL image processing
software.

GetLibVersion
Returns information about the used version of Intel
QPL software for image processing.

Syntax
const QplLibraryVersion* qpliGetLibVersion      (void );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Description

This function returns a pointer to a static data structure QplLibraryVersion that contains information
about the current version of Intel QPL for image processing. You need not release memory referenced by the
returned pointer, as it points to a static variable. The following fields of the QplLibraryVersion structure
are available:
major                         the major number of the current library version

minor                         the minor number of the current library version

majorBuild                    the number of builds of the major version

build                         current build number

Name                          the name of the current library version

Version                       the library version string

BuildDate                     the library version actual build date

                                                                                               25
---------------------Page 26---------------------

 3    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

For example, if the library version is 7.0 , library name is qplip8_1.lib, and build date is July, 20 2011,
then the fields in this structure are set as:
major = 7, minor = 0, Name = "qplip8", Version = "7.0 build 205.68", BuildDate = "Jul
20 2011"

      NOTE
      Each sub-library that is used in the image processing domain has its own similar function to retrieve
      information about the active library version. These functions are: qpliGetLibVersion,
      qpljGetLibVersion  , qplcvGetLibVersion  , qplvcGetLibVersion  , and qplccGetLibVersion  .
      They are declared in the following header files: qplcore.h, qplj.h, qplcv.h, qplvc.h, qplcc.h,
      respectively, and have the same interface as the above described function.

Example
The code example below shows how to use qpliGetLibVersion  :
      void libinfo(void) {
         const QplLibraryVersion* lib = qpliGetLibVersion();
         printf(“%s %s %d.%d.%d.%d\n”, lib->Name, lib->Version,
            lib->major, lib->minor, lib->majorBuild, lib->build);
      }
       
      Output:
        qplip8_1.lib 7.0 build 205.68

Status Information Function

Use this function to get a brief description of the status code returned by the current Intel QPL software.

qplGetStatusString
Translates a status code into a message.

Syntax
const char* qplGetStatusString    (QplStatus StsCode   );

Include Files
qplcore.h

Parameters

StsCode                       Code that indicates the status type (see Table Status Codes and Messages)

Description
This function returns a pointer to the text string associated with a status code StsCode. Use this function to
produce error and warning messages. The returned pointer is a pointer to an internal static buffer and needs
not be released.
The status information function translates this code into the corresponding message Null Pointer Error:

   26
---------------------Page 27---------------------

                                                                          Support Functions  3 

Example
A code example below shows how to use the qplGetStatusString function. If you call an Intel QPL function,
in this example qpliSet_8u_C1R, with a NULL pointer, it returns an error code -8.
void statusInfo( void ) {
   QpliSize roi = {0};
   QplStatus st = qpliSet_8u_C1R(3, 0, 0, roi );
   printf( " %d : %s\n", st, qplGetStatusString( st ));
}
Output:
    -8, Null Pointer Error

Memory Allocation Functions

This section describes the Intel QPL functions that allocate aligned memory blocks for data of required type,
or free previously allocated memory.

     NOTE
     The only function to free the memory allocated by any of these functions is qpliFree().

Malloc
Allocates memory aligned to 64-byte boundary.

Syntax
Qpl<datatype>* qpliMalloc_<mod>  (int widthPixels  , int heightPixels ,  int* pStepBytes );
Supported values for mod:

 8u_C1        16u_C1       16s_C1        32s_C1       32f_C1       32sc_C1       32fc_C1
 8u_C2        16u_C2       16s_C2        32s_C2       32f_C2       32sc_C2       32fc_C2
 8u_C3        16u_C3       16s_C3        32s_C3       32f_C3       32sc_C3       32fc_C3
 8u_C4        16u_C4       16s_C4        32s_C4       32f_C4       32sc_C4       32fc_C4
 8u_AC4       16u_AC4      16s_AC4       32s_AC4      32f_AC4      32sc_AC4      32fc_AC4

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

widthPixels                 Width of an image in pixels

heightPixels                Height of an image in pixels

                                                                                         27
---------------------Page 28---------------------

 3    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

pStepBytes                    Pointer to the distance in bytes between starts of consecutive lines in the
                              image

Description
This function allocates a memory block aligned to 64-byte boundary for elements of different data types.
Every line of the image is aligned in accordance with the pStepBytes parameter, which is calculated by the
qpliMalloc  function and returned for further use.
The function qpliMalloc allocates one continuous memory block. Functions that operate on planar images
require an array of separate pointers (QplType* plane[3]) to each plane as an input. In this case, you
should call the qpliMalloc function three times.

Example
The code example below demonstrates how to construct an array and set correct values to the pointers to
use the allocated memory block with the Intel QPL functions operating on planar images. You need to specify
pStepBytes  for each plane. The example is given for the 8u data type.
int stepBytes[3];
Qpl8u* plane[3];
   plane[0] = qpliMalloc_8u_C1(widthPixels, heightPixels,
                               &(stepBytes [0]));
   plane[1] = qpliMalloc_8u_C1(widthPixels/2, heightPixels/2,
                               &(stepBytes [1]));
   plane[2] = qpliMalloc_8u_C1(widthPixels/2, heightPixels/2,
                               &(stepBytes [2]));

Return Values
The return value of qpliMalloc function is a pointer to an aligned memory block.
If no memory is available in the system, the NULL value is returned.
To free the allocated memory block, use the qpliFree function.

Free
Frees memory allocated by the function qpliMalloc.

Syntax
void qpliFree  (void* ptr );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h , qpls.h
Libraries: qplcore.lib, qplvm.lib , qpls.lib

   28
---------------------Page 29---------------------

                                                                               Support Functions  3  

Parameters

ptr                           Pointer to a memory block to be freed. This block must have been
                              previously allocated by the function qpliMalloc.

Description
This function frees the aligned memory block allocated by the function qpliMalloc.

      NOTE
      The function qpliFree cannot be used to free memory allocated by standard functions like malloc or
      calloc , nor can the memory allocated by qpliMalloc be freed by free.

                                                                                               29
---------------------Page 30---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Image Data Exchange and

Initialization Functions                                                       4

This chapter describes the Intel® QPL image processing functions that perform image data manipulation,
exchange and initialization operations.
Many solutions and hints for use of these functions can be found in Intel® QPL Samples. See Intel® QPL Image
Processing and Media Processing Samples downloadable from http://www.intel.com/cd/software/products/
asmo-na/eng/220046.htm.

Convert
Converts image pixel values from one data type to
another.

Syntax
Case 1: Conversion to increase bit depth and change signed to unsigned type
QplStatus qpliConvert_<mod>(const Qpl<srcDatatype>* pSrc ,  int srcStep,
Qpl<dstDatatype>* pDst, int dstStep , QpliSize roiSize );
Supported values for mod:

 8u16u_C1R         8u16s_C1R         8u32s_C1R         8u32f_C1R         8s32s_C1R
 8u16u_C3R         8u16s_C3R         8u32s_C3R         8u32f_C3R         8s32s_C3R
 8u16u_C4R         8u16s_C4R         8u32s_C4R         8u32f_C4R         8s32s_C4R
                                                                         
 8s32f_C1R         16u32s_C1R        16u32f_C1R        16s32s_C1R        16s32f_C1R
 8s32f_C3R         16u32s_C3R        16u32f_C3R        16s32s_C3R        16s32f_C3R
 8s32f_C4R         16u32s_C4R        16u32f_C4R        16s32s_C4R        16s32f_C4R
 8s8u_C1Rs         16s16u_C1Rs       16u32u_C1R        32s32u_C1Rs       32u32f_C1R
 8s16u_C1Rs        16s32u_C1Rs                         32s32f_C1R
 8s16s_C1R
 8s32u_C1Rs

QplStatus qpliConvert_1u8u_C1R (const Qpl8u* pSrc, int srcStep , int srcBitOffset , Qpl8u*
pDst, int dstStep, QpliSize roiSize );
THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliConvert_<mod>(const Qpl<srcDatatype>* pSrc ,  int srcStep,
Qpl<dstDatatype>* pDst, int dstStep , QpliSize roiSize );
Deprecated values for mod:

 8u16u_AC4R        8u16s_AC4R        8u32s_AC4R        8u32f_AC4R        8s32s_AC4R
 8s32f_AC4R        16u32s_AC4R       16u32f_AC4R       16s32s_AC4R       16s32f_AC4R

   30
---------------------Page 31---------------------

                                               Image Data Exchange and Initialization Functions  4 

Case 2: Conversion to reduce bit depth and change unsigned to signed type: integer to integer type
QplStatus qpliConvert_<mod>(const Qpl<srcDatatype>* pSrc ,  int srcStep,
Qpl<dstDatatype>* pDst, int dstStep , QpliSize roiSize );
Supported values for mod:

 16u8u_C1R         16s8u_C1R         32s8u_C1R         32s8s_C1R
 16u8u_C3R         16s8u_C3R         32s8u_C3R         32s8s_C3R
 16u8u_C4R         16s8u_C4R         32s8u_C4R         32s8s_C4R

QplStatus qpliConvert_<mod>(const Qpl<srcDatatype>* pSrc ,  int srcStep,
Qpl<dstDatatype>* pDst, int dstStep , QpliSize roiSize , QplRoundMode roundMode , int
scaleFactor);
Supported values for mod:

 8u8s_C1RSfs       16u8s_C1RSfs      32u8u_C1RSfs      32s16u_C1RSfs
                   16s8s_C1RSfs      32u8s_C1RSfs      32s16s_C1RSfs
                   16u16s_C1RSfs     32u16u_C1RSfs
                                     32u16s_C1RSfs
                                     32u32s_C1RSfs

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliConvert_<mod>(const Qpl<srcDatatype>* pSrc ,  int srcStep,
Qpl<dstDatatype>* pDst, int dstStep , QpliSize roiSize );
Deprecated values for mod:

 16u8u_AC4R        16s8u_AC4R        32s8u_AC4R        32s8s_AC4R

Floating point to integer type:
QplStatus qpliConvert_<mod>(const Qpl32f* pSrc , int srcStep , Qpl<dstDatatype>* pDst ,
int dstStep, QpliSize roiSize , QplRoundMode roundMode );
Supported values for mod:

 32f8u_C1R         32f8s_C1R         32f16u_C1R        32f16s_C1R
 32f8u_C3R         32f8s_C3R         32f16u_C3R        32f16s_C3R
 32f8u_C4R         32f8s_C4R         32f16u_C4R        32f16s_C4R
                                                       

QplStatus qpliConvert_<mod>(const Qpl32f* pSrc , int srcStep , Qpl<dstDatatype>* pDst ,
int dstStep, QpliSize roiSize , QplRoundMode roundMode , int scaleFactor);
Supported values for mod:

 32f8u_C1RSfs      32f16u_C1RSfs     32f32u_C1RSfs
 32f8s_C1RSfs      32f16s_C1RSfs     32f32s_C1RSfs

QplStatus qpliConvert_32f32u_C1IRSfs (Qpl32u* pSrcDst, int srcDstStep , QpliSize roiSize ,
QplRoundMode roundMode, int scaleFactor );

                                                                                     31
---------------------Page 32---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliConvert_<mod>   (const Qpl32f* pSrc   , int srcStep  , Qpl<dstDatatype>* pDst   ,
int dstStep , QpliSize roiSize   , QplRoundMode roundMode   );
Deprecated values for mod:
 32f8u_AC4R          32f8s_AC4R          32f16u_AC4R        32f16s_AC4R

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance, in bytes, between the starting points of consecutive lines in the
                              source image.

srcBitOffset                  Offset, in bits, from the first byte of the source image row.

pDst                          Pointer to the destination image ROI.

pSrcDst                       Pointer to the source and destination image ROI for in-place operation.

dstStep                       Distance, in bytes, between the starting points of consecutive lines in the
                              destination image.

srcDstStep                    Distance, in bytes, between the starting points of consecutive lines in the
                              source and destination image for in-place operation.

roiSize                       Size of the source and destination ROI in pixels.

scaleFactor                   Scale factor (see Integer Result Scaling).

roundMode                     Rounding mode, the following values are possible:

                              qplRndZero              specifies that floating-point values are
                                                      truncated to zero,
                              qplRndNear              specifies that floating-point values are
                                                      rounded to the nearest even integer when
                                                      the fractional part equals 0.5; otherwise
                                                      they are rounded to the nearest integer,
                              qplRndFinancial         specifies that floating-point values are
                                                      rounded down to the nearest integer when
                                                      the fractional part is less than 0.5, or
                                                      rounded up to the nearest integer if the
                                                      fractional part is equal or greater than 0.5.

Description
Functions qpliConvert_16s32f_AC4R  , qpliConvert_16s32s_AC4R  , qpliConvert_16s8u_AC4R   ,
qpliConvert_16u32f_AC4R   , qpliConvert_16u32s_AC4R  , qpliConvert_16u8u_AC4R  ,
qpliConvert_32f16s_AC4R   , qpliConvert_32f16u_AC4R  , qpliConvert_32f8s_AC4R   ,

   32
---------------------Page 33---------------------

                                                       Image Data Exchange and Initialization Functions  4 

qpliConvert_32f8u_AC4R    , qpliConvert_32s8s_AC4R    , qpliConvert_32s8u_AC4R    ,
qpliConvert_8s32f_AC4R    , qpliConvert_8s32s_AC4R    , qpliConvert_8u16s_AC4R    ,
qpliConvert_8u16u_AC4R    , qpliConvert_8u32f_AC4R    , and qpliConvert_8u32s_AC4R     are deprecated.
Use the C4R flavor instead.
For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI.
This function converts pixel values in the source image ROI pSrc to a different data type and writes them to
the destination image ROI pDst.
The result of integer operations is always saturated to the destination data type range. It means that if the
value of the source pixel is out of the data range of the destination image, the value of the corresponding
destination pixel is set to the value of the lower or upper bound (minimum or maximum) of the destination
data range:
x = pSrc[i,j]
if (x > MAX_VAL) x = MAX_VAL
if (x < MIN_VAL) x = MIN_VAL
pDst[i,j] = (CASTING)x
If you want to shift data from the signed range to the unsigned range and vice-versa, see "Application Notes"
below.
The function flavors with the Sfs descriptor in their names perform scaling of the internally computed results
in accordance with the scaleFactor  parameter.
When converting from floating-point to integer type, rounding defined by roundMode is performed, and the
result is saturated to the destination data type range.
1u to 8u conversion. The data type of the source image is 8u . It means that each byte consists of eight
consecutive pixels of the image (1 bit per pixel). You need to specify the start position of the ROI buffer in
the srcBitOffset   parameter. The qpliConvert_1u8u_C1R     function transforms each bit of the source
image into the pixel of the destination image in the following way:
•     if the input pixel is equal to 0, the corresponding output pixel is set to 0.
•     if the input pixel is equal to 1, the corresponding output pixel is set to 255.

      NOTE
      The bit order of each byte in the source image is inverse to the pixel order. It means that the first
      pixel in a row represents the last (seventh) bit of the first byte in a row.

Application Notes
When data is converted from the signed integer to the corresponding unsigned integer and vice versa (8s --
>8u, 16u --> 16s), the pixel information may be lost because all negative values will be set to zero (signed-
unsigned conversion), or unsigned values from the high half of the range will be set to the maximum value of
the signed range (unsigned - signed conversion).
If you need just to shift the data from the signed range to the unsigned range and vice versa, use the
function qpliXorC  with the parameter value  specified in such a way that the most significant bit is set to 1,
and all other bits are set to 0. For example, if you want to convert pixel values from Qpls16s type to Qpl16u
type with the rage shift call the function:
qpliXorC_16u_C1R( (Qpl16u *)pSrc, srcStep, 0x8000, pDst, dstStep, roiSize);
In this case the pixels values are converted as follows:
-32768 --> 0

                                                                                                   33
---------------------Page 34---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

-32767 --> 1
...
-1 --> 32767
0 --> 32768
1 --> 32769
...
32766 --> 65534
32767 --> 65535

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                   Indicates an error when any of the specified pointers is NULL, with the
                                   exception of second mode in Case 4.

qplStsSizeErr                      Indicates an error when roiSize has a field with zero or negative
                                   value, or srcBitOffset/dstBitOffset   is less than zero.

qplStsStepErr                      Indicates an error whensrcStep or dstStep has a zero or negative
                                   value.

qplStsMemAllocErr                  Indicates an error when memory allocation fails.

Example
The code example below shows data conversion without scaling.
      QplStatus convert( void ) {

         QpliSize roi={5,4};
         Qpl32f x[5*4];      
       
         Qpl8u y[5*4];
         qpliSet_32f_C1R( -1.0f, x, 5*sizeof(Qpl32f), roi );
               x[1] = 300; x[2] = 150;

   return qpliConvert_32f8u_C1R( x, 5*sizeof(Qpl32f), y, 5, roi, qplRndNear );
   }

The destination image y contains:

   00 FF 96 00 00
   00 00 00 00 00
   00 00 00 00 00
   00 00 00 00 00

See Also
Integer Result Scaling
Regions of Interest in Intel QPL

   34
---------------------Page 35---------------------

                                                    Image Data Exchange and Initialization Functions  4 

BinToGray, GrayToBin
Converts a bitonal image to a grayscale image and
vice versa.

Syntax
Case 1: Conversion of a bitonal image to a grayscale image
QplStatus qpliBinToGray_1u<dstDataType>_C1R(const Qpl8u* pSrc, int srcStep, int
srcBitOffset, Qpl<dstDataType>* pDst, int dstStep, QpliSize roiSize, Qpl<dstDataType>
loVal, Qpl8u* pBuffer  );
Supported values for dstDataType:

 8u                  16u                       16s                       32f

Case 2: Conversion of a grayscale image to a bitonal image
QplStatus qpliGrayToBin_<srcDataType>1u_C1R(const Qpl<srcDataType>* pSrc, int srcStep,
Qpl8u* pDst, int dstStep, int dstBitOffset, QpliSize roiSize, Qpl<sourceDataType>
threshold );
Supported values for srcDataType:

 8u                  16u                       16s                       32f

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance, in bytes, between the starting points of consecutive lines in the
                             source image.

srcBitOffset                 Offset, in bits, from the first byte of the source image row.

pDst                         Pointer to the destination image ROI.

dstStep                      Distance, in bytes, between the starting points of consecutive lines in the
                             destination image.

dstBitOffset                 Offset, in bits, from the first byte of the destination image row.

roiSize                      Size of the ROI in pixels.

loVal                        Destination value that corresponds to the "0" value of the corresponding
                             source element.

hiVal                        Destination value that corresponds to the "1" value of the corresponding
                             source element.

                                                                                             35
---------------------Page 36---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

threshold                      Threshold level.

Description
These functions operate with ROI.
The qpliBinToGray   function converts a bitonal image to grayscale, and the qpliGrayToBin function
converts a grayscale image to bitonal. The data type of the bitonal image is 8u. It means that each byte
consists of eight consecutive pixels of the image (1 bit per pixel). You need to specify the start position of the
ROI buffer in the srcBitOffset and dstBitOffset   parameters.
The qpliBinToGray   function transforms each bit of the source image into the pixel of the destination image
in the following way:
•     If the input pixel is equal to 0, the corresponding output pixel is set to loVal.
•     If the input pixel is equal to 1, the corresponding output pixel is set to hiVal.

The qpliGrayToBin   function transforms each pixel of the source image into the bit of the destination image
in the following way:
•     If the input pixel is more than the threshold value, the corresponding output bit is set to 1.
•     If the input pixel is less than, or equal to the threshold value, the corresponding output bit is set to 0.

Return Values

qplStsNoErr                         Indicates no error.

qplStsNullPtrErr                    Indicates an error when any of the specified pointers is   NULL .

qplStsStepErr                       Indicates an error when the   srcStep  or dstStep  value is less
                                    than, or equal to zero.
qplStsSizeErr                       Indicates an error when:
                                    •  roiSize  has a zero or negative value
                                    •     the srcBitOffset or dstBitOffset  value is less than zero

See Also
Regions of Interest in Intel QPL

Scale
Scales pixel values of an image and converts them to
another bit depth.

Syntax

Case 1: Scaling with conversion to integer data of increased bit depth
QplStatus qpliScale_<mod>    (const Qpl<srcDatatype>* pSrc      , int srcStep  ,  Qpl<dstDatatype>*
pDst,  int dstStep  , QpliSize roiSize   );
Supported values for mod:

 8u16u_C1R                         8u16s_C1R                          8u32s_C1R
 8u16u_C3R                         8u16s_C3R                          8u32s_C3R
 8u16u_C4R                         8u16s_C4R                          8u32s_C4R
                                                                      

   36
---------------------Page 37---------------------

                                                Image Data Exchange and Initialization Functions  4 

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliScale_<mod> (const Qpl<srcDatatype>* pSrc , int srcStep , Qpl<dstDatatype>*
pDst, int dstStep,  QpliSize roiSize);
Deprecated values for mod:

 8u16u_AC4R                    8u16s_AC4R                     8u32s_AC4R

Case 2: Scaling with conversion to floating-point data
QplStatus qpliScale_<mod> (const Qpl8u* pSrc,  int srcStep, Qpl32f* pDst , int dstStep ,
QpliSize roiSize, Qpli32f vMin , Qpli32f vMax );
Supported values for mod:

 8u32f_C1R
 8u32f_C3R
 8u32f_C4R
 

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliScale_8u32f_AC4R (const Qpl8u* pSrc , int srcStep,  Qpl32f* pDst, int
dstStep, QpliSize roiSize , Qpli32f vMin , Qpli32f vMax);
Case 3: Scaling of integer data with conversion to reduced bit depth
QplStatus qpliScale_<mod>  (const Qpl<srcDatatype>* pSrc , int srcStep , Qpl<dstDatatype>*
pDst, int dstStep,  QpliSize roiSize,  QplHintAlgorithm hint );
Supported values for mod:

 16u8u_C1R                     16s8u_C1R                      32s8u_C1R
 16u8u_C3R                     16s8u_C3R                      32s8u_C3R
 16u8u_C4R                     16s8u_C4R                      32s8u_C4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliScale_<mod>  (const Qpl<srcDatatype>* pSrc , int srcStep , Qpl<dstDatatype>*
pDst, int dstStep,  QpliSize roiSize,  QplHintAlgorithm hint );
Deprecated values for mod:

 16u8u_AC4R                    16s8u_AC4R                     32s8u_AC4R

Case 4: Scaling of floating-point data with conversion to integer data type
QplStatus qpliScale_<mod> (const Qpl32f* pSrc,  int srcStep, Qpl8u* pDst , int dstStep ,
QpliSize roiSize, Qpli32f vMin , Qpli32f vMax );
Supported values for mod:

 32f8u_C1R
 32f8u_C3R
 32f8u_C4R
 

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliScale_32f8u_AC4R (const Qpl32f* pSrc , int srcStep,  Qpl8u* pDst, int
dstStep, QpliSize roiSize , Qpli32f vMin , Qpli32f vMax);

                                                                                      37
---------------------Page 38---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h  , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib  , qpls.lib

Parameters

pSrc                           Pointer to the source image ROI.

srcStep                        Distance, in bytes, between the starting points of consecutive lines in the
                               source image.

pDst                           Pointer to the destination image ROI.

dstStep                        Distance, in bytes, between the starting bytes of consecutive lines in the
                               destination image.

roiSize                        Size of the source and destination ROI in pixels.

vMin , vMax                    Minimum and maximum values of the input data.

hint                           Option to select the algorithmic implementation of the function (see Hint
                               Arguments for Image Moment Functions).

Description
AC4R flavors of the qpliScale function are deprecated. These functions are obsolete and will be removed in
a future release. Use C4R flavor instead. Use the following link for details: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI.
This function converts pixel values of a source image ROI pSrc to the destination data type, using a linear
mapping. The computation algorithm is specified by the hint argument. For conversion between integer data
types, the whole range [src_Min..src_Max  ] of the input data type is mapped onto the range
[dst_Min..dst_Max   ] of the output data type.
The source pixel p is mapped to the destination pixel p′ by the following formula:
p′ = dst_Min + k*(p - src_Min)
where
k = (dst_Max - dst_Min)/(src_Max - src_Min)
For conversions to and from floating-point data type, the user-defined floating-point data range
[vMin..vMax ] is mapped onto the source or destination data type range.
If the conversion is from Qpl32f type and some of the input floating-point values are outside the specified
input data range [vMin..vMax ], the corresponding output values saturate. To determine the actual floating-
point data range in your image, use the qpliMinMax function.

Return Values

qplStsNoErr                         Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                    Indicates an error when any of the specified pointers is NULL.

   38
---------------------Page 39---------------------

                                                   Image Data Exchange and Initialization Functions  4 

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

qplStsStepErr                     Indicates an error condition if srcStep or dstStep has a zero or
                                  negative value.

qplStsScaleRangeErr               Indicates an error condition if the input data bounds are incorrect,
                                  that is, vMax is less than or equal to vMin .

Example
The code example below shows how to use scaling to preserve the data range.

QplStatus scale( void ) {
   QpliSize roi = {5,4};
   Qpl32f x[5*4];
   Qpl8u y[5*4];
   qpliSet_32f_C1R( -1.0f, x, 5*sizeof(Qpl32f), roi );
   x[1] = 300; x[2] = 150;
   return qpliScale_32f8u_C1R( x, 5*sizeof(Qpl32f), y, 5, roi, -1, 300 );
}

The destination image y contains:
00 FF 80 00 00
00 00 00 00 00
00 00 00 00 00
00 00 00 00 00

See Also
Regions of Interest in Intel QPL
Image Moments
Intel® Query Processing Library Concepts
MinMax Computes the minimum and maximum of image pixel values.

Set
Sets pixels of an array to a constant value.

Syntax

Case 1: Setting one-channel data to a value
QplStatus qpliSet_<mod>  (Qpl<datatype> value   , Qpl<datatype>* pDst  ,  int dstStep ,  QpliSize
roiSize);
Supported values for mod:

 8u_C1R             16u_C1R             16s_C1R             32s_C1R            32f_C1R

Case 2: Setting each color channel to a specified value
QplStatus qpliSet_<mod>  (const Qpl<datatype> value[3]    , Qpl<datatype>* pDst   , int dstStep ,
QpliSize roiSize );
Supported values for mod:

 8u_C3R             16u_C3R             16s_C3R             32s_C3R            32f_C3R

                                                                                            39
---------------------Page 40---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 8u_AC4R            16u_AC4R           16s_AC4R          32s_AC4R           32f_AC4R

Case 3: Setting color channels and alpha channel to specified values
QplStatus qpliSet_<mod> (const Qpl<datatype> value[4]   , Qpl<datatype>* pDst  , int dstStep ,
QpliSize roiSize );
Supported values for mod:

 8u_C4R             16u_C4R            16s_C4R           32s_C4R            32f_C4R

Case 4: Setting masked one-channel data to a value
QplStatus qpliSet_<mod> (Qpl<datatype> value  , Qpl<datatype>* pDst  , int dstStep , QpliSize
roiSize, const Qpl8u* pMask  , int maskStep );
Supported values for mod:

 8u_C1MR            16u_C1MR           16s_C1MR          32s_C1MR           32f_C1MR

Case 5: Setting color channels of masked multi-channel data to specified values
QplStatus qpliSet_<mod> (const Qpl<datatype> value[3]   , Qpl<datatype>* pDst  , int dstStep ,
QpliSize roiSize , const Qpl8u* pMask  , int maskStep );
Supported values for mod:

 8u_C3MR            16u_C3MR           16s_C3MR          32s_C3MR           32f_C3MR
 8u_AC4MR           16u_AC4MR          16s_AC4MR         32s_AC4MR          32f_AC4MR

Case 6: Setting all channels of masked multi-channel data to specified values
QplStatus qpliSet_<mod> (const Qpl<datatype> value[4]   , Qpl<datatype>* pDst  , int dstStep ,
QpliSize roiSize , const Qpl8u* pMask  , int maskStep );
Supported values for mod:

 8u_C4MR            16u_C4MR           16s_C4MR          32s_C4MR           32f_C4MR

Case 7: Setting selected channel of multi-channel data to a value
QplStatus qpliSet_<mod> (Qpl<datatype> value  , Qpl<datatype>* pDst  , int dstStep , QpliSize
roiSize);
Supported values for mod:

 8u_C3CR            16u_C3CR           16s_C3CR          32s_C3CR           32f_C3CR
 8u_C4CR            16u_C4CR           16s_C4CR          32s_C4CR           32f_C4CR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

   40
---------------------Page 41---------------------

                                                       Image Data Exchange and Initialization Functions  4 

Parameters

value                          Constant value to assign to each pixel in the destination image ROI.

pDst                           Pointer to the destination image ROI.

dstStep                        Distance, in bytes, between the starting points of consecutive lines in the
                               destination image.

roiSize                        Size of the image ROI in pixels.

pMask                          Pointer to the mask image buffer.

maskStep                       Distance, in bytes, between the starting points of consecutive lines in the
                               mask image buffer.

Description
This function operates with ROI.
This function sets pixels in the destination image ROI pDst to the value constant. Either all pixels in a
rectangular ROI, or only those selected by the specified mask pMask, can be set to a value. In case of
masked operation, the function sets pixel values in the destination buffer only if the spatially corresponding
mask array value is non-zero. When a channel of interest is selected, that is only one channel of a multi-
channel image must be set (see Case 7), the pDst  pointer points to the start of ROI buffer in the required
channel. If alpha channel is present in the source image data, the alpha components may be either skqpled,
or set to a value, depending on the chosen qpliSet function flavor.
This function supports negative step value.

Return Values

qplStsNoErr                          Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                     Indicates an error when any of the specified pointers is NULL.

qplStsSizeErr                        Indicates an error condition if roiSize has a field with zero or
                                     negative value.

qplStsStepErr                        Indicates an error condition if dstStep or maskStep has a zero value.

Example
The code example below shows how to use the function  qpliSet_8u_C1R  .
void func_set()
{    
    QpliSize roi = {5,4};
    Qpl8u x[8*4] = {0};
        
    qpliSet_8u_C1R(1, x, 8, roi);
}

Result:
01 01 01 01 01 00 00 00
01 01 01 01 01 00 00 00
01 01 01 01 01 00 00 00
01 01 01 01 01 00 00 00

                                                                                                   41
---------------------Page 42---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

See Also
Regions of Interest in Intel QPL

Copy

Copies pixel values between two buffers.

Syntax

Case 1: Copying all pixels of all color channels
QplStatus qpliCopy_<mod> (const Qpl<datatype>* pSrc  , int srcStep,  Qpl<datatype>* pDst ,
int dstStep, QpliSize roiSize );
Supported values for mod:

 8u_C1R            16u_C1R            16s_C1R           32s_C1R            32f_C1R
 8u_C3R            16u_C3R            16s_C3R           32s_C3R            32f_C3R
 8u_C4R            16u_C4R            16s_C4R           32s_C4R            32f_C4R
 8u_AC4R           16u_AC4R           16s_AC4R          32s_AC4R           32f_AC4R
 8u_C3AC4R         16u_C3AC4R         16s_C3AC4R        32s_C3AC4R         32f_C3AC4R
 8u_AC4C3R         16u_AC4C3R         16s_AC4C3R        32s_AC4C3R         32f_AC4C3R

Case 2: Copying masked pixels only
QplStatus qpliCopy_<mod> (const Qpl<datatype>* pSrc  , int srcStep,  Qpl<datatype>* pDst ,
int dstStep, QpliSize roiSize ,const Qpl8u* pMask  , int maskStep );
Supported values for mod:

 8u_C1MR           16u_C1MR           16s_C1MR          32s_C1MR           32f_C1MR
 8u_C3MR           16u_C3MR           16s_C3MR          32s_C3MR           32f_C3MR
 8u_C4MR           16u_C4MR           16s_C4MR          32s_C4MR           32f_C4MR
 8u_AC4MR          16u_AC4MR          16s_AC4MR         32s_AC4MR          32f_AC4MR

Case 3: Copying a selected channel in a multi-channel image
QplStatus qpliCopy_<mod> (const Qpl<datatype>* pSrc  , int srcStep,  Qpl<datatype>* pDst ,
int dstStep, QpliSize roiSize );
Supported values for mod:

 8u_C3CR           16u_C3CR           16s_C3CR          32s_C3CR           32f_C3CR
 8u_C4CR           16u_C4CR           16s_C4CR          32s_C4CR           32f_C4CR

Case 4: Copying a selected channel to a one-channel image
QplStatus qpliCopy_<mod> (const Qpl<datatype>* pSrc  , int srcStep,  Qpl<datatype>* pDst ,
int dstStep, QpliSize roiSize );
Supported values for mod:

 8u_C3C1R          16u_C3C1R          16s_C3C1R         32s_C3C1R          32f_C3C1R
 8u_C4C1R          16u_C4C1R          16s_C4C1R         32s_C4C1R          32f_C4C1R

   42
---------------------Page 43---------------------

                                                 Image Data Exchange and Initialization Functions  4 

Case 5: Copying a one-channel image to a multi-channel image
QplStatus qpliCopy_<mod> (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype>* pDst  ,
int dstStep,  QpliSize roiSize );
Supported values for mod:

 8u_C1C3R          16u_C1C3R          16s_C1C3R          32s_C1C3R          32f_C1C3R
 8u_C1C4R          16u_C1C4R          16s_C1C4R          32s_C1C4R          32f_C1C4R

Case 6: Splitting color image into separate planes
QplStatus qpliCopy_<mod> (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype>* const
pDst[3], int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C3P3R          16u_C3P3R          16s_C3P3R          32s_C3P3R          32f_C3P3R
                                                                            

QplStatus qpliCopy_<mod> (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype>* const
pDst[4], int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C4P4R          16u_C4P4R          16s_C4P4R          32s_C4P4R          32f_C4P4R
                                                                            

Case 7: Composing color image from separate planes
QplStatus qpliCopy_<mod> (const Qpl<datatype>* const pSrc[3]   , int srcStep ,
Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_P3C3R          16u_P3C3R          16s_P3C3R          32s_P3C3R          32f_P3C3R
                                                                            

QplStatus qpliCopy_<mod> (const Qpl<datatype>* const pSrc[4]   , int srcStep ,
Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_P4C4R          16u_P4C4R          16s_P4C4R          32s_P4C4R          32f_P4C4R
                                                                            

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI. The array storing pointers to the color
                            planes of the source planar image.

                                                                                        43
---------------------Page 44---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

srcStep                         Distance, in bytes, between the starting points of consecutive lines in the
                                source image.

pDst                            Pointer to the destination image ROI. The array storing pointers to the color
                                planes of the destination planar image.

dstStep                         Distance, in bytes, between the starting points of consecutive lines in the
                                destination image.

roiSize                         Size of the source and destination ROI in pixels.

pMask                           Pointer to the mask image buffer.

maskStep                        Distance, in bytes, between the starting points of consecutive lines in the
                                mask image buffer.

Description
This function operates with ROI.
This function copies data from the source image pSrc to the destination image pDst. Copying pixels selected
by a mask pMask  is supported as well.
For masked operation (Case 2), the function writes pixel values in the destination buffer only if the spatially
corresponding mask array value is non-zero (as illustrated in the code example below).
Function flavors operating with the channel of interest (descriptor C) copy only one specified channel of a
source multi-channel image to the channel of another multi-channel image (see Case 3). For these
functions, the pSrc and pDst pointers point to the starts of ROI buffers in the specified channels of source
and destination images, respectively.
Some function flavors add alpha channel to the 3-channel source image (flavors with the _C3AC4R
descriptor), or discard alpha channel from the source image (flavors with the _AC4C3R descriptor) - see Case
1.
Special function flavors copy data from only one specified channel pSrc of a multi-channel image to a one-
channel image pDst  (see Case 4), as well as to copy data from a one-channel image pSrc  to only one
specified channel of a multi-channel image pDst (see Case 5).
You can also use the qpliCopy  function to convert the interleaved color image into separate planes and vice
versa (see Case 6 and Case 7).

Return Values

qplStsNoErr                          Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                     Indicates an error when any of the specified pointers is NULL, with the
                                     exception of second mode in Case 4.

qplStsSizeErr                        Indicates an error condition if roiSize has a field with a zero or
                                     negative value.

qplStsStepErr                        Indicates an error condition if srcStep or dstStep is less than
                                     roiSize.width * <pixelSize>       for Cases 4 and 5.

    44
---------------------Page 45---------------------

                                                   Image Data Exchange and Initialization Functions  4 

Example
The code example below shows how to copy masked data.
      QplStatus copyWithMask( void ) {
      Qpl8u mask[3*3], x[5*4], y[5*4]={0};
      QpliSize imgroi={5,4}, mskroi={3,3};
      qpliSet_8u_C1R( 3, x, 5, imgroi );
      /// set mask with a hole in upper left corner
      qpliSet_8u_C1R( 1, mask, 3, mskroi );
      mask[0] = 0;
      /// copy roi with mask
      return qpliCopy_8u_C1MR( x, 5, y, 5, mskroi, mask, 3 );
   }

The destination image y contains:
   00 03 03 00 00
   03 03 03 00 00
   03 03 03 00 00
   00 00 00 00 00

See Also
Regions of Interest in Intel QPL

CopyManaged
Copies pixel values between two images in accordance
with the specified type of copying.

Syntax
QplStatus qpliCopyManaged_8u_C1R   (const Qpl8u* pSrc  ,  int srcStep , Qpl8u* pDst  , int
dstStep,  QpliSize roiSize  , int flags );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance, in bytes, between the starting points of consecutive lines in the
                             source image.

pDst                         Pointer to the destination image ROI.

dstStep                      Distance, in bytes, between the starting points of consecutive lines in the
                             destination image.

roiSize                      Size of the image ROI in pixels.

flags                        Specifies the type of copying. Possible values are:
                             •  QPL_TEMPORAL_COPY   - standard copying

                                                                                            45
---------------------Page 46---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

                               •  QPL_NONTEMPORAL_STORE      - copying without caching the destination
                                  image
                               •  QPL_NONTEMPORAL_LOAD      - processor uses non-temporal load
                                  instructions

Description
This function operates with ROI.
This function copies data from a source image ROI pSrc to the destination image ROI pDst. The flags
parameter specifies the type of copying that the function performs:
•     When flags is set to QPL_TEMPORAL_COPY, the function is identical to the qpliCopy_8u_C1R function.
•     When flags is set to QPL_NONTEMPORAL_STORE , the processor uses non-temporal store instructions.
   Copying is performed without caching the data of the destination image.
•     When flags is set to QPL_NONTEMPORAL_LOAD , the processor uses non-temporal load instructions.

To achieve better performance, align data to 64-byte boundary.

 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

Return Values

qplStsNoErr                          Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                     Indicates an error when one of the specified pointers is NULL.

qplStsSizeErr                        Indicates an error when roiSize  has a field with a zero or negative
                                     value.

See Also
Regions of Interest in Intel QPL

CopyConstBorder
Copies pixels values between two images and adds
the border pixels with a constant value.

   46
---------------------Page 47---------------------

                                                  Image Data Exchange and Initialization Functions  4 

Syntax

Case 1: Operation on one-channel data
QplStatus qpliCopyConstBorder_<mod>  (const Qpl<datatype>* pSrc   , int srcStep , QpliSize
srcRoiSize,  Qpl<datatype>* pDst , int dstStep ,  QpliSize dstRoiSize ,  int
topBorderHeight , int leftBorderWidth  , Qpl<datatype> value );
Supported values for mod:

 8u_C1R             16u_C1R            16s_C1R           32s_C1R            32f_C1R

Case 2: Operation on multi-channel data
QplStatus qpliCopyConstBorder_<mod>  (const Qpl<datatype>* pSrc   , int srcStep , QpliSize
srcRoiSize,  Qpl<datatype>* pDst , int dstStep ,  QpliSize dstRoiSize ,  int
topBorderHeight , int leftBorderWidth  , const Qpl<datatype> value[3]  );
Supported values for mod:

 8u_C3R             16u_C3R            16s_C3R           32s_C3R            32f_C3R
 8u_AC4R            16u_AC4R           16s_AC4R          32s_AC4R           32f_AC4R

QplStatus qpliCopyConstBorder_<mod>  (const Qpl<datatype>* pSrc   , int srcStep , QpliSize
srcRoiSize,  Qpl<datatype>* pDst , int dstStep ,  QpliSize dstRoiSize ,  int
topBorderHeight , int leftBorderWidth  , const Qpl<datatype> value[4]  );
Supported values for mod:

 8u_C4R             16u_C4R            16s_C4R           32s_C4R            32f_C4R

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI.

srcStep                     Distance in bytes between starts of consecutive lines in the source image.

pDst                        Pointer to the destination image.

dstStep                     Distance in bytes between starts of consecutive lines in the destination
                            image.

srcRoiSize                  Size of the source ROI in pixels.

dstRoiSize                  Size of the desctination ROI in pixels.

topBorderHeight             Height of the top border in pixels.

leftBorderWidth             Width of the left border in pixels.

                                                                                         47
---------------------Page 48---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

value                          The constant value to assign to the border pixels (constant vector in case of
                               multi-channel images).

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function copies the source image pSrc to the destination image pDst and creates border outside the
copied area; pixel values of the border are set to the specified constant value that is passed by the value
argument. The parameters  topBorderHeight    and leftBorderWidth   specify the position of the first pixel of
the source ROI in the destination image ROI (see Figure Creating a Border of Pixels with Constant Value.)
Squares marked in red correspond to pixels copied from the source image, that is, the source image ROI.

Creating a Border of Pixels with Constant Value

 

 

The height (width) of the destination ROI cannot be less than the sum of the height (width) of source ROI
and the topBorderHeight   (leftBorderWidth   ) parameter.

Return Values

qplStsNoErr                         Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                    Indicates an error when any of the specified pointers is NULL.

qplStsSizeErr                       Indicates an error condition if srcRoiSize or dstRoiSize has a field
                                    with a zero or negative value, or topBorderHeight  or
                                    leftBorderWidth    is less than zero, or dstRoiSize.width <
                                    srcRoiSize.width + leftBorderWidth       , or dstRoiSize.height <
                                    srcRoiSize.height + topBorderHeight       .

qplStsStepErr                       Indicates an error condition if srcStep or dstStep has a zero or
                                    negative value.

   48
---------------------Page 49---------------------

                                                 Image Data Exchange and Initialization Functions  4 

Example
The code example below shows how to use the function qpliCopyConstBorder_8u_C1R.
Qpl8u src[8*4] = {3, 3, 3, 3, 3, 8, 8, 8,
                  3, 2, 1, 2, 3, 8, 8, 8,
                  3, 2, 1, 2, 3, 8, 8, 8,
                  3, 3, 3, 3, 3, 8, 8, 8};
Qpl8u dst[8*6];
QpliSize srcRoi = { 5, 4 };
QpliSize dstRoi = { 7, 6 };
int borderWidth  = 1;
int borderHeight = 1;
int borderVal = 0;
        
qpliCopyConstBorder_8u_C1R(src, 8, srcRoi, dst, 8, dstRoi, borderHeight, borderWidth, borderVal);

        Results
source image:
3 3 3 3 3 8 8 8
3 2 1 2 3 8 8 8
3 2 1 2 3 8 8 8   src
3 3 3 3 3 8 8 8
        
destination image:
0 0 0 0 0 0 0
0 3 3 3 3 3 0
0 3 2 1 2 3 0
0 3 2 1 2 3 0    dst
0 3 3 3 3 3 0
0 0 0 0 0 0 0
    

CopyReplicateBorder

Copies pixels values between two images and adds
the replicated border pixels.

Syntax

Case 1: Not-in-place operation
QplStatus qpliCopyReplicateBorder_<mod>  (const Qpl<datatype>* pSrc  , int srcStep ,
QpliSize srcRoiSize , Qpl<datatype>* pDst ,  int dstStep,  QpliSize dstRoiSize , int
topBorderHeight , int leftBorderWidth );
Supported values for mod:

 8u_C1R            16u_C1R            16s_C1R            32s_C1R           32f_C1R
 8u_C3R            16u_C3R            16s_C3R            32s_C3R           32f_C3R
 8u_C4R            16u_C4R            16s_C4R            32s_C4R           32f_C4R
 8u_AC4R           16u_AC4R           16s_AC4R           32s_AC4R          32f_AC4R

                                                                                        49
---------------------Page 50---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliCopyReplicateBorder_<mod>      ( const Qpl<datatype>* pSrc    , int srcDstStep   ,
QpliSize srcRoiSize   , QpliSize dstRoiSize    , int topBorderHeight    , int leftBorderWidth   );
Deprecated values for mod:

 8u_C1IR             16u_C1IR             16s_C1IR            32s_C1IR             32f_C1IR
 8u_C3IR             16u_C3IR             16s_C3IR            32s_C3IR             32f_C3IR
 8u_C4IR             16u_C4IR             16s_C4IR            32s_C4IR             32f_C4IR
 8u_AC4IR            16u_AC4IR            16s_AC4IR           32s_AC4IR            32f_AC4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h , qpls.h
Libraries: qplcore.lib, qplvm.lib , qpls.lib

Parameters

pSrc                           Pointer to the source image ROI.

srcStep                        Distance in bytes between starts of consecutive lines in the source image.

pDst                           Pointer to the destination image.

dstStep                        Distance in bytes between starts of consecutive lines in destination image.

srcDstStep                     Distance in bytes between starts of consecutive lines in the source and the
                               destination image.

srcRoiSize                     Size of the source ROI in pixels.

dstRoiSize                     Size of the destination ROI in pixels.

topBorderHeight                Height of the top border in pixels.

leftBorderWidth                Width of the left border in pixels.

Description
The in-place flavors of qpliCopyReplicateBorder  are deprecated. In-place functionality will be removed in
a future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function copies the source image pSrc to the destination image pDst and fills pixels ("border") outside
the copied area in the destination image with the values of the source image pixels according to the scheme
illustrated in Figure Creating a Replicated Border. Squares marked in red correspond to pixels copied from
the source image, that is, the source image ROI.
Note that the in-place function flavor actually adds border pixels to the source image ROI, thus a destination
image ROI is larger than the initial image.

   50
---------------------Page 51---------------------

                                                    Image Data Exchange and Initialization Functions  4 

The parameters topBorderHeight  and leftBorderWidth   specify the position of the first pixel of the source
ROI in the destination image ROI.

Creating a Replicated Border

The height (width) of the destination ROI cannot be less than the sum of the height (width) of source ROI
and the topBorderHeight  (leftBorderWidth ) parameter.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                  Indicates an error when any of the specified pointers is NULL.

qplStsSizeErr                     Indicates an error condition if srcRoiSize or dstRoiSize has a field
                                  with a zero or negative value, or topBorderHeight or
                                  leftBorderWidth   is less than zero, or dstRoiSize.width <
                                  srcRoiSize.width + leftBorderWidth     , or dstRoiSize.height <
                                  srcRoiSize.height + topBorderHeight     .

qplStsStepErr                     Indicates an error condition if srcStep or dstStep has a zero or
                                  negative value.

Example
The code example below shows how to use the qpliCopyReplicateBorder_8u_C1R    function.
Qpl8u src[8*4] = {5, 4, 3, 4, 5, 8, 8, 8,
                3, 2, 1, 2, 3, 8, 8, 8,
                3, 2, 1, 2, 3, 8, 8, 8,
                5, 4, 3, 4, 5, 8, 8, 8};
Qpl8u dst[9*8];
QpliSize srcRoi = { 5, 4 };
QpliSize dstRoi = { 9, 8 };
int topborderHeight  = 2;
int leftborderWidth  = 2;
        
qpliCopyReplicateBorder_8u_C1R(src, 8, srcRoi, dst, 9, dstRoi, topBorderHeight, leftBorderWidth);

        Results
source image:

                                                                                             51
---------------------Page 52---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

5 4 3 4 5 8 8 8
3 2 1 2 3 8 8 8
3 2 1 2 3 8 8 8
5 4 3 4 5 8 8 8
        
destination image:
5 5 5 4 3 4 5 5 5
5 5 5 4 3 4 5 5 5
5 5 5 4 3 4 5 5 5
3 3 3 2 1 2 3 3 3
3 3 3 2 1 2 3 3 3
5 5 5 4 3 4 5 5 5
5 5 5 4 3 4 5 5 5
5 5 5 4 3 4 5 5 5
    

CopyWrapBorder

Copies pixels values between two images and adds
the border pixels.

Syntax

Case 1: Not-in-place operation
QplStatus qpliCopyWrapBorder_32s_C1R  (const Qpl32s* pSrc , int srcStep , QpliSize
srcRoiSize, Qpl32s* pDst , int dstStep , QpliSize dstRoiSize  , int topBorderHeight , int
leftBorderWidth );
QplStatus qpliCopyWrapBorder_32f_C1R  (const Qpl32f* pSrc , int srcStep , QpliSize
srcRoiSize, Qpl32f* pDst , int dstStep , QpliSize dstRoiSize  , int topBorderHeight , int
leftBorderWidth );
Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliCopyWrapBorder_32s_C1IR  (const Qpl32s* pSrc , int srcDstStep ,  QpliSize
srcRoiSize, QpliSize dstRoiSize  , int topBorderHeight , int leftBorderWidth  );
QplStatus qpliCopyWrapBorder_32f_C1IR  (const Qpl32f* pSrc , int srcDstStep ,  QpliSize
srcRoiSize, QpliSize dstRoiSize  , int topBorderHeight , int leftBorderWidth  );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI.

srcStep                     Distance in bytes between starts of consecutive lines in the source image.

pDst                        Pointer to the destination image ROI.

   52
---------------------Page 53---------------------

                                                        Image Data Exchange and Initialization Functions  4 

dstStep                         Distance in bytes between starts of consecutive lines in the destination
                                image.

srcDstStep                      Distance in bytes between starts of consecutive lines in the source and
                                destination image for in-place flavor.

srcRoiSize                      Size of the source ROI in pixels.

dstRoiSize                      Size of the desctination ROI in pixels.

topBorderHeight                 Height of the top border in pixels.

leftBorderWidth                 Width of the left border in pixels.

Description
The in-place flavors of qpliCopyWrapBorder   are deprecated. In-place functionality will be removed in a
future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function copies the source image pSrc to the destination image pDst and fills pixels ("border") outside
the copied area in the destination image with the values of the source image pixels according to the scheme
illustrated in Figure Creating a Border of Pixels by qpliCopyWrapBorder Function. Squares marked in red
correspond to pixels copied from the source image.
Note that the in-place function flavor actually adds border pixels to the source image ROI, thus a destination
image ROI is larger than the initial image.
The parameters topBorderHeight     and leftBorderWidth    specify the position of the first pixel of the source
ROI in the destination image ROI.

Creating a Border of Pixels by qpliCopyWrapBorder Function

The height (width) of the destination ROI cannot be less than the sum of the height (width) of source ROI
and the topBorderHeight    (leftBorderWidth   ) parameter.

                                                                                                    53
---------------------Page 54---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                  Indicates an error when any of the specified pointers is NULL.

qplStsSizeErr                     Indicates an error condition if srcRoiSize or dstRoiSize has a field
                                  with a zero or negative value, or topBorderHeight or
                                  leftBorderWidth   is less than zero, or dstRoiSize.width <
                                  srcRoiSize.width + leftBorderWidth     , or dstRoiSize.height <
                                  srcRoiSize.height + topBorderHeight     .

qplStsStepErr                     Indicates an error condition if srcStep or dstStep has a zero or
                                  negative value.

qplStsNotEvenStepErr              Indicates an error condition if one of the step values is not divisible by
                                  4 for floating point images, or by 2 for short integer images.

Example
The code example below shows how to use the qpliCopyWrapBorder_32s_C1R   function.
Qpl32s src[8*4] = {
       5, 4, 3, 4, 5, 8, 8, 8,
       3, 2, 1, 2, 3, 8, 8, 8,
       3, 2, 1, 2, 3, 8, 8, 8,
       5, 4, 3, 4, 5, 8, 8, 8
       };
Qpl32s dst[9*8];
QpliSize srcRoi = { 5, 4 };
QpliSize dstRoi = { 9, 8 };
int topborderHeight  = 2;
int leftborderWidth = 2;
        
qpliCopyWrapBorder_32s_C1R (src, 8*sizeof(Qpl32s), srcRoi, dst, 
                   9*sizeof(Qpl32s), dstRoi, topBorderHeight, leftBorderWidth);
        

        Results
source image:
   5 4 3 4 5 8 8 8
   3 2 1 2 3 8 8 8
   3 2 1 2 3 8 8 8
   5 4 3 4 5 8 8 8
        
destination image:
   2 3 3 2 1 2 3 3 2
   4 5 5 4 3 4 5 5 4
   4 5 5 4 3 4 5 5 4
   2 3 3 2 1 2 3 3 2
   2 3 3 2 1 2 3 3 2
   4 5 5 4 3 4 5 5 4
   4 5 5 4 3 4 5 5 4
   2 3 3 2 1 2 3 3 2
    

   54
---------------------Page 55---------------------

                                                     Image Data Exchange and Initialization Functions  4 

CopySubpix
Copies pixel values between two images with subpixel
precision.

Syntax

Case 1: Copying without conversion or with conversion to floating point data
QplStatus qpliCopySubpix_<mod>    (const Qpl<srcDatatype>* pSrc    ,  int srcStep ,
Qpl<dstDatatype>* pDst   , int dstStep  , QpliSize roiSize   , Qpl32f dx ,  Qpl32f dy );
Supported values for mod:
 8u_C1R                           16u_C1R                           32f_C1R
 8u32f_C1R                        16u32f_C1R                         

Case 2: Copying with conversion to integer data
QplStatus qpliCopySubpix_8u16u_C1R_Sfs     (const Qpl8u* pSrc   , int srcStep  , Qpl16u* pDst  ,
int dstStep ,  QpliSize roiSize  , Qpl32f dx  , Qpl32f dy ,  int scaleFactor  );

Include Files
qplcv.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source image.

pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the destination
                              image.

roiSize                       Size of the source and destination ROI in pixels.

dx                            Fractional part of the x-coordinate in the source image.

dy                            Fractional part of the y-coordinate in the source image.

scaleFactor                   Scale factor (see Integer Result Scaling).

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function computes the pixel value of the destination image using linear interpolation (see Linear
Interpolation in Appendix B) in accordance with the following formula:
 

 

                                                                                              55
---------------------Page 56---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

where i = 0, ... roiSize.height - 1    , j = 0, ... roiSize.width - 1    .

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                  Indicates an error when any of the specified pointers is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

qplStsStepErr                     Indicates an error condition if srcStep or dstStep is less than
                                  roiSize.width * <pixelSize>   .

qplStsNotEvenStepErr              Indicates an error condition if one of srcStep or dstStep is not
                                  divisible by 4 for floating point images, or by 2 for short integer
                                  images.

CopySubpixIntersect

Copies pixel values of the intersection with specified
window with subpixel precision.

Syntax

Case 1: Copying without conversion or with conversion to floating point data
QplStatus qpliCopySubpixIntersect_<mod>    (const Qpl<srcDatatype>* pSrc   ,  int srcStep ,
QpliSize srcRoiSize  , Qpl<dstDatatype>* pDst   , int dstStep ,  QpliSize dstRoiSize  ,
QpliPoint_32f point  , QpliPoint* pMin  , QpliPoint* pMax  );
Supported values for mod:

 8u_C1R                          16u_C1R                          32f_C1R
 8u32f_C1R                       16u32f_C1R                        

Case 2: Copying with conversion to integer data
QplStatus qpliCopySubpixIntersect_8u16u_C1R_Sfs     (const Qpl8u* pSrc  , int srcStep  ,
QpliSize srcRoiSize  , Qpl16u* pDst  , int dstStep ,  QpliSize dstRoiSize  , QpliPoint_32f
point, QpliPoint* pMin  ,  QpliPoint* pMax ,  int scaleFactor );

Include Files
qplcv.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source image.

   56
---------------------Page 57---------------------

                                                       Image Data Exchange and Initialization Functions  4 

srcRoiSize                     Size of the source image ROI in pixels.

pDst                           Pointer to the destination image ROI.

dstStep                        Distance in bytes between starts of consecutive lines in the source and
                               destination image.

dstRoiSize                     Size of the destination ROI in pixels.

point                          Center point of the window.

pMin                           Pointer to coordinates of the top left pixel of the intersection in the
                               destination image.

pMax                           Pointer to coordinates of the bottom right pixel of the intersection in the
                               destination image.

scaleFactor                    Scale factor (see Integer Result Scaling).

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function determines the intersection of the source image and the window of size dstRoiSize centered
in point point. The corresponding pixels of the destination image are calculated using linear interpolation
(see Linear Interpolation in Appendix B) in accordance with the following formula:
 

 
where Xsubpix(j) = min(max (point.x  + j - 0.5*(dstRoiSize.width   - 1), 0), srcRoiSize.width  - 1),
Ysubpix(i) = min(max(point.y  + i - 0.5*(dstRoiSize.height   - 1), 0), srcRoiSize.height   - 1),
i = 0, ... dstRoiSize.height - 1       , j = 0, ... dstRoiSize.width - 1       .

                                                                                                  57
---------------------Page 58---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Minimal values of j and i (coordinates of the top left calculated destination pixel) are assigned to pMin.x and
pMin.y, maximal values (coordinates of the top left calculated destination pixel) - to pMin.x and pMin.y.
(See Figure Image Copying with Subpixel Precision Using qpliCopySubpixIntersect  Function.)

Image Copying with Subpixel Precision Using qpliCopySubpixIntersect Function

The height (width) of the destination ROI cannot be less than the sum of the height (width) of source ROI
and the topBorderHeight   (leftBorderWidth ) parameter.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                   Indicates an error when any of the specified pointers is NULL.

qplStsSizeErr                      Indicates an error condition if srcRoiSize or dstRoiSize has a field
                                   with a zero or negative value.

qplStsStepErr                      Indicates an error condition if srcStep is less than
                                   srcRoiSize.width * <pixelSize>     , or dstStep is less than
                                   dstRoiSize.width * <pixelSize>     .

Example
The code example below shows how to use the function qpliCopySubpixIntersect_8u_C1R   .
Qpl8u src[8*6] = {
      7, 7, 6, 6, 6, 6, 7, 7,
      6, 5, 5, 5, 5, 5, 5, 6,
      6, 5, 4, 3, 3, 4, 5, 6,
      6, 5, 4, 3, 3, 4, 5, 6,
      6, 5, 5, 5, 5, 5, 5, 6,
      6, 6, 6, 6, 6, 6, 6, 6
    };
Qpl8u dst[7*4];
QpliSize srcRoi = { 8, 6 };
QpliSize dstRoi = { 7, 4 };
QpliPoint_32f point = { 4, 1 };

   58
---------------------Page 59---------------------

                                                   Image Data Exchange and Initialization Functions  4 
QpliPoint min;
QpliPoint max;
        
qpliCopySubpixIntersect_8u_C1R (src, 8, srcRoi, dst, 7, dstRoi, point, &min, &max );

        Results
source image:
7 7 6 6 6 6 7 7
6 5 5 5 5 5 5 6
6 5 4 3 3 4 5 6
6 5 4 3 3 4 5 6
6 5 5 5 5 5 5 6
6 6 6 6 6 6 6 6
        
destination image:
7 6 6 6 6 7 7
6 6 6 6 6 6 7
5 5 4 4 5 5 6
5 4 3 3 4 5 6
        
min = { 0, 1 }
max = { 5, 3 }
    

Dup

Copies a gray scale image to all channels of the color
image.

Syntax

QplStatus qpliDup_8u_C1C3R  (const Qpl8u* pSrc  , int srcStep  , Qpl8u* pDst , int dstStep  ,
QpliSize roiSize );
QplStatus qpliDup_8u_C1C4R  (const Qpl8u* pSrc  , int srcStep  , Qpl8u* pDst , int dstStep  ,
QpliSize roiSize );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source image.

pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the destination
                             image.

                                                                                           59
---------------------Page 60---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function copies a one-channel (gray scale) image pSrc to each channel of the multi-channel image
pDst.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                  Indicates an error when any of the specified pointers is NULL.

qplStsSizeErr                     Indicates an error condition if RoiSize has a field with a zero or
                                  negative value.

Transpose
Transposes a source image.

Syntax

Case 1: Not-in-place operation
QplStatus qpliTranspose_<mod>   (const Qpl<datatype>* pSrc   , int srcStep ,  Qpl<datatype>*
pDst, int dstStep  , QpliSize roiSize  );
Supported values for mod:

 8u_C1R             16u_C1R             16s_C1R            32s_C1R             32f_C1R
 8u_C3R             16u_C3R             16s_C3R            32s_C3R             32f_C3R
 8u_C4R             16u_C4R             16s_C4R            32s_C4R             32f_C4R

Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliTranspose_<mod>   (const Qpl<datatype>* pSrcDst   ,  int srcDstStep ,  QpliSize
roiSize);
Deprecated values for mod:

 8u_C1IR            16u_C1IR            16s_C1IR           32s_C1IR            32f_C1IR
 8u_C3IR            16u_C3IR            16s_C3IR           32s_C3IR            32f_C3IR
 8u_C4IR            16u_C4IR            16s_C4IR           32s_C4IR            32f_C4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

   60
---------------------Page 61---------------------

                                                       Image Data Exchange and Initialization Functions  4 

Parameters

pSrc                           Pointer to the source image ROI.

srcStep                        Distance, in bytes, between the starting points of consecutive lines in the
                               source image.

pDst                           Pointer to the destination image ROI.

dstStep                        Distance, in bytes, between the starting points of consecutive lines in the
                               destination image.

pSrcDst                        Pointer to the source and destination ROI for in-place operation.

srcDstStep                     Distance, in bytes, between the starting points of consecutive lines in the
                               source and destination image buffer for the in-place operation.

roiSize                        Size of the source ROI in pixels.

Description
The in-place flavors of the qpliTranspose function are deprecated. In-place functionality will be removed in
a future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
This function operates with ROI.
This function transposes the source image pSrc (pSrcDst for in-place flavors) and stores the result in pDst
(pSrcDst ). The destination image is obtained from the source image by transforming the columns to the
rows: pDst(x,y) = pSrc (y,x)
The parameter roiSize   is specified for the source image. The value of the roiSize.width parameter for
the destination image is equal to roiSize.height  for the source image, and roiSize.height  for the
destination image is equal to roiSize.width  for the source image.

      NOTE
      For in-place operations, roiSize.width  must be equal to roiSize.height  .

Return Values

qplStsNoErr                          Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                     Indicates an error when any of the specified pointers is NULL, with the
                                     exception of second mode in Case 4.

qplStsSizeErr                        Indicates an error when:
                                     •  roiSize  has a field with a zero or negative value
                                     •  roiSize.width   is not equal to roiSize.height  for in-place
                                        flavors

                                                                                                   61
---------------------Page 62---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Example
The code example below shows how to use the qpliTranspose_8u_C1R function.
Qpl8u src[8*4] = {1, 2, 3, 4, 8, 8, 8, 8, 
                  1, 2, 3, 4, 8, 8, 8, 8,
                  1, 2, 3, 4, 8, 8, 8, 8,
                  1, 2, 3, 4, 8, 8, 8, 8};
Qpl8u dst[4*4];
QpliSize srcRoi = { 4, 4 };
        
qpliTranspose_8u_C1R ( src, 8, dst, 4, srcRoi );
        
    

Result:
       
1 2 3 4 8 8 8 8
1 2 3 4 8 8 8 8    src
1 2 3 4 8 8 8 8
        
        
1 1 1 1
2 2 2 2
3 3 3 3      dst
4 4 4 4
    

See Also
Regions of Interest in Intel QPL

SwapChannels

Copies channels of the source image to the destination
image.

Syntax

Case 1: Not-in-place operation
QplStatus qpliSwapChannels_<mod>  (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype>*
pDst, int dstStep , QpliSize roiSize ,  const int dstOrder[3] );
Supported values for mod:

 8u_C3R            16u_C3R            16s_C3R            32s_C3R            32f_C3R
 8u_AC4R           16u_AC4R           16s_AC4R           32s_AC4R           32f_AC4R

QplStatus qpliSwapChannels_<mod>  (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype>*
pDst, int dstStep , QpliSize roiSize ,  const int dstOrder[4] );
Supported values for mod:

 8u_C4R            16u_C4R            16s_C4R            32s_C4R            32f_C4R

Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSwapChannels_8u_C3IR  (Qpl8u* pSrcDst , int srcDstStep ,  QpliSize roiSize ,
const int dstOrder[3] );

   62
---------------------Page 63---------------------

                                                     Image Data Exchange and Initialization Functions  4 

QplStatus qpliSwapChannels_8u_C4IR     (Qpl8u* pSrcDst  , int srcDstStep  ,  QpliSize roiSize  ,
const int dstOrder[4]   );
Case 3: Operation with converting 3-channel image to the 4-channel image
QplStatus qpliSwapChannels_<mod>    (const Qpl<datatype>* pSrc    , int srcStep  , Qpl<datatype>*
pDst,  int dstStep ,  QpliSize roiSize  , const int dstOrder[4]   ,  Qpl<datatype> val  );
Supported values for mod:

 8u_C3C4R            16u_C3C4R           16s_C3C4R           32s_C3C4R           32f_C3C4R

Case 4: Operation with converting 4-channel image to the 3-channel image
QplStatus qpliSwapChannels_<mod>    (const Qpl<datatype>* pSrc    , int srcStep  , Qpl<datatype>*
pDst,  int dstStep ,  QpliSize roiSize  , const int dstOrder[3]   );
Supported values for mod:

 8u_C4C3R            16u_C4C3R           16s_C4C3R           32s_C4C3R           32f_C4C3R

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source image.

pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the destination
                              image.

pSrcDst                       Pointer to the source and destination ROI for in-place operation.

srcDstStep                    Distance in bytes between starts of consecutive lines in the source and
                              destination image for the in-place operation.

roiSize                       Size of the source and destination ROI in pixels.

dstOrder                      Order of channels in the destination image.

val                           Constant value.

Description
The in-place flavors of the qpliSwapChannels function are deprecated. In-place functionality will be
removed in a future release. Use the following link for details: http://software.intel.com/sites/products/qpl-
deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function copies the data from specified channels of the source image ROI pSrc to the specified channels
of the destination image ROI pDst.

                                                                                              63
---------------------Page 64---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

The first channel in the destination image is determined by the first component of dstOrder. Its value lies in
the range [0..2] for a 3-channel image, and [0..3] for a 4-channel image, and indicates the corresponding
channel number of the source image. Other channels are specified in the similar way. For example, if the
sequence of channels in the source 3-channel image is A, B, C, and dstOrder[0]=2, dstOrder[1] =0,
dstOrder  [2]=1, then the order of channels in the 3-channel destination image is C, A, B. Some or all
components of dstOrder  may have the same values. It means that data from a certain channel of the
source image may be copied to several channels of the destination image.
Some functions flavors convert a 3-channel source image to the 4-channel destination image (see Case 3).
In this case an additional channel contains data from any specified source channel, or its pixel values are set
to the specified constant value val (corresponding component dstOrder[n] should be set to 3), or its pixel
values are not set at all (corresponding component dstOrder[n] should be set to an arbitrary value greater
than 3). For example, the sequence of channels in the source 3-channel image is A, B, C, if dstOrder[0]=1,
dstOrder[1]  =0, dstOrder  [2]=1, dstOrder[3]  =2, then the order of channels in the 4-channel
destination image will be B, A, B, C; if dstOrder[0]=4, dstOrder [1]=0, dstOrder[2] =1,
dstOrder[3]  =2, then the order of channels in the 4-channel destination image will be D, A, B, C, where D is
a channel whose pixel values are not set.
The function flavors that support image with the alpha channel do not perform operation on it.
This function supports negative step values.

Return Values

qplStsNoErr                         Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                    Indicates an error when any of the specified pointers is NULL.

qplStsSizeErr                       Indicates an error condition if roiSize has a field with zero or
                                    negative value.

qplStsStepErr                       Indicates an error condition if srcStep or dstStep has a zero value.

Example
The code example below shows how to use the function qpliSwapChannels_8u_C3R    .
Qpl8u src[12*3] = { 255, 0,  0, 255, 0,  0, 255, 0,  0, 255, 0,  0,
                     0, 255, 0,  0, 255, 0,  0, 255, 0,  0, 255, 0, 
                     0,  0, 255, 0,  0, 255, 0,  0, 255, 0,  0, 255};
Qpl8u dst[12*3];
QpliSize roiSize = { 4, 3 };
int order[3] = { 2, 1, 0 }
        
qpliSwapChannels_8u_C3R ( src, 12, dst, 12, roiSize, order );
        
    
Result:   
src    [rgb]
        
255 0  0 255 0  0 255 0  0 255 0  0
0  255 0  0 255 0  0 255 0  0 255 0
0   0 255 0  0 255 0  0 255 0  0 255
        
dst    [bgr]
        
0   0 255 0  0 255 0  0 255 0  0 255

   64
---------------------Page 65---------------------

                                                    Image Data Exchange and Initialization Functions  4 
0  255 0  0 255 0  0 255 0  0 255 0
255 0  0 255 0  0 255 0  0 255 0  0
    

AddRandUniform_Direct
DEPRECATED. Generates random samples with
uniform distribution and adds them to an image data.

Syntax
QplStatus qpliAddRandUniform_Direct_<mod>     ( Qpl<datatype>* pSrcDst   , int srcDstStep  ,
QpliSize roiSize  , Qpl<datatype> low   , Qpl<datatype> high   , unsigned int* pSeed   );
Supported values for mod:

 8u_C1IR                  16u_C1IR                 16s_C1IR                 32f_C1IR
 8u_C3IR                  16u_C3IR                 16s_C3IR                 32f_C3IR
 8u_C4IR                  16u_C4IR                 16s_C4IR                 32f_C4IR
 8u_AC4IR                 16u_AC4IR                16s_AC4IR                32f_AC4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrcDst                       Pointer to the source and destination image ROI.

srcDstStep                    Distance in bytes between starts of consecutive lines in the source and
                              destination image.

roiSize                       Size of the image ROI in pixels.

low                           The lower bound for the range of uniformly distributed values.

high                          The upper bound for the range of uniformly distributed values.

pSeed                         The initial seed value for the pseudo-random number generator.

Description
The function qpliAddRandUniform_Direct   is deprecated. This function is obsolete and will be removed in a
future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
The function generates samples with uniform distribution over the range [low, high] and adds them to a
source image pointed to by pSrcDst.
The resulting pixel values that exceed the image data range are saturated to the respective data-range
limits. To obtain an image that contains pure noise with uniform distribution, call
qpliAddRandUniform_Direct    using a source image with zero data as input.

                                                                                              65
---------------------Page 66---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                 Indicates an error when any of the specified pointers is NULL.

qplStsSizeErr                    Indicates an error condition if roiSize has a field with zero or
                                 negative value.

qplStsStepErr                    Indicates an error condition if srcDstStep has a zero or negative
                                 value.

Example
The code example below shows data conversion without scaling.
      QplStatus randUniform( void ) {
         unsigned int seed = 123456;
         Qpl8u img[2048], mn, mx;
         QpliSize roi={2048,1};
         Qpl64f mean;
         QplStatus st;
         qpliSet_8u_C1R( 0, img, 2048, roi );
         st = qpliAddRandUniform_Direct_8u_C1IR(img, 2048, roi, 0, 255, &seed);
         qpliMean_8u_C1R( img, 2048, roi, &mean );
         qpliMinMax_8u_C1R( img, 2048, roi, &mn, &mx );
         printf( "[%d..%d], mean=%.3f\n", mn, mx, mean );
         return st;
      }

AddRandGauss_Direct

DEPRECATED. Generates random samples with
Gaussian distribution and adds them to an image
data.

Syntax
QplStatus qpliAddRandGauss_Direct_<mod>   ( Qpl<datatype>* pSrcDst  , int srcDstStep ,
QpliSize roiSize , Qpl<datatype> mean  ,  Qpl<datatype> stDev  , unsigned int* pSeed  );
Supported values for mod:

 8u_C1IR                 16u_C1IR                16s_C1IR                32f_C1IR
 8u_C3IR                 16u_C3IR                16s_C3IR                32f_C3IR
 8u_C4IR                 16u_C4IR                16s_C4IR                32f_C4IR
 8u_AC4IR                16u_AC4IR               16s_AC4IR               32f_AC4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

   66
---------------------Page 67---------------------

                                                      Image Data Exchange and Initialization Functions  4 

Parameters

pSrcDst                        Pointer to the source and destination image ROI.

srcDstStep                     Distance in bytes between starts of consecutive lines in the source and
                               destination image.

roiSize                        Size of the image ROI in pixels.

mean                           The mean of the Gaussian distribution.

stDev                          The standard deviation of the Gaussian distribution.

pSeed                          The initial seed value for the pseudo-random number generator.

Description
The function qplpiAddRandGauss_Direct    is deprecated. This function is obsolete and will be removed in a
future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
The function generates samples with Gaussian distribution that have the mean value mean and standard
deviation stdev and adds them to a source image ROI pointed to by pSrcDst.
The resulting pixel values that exceed the image data range are saturated to the respective data-range
limits. To obtain an image which contains pure noise with Gaussian distribution, call
qpliAddRandGauss_Direct     using a source image with zero data as input.

Return Values

qplStsNoErr                         Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                    Indicates an error condition if pSrcDst or pSeed pointer is NULL.

qplStsSizeErr                       Indicates an error condition if roiSize has a field with zero or
                                    negative value.

qplStsStepErr                       Indicates an error condition if srcDstStep has a zero or negative
                                    value.

ImageJaehne
Creates Jaehne test image.

Syntax

QplStatus qpliImageJaehne_<mod>     (Qpl<datatype>* pDst   ,  int dstStep  , QpliSize roiSize   );
Supported values for mod:

 8u_C1R          16u_C1R          16s_C1R          32f_C1R
 8u_C3R          16u_C3R          16s_C3R          32f_C3R
 8u_C4R          16u_C4R          16s_C4R          32f_C4R
 8u_AC4R         16u_AC4R         16s_AC4R         32f_AC4R

                                                                                                67
---------------------Page 68---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliImageJaehne_<mod>     (Qpl<datatype>* pDst   , int dstStep  , QpliSize roiSize   );
Deprecated values for mod:

 8s_C1R          32s_C1R
 8s_C3R          32s_C3R
 8s_C4R          32s_C4R
 8s_AC4R         32s_AC4R

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the destination
                              image.

roiSize                       Size of the destination image ROI in pixels.

Description
Functions qpliImageJaehne_8s_AC4R   , qpliImageJaehne_8s_C1R   , qpliImageJaehne_8s_C3R   , and
qpliImageJaehne_8s_C4R    are deprecated. 8s data type is obsolete and its support will be removed in a
future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
Functions qpliImageJaehne_32s_AC4R   , qpliImageJaehne_32s_C1R   , qpliImageJaehne_32s_C3R   , and
qpliImageJaehne_32s_C4R    are deprecated. These functions are obsolete and will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function creates a specific one- or three-channel test image that has been first introduced to digital
image processing by B.Jaehne (see [Jae95]).
The destination image pixel values are computed according to the following formula:
Dst(x,y) = A*sin(0.5*QPL_PI* (x     2
                                    2 + y  2
                                          2 ) / roiSize.height)   ,
where x, y are pixel coordinates varying in the range

0 ≤ x  ≤ roiSize.width-1   , 0 ≤ y ≤ roiSize.height-1   ;
QPL_PI is the library constant that stands for π value.
x2 = (x-roiSize.width+1)/2.0    ,
y2 = (y-roiSize.height+1)/2.0    ,
A is the constant value that depends upon the image type being created.
For the 32f floating point data, the pixel values in the created image can vary in the range between 0
(inclusive) and 1 (exclusive).

   68
---------------------Page 69---------------------

                                                     Image Data Exchange and Initialization Functions  4 

Figure Example of a Generated Jaehne's Test Image illustrates an example of a test image generated by the
qpliImageJaehne   function.

Example of a Generated Jaehne's Test Image

 

 

These test images can be effectively used when you need to visualize and interpret the results of applying
filtering functions, similarly to what is proposed in [Jae95].

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                   Indicates an error condition if the pDst pointer is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with a zero or
                                   negative value, or if dstStep is less than or equal to zero.

ImageRamp
Creates a test image that has an intensity ramp.

Syntax

QplStatus qpliImageRamp_<mod>    (Qpl<datatype>* pDst   , int dstStep  , QpliSize roiSize   , float
offset,  float slope  , QpliAxis axis  );
Supported values for mod:

 8u_C1R          16u_C1R         16s_C1R          32f_C1R
 8u_C3R          16u_C3R         16s_C3R          32f_C3R

                                                                                              69
---------------------Page 70---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 8u_C4R          16u_C4R         16s_C4R          32f_C4R
 8u_AC4R         16u_AC4R        16s_AC4R         32f_AC4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliImageRamp_<mod>    (Qpl<datatype>* pDst   , int dstStep  , QpliSize roiSize   , float
offset,  float slope ,  QpliAxis axis  );
Deprecated values for mod:

 8s_C1R          32s_C1R
 8s_C3R          32s_C3R
 8s_C4R          32s_C4R
 8s_AC4R         32s_AC4R

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the destination
                              image.

roiSize                       Size of the destination image ROI in pixels.

offset                        Offset value.

slope                         Slope coefficient.

axis                          Specifies the direction of the image intensity ramp; can be one of the
                              following:

                              qplAxsHorizontal         for the ramp in X-direction,

                              qplAxsVertical           for the ramp in Y-direction,

                              qplAxsBoth               for the ramp in both X and Y-directions.

Description
Functions qpliImageRamp_8s_AC4R  , qpliImageRamp_8s_C1R  , qpliImageRamp_8s_C3R  , and
qpliImageRamp_8s_C4R   are deprecated. 8s data type is obsolete and its support will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
Functions qpliImageRamp_32s_AC4R  , qpliImageRamp_32s_C1R   , qpliImageRamp_32s_C3R  , and
qpliImageRamp_32s_C4R    are deprecated. These functions are obsolete and will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).

   70
---------------------Page 71---------------------

                                                    Image Data Exchange and Initialization Functions  4 

The function creates a one- or three-channel image that can be used as a test image to examine the effect of
applying different image processing functions.
The destination image pixel values are computed according to one of the following formulas:
dst(x,y) = offset + slope * x    , if axis = qplAxsHorizontal ,
dst(x,y) = offset + slope * y    , if axis = qplAxsVertical ,
dst(x,y) = offset + slope * x * y    , if axis = qplAxsBoth ,
where x, y are pixel coordinates varying in the range

0 ≤ x  ≤ roiSize.width-1  , 0 ≤ y  ≤ roiSize.height-1  ;
Note that linear transform coefficients offset and slope have floating-point values for all function flavors.
The computed pixel values that exceed the image data range are saturated to the respective data-range
limits.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                   Indicates an error condition if the pDst pointer is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with a zero or
                                   negative value, or if dstStep is less than or equal to zero.

Example
The code example below illustrates how to use the qpliImageRamp function.
QplStatus ramp( void ){
   Qpl8u dst[8*4];
   QpliSize roiSize = { 8, 4 };
   return qpliImageRamp_8u_C1R( dst, 8, roiSize, 0.0f, 256.0f/7,  qplAxsHorizontal);
}

The destination image contains the following data:

 00 25 49 6E 92 B7 DB FF
 00 25 49 6E 92 B7 DB FF
 00 25 49 6E 92 B7 DB FF
 00 25 49 6E 92 B7 DB FF
    

SampleLine

Puts a raster line into buffer.

Syntax

QplStatus qpliSampleLine_<mod>    (const Qpl<datatype>* pSrc    , int scrStep  , QpliSize
roiSize , Qpl<datatype>* pDst   , QpliPoint pt1  , QpliPoint pt2  );
Supported values for mod:

 8u_C1R                           16u_C1R                           32f_C1R
 8u_C3R                           16u_C3R                           32f_C3R

                                                                                              71
---------------------Page 72---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Include Files
qplcv.h

Domain Dependencies
Headers: qplcore.h , qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib , qpls.lib , qpli.lib

Parameters

pSrc                           Pointer to the ROI in the source raster image.

srcStep                        Distance in bytes between starts of consecutive lines in the raster image.

roiSize                        Size of the image ROI in pixels.

pDst                           Pointer to the destination buffer. The buffer is to store at least max(|pt2.x
                               - pt1.x| + 1, |pt2.y - pt1.y| + 1)       points.

pt1                            Starting point of the line.

pt2                            Ending point of the line.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function iterates through the points that belong to the raster line using the 8-point connected
Bresenham algorithm, and puts the resulting pixels into the destination buffer.

Return Values

qplStsNoErr                         Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                    Indicates an error condition if any of the specified pointers is NULL.

qplStsSizeErr                       Indicates an error condition if roiSize.width or roiSize.height  is
                                    less than or equal to zero.

qplStsStepErr                       Indicates an error condition if srcStep is less than roiSize.width *
                                    <pixelSize>  .

qplStsNotEvenStepErr                Indicates an error when the step for the floating-point image cannot
                                    be divided by 4.

qplStsOutOfRangeErr                 Indicates an error when any of the line ending points is outside the
                                    image.

Example
The code example below shows how to use the function qpliSampleLine_8u_C1R     .
void func_sampleline()
{
    Qpl8u pSrc[5*4] = { 0, 1, 2, 3, 4,
                        5, 6, 7, 8, 9,
                        0, 9, 8, 7, 6,
                        5, 4, 3, 2, 1 };

   72
---------------------Page 73---------------------

                                                    Image Data Exchange and Initialization Functions  4 
    QpliSize roiSize = {5, 4};
    QpliPoint pt1 = {1, 1};
    QpliPoint pt2 = {2, 3};
    Qpl8u pDst[3];
    int srcStep = 5;
        
    qpliSampleLine_8u_C1R( pSrc, srcStep, roiSize, pDst, pt1, pt2 );
                
                printf("%Result: d, %d, %d\n", pDst[0], pDst[1], pDst[2] );
}

Result: 6, 9, 3

ZigzagFwd8x8
DEPRECATED. Converts a conventional order to the
zigzag order.

Syntax

QplStatus qpliZigzagFwd8x8_16s_C1    (const Qpl16s* pSrc   , Qpl16s* pDst  );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                          Pointer to the source data.

pDst                          Pointer to the destination data.

Description
The function qpliZigzagFwd8x8  is deprecated. This function is obsolete and will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function rearranges data in an 8x8 block from a conventional order (left-to-right, top-to-bottom) to the
zigzag sequence.

                                                                                             73
---------------------Page 74---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Figure Zigzag Sequence specifies the resulting zigzag sequence.

Zigzag Sequence

Return Values

qplStsNoErr                       Indicates no error.

qplStsNullPtrErr                  Indicates an error when any of the specified pointers is NULL.

Example
The code example below shows how to use the qpliZigzagFwd8x8_16s_C1  function.
Qpl16s src[8*8] = {
                   0, 1, 5, 7, 9, 2, 4, 1,
                   5, 4, 8, 6, 3, 8, 0, 3,
                   6, 2, 6, 8, 1, 4, 2, 8,
                   4, 3, 2, 9, 3, 0, 6, 6,
                   7, 7, 3, 0, 4, 1, 0, 9,
                   5, 1, 9, 2, 5, 7, 1, 7,
                   0, 3, 5, 0, 7, 5, 9, 8,
                   2, 9, 1, 4, 6, 8, 2, 3
                 };
Qpl16s dst[8*8];
        
qpliZigzagFwd8x8_16s_C1 ( src, dst );
        
Result:
0 1 5 7 9 2 4 1
5 4 8 6 3 8 0 3
6 2 6 8 1 4 2 8
4 3 2 9 3 0 6 6     src  //conventional order
7 7 3 0 4 1 0 9
5 1 9 2 5 7 1 7
0 3 5 0 7 5 9 8
2 9 1 4 6 8 2 3
        
        
0 1 5 6 4 5 7 8
2 4 7 3 6 6 9 2
3 8 2 7 5 0 1 3
9 1 8 4 1 0 4 3      dst  //zigzag order
0 9 3 2 9 5 2 4
0 2 3 8 6 1 5 0

   74
---------------------Page 75---------------------

                                                     Image Data Exchange and Initialization Functions  4 
1 4 7 7 0 6 9 1
5 6 8 9 7 8 2 3
    
Example shows how to use the qpliZigzagFwd8x8_16s_C1     function.

ZigzagInv8x8
DEPRECATED. Converts a zigzag order to the
conventional order.

Syntax

QplStatus qpliZigzagInv8x8_16s_C1     (const Qpl16s* pSrc   , Qpl16s* pDst  );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                          Pointer to the source data.

pDst                          Pointer to the destination data.

Description
The function qpliZigzagInv8x8  is deprecated. This function is obsolete and will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function rearranges data in an 8x8 block from a zigzag sequence to the conventional order (left-to-right,
top-to-bottom).
Figure Zigzag Sequence specifies the resulting zigzag sequence.

Return Values

qplStsNoErr                        Indicates no error.

qplStsNullPtrErr                   Indicates an error when any of the specified pointers is NULL.

Row Oriented Resampling
This section describes the low-level high-optimized functions for image resampling. They can be used for
resizing of images with arbitrary rational resizing factor. The functions use anti-aliasing filters in effective
polyphase implementation.(The similar implementation is used in signal-processing multi-rate filters.)

                                                                                               75
---------------------Page 76---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

For the perfect unshifted block-by-block or parallelized image data processing, the source and destination
images are defined with respect to the high-resolution reference grid (see Figure Row-Oriented Resampling
of an Image). Required borders around the source image may either be created manually by the user or
automatically by the special flavor of the resampling function.

Row-Oriented Resampling of an Image

ResampleRowGetSize
Computes the sizes of the resample structure and the
work buffer.

Syntax
QplStatus qpliResampleRowGetSize_32f     (int srcSampleWidth   ,  int dstSampleWidth   , int*
pSpecSize , int* pBufSize   );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

srcSampleWidth                Distance between neighbor pixels of the source row on the reference grid.

dstSampleWidth                Distance between neighbor pixels of the destination row on the reference
                              grid.

pSpecSize                     Pointer to the computed size of the structure.

pBufSize                      Pointer to the computed size of the buffer.

   76
---------------------Page 77---------------------

                                                     Image Data Exchange and Initialization Functions  4 

Description

This function calculates sizes of the resampling parameters structure QpliResampleRowSpec structure and
the work buffer utilized by the functions ResampleRow ResampleRowReplicateBorder and ResampleRow
ResampleRowReplicateBorder. These values are stored in the pSpecSize and pBufSize  respectively.
Calculations are performed in accordance with the parameters of resampling: widths of source and
destination samples. The structure and the buffer must be created by the user. Use the function 
ResampleRowInit to initialize the QpliResampleRowSpec structure.
This function computes the sizes of the row resampling structure QpliResampleRowSpec and of the work
buffer.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is NULL.

qplStsOutOfRangeErr                Indicates an error condition if any of the scrSampleWidth or
                                   dstSampleWidth    parameters is not valid.

ResampleRowInit
Initializes the row resampling structure.

Syntax
QplStatus qpliResampleRowInit_32f     (QpliResampleRowSpec_32f* pRowSpec      , QpliResampleType
filterType ,  int scrSampleWidth   , int dstSampleWidth   );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h , qpls.h
Libraries: qplcore.lib, qplvm.lib , qpls.lib

Parameters

srcSampleWidth                Distance between neighbor pixels of the source row on the reference grid.

dstSampleWidth                Distance between neighbor pixels of the destination row on the reference
                              grid.

pRowSpec                      Pointer to the initialized structure.

filterType                    Specifies the type of the interpolation filter that is used for resampling.
                              Possible value is qplResampleCatmullRom   for the Catmull-Rom
                              interpolation.

Description

                                                                                                77
---------------------Page 78---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

This function initializes in the external buffer the resampling specification structure QpliResampleRowSpec
created by the user. The buffer size should be computed previously by the function ResampleRowGetSize.
This function is necessary for the functions ResampleRow ResampleRowReplicateBorder and ResampleRow
ResampleRowReplicateBorder.

Return Values

qplStsNoErr                         Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                    Indicates an error condition if one of the specified pointers is NULL.

qplStsBadArgErr                     Indicates an error condition if the specified filter type is incorrect or
                                    unsupported.

qplStsOutOfRangeErr                 Indicates an error condition if any of the scrSampleWidth or
                                    dstSampleWidth   parameters is not valid.

ResampleRowGetBorderWidth
Computes the width of the left and right borders.

Syntax
QplStatus qpliResampleRowGetBorderWidth_32f       (const QpliResampleRowSpec_32f* pRowSpec       ,
int* pLeftWidth  ,  int* pRightWidth  );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h , qpls.h
Libraries: qplcore.lib, qplvm.lib , qpls.lib

Parameters

pRowSpec                       Pointer to the initialized row resampling structure.

pLeftWidth                     Pointer to the size (in pixels) of the left border width.

pRightWidth                    Pointer to the size (in pixels) of the right border width.

Description

This function computes the width of the right and left borders (in pixels) that must be added to the source
buffer before resampling with the function ResampleRow ResampleRowReplicateBorder. The results are
stored in the pRightWidth and pLeftWidth   respectively. The width of each border depends on parameters
of resampling determined in the QpliResampleRowSpec   structure.

Return Values

qplStsNoErr                         Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                    Indicates an error condition if the pRowSpec pointer is NULL.

   78
---------------------Page 79---------------------

                                                    Image Data Exchange and Initialization Functions  4 

qplStsBadArgErr                    Indicates an error condition if the specified filter type is incorrect or
                                   unsupported.

ResampleRow, ResampleRowReplicateBorder
Performs row-oriented resampling of the image.

Syntax
QplStatus qpliResampleRow_32f_C1    (const Qpl32f*pSrc  ,  int srcLineStep  , Qpl32f* pDst  , int
dstLineStep , int xOriginRefGrid   , QpliSizesizeRefGrid   , const QpliResampleRowSpec_32f*
pRowSpec , Qpl8u* pBuffer  );
QplStatus qpliResampleRowReplicateBorder_32f_C1R      (const Qpl32f* pSrc   , int srcLineStep  ,
Qpl32f* pDst ,  int dstLineStep  , int xOriginRefGrid   , QpliSize sizeRefGrid   , const
QpliResampleRowSpec_32f* pRowSpec    ,  Qpl8u* pBuffer );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                          Pointer to the source row origin.

srcLineStep                   Distance in bytes between starts of consecutive lines in the source image
                              buffer.

pDst                          Pointer to the destination row origin.

dstLineStep                   Distance in bytes between starts of consecutive lines in the destination
                              image buffer.

xOriginRefGrid                x-coordinate of the image origin in the reference grid.

sizeRefGrid                   Size of the image in terms of the reference grid.

pRowSpec                      Pointer to the initialized row resampling structure.

pBuffer                       Pointer to the work buffer.

Description

These functions resample one or several rows of the source image pSrc. Parameters of resampling (including
filter taps) are defined by the QpliResampleRowSpec structure. Reference grid is determined by its origin
(the xOriginRefGrid  parameter) and size (the sizeRefGrid parameter). Height of the sizeRefGrid
structure defines number of rows to be resampled. The result is written to the destination image pDst.
Function qpliResampleRow  automatically creates replicated borders around the source image.
Function qpliResampleRowReplicateBorder    requires left and right replicate borders created by the user
around the source image for each row. Use the ResampleRowGetBorderWidth function to compute width of
the borders.

                                                                                             79
---------------------Page 80---------------------

 4    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Return Values

qplStsNoErr                          Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                     Indicates an error condition if one of the specified pointer is NULL.

qplStsBadArgErr                      Indicates an error condition if the structure is corrupted.

qplStsOutOfRangeErr                  Indicates an error condition if the xOriginRefGrid  is out of the
                                     range.

qplStsSizeErr                        Indicates an error condition if the sizeRefGrid is not valid.

    80
---------------------Page 81---------------------

Image Arithmetic and Logical

Operations                                                                             5

This chapter describes functions that modify pixel values of an image buffer using arithmetic or logical
operations. It also includes functions that perform image compositing based on opacity (alpha-blending).
An additional suffix C, if present in the function name, indicates operation with a constant. Arithmetic
functions that operate on integer data perform fixed scaling of the internally computed results. In case of
overflow the result value is saturated to the destination data type range.

      NOTE
      Most arithmetic and logical functions support data with 1-,3-, or 4-channel pixel values. In the alpha
      channel case (AC4), the alpha channels are not processed.

Many solutions and hints for use of these functions can be found in Intel QPL Samples. See Intel® QPL Image
Processing and Media Processing Samples downloadable from http://www.intel.com/cd/software/products/
asmo-na/eng/220046.htm .

Arithmetic Operations
Functions described in this section perform arithmetic operations on pixel values. Arithmetic operations
include addition, multiplication, subtraction, and division of pixel values of two images as well as similar
operations on a single image and a constant. Computation of an absolute value, square, square root,
exponential, and natural logarithm of pixels in an image buffer is also supported. Functions of this group
perform operations on each pixel in the source buffer(s), and write the results into the destination buffer.
Some functions also support processing of images with complex data.

Add
Adds pixel values of two images.

Syntax
Case 1: Not-in-place operation on integer or complex data
QplStatus qpliAdd_<mod>   (const Qpl<datatype>* pSrc1    , int src1Step  , const Qpl<datatype>*
pSrc2,  int src2Step ,  Qpl<datatype>* pDst   , int dstStep  , QpliSize roiSize   , int
scaleFactor );
Supported values for mod:

 8u_C1RSfs           16u_C1RSfs          16s_C1RSfs
 8u_C3RSfs           16u_C3RSfs          16s_C3RSfs
 8u_C4RSfs           16u_C4RSfs          16s_C4RSfs

                                                                                              81
---------------------Page 82---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAdd_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize , int
scaleFactor);
Deprecated values for mod:

 8u_AC4RSfs        16u_AC4RSfs       16s_AC4RSfs        16sc_AC4RSfs      16sc_C1RSfs

 16sc_C3RSfs       32sc_C3RSfs       32sc_AC4RSfs       32sc_C1RSfs

Case 2: Not-in-place operation on floating-point or complex data
QplStatus qpliAdd_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize );
Supported values for mod:

 32f_C1R   32fc_C1R

 32f_C3R   32fc_C3R

 32f_C4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAdd_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize );
Deprecated values for mod:

 32f_AC4R 32fc_AC4R 32fc_C3R 32fc_C1R

Case 3: In-place operation on integer or complex data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAdd_<mod> (const Qpl<datatype>* pSrc , int srcStep , Qpl<datatype>* pSrcDst ,
int srcDstStep, QpliSize roiSize , int scaleFactor );
Deprecated values for mod:

 8u_C1IRSfs      16u_C1IRSfs       16s_C1IRSfs        16sc_C1IRSfs       32sc_C1IRSfs

 8u_C3IRSfs      16u_C3IRSfs       16s_C3IRSfs        16sc_C3IRSfs       32sc_C3IRSfs

 8u_AC4IRSfs     16u_AC4IRSfs      16s_AC4IRSfs       16sc_AC4IRSfs      32sc_AC4IRSfs

 8u_C4IRSfs      16u_C4IRSfs       16s_C4IRSfs

Case 4: In-place operation on floating-point or complex data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAdd_<mod> (const Qpl<datatype>* pSrc , int srcStep , Qpl<datatype>* pSrcDst ,
int srcDstStep, QpliSize roiSize );
Deprecated values for mod:

 32f_C1IR  32fc_C1IR

 32f_C3IR  32fc_C3IR

 32f_AC4IR 32fc_AC4IR

   82
---------------------Page 83---------------------

                                                        Image Arithmetic and Logical Operations  5 

 32f_C4IR    

Case 5: In-place operation using a floating-point accumulator image
QplStatus qpliAdd_<mod> (const Qpl<srcDatatype>* pSrc   , int srcStep , Qpl32f* pSrcDst ,  int
srcDstStep,  QpliSize roiSize );
Supported values for mod:

 8u32f_C1IR 16u32f_C1IR

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliAdd_8s32f_C1IR  (const Qpl<srcDatatype>* pSrc  , int srcStep ,  Qpl32f*
pSrcDst, int srcDstStep ,  QpliSize roiSize );
Case 6: Masked in-place operation using a floating-point accumulator image
QplStatus qpliAdd_<mod> (const Qpl<srcDatatype>* pSrc   , int srcStep , const Qpl8u* pMask  ,
int maskStep,  Qpl32f* pSrcDst , int srcDstStep ,  QpliSize roiSize );
Supported values for mod:

 8u32f_C1IMR 16u32f_C1IMR 32f_C1IMR

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliAdd_8s32f_C1IMR  (const Qpl<srcDatatype>* pSrc  , int srcStep ,  const Qpl8u*
pMask, int maskStep , Qpl32f* pSrcDst  , int srcDstStep , QpliSize roiSize  );

Include Files
qplcv.h
qpli.h

Domain Dependencies
Flavors declared in qpli.h:
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib
Flavors declared in qplcv.h:
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc1, pSrc2                Pointer to the ROI in the source images.

src1Step, src2Step          Distance, in bytes, between the starting points of consecutive lines
                            in the source images.
pDst                        Pointer to the destination image ROI.

dstStep                     Distance, in bytes, between the starting points of consecutive lines
                            in the destination image.
pSrc                        Pointer to the first source image ROI for the in-place operation.

srcStep                     Distance, in bytes, between the starting points of consecutive lines
                            in the first source image for the in-place operation.

                                                                                         83
---------------------Page 84---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

pSrcDst                     Pointer to the second source and destination image ROI for the in-
                            place operation.
srcDstStep                  Distance, in bytes, between the starting points of consecutive lines
                            in the source and destination image for the in-place operation.
pMask                       Pointer to the mask image ROI for the masked operation.

maskStep                    Distance, in bytes, between the starting points of consecutive lines
                            in the mask image for the masked operation.
roiSize                     Size of the source and destination ROI in pixels.

scaleFactor                 Scale factor (see Integer Result Scaling).

Description
Functions qpliAdd_16s_AC4RSfs, qpliAdd_16u_AC4RSfs , qpliAdd_16u_AC4IRSfs , qpliAdd_32f_AC4R ,
qpliAdd_32f_AC4IR , and qpliAdd_8u_AC4RSfs  are deprecated. These functions are obsolete and will be
removed in a future release.
Functions qpliAdd_16sc_AC4IRSfs, qpliAdd_16sc_AC4RSfs , qpliAdd_16sc_C1IRSfs  ,
qpliAdd_16sc_C1RSfs , qpliAdd_16sc_C3IRSfs , qpliAdd_16sc_C3RSfs , qpliAdd_32fc_AC4IR ,
qpliAdd_32fc_AC4R , qpliAdd_32fc_C1IR , qpliAdd_32fc_C1R , qpliAdd_32fc_C3IR,
qpliAdd_32fc_C3R , qpliAdd_32sc_AC4IRSfs , qpliAdd_32sc_AC4RSfs , qpliAdd_32sc_C1IRSfs ,
qpliAdd_32sc_C1RSfs , qpliAdd_32sc_C3IRSfs , and qpliAdd_32sc_C3RSfs  are deprecated. Complex
format is obsolete for image processing functionality and will be removed in a future release.
Functions qpliAdd_8s32f_C1IMR and qpliAdd_8s32f_C1IR  are deprecated.
The in-place flavors of the qpliAdd function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                             Use Instead

 qpliAdd_8u_C1IRSfs                             qpliAdd_8u_C1RSfs

 qpliAdd_8u_C3IRSfs                             qpliAdd_8u_C3RSfs

 qpliAdd_8u_C4IRSfs                             qpliAdd_8u_C4RSfs

 qpliAdd_8u_AC4IRSfs                            qpliAdd_8u_AC4RSfs

 qpliAdd_16s_C1IRSfs                            qpliAdd_16s_C1RSfs

 qpliAdd_16s_C3IRSfs                            qpliAdd_16s_C3RSfs

 qpliAdd_16s_C4IRSfs                            qpliAdd_16s_C4RSfs

 qpliAdd_16s_AC4IRSfs                           qpliAdd_16s_AC4RSfs

 qpliAdd_16u_C1IRSfs                            qpliAdd_16u_C1RSfs

 qpliAdd_16u_C3IRSfs                            qpliAdd_16u_C3RSfs

 qpliAdd_16u_C4IRSfs                            qpliAdd_16u_C4RSfs

 qpliAdd_32f_C1IR                               qpliAdd_32f_C1R

 qpliAdd_32f_C3IR                               qpliAdd_32f_C3R

 qpliAdd_32f_C4IR                               qpliAdd_32f_C4R

   84
---------------------Page 85---------------------

                                                             Image Arithmetic and Logical Operations  5 

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI.
This function adds corresponding pixel values of two source image buffers and places the results in a
destination buffer. In case of operations on integer data, the resulting values are scaled by scaleFactor.
For complex data, the function processes both real and imaginary parts of pixel values. Some function flavors
add 8u, 8s, 16u, or 32f source image pixel values to a floating point accumulator image in-place. Addition of
pixel values in case of a masked operation is performed only if the respective mask value is non-zero;
otherwise, the accumulator pixel value remains unchanged.

      NOTE
      For the functions that operate on complex data, step values must be positive. For the functions that
      use an accumulator image, step values must be no less than roiSize.width*<pixelSize>  .

Functions with AC4 descriptor do not process alpha channels.
Function flavors described in Case 5 and Case 6 are declared in the qplcv.h.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition when any of the specified pointers
                                   is NULL.
qplStsSizeErr                      Indicates an error condition when   roiSize  has a field with zero
                                   or negative value.
qplStsStepErr                      Indicates an error condition in the following cases:
                                   •  For functions that operate on complex data, if any of the specified
                                      step values is zero or negative.
                                   •  For functions using an accumulator image, if any of the specified
                                      step values is less than roiSize.width * <pixelSize>  .

qplStsNotEvenStepErr               Indicates an error condition when one of step values for
                                   floating-point images cannot be divided by 4.

Example
The code example below shows how to use the function qpliAdd_8u_C1RSfs  .
Qpl8u src1[8*4] = {8, 4, 2, 1, 0, 0, 0, 0,
                   8, 4, 2, 1, 0, 0, 0, 0,
                   8, 4, 2, 1, 0, 0, 0, 0,
                   8, 4, 2, 1, 0, 0, 0, 0};
Qpl8u src2[8*4] = {4, 3, 2, 1, 0, 0, 0, 0,
                   4, 3, 2, 1, 0, 0, 0, 0,
                   4, 3, 2, 1, 0, 0, 0, 0,
                   4, 3, 2, 1, 0, 0, 0, 0};
Qpl8u dst[8*4];
QpliSize srcRoi = { 4, 4 };
Int scaleFactor = 1;    // later examples for 2 and -2 values

qpliAdd_8u_C1RSfs (src1, 8, src2, 8, dst, 4, srcRoi, scaleFactor );

Result:
    src1                src2            

                                                                                                85
---------------------Page 86---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

8 4 2 1 0 0 0 0    4 3 2 1 0 0 0 0
8 4 2 1 0 0 0 0    4 3 2 1 0 0 0 0
8 4 2 1 0 0 0 0    4 3 2 1 0 0 0 0
8 4 2 1 0 0 0 0    4 3 2 1 0 0 0 0

dst >>    scaleFactor = 1        scaleFactor = 2    ScaleFactor = -2
             6 4 2 1                3 2 1 0            48 28 16 8
             6 4 2 1                3 2 1 0            48 28 16 8
             6 4 2 1                3 2 1 0            48 28 16 8
             6 4 2 1                3 2 1 0            48 28 16 8

See Also
Regions of Interest in Intel QPL

AddC
Adds a constant to pixel values of an image.

Syntax
Case 1: Not-in-place operation on one-channel integer or complex data
QplStatus qpliAddC_<mod> (const Qpl<datatype>* pSrc  ,  int srcStep,  Qpl<datatype> value ,
Qpl<datatype>* pDst , int dstStep , QpliSize roiSize  , int scaleFactor );
Supported values for mod:

 8u_C1RSfs         16u_C1RSfs         16s_C1RSfs

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAddC_<mod> (const Qpl<datatype>* pSrc  ,  int srcStep,  Qpl<datatype> value ,
Qpl<datatype>* pDst , int dstStep , QpliSize roiSize  , int scaleFactor );
Deprecated values for mod:

 16sc_C1RSfs       32sc_C1RSfs

Case 2: Not-in-place operation on multi-channel integer or complex data
QplStatus qpliAddC_<mod> (const Qpl<datatype>* pSrc  ,  int srcStep,  const Qpl<datatype>
value[3], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize ,  int scaleFactor );
Supported values for mod:

 8u_C3RSfs                    16u_C3RSfs                      16s_C3RSfs
                                                              

QplStatus qpliAddC_<mod> (const Qpl<datatype>* pSrc  ,  int srcStep,  const Qpl<datatype>
value[4], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize ,  int scaleFactor );
Supported values for mod:

 8u_C4RSfs     16u_C4RSfs       16s_C4RSfs

   86
---------------------Page 87---------------------

                                                      Image Arithmetic and Logical Operations  5 

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAddC_<mod> (const Qpl<datatype>* pSrc , int srcStep,  const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize , int scaleFactor);
Deprecated values for mod:

 16sc_C3RSfs 32sc_C3RSfs 8u_AC4RSfs 16u_AC4RSfs 16s_AC4RSfs 16sc_AC4RSfs 32sc_AC4RSfs

Case 3: Not-in-place operation on one-channel floating-point or complex data
QplStatus qpliAddC_<mod> (const Qpl<datatype>* pSrc , int srcStep,  Qpl<datatype> value ,
Qpl<datatype>* pDst,  int dstStep, QpliSize roiSize );
Supported values for mod:

 32f_C1R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAddC_<mod> (const Qpl<datatype>* pSrc , int srcStep,  Qpl<datatype> value ,
Qpl<datatype>* pDst,  int dstStep, QpliSize roiSize );
Deprecated values for mod:

 32fc_C1R

Case 4: Not-in-place operation on multi-channel floating-point or complex data
QplStatus qpliAddC_<mod> (const Qpl<datatype>* pSrc , int srcStep,  const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Supported values for mod:

 32f_C3R

QplStatus qpliAddC_32f_C4R (const Qpl32f* pSrc , int srcStep, const Qpl32f value[4] ,
Qpl32f* pDst, int dstStep , QpliSize roiSize );
THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAddC_<mod> (const Qpl<datatype>* pSrc , int srcStep,  const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Deprecated values for mod:

 32f_AC4R 32fc_C3R 32fc_AC4R

Case 5: In-place operation on one-channel integer or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliAddC_<mod> (Qpl<datatype> value,  Qpl<datatype>* pSrcDst , int srcDstStep ,
QpliSize roiSize, int scaleFactor );
Deprecated values for mod:

 8u_C1IRSfs        16u_C1IRSfs       16s_C1IRSfs       16sc_C1IRSfs       32sc_C1IRSfs

                                                                                      87
---------------------Page 88---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Case 6: In-place operation on multi-channel integer or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliAddC_<mod> (const Qpl<datatype> value[3]  ,  Qpl<datatype>* pSrcDst , int
srcDstStep, QpliSize roiSize  , int scaleFactor );
Deprecated values for mod:

 8u_C3IRSfs       16u_C3IRSfs       16s_C3IRSfs        16sc_C3IRSfs        32sc_C3IRSfs

 8u_AC4IRSfs      16u_AC4IRSfs      16s_AC4IRSfs       16sc_AC4IRSfs       32sc_AC4IRSfs

QplStatus qpliAddC_<mod> (const Qpl<datatype> value[4]  ,  Qpl<datatype>* pSrcDst , int
srcDstStep, QpliSize roiSize  , int scaleFactor );
Deprecated values for mod:

 8u_C4IRSfs    16u_C4IRSfs     16s_C4IRSfs

Case 7: In-place operation on multi-channel floating-point or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliAddC_<mod> (Qpl<datatype> value  , Qpl<datatype>* pSrcDst  , int srcDstStep ,
QpliSize roiSize );
Deprecated values for mod:

 32f_C1IR  32fc_C1IR

Case 8: In-place operation on multi-channel floating-point or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliAddC_<mod> (const Qpl<datatype> value[3]  ,  Qpl<datatype>* pSrcDst , int
srcDstStep, QpliSize roiSize  );
Deprecated values for mod:

 32f_C3IR  32fc_C3IR

 32f_AC4IR 32fc_AC4IR

QplStatus qpliAddC_32f_C4IR ( const Qpl32f value[4] , Qpl32f* pSrcDst ,  int srcDstStep ,
QpliSize roiSize );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI.

srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image.

   88
---------------------Page 89---------------------

                                                        Image Arithmetic and Logical Operations  5 

value                       The constant value to add to image pixel values (constant vector in
                            case of multi-channel images).
pDst                        Pointer to the destination image ROI.

dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
pSrcDst                     Pointer to the source and destination image ROI for the in-place
                            operation.
srcDstStep                  Distance in bytes between starts of consecutive lines in the source
                            and destination image buffer for the in-place operation.
roiSize                     Size of the source and destination ROI in pixels.

scaleFactor                 Scale factor (see Integer Result Scaling).

Description
Functions qpliAddC_16s_AC4RSfs, qpliAddC_16u_AC4RSfs , qpliAddC_16u_AC4IRSfs ,
qpliAddC_32f_AC4R , qpliAddC_32f_AC4IR , and qpliAddC_8u_AC4RSfs are deprecated. These functions
are obsolete and will be removed in a future release. Use C4R flavor instead.
Functions qpliAddC_16sc_AC4IRSfs, qpliAddC_16sc_AC4RSfs , qpliAddC_16sc_C1IRSfs ,
qpliAddC_16sc_C1RSfs , qpliAddC_16sc_C3IRSfs , qpliAddC_16sc_C3RSfs , qpliAddC_16u_AC4IRSfs ,
qpliAddC_32fc_AC4IR , qpliAddC_32fc_AC4R , qpliAddC_32fc_C1IR , qpliAddC_32fc_C1R,
qpliAddC_32fc_C3IR , qpliAddC_32fc_C3R , qpliAddC_32sc_AC4IRSfs , qpliAddC_32sc_AC4RSfs ,
qpliAddC_32sc_C1IRSfs , qpliAddC_32sc_C1RSfs , qpliAddC_32sc_C3IRSfs , and
qpliAddC_32sc_C3RSfs  are deprecated. Complex format is obsolete for image processing functionality and
will be removed in a future release.
The in-place flavors of the qpliAddC function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                             Substitution

 qpliAddC_8u_C1IRSfs                            qpliAddC_8u_C1RSfs

 qpliAddC_8u_C3IRSfs                            qpliAddC_8u_C3RSfs

 qpliAddC_8u_C4IRSfs                            qpliAddC_8u_C4RSfs

 qpliAddC_8u_AC4IRSfs                           qpliAddC_8u_AC4RSfs

 qpliAddC_16s_C1IRSfs                           qpliAddC_16s_C1RSfs

 qpliAddC_16s_C3IRSfs                           qpliAddC_16s_C3RSfs

 qpliAddC_16s_C4IRSfs                           qpliAddC_16s_C4RSfs

 qpliAddC_16s_AC4IRSfs                          qpliAddC_16s_AC4RSfs

 qpliAddC_16u_C1IRSfs                           qpliAddC_16u_C1RSfs

 qpliAddC_16u_C3IRSfs                           qpliAddC_16u_C3RSfs

 qpliAddC_16u_C4IRSfs                           qpliAddC_16u_C4RSfs

 qpliAddC_32f_C1IR                              qpliAddC_32f_C1R

 qpliAddC_32f_C3IR                              qpliAddC_32f_C3R

 qpliAddC_32f_C4IR                              qpliAddC_32f_C4R

                                                                                         89
---------------------Page 90---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function changes the image intensity by adding value to image pixel values. For one-channel images, a
positive value brightens the image (increases the intensity); a negative value darkens the image (decreases
the intensity). For multi-channel images, the components of a constant vector value are added to pixel
channel values. For complex data, the function processes both real and imaginary parts of pixel values.

      NOTE
      Step values must be positive for functions that operate on complex data.

In case of operations on integer data, the resulting values are scaled by scaleFactor.
Note that the functions with AC4 descriptor do not process alpha channels.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if any of the specified pointers is
                                   NULL.
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if any of the specified buffer step
                                   values is zero or negative for functions that operate on
                                   complex data.

AddSquare
Adds squared pixel values of a source image to
floating-point pixel values of an accumulator image.

Syntax
Case 1: In-place operation
QplStatus qpliAddSquare_<mod>    (const Qpl<srcDatatype>* pSrc    , int srcStep  , Qpl32f*
pSrcDst , int srcDstStep  , QpliSize roiSize   );
Supported values for mod:

 8u32f_C1IR                        16u32f_C1IR                           32f_C1IR

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliAddSquare_8s32f_C1IR    (const Qpl<srcDatatype>* pSrc     , int srcStep  , Qpl32f*
pSrcDst , int srcDstStep  , QpliSize roiSize   );
Case 2: Masked in-place operation
QplStatus qpliAddSquare_<mod>    (const Qpl<srcDatatype>* pSrc    , int srcStep  , const Qpl8u*
pMask,  int maskStep ,  Qpl32f* pSrcDst  , int srcDstStep  ,  QpliSize roiSize  );
Supported values for mod:

 8u32f_C1IMR                       16u32f_C1IMR                         32f_C1IMR

   90
---------------------Page 91---------------------

                                                          Image Arithmetic and Logical Operations  5 

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliAddSquare_8s32f_C1IMR    (const Qpl<srcDatatype>* pSrc   ,  int srcStep , const
Qpl8u* pMask , int maskStep  , Qpl32f* pSrcDst  , int srcDstStep  , QpliSize roiSize  );

Include Files
qplcv.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc1                        Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pMask                        Pointer to the mask image.

maskStep                     Distance in bytes between starts of consecutive lines in the mask
                             image.
pSrcDst                      Pointer to the destination (accumulator) image ROI.

srcDstStep                   Distance in bytes between starts of consecutive lines in the
                             accumulator image.
roiSize                      Size of the image ROI in pixels.

Description
Functions qpliAddSquare_8s32f_C1IMR   and qpliAddSquare_8s32f_C1IR   are deprecated. The 8s data
type is obsolete and its support will be removed in a future release. Use the following link for details: http://
software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function adds squared pixel values of the source image pSrc to floating-point pixel values of the
accumulator image pSrcDst as follows:
pSrcDst(x,y) = pSrcDst(x,y) + pSrc(x,y)    2

Addition of the squared pixel values in case of a masked operation is performed only if the respective mask
value is nonzero; otherwise, the accumulator pixel value remains unchanged.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if any of the specified pointers is
                                  NULL .
qplStsSizeErr                     Indicates an error when roiSize.width   or roiSize.height  is
                                  negative.
qplStsStepErr                     Indicates an error when srcStep , maskStep , or srcDstStep is
                                  less than roiSize.width * <pixelSize>   .
qplStsNotEvenStepErr              Indicates an error condition if one of step values for floating-
                                  point images cannot be divided by 4.

                                                                                            91
---------------------Page 92---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

AddProduct
Adds product of pixel values of two source images to
floating-point pixel values of an accumulator image.

Syntax
Case 1: In-place operation
QplStatus qpliAddProduct_<mod> (const Qpl<srcDatatype>* pSrc1  , int src1Step , const
Qpl<srcDatatype>* pSrc2 , int src2Step , Qpl32f* pSrcDst , int srcDstStep , QpliSize
roiSize);
Supported values for mod:

 8u32f_C1IR                      16u32f_C1IR                       32f_C1IR

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliAddProduct_8s32f_C1IR  (const Qpl<srcDatatype>* pSrc1  , int src1Step , const
Qpl<srcDatatype>* pSrc2 , int src2Step , Qpl32f* pSrcDst , int srcDstStep , QpliSize
roiSize);
Case 2: Masked in-place operation
QplStatus qpliAddProduct_<mod> (const Qpl<srcDatatype>* pSrc1  , int src1Step , const
Qpl<srcDatatype>* pSrc2 , int src2Step , const Qpl8u* pMask ,  int maskStep,  Qpl32f*
pSrcDst, int srcDstStep , QpliSize roiSize );
Supported values for mod:

 8u32f_C1IMR                    16u32f_C1IMR                       32f_C1IMR

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliAddProduct_8s32f_C1IMR  (const Qpl<srcDatatype>* pSrc1  , int src1Step , const
Qpl<srcDatatype>* pSrc2 , int src2Step , const Qpl8u* pMask ,  int maskStep,  Qpl32f*
pSrcDst, int srcDstStep , QpliSize roiSize );

Include Files
qplcv.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc1, pSrc2                Pointers to the source images ROI.

src1Step, src2Step          Distances in bytes between starts of consecutive lines in the source
                            images.
pMask                       Pointer to the mask image.

maskStep                    Distance in bytes between starts of consecutive lines in the mask
                            image.
pSrcDst                     Pointer to the destination (accumulator) image ROI.

   92
---------------------Page 93---------------------

                                                          Image Arithmetic and Logical Operations  5 

srcDstStep                   Distance in bytes between starts of consecutive lines in the
                             accumulator image.
roiSize                      Size of the image ROI in pixels.

Description
Functions qpliAddProduct_8s32f_C1IMR   and qpliAddProduct_8s32f_C1IR   are deprecated. The 8s data
type is obsolete and its support will be removed in a future release. Use the following link for details: http://
software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function adds the product of pixel values of two source images pSrc1 and pSrc2 to floating-point pixel
values of the accumulator image pSrcDst as given by:
pSrcDst(x,y) = pSrcDst(x,y) + pSrc1(x,y) * pSrc2(x,y)
The products of pixel values in case of a masked operation are added only if the respective mask value is
nonzero; otherwise, the accumulator pixel value remains unchanged.

Return Values

qplStsNoErr                       Indicates no error.

qplStsNullPtrErr                  Indicates an error when any of the specified pointers is null.

qplStsSizeErr                     Indicates an error when  roiSize.width  or roiSize.height  is
                                  negative.
qplStsStepErr                     Indicates an error if src1Step, src2Step, maskStep, or
                                  srcDdstStep  is less than roiSize.width * <pixelSize>  .
qplStsNotEvenStepErr              Indicates an error condition if one of step values for floating-
                                  point images cannot be divided by 4.

AddWeighted
Adds weighted pixel values of a source image to
floating-point pixel values of an accumulator image.

Syntax
Case 1: In-place operation
QplStatus qpliAddWeighted_<mod>   (const Qpl<srcDatatype>* pSrc    , int srcStep  , Qpl32f*
pSrcDst,  int srcdstStep ,  QpliSize roiSize  , Qpl32f alpha  );
Supported values for mod:

 8u32f_C1IR                       16u32f_C1IR                          32f_C1IR

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliAddWeighted_8s32f_C1IR    (const Qpl<srcDatatype>* pSrc   ,  int srcStep ,  Qpl32f*
pSrcDst,  int srcdstStep ,  QpliSize roiSize  , Qpl32f alpha  );

                                                                                            93
---------------------Page 94---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Case 2: Masked in-place operation
QplStatus qpliAddWeighted_<mod>   (const Qpl<srcDatatype>* pSrc  ,  int srcStep , const Qpl8u*
pMask, int maskStep ,  Qpl32f* pSrcDst ,  int srcDstStep , QpliSize roiSize  , Qpl32f alpha );
Supported values for mod:

 8u32f_C1IMR                      16u32f_C1IMR                       32f_C1IMR

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliAddWeighted_8s32f_C1IMR   (const Qpl<srcDatatype>* pSrc   , int srcStep ,  const
Qpl8u* pMask , int maskStep ,  Qpl32f* pSrcDst , int srcDstStep  , QpliSize roiSize  , Qpl32f
alpha);
Case 3: Not-in-place operation
QplStatus qpliAddWeighted_32f_C1R   (const Qpl32f* pSrc1  , int src1Step ,  const Qpl32f*
pSrc2, int src2Step ,  Qpl32f* pDst , int dstStep ,  QpliSize roiSize ,  Qpl32f alpha );

Include Files
qplcv.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI for the in-place operation.

pSrc1, pSrc2                 Pointers to the ROI in the source images.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image for the in-place operation.
src1Step, src2Step           Distance in bytes between starts of consecutive lines in the source
                             images.
pMask                        Pointer to the mask image.

maskStep                     Distance in bytes between starts of consecutive lines in the mask
                             image.
pSrcDst                      Pointer to the destination (accumulator) image ROI for the in-place
                             operation.
srcDstStep                   Distance in bytes between starts of consecutive lines in the
                             accumulator image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the image ROI in pixels.

alpha                        Weight a of the source image.

Description
Functions qpliAddWeighted_8s32f_C1IMR  and qpliAddWeighted_8s32f_C1IR   are deprecated. The 8s
data type is obsolete and its support will be removed in a future release. Use the following link for details:
http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).

   94
---------------------Page 95---------------------

                                                            Image Arithmetic and Logical Operations  5 

This function adds pixel values of the source image pSrc1 multiplied by a weight factor alpha to pixel values
of the image pSrc2 multiplied by (1-alpha) and stores result in the pDst as follows:
pDst(x,y) = pSrc1(x,y)* alpha + pSrc2(x,y)*(1- alpha)       .
The in-place flavors of the function adds pixel values of the source image pSrc multiplied by a weight factor
alpha to floating-point pixel values of the accumulator image pSrcDst multiplied by (1-alpha) as follows:
pSrcDst(x,y) = pSrcDst(x,y)* (1-alpha) + pSrc(x,y)*alpha
Addition of the weighted pixel values in case of a masked operation is performed only if the respective mask
value is nonzero; otherwise, the accumulator pixel value remains unchanged.

Return Values

qplStsNoErr                        Indicates no error.

qplStsNullPtrErr                   Indicates an error when any of the specified pointers is NULL.

qplStsSizeErr                      Indicates an error when  roiSize.width   or roiSize.height  is
                                   equal to 0 or negative.
qplStsStepErr                      Indicates an error when one of the step values is equal to zero,
                                   or is less than roiSize.width * <pixelSize>   .
qplStsNotEvenStepErr               Indicates an error when one of step values for floating-point
                                   images cannot be divided by 4.

FastArctan
DEPRECATED. Calculates angle image for values of
two images with limited accuracy (~0.1 degree).

Syntax
QplStatus qplibFastArctan_32f(const Qpl32f* pSrcY, const Qpl32f* pSrcX, Qpl32f* pDst,
int length );

Include Files
qplcv.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib , qpli.lib

Parameters

pSrc1, pSrc2                  Pointer to the source vector.

pDst                          Pointer to the destination vector.

length                        Length of the source and destination vectors.

Description
The function qplibFastArctan_32f  is deprecated. This function is obsolete and will be removed in a future
release.
This function calculates angles in degrees between corresponding pixel values of two source image vectors
and places the results in a destination vector (for example, atan(pSrcY[i]/pSrcX[i])).

                                                                                              95
---------------------Page 96---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

     WARNING
     This function works with limited accuracy ~0.1 degree

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if one of the specified pointers is
                                 NULL.
qplStsSizeErr                    Indicates an error condition if length is less than, or equal to
                                 zero.

Mul
Multiplies pixel values of two images.
Case 1: Not-in-place operation on integer or complex data
QplStatus qpliMul_<mod> (const Qpl<datatype>* pSrc1  ,  int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize  , int
scaleFactor);
Supported values for mod:

 8u_C1RSfs                    16u_C1RSfs                       16s_C1RSfs

 8u_C3RSfs                    16u_C3RSfs                       16s_C3RSfs

 8u_AC4RSfs                   16u_AC4RSfs                      16s_AC4RSfs

 8u_C4RSfs                    16u_C4RSfs                       16s_C4RSfs

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMul_<mod> (const Qpl<datatype>* pSrc1  ,  int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize  , int
scaleFactor);
Deprecated values for mod:

 16sc_C1RSfs                                    32sc_C1RSfs

 16sc_C3RSfs                                    32sc_C3RSfs

 16sc_AC4RSfs                                   32sc_AC4RSfs
                                                

Case 2: Not-in-place operation on floating-point or complex data
QplStatus qpliMul_<mod> (const Qpl<datatype>* pSrc1  ,  int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize  );
Supported values for mod:

 32f_C1R    32f_AC4R

 32f_C3R    32f_C4R

   96
---------------------Page 97---------------------

                                                       Image Arithmetic and Logical Operations  5 

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMul_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Deprecated values for mod:

 32fc_C1R

 32fc_C3R

 32fc_AC4R
 

Case 3: In-place operation on integer or complex data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMul_<mod> (const Qpl<datatype>* pSrc , int srcStep , Qpl<datatype>* pSrcDst ,
int srcDstStep, QpliSize roiSize ,  int scaleFactor);
Deprecated values for mod:

 8u_C1IRSfs      16u_C1IRSfs        16s_C1IRSfs       16sc_C1IRSfs       32sc_C1IRSfs

 8u_C3IRSfs      16u_C3IRSfs        16s_C3IRSfs       16sc_C3IRSfs       32sc_C3IRSfs

 8u_AC4IRSfs     16u_AC4IRSfs       16s_AC4IRSfs      16sc_AC4IRSfs      32sc_AC4IRSfs

 8u_C4IRSfs      16u_C4IRSfs        16s_C4IRSfs                           

Case 4: In-place operation on floating-point or complex data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMul_<mod> (const Qpl<datatype>* pSrc , int srcStep , Qpl<datatype>* pSrcDst ,
int srcDstStep,  QpliSize roiSize);
Deprecated values for mod:

 32f_C1IR  32fc_C1IR

 32f_C3IR  32fc_C3IR

 32f_AC4IR 32fc_AC4IR

 32f_C4IR   

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc, pSrc1, pSrc2         Pointers to the source images ROI.

srcStep, src1Step, src2StepDistances in bytes between starts of consecutive lines in the source
                           images.
pDst                       Pointer to the destination image ROI.

                                                                                      97
---------------------Page 98---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
pSrcDst                      Pointer to the source and destination image ROI for the in-place
                             operation.
srcDstStep                   Distance in bytes between starts of consecutive lines in the source
                             and destination image for the in-place operation.
roiSize                      Size of the source and destination ROI in pixels.

scaleFactor                  Scale factor (see Integer Result Scaling).

Description
Functions qpliMul_16sc_AC4IRSfs , qpliMul_16sc_AC4RSfs , qpliMul_16sc_C1IRSfs ,
qpliMul_16sc_C1RSfs , qpliMul_16sc_C3IRSfs  , qpliMul_16sc_C3RSfs , qpliMul_32fc_AC4IR ,
qpliMul_32fc_AC4R , qpliMul_32fc_C1IR , qpliMul_32fc_C1R , qpliMul_32fc_C3IR ,
qpliMul_32fc_C3R , qpliMul_32sc_AC4IRSfs  , qpliMul_32sc_AC4RSfs , qpliMul_32sc_C1IRSfs ,
qpliMul_32sc_C1RSfs , qpliMul_32sc_C3IRSfs  , and qpliMul_32sc_C3RSfs  are deprecated. Complex
format is obsolete for image processing functionality and will be removed in a future release.
The in-place flavors of the qpliMul function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                             Substitution

 qpliMul_8u_C1IRSfs                              qpliMul_8u_C1RSfs

 qpliMul_8u_C3IRSfs                              qpliMul_8u_C3RSfs

 qpliMul_8u_C4IRSfs                              qpliMul_8u_C4RSfs

 qpliMul_8u_AC4IRSfs                             qpliMul_8u_AC4RSfs

 qpliMul_16s_C1IRSfs                             qpliMul_16s_C1RSfs

 qpliMul_16s_C3IRSfs                             qpliMul_16s_C3RSfs

 qpliMul_16s_C4IRSfs                             qpliMul_16s_C4RSfs

 qpliMul_16s_AC4IRSfs                            qpliMul_16s_AC4RSfs

 qpliMul_16u_C1IRSfs                             qpliMul_16u_C1RSfs

 qpliMul_16u_C3IRSfs                             qpliMul_16u_C3RSfs

 qpliMul_16u_C4IRSfs                             qpliMul_16u_C4RSfs

 qpliMul_16u_AC4IRSfs                            qpliMul_16u_AC4IRSfs

 qpliMul_32f_C1IR                                qpliMul_32f_C1R

 qpliMul_32f_C3IR                                qpliMul_32f_C3R

 qpliMul_32f_C4IR                                qpliMul_32f_C4R

 qpliMul_32f_AC4IR                               qpliMul_32f_AC4IR

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).

   98
---------------------Page 99---------------------

                                                          Image Arithmetic and Logical Operations  5 

This function multiplies corresponding pixel values of two source image buffers and places the results in a
destination buffer. In case of operations on integer data, the resulting values are scaled by scaleFactor.
For complex data, the function processes both real and imaginary parts of pixel values.

     NOTE
     Step values must be positive for functions that operate on complex data.

Note that the functions with AC4 descriptor do not process alpha channels.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if any of the pointers is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with zero or
                                  negative value.
qplStsStepErr                     Indicates an error condition if any of the specified buffer step
                                  values is zero or negative for functions that operate on
                                  complex data.

MulC
Multiplies pixel values of an image by a constant.

Syntax
Case 1: Not-in-place operation on one-channel integer or complex data
QplStatus qpliMulC_<mod>  (const Qpl<datatype>* pSrc   ,  int srcStep ,  Qpl<datatype> value  ,
Qpl<datatype>* pDst  , int dstStep ,  QpliSize roiSize  , int scaleFactor  );
Supported values for mod:

 8u_C1RSfs                     16u_C1RSfs                        16s_C1RSfs

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMulC_<mod>  (const Qpl<datatype>* pSrc   ,  int srcStep ,  Qpl<datatype> value  ,
Qpl<datatype>* pDst  , int dstStep ,  QpliSize roiSize  , int scaleFactor  );
Deprecated values for mod:

 16sc_C1RSfs                                      32sc_C1RSfs

Case 2: Not-in-place operation on multi-channel integer or complex data
QplStatus qpliMulC_<mod>  (const Qpl<datatype>* pSrc   ,  int srcStep ,  const Qpl<datatype>
value[3],  Qpl<datatype>* pDst  , int dstStep  , QpliSize roiSize  , int scaleFactor  );
Supported values for mod:

 8u_C3RSfs                     16u_C3RSfs                        16s_C3RSfs
                                                                 

                                                                                            99
---------------------Page 100---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

QplStatus qpliMulC_<mod> (const Qpl<datatype>* pSrc , int srcStep, const Qpl<datatype>
value[4], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize,  int scaleFactor);
Supported values for mod:

 8u_C4RSfs     16u_C4RSfs      16s_C4RSfs

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMulC_<mod> (const Qpl<datatype>* pSrc , int srcStep, const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize,  int scaleFactor);
Deprecated values for mod:

 8u_AC4RSfs      16u_AC4RSfs       16s_AC4RSfs       16sc_AC4RSfs       32sc_AC4RSfs

                                                     16sc_C3RSfs        32sc_C3RSfs

Case 3: Not-in-place operation on one-channel floating-point or complex data
QplStatus qpliMulC_32f_C1R (const Qpl<datatype>* pSrc , int srcStep,  Qpl<datatype> value,
Qpl<datatype>* pDst,  int dstStep, QpliSize roiSize );
THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliMulC_32fc_C1R (const Qpl<datatype>* pSrc , int srcStep,  Qpl<datatype>
value, Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
Case 4: Not-in-place operation on multi-channel floating-point or complex data
QplStatus qpliMulC_32f_C3R (const Qpl<datatype>* pSrc , int srcStep,  const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize);
QplStatus qpliMulC_32f_C4R (const Qpl32f* pSrc,  int srcStep, const Qpl32f value[4] ,
Qpl32f* pDst, int dstStep , QpliSize roiSize );
THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMulC_<mod> (const Qpl<datatype>* pSrc , int srcStep, const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize);
Deprecated values for mod:

 32f_AC4R  32fc_AC4R

           32fc_C3R

QplStatus qpliMulC_32f_C4R (const Qpl32f* pSrc,  int srcStep, const Qpl32f value[4] ,
Qpl32f* pDst, int dstStep , QpliSize roiSize );
Case 5: In-place operation on one-channel integer or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliMulC_<mod> (Qpl<datatype> value,  Qpl<datatype>* pSrcDst,  int srcDstStep,
QpliSize roiSize, int scaleFactor );
Deprecated values for mod:

 8u_C1IRSfs      16u_C1IRSfs       16s_C1IRSfs       16sc_C1IRSfs       32sc_C1IRSfs

  100
---------------------Page 101---------------------

                                                       Image Arithmetic and Logical Operations  5 

Case 6: In-place operation on multi-channel integer or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliMulC_<mod> (const Qpl<datatype> value[3]  , Qpl<datatype>* pSrcDst ,  int
srcDstStep, QpliSize roiSize ,  int scaleFactor );
Deprecated values for mod:

 8u_C3IRSfs       16u_C3IRSfs       16s_C3IRSfs       16sc_C3IRSfs        32sc_C3IRSfs

 8u_AC4IRSfs      16u_AC4IRSfs      16s_AC4IRSfs      16sc_AC4IRSfs       32sc_AC4IRSfs

QplStatus qpliMulC_<mod> (const Qpl<datatype> value[4]  , Qpl<datatype>* pSrcDst ,  int
srcDstStep, QpliSize roiSize ,  int scaleFactor );
Deprecated values for mod:

 8u_C4IRSfs 16u_C4IRSfs 16s_C4IRSfs

Case 7: In-place operation on one-channel floating-point or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliMulC_<mod> (Qpl<datatype> value , Qpl<datatype>* pSrcDst  , int srcDstStep ,
QpliSize roiSize );
Deprecated values for mod:

 32f_C1IR  32fc_C1IR

Case 8: In-place operation on multi-channel floating-point or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliMulC_<mod> (const Qpl<datatype> value[3]  , Qpl<datatype>* pSrcDst ,  int
srcDstStep, QpliSize roiSize );
Deprecated values for mod:

 32f_C3IR  32fc_C3IR

 32f_AC4IR 32fc_AC4IR

QplStatus qpliMulC_32f_C4IR (const Qpl32f value[4]  , Qpl32f* pSrcDst , int srcDstStep ,
QpliSize roiSize );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI.

srcStep                     Distance, in bytes, between the starting points of consecutive lines
                            in the source image.

                                                                                       101
---------------------Page 102---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

value                       The constant value to add to image pixel values (constant vector in
                            case of multi-channel images).
pDst                        Pointer to the destination image ROI.

dstStep                     Distance, in bytes, between the starting points of consecutive lines
                            in the destination image.
pSrcDst                     Pointer to the source and destination image ROI for the in-place
                            operation.
srcDstStep                  Distance, in bytes, between the starting points of consecutive lines
                            in the source and destination image for the in-place operation.
roiSize                     Size of the source and destination ROI in pixels.

scaleFactor                 Scale factor (see Integer Result Scaling).

Description
Functions qpliMulC_16s_AC4RSfs, qpliMulC_16u_AC4RSfs , qpliMulC_16u_AC4IRSfs  ,
qpliMulC_32f_AC4R , qpliMulC_32f_AC4IR , and qpliMulC_8u_AC4RSfs  are deprecated. This function is
obsolete and will be removed in a future release. Use C4R flavor instead.
Functions qpliMulC_16sc_AC4IRSfs, qpliMulC_16sc_AC4RSfs  , qpliMulC_16sc_C1IRSfs ,
qpliMulC_16sc_C1RSfs , qpliMulC_16sc_C3IRSfs  , qpliMulC_16sc_C3RSfs , qpliMulC_32fc_AC4IR ,
qpliMulC_32fc_AC4R , qpliMulC_32fc_C1IR , qpliMulC_32fc_C1R , qpliMulC_32fc_C3IR ,
qpliMulC_32fc_C3R , qpliMulC_32sc_AC4IRSfs , qpliMulC_32sc_AC4RSfs  , qpliMulC_32sc_C1IRSfs ,
qpliMulC_32sc_C1RSfs , qpliMulC_32sc_C3IRSfs  , and qpliMulC_32sc_C3RSfs  are deprecated. Complex
format is obsolete for image processing functionality and will be removed in a future release.
The in-place flavors of the qpliMulC function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                             Substitution

 qpliMulC_8u_C1IRSfs                             qpliMulC_8u_C1RSfs

 qpliMulC_8u_C3IRSfs                             qpliMulC_8u_C3RSfs

 qpliMulC_8u_C4IRSfs                             qpliMulC_8u_C4RSfs

 qpliMulC_8u_AC4IRSfs                            qpliMulC_8u_AC4RSfs

 qpliMulC_16s_C1IRSfs                            qpliMulC_16s_C1RSfs

 qpliMulC_16s_C3IRSfs                            qpliMulC_16s_C3RSfs

 qpliMulC_16s_C4IRSfs                            qpliMulC_16s_C4RSfs

 qpliMulC_16s_AC4IRSfs                           qpliMulC_16s_AC4RSfs

 qpliMulC_16u_C1IRSfs                            qpliMulC_16u_C1RSfs

 qpliMulC_16u_C3IRSfs                            qpliMulC_16u_C3RSfs

 qpliMulC_16u_C4IRSfs                            qpliMulC_16u_C4RSfs

 qpliMulC_32f_C1IR                               qpliMulC_32f_C1R

 qpliMulC_32f_C3IR                               qpliMulC_32f_C3R

 qpliMulC_32f_C4IR                               qpliMulC_32f_C4R

   102
---------------------Page 103---------------------

                                                            Image Arithmetic and Logical Operations  5 

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Regions of Interest in Intel QPL).
This function multiplies pixel values of an image by a constant value. For multi-channel images, pixel
channel values are multiplied by the components of a constant vector value. For complex data, the function
processes both real and imaginary parts of pixel values.

      NOTE
      Step values must be positive for functions that operate on complex data.

In case of operations on integer data, the resulting values are scaled by scaleFactor.
Note that the functions with AC4 descriptor do not process alpha channels.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if any of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if any of the specified buffer step
                                   values is zero or negative for functions that operate on
                                   complex data.

MulScale
Multiplies pixel values of two images and scales the
products.

Syntax
Case 1: Not-in-place operation
QplStatus qpliMulScale_<mod>    (const Qpl<datatype>* pSrc1    ,  int src1Step  , const
Qpl<datatype>* pSrc2   , int src2Step  ,  Qpl<datatype>* pDst   , int dstStep  , QpliSize
roiSize );
Supported values for mod:

 8u_C1R      16u_C1R

 8u_C3R      16u_C3R

 8u_C4R      16u_C4R

 8u_AC4R     16u_AC4R

                                                                                               103
---------------------Page 104---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMulScale_<mod>    (const Qpl<datatype>* pSrc    , int srcStep  , Qpl<datatype>*
pSrcDst , int srcDstStep  ,  QpliSize roiSize  );
Deprecated values for mod:

 8u_C1IR     16u_C1IR

 8u_C3IR     16u_C3IR

 8u_C4IR     16u_C4IR

 8u_AC4IR  16u_AC4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc, pSrc1, pSrc2            Pointers to the source images ROI.

srcStep , src1Step, src2Step  Distances in bytes between starts of consecutive lines in the source
                              images.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
pSrcDst                       Pointer to the source and destination image ROI for the in-place
                              operation.
srcDstStep                    Distance in bytes between starts of consecutive lines in the source
                              and destination image for the in-place operation.
roiSize                       Size of the source and destination ROI in pixels.

Description
The in-place flavors of qpliMulScale are deprecated. In-place functionality will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function operates with ROI (see Regions of Regions of Interest in Intel QPL).
This function multiplies corresponding pixel values of two input buffers and scales the products using the
following formula:
dst_pixel = src1_pixel * src2_pixel / max_val,
where src1_pixel  and src2_pixel  are pixel values of the source buffers, dst_pixel is the resultant pixel
value, and max_val is the maximum value of the pixel data range (see Table “Image Data Types and
Ranges” for details). The function is implemented for 8-bit and 16-bit unsigned data types only.
Note that the functions with AC4 descriptor do not process alpha channelss.

   104
---------------------Page 105---------------------

                                                        Image Arithmetic and Logical Operations  5 

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if any of the specified pointers is
                                 NULL.
qplStsSizeErr                    Indicates an error condition if roiSize has a field with zero or
                                 negative value.
qplStsStepErr                    Indicates an error condition if any of the specified buffer step
                                 values is zero or negative.

MulCScale
Multiplies pixel values of an image by a constant and
scales the products.

Syntax
Case 1: Not-in-place operation on one-channel data
QplStatus qpliMulCScale_<mod>  (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype>
value, Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C1R     16u_C1R

Case 2: Not-in-place operation on multi-channel data
QplStatus qpliMulCScale_<mod>  (const Qpl<datatype>* pSrc  , int srcStep , const
Qpl<datatype> value[3] , Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize  );
Supported values for mod:

 8u_C3R     16u_C3R
            

QplStatus qpliMulCScale_<mod>  (const Qpl<datatype>* pSrc  , int srcStep , const
Qpl<datatype> value[4] , Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize  );
Supported values for mod:

 8u_C4R     16u_C4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMulCScale_<mod>  (const Qpl<datatype>* pSrc  , int srcStep , const
Qpl<datatype> value[3] , Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize  );
Deprecated values for mod:

            
 8u_AC4R    16u_AC4R

                                                                                        105
---------------------Page 106---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Case 3: In-place operation on one-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMulCScale_<mod>   (Qpl<datatype> value  , const Qpl<datatype>* pSrcDst   ,  int
srcDstStep , QpliSize roiSize  );
Deprecated values for mod:

 8u_C1IR    16u_C1IR

Case 4: In-place operation on multi-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliMulCScale_<mod>   (const Qpl<datatype> value[3]   , const Qpl<datatype>*
pSrcDst,  int srcDstStep ,  QpliSize roiSize );
Deprecated values for mod:

 8u_C3IR    16u_C3IR

 8u_AC4IR  16u_AC4IR

QplStatus qpliMulCScale_<mod>   (const Qpl<datatype> value[4]   , const Qpl<datatype>*
pSrcDst,  int srcDstStep ,  QpliSize roiSize );
Deprecated values for mod:

 8u_C4IR    16u_C4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
value                        The constant value to multiply each pixel value in a source image
                             (constant vector in case of 3- or four-channel images).
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
pSrcDst                      Pointer to the source and destination image ROI for the in-place
                             operation.
srcDstStep                   Distance in bytes between starts of consecutive lines in the source
                             and destination image for the in-place operation.
roiSize                      Size of the source and destination ROI in pixels.

Description
The in-place flavors of qpliMulCScale are deprecated. In-place functionality will be removed in a future
release. Use C4R flavor instead. Use the following link for details: http://software.intel.com/sites/products/
qpl-deprecated-features-feedback/.

   106
---------------------Page 107---------------------

                                                            Image Arithmetic and Logical Operations  5 

Functions qpliMulCScale_8u_AC4R   and qpliMulCScale_16u_AC4R    are deprecated. This function is
obsolete and will be removed in a future release. Use C4R flavor instead. Use the following link for details:
http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function multiplies pixel values in the input buffer by a constant value and scales the products using the
following formula:
dst_pixel = src_pixel * value / max_val,
where src_pixel  is a pixel values of the source buffer, dst_pixel is the resultant pixel value, and max_val
is the maximum value of the pixel data range (see Table “Image Data Types and Ranges” for details).
The function is implemented for 8-bit and 16-bit unsigned data types only. It can be used to multiply pixel
values by a number between 0 and 1.
Note that the functions with AC4 descriptor do not process alpha channelss.

Return Values

qplStsNoErr                        ndicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if the roiSize has a field with zero
                                   or negative value.
qplStsStepErr                      Indicates an error condition if any of the specified buffer step
                                   values is zero or negative.

Example
The code example below shows how to use the function qpliMulCScale_8u_C1R .
void func_mulcscale()
{    
    QpliSize ROI = {8,4};
    QpliSize ROI2 = {5,4};
    Qpl8u src[8*4];
    Qpl8u dst[8*4];
    Qpl8u v = 100;

    qpliSet_8u_C1R(100,src,8,ROI);
    qpliSet_8u_C1R(0,dst,8,ROI);
    qpliMulCScale_8u_C1R(src,8,v,dst,8,ROI2);
}

Result:

            src1                                 dst
100 100 100 100 100 100 100 100         39 39 39 39 39 0 0 0
100 100 100 100 100 100 100 100         39 39 39 39 39 0 0 0
100 100 100 100 100 100 100 100         39 39 39 39 39 0 0 0
100 100 100 100 100 100 100 100         39 39 39 39 39 0 0 0

Sub
Subtracts pixel values of two images.

                                                                                              107
---------------------Page 108---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Syntax
Case 1: Not-in-place operation on integer or complex data
QplStatus qpliSub_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep , QpliSize roiSize , int
scaleFactor);
Supported values for mod

 8u_C1RSfs                    16u_C1RSfs                     16s_C1RSfs

 8u_C3RSfs                    16u_C3RSfs                     16s_C3RSfs

 8u_AC4RSfs                   16u_AC4RSfs                    16s_AC4RSfs

 8u_C4RSfs                    16u_C4RSfs                     16s_C4RSfs

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSub_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep , QpliSize roiSize , int
scaleFactor);
Deprecated values for mod

 16sc_C1RSfs                                   32sc_C1RSfs

 16sc_C3RSfs                                   32sc_C3RSfs

 16sc_AC4RSfs                                  32sc_AC4RSfs
                                              

Case 2: Not-in-place operation on floating-point or complex data
QplStatus qpliSub_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Supported values for mod:

 32f_C1R

 32f_C3R

 32f_AC4R

 32f_C4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSub_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Deprecated values for mod:

 32fc_C1R

 32fc_C3R

 32fc_AC4R

  108
---------------------Page 109---------------------

                                                        Image Arithmetic and Logical Operations  5 

Case 3: In-place operation on integer or complex data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSub_<mod> (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype>* pSrcDst  ,
int srcDstStep , QpliSize roiSize , int scaleFactor );
Deprecated values for mod:

 8u_C1IRSfs       16u_C1IRSfs       16s_C1IRSfs        16sc_C1IRSfs        32sc_C1IRSfs

 8u_C3IRSfs       16u_C3IRSfs       16s_C3IRSfs        16sc_C3IRSfs        32sc_C3IRSfs

 8u_AC4IRSfs      16u_AC4IRSfs      16s_AC4IRSfs       16sc_AC4IRSfs       32sc_AC4IRSfs

 8u_C4IRSfs       16u_C4IRSfs       16s_C4IRSfs                             

Case 4: In-place operation on floating-point or complex data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSub_<mod> (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype>* pSrcDst  ,
int srcDstStep , QpliSize roiSize );
Deprecated values for mod:

 32f_C1IR  32fc_C1IR

 32f_C3IR  32fc_C3IR

 32f_AC4IR 32fc_AC4IR

 32f_C4IR   

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc, pSrc1, pSrc2          Pointers to the source images ROI.

srcStep, src1Step, src2Step Distances in bytes between starts of consecutive lines in the source
                            images.
pDst                        Pointer to the destination image ROI.

dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
pSrcDst                     Pointer to the source and destination image ROI for the in-place
                            operation.
srcDstStep                  Distance in bytes between starts of consecutive lines in the source
                            and destination image for the in-place operation.
roiSize                     Size of the source and destination ROI in pixels.

scaleFactor                 Scale factor (see Integer Result Scaling).

Description
Functions qpliSub_16sc_AC4IRSfs, qpliSub_16sc_AC4RSfs, qpliSub_16sc_C1IRSfs ,
qpliSub_16sc_C1RSfs , qpliSub_16sc_C3IRSfs  , qpliSub_16sc_C3RSfs, qpliSub_32fc_AC4IR ,
qpliSub_32fc_AC4R , qpliSub_32fc_C1IR, qpliSub_32fc_C1R , qpliSub_32fc_C3IR,

                                                                                       109
---------------------Page 110---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

qpliSub_32fc_C3R  , qpliSub_32sc_AC4IRSfs  , qpliSub_32sc_AC4RSfs  , qpliSub_32sc_C1IRSfs   ,
qpliSub_32sc_C1RSfs   , qpliSub_32sc_C3IRSfs   , and qpliSub_32sc_C3RSfs   are deprecated. Complex
format is obsolete for image processing functionality and will be removed in a future release.
The in-place flavors of the qpliSub function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                               Substitution

 qpliSub_8u_C1IRSfs                                qpliSub_8u_C1RSfs

 qpliSub_8u_C3IRSfs                                qpliSub_8u_C3RSfs

 qpliSub_8u_C4IRSfs                                qpliSub_8u_C4RSfs

 qpliSub_8u_AC4IRSfs                               qpliSub_8u_AC4RSfs

 qpliSub_16s_C1IRSfs                               qpliSub_16s_C1RSfs

 qpliSub_16s_C3IRSfs                               qpliSub_16s_C3RSfs

 qpliSub_16s_C4IRSfs                               qpliSub_16s_C4RSfs

 qpliSub_16s_AC4IRSfs                              qpliSub_16s_AC4RSfs

 qpliSub_16u_C1IRSfs                               qpliSub_16u_C1RSfs

 qpliSub_16u_C3IRSfs                               qpliSub_16u_C3RSfs

 qpliSub_16u_C4IRSfs                               qpliSub_16u_C4RSfs

 qpliSub_16u_AC4IRSfs                              qpliSub_16u_AC4IRSfs

 qpliSub_32f_C1IR                                  qpliSub_32f_C1R

 qpliSub_32f_C3IR                                  qpliSub_32f_C3R

 qpliSub_32f_C4IR                                  qpliSub_32f_C4R

 qpliSub_32f_AC4IR                                 qpliSub_32f_AC4IR

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function subtracts pixel values of the source buffer pSrc1 from the corresponding pixel values of the
buffer pSrc2 and places the result in the destination buffer pDst. For in-place operations, the values in pSrc
are subtracted from the values in pSrcDst and the results are placed into pSrcDst. For complex data, the
function processes both real and imaginary parts of pixel values.

      NOTE
      Step values must be positive for functions that operate on complex data.

In case of operations on integer data, the resulting values are scaled by scaleFactor.
Note that the functions with AC4 descriptor do not process alpha channels.

   110
---------------------Page 111---------------------

                                                        Image Arithmetic and Logical Operations  5 

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if one of the specified pointers is
                                 NULL.
qplStsSizeErr                    Indicates an error condition if roiSize has a field with zero or
                                 negative value.
qplStsStepErr                    Indicates an error condition if any of the specified buffer step
                                 values is zero or negative for functions that operate on
                                 complex data.

SubC
Subtracts a constant from pixel values of an image.

Syntax
Case 1: Not-in-place operation on one-channel integer or complex data
QplStatus qpliSubC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype> value  ,
Qpl<datatype>* pDst , int dstStep , QpliSize roiSize ,  int scaleFactor );
Supported values for mod:

 8u_C1RSfs                    16u_C1RSfs                      16s_C1RSfs

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSubC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype> value  ,
Qpl<datatype>* pDst , int dstStep , QpliSize roiSize ,  int scaleFactor );
Supported values for mod:

 16sc_C1RSfs                                    32sc_C1RSfs

Case 2: Not-in-place operation on multi-channel integer or complex data
QplStatus qpliSubC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , const Qpl<datatype>
value[3], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize ,  int scaleFactor );
Supported values for mod:

 8u_C3RSfs                    16u_C3RSfs                      16s_C3RSfs
                                                              

QplStatus qpliSubC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , const Qpl<datatype>
value[4], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize ,  int scaleFactor );
Supported values for mod:

 8u_C4RSfs     16u_C4RSfs      16s_C4RSfs

                                                                                       111
---------------------Page 112---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSubC_<mod> (const Qpl<datatype>* pSrc , int srcStep,  const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize , int scaleFactor);
Deprecated values for mod:

                                                                        
 8u_AC4RSfs      16u_AC4RSfs       16s_AC4RSfs       16sc_AC4RSfs        32sc_AC4RSfs

QplStatus qpliSubC_<mod> (const Qpl<datatype>* pSrc , int srcStep,  const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize , int scaleFactor);
Deprecated values for mod:

 16sc_C3RSfs                                  32sc_C3RSfs
                                              

Case 3: Not-in-place operation on one-channel floating-point or complex data
QplStatus qpliSubC_32f_C1R (const Qpl<datatype>* pSrc , int srcStep,  Qpl<datatype> value ,
Qpl<datatype>* pDst,  int dstStep, QpliSize roiSize );
THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliSubC_32fc_C1R (const Qpl<datatype>* pSrc , int srcStep , Qpl<datatype>
value, Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
Case 4: Not-in-place operation on multi-channel floating-point or complex data
QplStatus qpliSubC_32f_C3R (const Qpl<datatype>* pSrc , int srcStep,  const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
QplStatus qpliSubC_32f_C4R (const Qpl32f* pSrc,  int srcStep, const Qpl32f value[4] ,
Qpl32f* pDst, int dstStep , QpliSize roiSize );
THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSubC_<mod> (const Qpl<datatype>* pSrc , int srcStep,  const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Deprecated values for mod:

               
 32f_AC4R      32fc_AC4R

QplStatus qpliSubC_32fc_C3R (const Qpl<datatype>* pSrc , int srcStep , const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Case 5: In-place operation on one-channel integer or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliSubC_<mod> (Qpl<datatype> value,  Qpl<datatype>* pSrcDst , int srcDstStep,
QpliSize roiSize, int scaleFactor );
Deprecated values for mod:

 8u_C1IRSfs      16u_C1IRSfs       16s_C1IRSfs       16sc_C1IRSfs        32sc_C1IRSfs

  112
---------------------Page 113---------------------

                                                       Image Arithmetic and Logical Operations  5 

Case 6: In-place operation on multi-channel integer or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliSubC_<mod> (const Qpl<datatype> value[3]  , Qpl<datatype>* pSrcDst ,  int
srcDstStep, QpliSize roiSize ,  int scaleFactor );
Deprecated values for mod:

 8u_C3IRSfs       16u_C3IRSfs       16s_C3IRSfs       16sc_C3IRSfs        32sc_C3IRSfs

 8u_AC4IRSfs      16u_AC4IRSfs      16s_AC4IRSfs      16sc_AC4IRSfs       32sc_AC4IRSfs

QplStatus qpliSubC_<mod> (const Qpl<datatype> value[4]  , Qpl<datatype>* pSrcDst ,  int
srcDstStep, QpliSize roiSize ,  int scaleFactor );
Deprecated values for mod:

 8u_C4IRSfs    16u_C4IRSfs     16s_C4IRSfs

Case 7: In-place operation on one-channel floating-point or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliSubC_<mod> (Qpl<datatype> value , Qpl<datatype>* pSrcDst  , int srcDstStep ,
QpliSize roiSize);
Deprecated values for mod:

 32f_C1IR      32fc_C1IR

Case 8: In-place operation on multi-channel floating-point or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliSubC_<mod> (const Qpl<datatype> value[3]  , Qpl<datatype>* pSrcDst ,  int
srcDstStep, QpliSize roiSize );
Deprecated values for mod:

 32f_C3IR      32fc_C3IR

 32f_AC4IR     32fc_AC4IR

QplStatus qpliSubC_32f_C4IR (const Qpl32f value[4]  , Qpl32f* pSrcDst , int srcDstStep ,
QpliSize roiSize);

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI.

srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image.

                                                                                       113
---------------------Page 114---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

value                       The constant value to subtract from each pixel value in a source
                            image (constant vector in case of multi-channel images).
pDst                        Pointer to the destination image ROI.

dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
pSrcDst                     Pointer to the source and destination image ROI for the in-place
                            operation.
srcDstStep                  Distance in bytes between starts of consecutive lines in the source
                            and destination image for the in-place operation.
roiSize                     Size of the source and destination ROI in pixels.

scaleFactor                 Scale factor (see Integer Result Scaling).

Description
Functions qpliSubC_16sc_AC4IRSfs, qpliSubC_16sc_AC4RSfs  , qpliSubC_16sc_C1IRSfs ,
qpliSubC_16sc_C1RSfs , qpliSubC_16sc_C3IRSfs   , qpliSubC_16sc_C3RSfs , qpliSubC_32fc_AC4IR ,
qpliSubC_32fc_AC4R , qpliSubC_32fc_C1IR , qpliSubC_32fc_C1R , qpliSubC_32fc_C3IR ,
qpliSubC_32fc_C3R , qpliSubC_32sc_AC4IRSfs , qpliSubC_32sc_AC4RSfs  , qpliSubC_32sc_C1IRSfs ,
qpliSubC_32sc_C1RSfs  , qpliSubC_32sc_C3IRSfs  , and qpliSubC_32sc_C3RSfs  are deprecated.
Complex format is obsolete for image processing functionality and will be removed in a future release.
Functions qpliSubC_16s_AC4RSfs, qpliSubC_16u_AC4RSfs , qpliSubC_16u_AC4IRSfs ,
qpliSubC_32f_AC4R , qpliSubC_32f_AC4IR , and qpliSubC_8u_AC4RSfs  are deprecated. These functions
are obsolete and will be removed in a future release. Use C4R flavor instead.
The in-place flavors of the qpliSubC function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                             Substitution

 qpliSubC_8u_C1IRSfs                            qpliSubC_8u_C1RSfs

 qpliSubC_8u_C3IRSfs                            qpliSubC_8u_C3RSfs

 qpliSubC_8u_C4IRSfs                            qpliSubC_8u_C4RSfs

 qpliSubC_8u_AC4IRSfs                           qpliSubC_8u_AC4RSfs

 qpliSubC_16s_C1IRSfs                           qpliSubC_16s_C1RSfs

 qpliSubC_16s_C3IRSfs                           qpliSubC_16s_C3RSfs

 qpliSubC_16s_C4IRSfs                           qpliSubC_16s_C4RSfs

 qpliSubC_16s_AC4IRSfs                          qpliSubC_16s_AC4RSfs

 qpliSubC_16u_C1IRSfs                           qpliSubC_16u_C1RSfs

 qpliSubC_16u_C3IRSfs                           qpliSubC_16u_C3RSfs

 qpliSubC_16u_C4IRSfs                           qpliSubC_16u_C4RSfs

 qpliSubC_32f_C1IR                              qpliSubC_32f_C1R

 qpliSubC_32f_C3IR                              qpliSubC_32f_C3R

 qpliSubC_32f_C4IR                              qpliSubC_32f_C4R

   114
---------------------Page 115---------------------

                                                            Image Arithmetic and Logical Operations  5 

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function changes image intensity by subtracting the constant value from pixel values of an image
buffer. For multi-channel images, the components of a constant vector value are subtracted from pixel
channel values. For complex data, the function processes both real and imaginary parts of pixel values.

      NOTE
      Step values must be positive for functions that operate on complex data.

In case of operations on integer data, the resulting values are scaled by scaleFactor.
Note that the functions with the AC4 descriptor do not process alpha channelss.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if any of the specified buffer step
                                   values is zero or negative for functions that operate on
                                   complex data.

Div
Divides pixel values of an image by pixel values of
another image.

Syntax
Case 1: Not-in-place operation on integer or complex data
QplStatus qpliDiv_<mod>   (const Qpl<datatype>* pSrc1    ,  int src1Step ,  const Qpl<datatype>*
pSrc2,  int src2Step  , Qpl<datatype>* pDst   , int dstStep  ,  QpliSize roiSize  , int
scaleFactor );
Supported values for mod:

 8u_C1RSfs                      16u_C1RSfs                         16s_C1RSfs

 8u_C3RSfs                      16u_C3RSfs                         16s_C3RSfs

 8u_AC4RSfs                     16u_AC4RSfs                        16s_AC4RSfs

 8u_C4RSfs                      16u_C4RSfs                         16s_C4RSfs

                                                                                              115
---------------------Page 116---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliDiv_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize,  int
scaleFactor);
Deprecated values for mod:

 16sc_C1RSfs                                  32sc_C1RSfs

 16sc_C3RSfs                                  32sc_C3RSfs

 16sc_AC4RSfs                                 32sc_AC4RSfs

Case 2: Not-in-place operation on floating-point or complex data
QplStatus qpliDiv_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
Supported values for mod:

 32f_C1R

 32f_C3R

 32f_AC4R

 32f_C4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliDiv_<mod> (const Qpl<datatype>* pSrc1 , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
Deprecated values for mod:

 32fc_C1R

 32fc_C3R

 32fc_AC4R
 

Case 3: In-place operation on integer or complex data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliDiv_<mod> (const Qpl<datatype>* pSrc , int srcStep , Qpl<datatype>* pSrcDst ,
int srcDstStep, QpliSize roiSize , int scaleFactor );
Deprecated values for mod:

 8u_C1IRSfs      16u_C1IRSfs       16s_C1IRSfs       16sc_C1IRSfs        32sc_C1IRSfs

 8u_C3IRSfs      16u_C3IRSfs       16s_C3IRSfs       16sc_C3IRSfs        32sc_C3IRSfs

 8u_AC4IRSfs     16u_AC4IRSfs      16s_AC4IRSfs      16sc_AC4IRSfs       32sc_AC4IRSfs

 8u_C4IRSfs      16u_C4IRSfs       16s_C4IRSfs                            

  116
---------------------Page 117---------------------

                                                         Image Arithmetic and Logical Operations  5 

Case 4: In-place operation on floating-point or complex data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliDiv_<mod>  (const Qpl<datatype>* pSrc  ,  int srcStep , Qpl<datatype>* pSrcDst  ,
int srcDstStep , QpliSize roiSize  );
Deprecated values for mod:

 32f_C1IR  32fc_C1IR

 32f_C3IR  32fc_C3IR

 32f_AC4IR 32fc_AC4IR

 32f_C4IR   

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc, pSrc1, pSrc2           Pointers to the source images ROI.

srcStep, src1Step, src2Step  Distances in bytes between starts of consecutive lines in the source
                             images.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
pSrcDst                      Pointer to the source and destination image ROI for the in-place
                             operation.
srcDstStep                   Distance in bytes between starts of consecutive lines in the source
                             and destination image for the in-place operation.
roiSize                      Size of the source and destination ROI in pixels.

scaleFactor                  Scale factor (see Integer Result Scaling).

Description
Functions qpliDiv_16sc_AC4IRSfs , qpliDiv_16sc_AC4RSfs , qpliDiv_16sc_C1IRSfs ,
qpliDiv_16sc_C1RSfs , qpliDiv_16sc_C3IRSfs  , qpliDiv_16sc_C3RSfs , qpliDiv_32fc_AC4IR ,
qpliDiv_32fc_AC4R , qpliDiv_32fc_C1IR , qpliDiv_32fc_C1R , qpliDiv_32fc_C3IR ,
qpliDiv_32fc_C3R , qpliDiv_32sc_AC4IRSfs , qpliDiv_32sc_AC4RSfs  , qpliDiv_32sc_C1IRSfs ,
qpliDiv_32sc_C1RSfs , qpliDiv_32sc_C3IRSfs  , and qpliDiv_32sc_C3RSfs  are deprecated. Complex
format is obsolete for image processing functionality and will be removed in a future release.
The in-place flavors of the qpliDiv function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                             Substitution

 qpliDiv_8u_C1IRSfs                              qpliDiv_8u_C1RSfs

 qpliDiv_8u_C3IRSfs                              qpliDiv_8u_C3RSfs

                                                                                          117
---------------------Page 118---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 Deprecated Function                               Substitution

 qpliDiv_8u_C4IRSfs                                qpliDiv_8u_C4RSfs

 qpliDiv_8u_AC4IRSfs                               qpliDiv_8u_AC4RSfs

 qpliDiv_16s_C1IRSfs                               qpliDiv_16s_C1RSfs

 qpliDiv_16s_C3IRSfs                               qpliDiv_16s_C3RSfs

 qpliDiv_16s_C4IRSfs                               qpliDiv_16s_C4RSfs

 qpliDiv_16s_AC4IRSfs                              qpliDiv_16s_AC4RSfs

 qpliDiv_16u_C1IRSfs                               qpliDiv_16u_C1RSfs

 qpliDiv_16u_C3IRSfs                               qpliDiv_16u_C3RSfs

 qpliDiv_16u_C4IRSfs                               qpliDiv_16u_C4RSfs

 qpliDiv_16u_AC4IRSfs                              qpliDiv_16u_AC4IRSfs

 qpliDiv_32f_C1IR                                  qpliDiv_32f_C1R

 qpliDiv_32f_C3IR                                  qpliDiv_32f_C3R

 qpliDiv_32f_C4IR                                  qpliDiv_32f_C4R

 qpliDiv_32f_AC4IR                                 qpliDiv_32f_AC4IR

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function divides pixel values of the source buffer pSrc2 by the corresponding pixel values of the buffer
pSrc1 and places the result in a destination buffer pDst. For in-place operations, the values in pSrcDst are
divided by the values in pSrc and placed into pSrcDst. For complex data, the function processes both real
and imaginary parts of pixel values. In case of operations on integer data, the resulting values are scaled by
scaleFactor  and rounded (not truncated). When the function encounters a zero divisor value, the execution
is not interrupted. The function returns the warning message and corresponding result value (see appendix A
“Appendix A Handling of Special Cases” for more information).
Note that the functions with the AC4 descriptor do not process alpha channels.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL.
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if any of the specified buffer step
                                   values is zero or negative.
qplStsDivByZero                    Indicates a warning that a divisor value is zero. The function
                                   execution is continued.

   118
---------------------Page 119---------------------

                                                        Image Arithmetic and Logical Operations  5 

Example
The code example below illustrates how the function qpliDiv can be used.

QplStatus div32f( void ) {
   Qpl32f a[4*3], b[4*3];
   QpliSize roi = {2,2};
   int i;
   for( i=0; i<4*3; ++i ) a[i] = b[i] = (float)i;
   return qpliDiv_32f_C1IR( a, 4*sizeof(Qpl32f), b, 
                              4*sizeof(Qpl32f), roi );
}

The destination image b contains
-1.#IND  +1.000  +2.000  +3.000
+1.000   +1.000  +6.000  +7.000
+8.000   +9.000  +10.00  +11.00

Console output:
-- warning in div32f:
(6) Zero value(s) of divisor in the function Div
 

Div_Round
DEPRECATED. Divides pixel values of an image by
pixel values of another image with different rounding
modes.

Syntax
Case 1: Not-in-place operation on integer data
QplStatus qpliDiv_Round_<mod>  (const Qpl<datatype>* pSrc1  , int src1Step , const
Qpl<datatype>* pSrc2 , int src2Step ,  Qpl<datatype>* pDst , int dstStep , QpliSize
roiSize, QplRoundMode rndMode  , int scaleFactor );
Supported values for mod:

 8u_C1RSfs     16u_C1RSfs       16s_C1RSfs

 8u_C3RSfs     16u_C3RSfs       16s_C3RSfs

 8u_AC4RSfs    16u_AC4RSfs      16s_AC4RSfs

 8u_C4RSfs     16u_C4RSfs       16s_C4RSfs

Case 2: In-place operation on integer data
QplStatus qpliDiv_Round_<mod>  (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype>*
pSrcDst, int srcDstStep ,  QpliSize roiSize , QplRoundMode rndMode  , int scaleFactor );
Supported values for mod:

 8u_C1IRSfs     16u_C1IRSfs     16s_C1IRSfs

 8u_C3IRSfs     16u_C3IRSfs     16s_C3IRSfs

                                                                                        119
---------------------Page 120---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 8u_AC4IRSfs     16u_AC4IRSfs      16s_AC4IRSfs

 8u_C4IRSfs      16u_C4IRSfs       16s_C4IRSfs

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h , qpls.h
Libraries: qplcore.lib, qplvm.lib , qpls.lib

Parameters

pSrc, pSrc1 , pSrc2            Pointers to the source images ROI.

srcStep , src1Step , src2Step  Distances in bytes between starts of consecutive lines in the source images.

pDst                           Pointer to the destination image ROI.

dstStep                        Distance in bytes between starts of consecutive lines in the destination
                               image.

pSrcDst                        Pointer to the source and destination image ROI for the in-place operation.

srcDstStep                     Distance in bytes between starts of consecutive lines in the source and
                               destination image for the in-place operation.

roiSize                        Size of the source and destination ROI in pixels.

roundMode                      Rounding mode, the following values are possible:

                               qplRndZero               specifies that floating-point values are
                                                        truncated toward zero,
                               qplRndNear               specifies that floating-point values are
                                                        rounded to the nearest even integer when
                                                        the fractional part equals 0.5; otherwise
                                                        they are rounded to the nearest integer,
                               qplRndFinancial          specifies that floating-point values are
                                                        rounded down to the nearest integer when
                                                        the fractional part is less than 0.5, or
                                                        rounded up to the nearest integer if the
                                                        fractional part is equal or greater than 0.5.

scaleFactor                    Scale factor (see Integer Result Scaling).

Description
The functions qpliDiv_Round  is deprecated. This function is obsolete and will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function divides pixel values of the source buffer pSrc2 by the corresponding pixel values of the buffer
pSrc1 and places the result in a destination buffer pDst. For in-place operations, the values in pSrcDst are
divided by the values in pSrc and placed into pSrcDst. The resulting values are scaled by scaleFactor and

   120
---------------------Page 121---------------------

                                                           Image Arithmetic and Logical Operations  5 

rounded using the rounding method specified by the parameter roundMode. When the function encounters a
zero divisor value, the execution is not interrupted. The function returns the warning message and
corresponding result value (see appendix A “Appendix A Handling of Special Cases” for more information).
Note that the functions with the AC4 descriptor do not process alpha channelss.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a warning.

qplStsNullPtrErr                  Indicates an error condition if one of the specified pointers is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with zero or
                                  negative value.

qplStsStepErr                     Indicates an error condition if any of the specified buffer step values is
                                  zero or negative.

qplStsDivByZero                   Indicates a warning that a divisor value is zero. The function
                                  execution is continued.

qplStsStsRoundModeNotSupported    Indicates an error condition if the roundMode has an illegal value.
Err

DivC
Divides pixel values of an image by a constant.

Syntax
Case 1: Not-in-place operation on one-channel integer or complex data
QplStatus qpliDivC_<mod>   (const Qpl<datatype>* pSrc   ,  int srcStep , Qpl<datatype> value   ,
Qpl<datatype>* pDst  , int dstStep  , QpliSize roiSize   , int scaleFactor  );
Supported values for mod:

 8u_C1RSfs                      16u_C1RSfs                        16s_C1RSfs

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliDivC_<mod>   (const Qpl<datatype>* pSrc   ,  int srcStep , Qpl<datatype> value   ,
Qpl<datatype>* pDst  , int dstStep  , QpliSize roiSize   , int scaleFactor  );
Deprecated values for mod:

 16sc_C1RSfs                                      32sc_C1RSfs

Case 2: Not-in-place operation on multi-channel integer or complex data
QplStatus qpliDivC_<mod>   (const Qpl<datatype>* pSrc   ,  int srcStep , const Qpl<datatype>
value[3] , Qpl<datatype>* pDst   , int dstStep ,  QpliSize roiSize  , int scaleFactor  );
Supported values for mod:

 8u_C3RSfs             16u_C3RSfs               16s_C3RSfs               16s_AC4RSfs

                                                                                             121
---------------------Page 122---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

QplStatus qpliDivC_<mod> (const Qpl<datatype>* pSrc , int srcStep, const Qpl<datatype>
value[4], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize,  int scaleFactor);
Supported values for mod:

 8u_C4RSfs 16u_C4RSfs 16s_C4RSfs

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliDivC_<mod> (const Qpl<datatype>* pSrc , int srcStep, const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize,  int scaleFactor);
Deprecated values for mod:

 16sc_C3RSfs                  32sc_C3RSfs                   16sc_AC4RSfs

 8u_AC4RSfs                   16u_AC4RSfs                   32sc_AC4RSfs

Case 3: Not-in-place operation on one-channel floating-point or complex data
QplStatus qpliDivC_32f_C1R (const Qpl<datatype>* pSrc , int srcStep,  Qpl<datatype> value,
Qpl<datatype>* pDst,  int dstStep, QpliSize roiSize );
THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliDivC_32fc_C1R (const Qpl<datatype>* pSrc , int srcStep,  Qpl<datatype>
value, Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
Case 4: Not-in-place operation on multi-channel floating-point or complex data
QplStatus qpliDivC_32f_C3R (const Qpl<datatype>* pSrc , int srcStep,  const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize);
QplStatus qpliDivC_32f_C4R (const Qpl32f* pSrc,  int srcStep, const Qpl32f value[4] ,
Qpl32f* pDst, int dstStep , QpliSize roiSize );
THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliDivC_<mod> (const Qpl<datatype>* pSrc , int srcStep, const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize);
Deprecated values for mod:

 32f_AC4R 32fc_AC4R 32fc_C3R

QplStatus qpliDivC_32f_C4R (const Qpl32f* pSrc,  int srcStep, const Qpl32f value[4] ,
Qpl32f* pDst, int dstStep , QpliSize roiSize );
Case 5: In-place operation on one-channel integer or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliDivC_<mod> (Qpl<datatype> value,  Qpl<datatype>* pSrcDst,  int srcDstStep,
QpliSize roiSize, int scaleFactor );
Deprecated values for mod:

 8u_C1IRSfs      16u_C1IRSfs       16s_C1IRSfs       16sc_C1IRSfs       32sc_C1IRSfs

  122
---------------------Page 123---------------------

                                                       Image Arithmetic and Logical Operations  5 

Case 6: In-place operation on multi-channel integer or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliDivC_<mod> (const Qpl<datatype> value[3]  , Qpl<datatype>* pSrcDst ,  int
srcDstStep, QpliSize roiSize ,  int scaleFactor );
Deprecated values for mod:

 8u_C3IRSfs       16u_C3IRSfs       16s_C3IRSfs       16sc_C3IRSfs        32sc_C3IRSfs

 8u_AC4IRSfs      16u_AC4IRSfs      16s_AC4IRSfs      16sc_AC4IRSfs       32sc_AC4IRSfs

QplStatus qpliDivC_<mod> (const Qpl<datatype> value[4]  , Qpl<datatype>* pSrcDst ,  int
srcDstStep, QpliSize roiSize ,  int scaleFactor );
Deprecated values for mod:

 8u_C4IRSfs 16u_C4IRSfs 16s_C4IRSfs

Case 7: In-place operation on one-channel floating-point or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliDivC_<mod> (Qpl<datatype> value , Qpl<datatype>* pSrcDst  , int srcDstStep ,
QpliSize roiSize );
Deprecated values for mod:

 32f_C1IR  32fc_C1IR

Case 8: In-place operation on multi-channel floating-point or complex data. THE FOLLOWING FUNCTIONS ARE
DEPRECATED:
QplStatus qpliDivC_<mod> (const Qpl<datatype> value[3]  , Qpl<datatype>* pSrcDst ,  int
srcDstStep, QpliSize roiSize );
Deprecated values for mod:

 32f_C3IR  32fc_C3IR

 32f_AC4IR 32fc_AC4IR

QplStatus qpliDivC_32f_C4IR (const Qpl32f value[4]  , Qpl32f* pSrcDst , int srcDstStep ,
QpliSize roiSize );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI.

srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image.

                                                                                       123
---------------------Page 124---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

value                        The constant value to divide each pixel value in a source buffer
                             (constant vector in case of 3- or four-channel images).
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
pSrcDst                      Pointer to the source and destination image ROI for the in-place
                             operation.
srcDstStep                   Distance in bytes between starts of consecutive lines in the source
                             and destination image for the in-place operation.
roiSize                      Size of the source and destination ROI in pixels.

scaleFactor                  Scale factor (see InInteger Result Scaling).

Description
The in-place flavors of qpliDivС are deprecated. In-place functionality will be removed in a future release.
Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
Functions qpliDivC_16u_AC4RSfs , qpliDivC_16u_AC4IRSfs  , qpliDivC_32f_AC4R ,
qpliDivC_32f_AC4IR  , and qpliDivC_8u_AC4RSfs  are deprecated. This function is obsolete and will be
removed in a future release. Use C4R flavor instead. Use the following link for details: http://
software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliDivC_16sc_AC4IRSfs , qpliDivC_16sc_AC4RSfs  , qpliDivC_16sc_C1IRSfs  ,
qpliDivC_16sc_C1RSfs  , qpliDivC_16sc_C3IRSfs  , qpliDivC_16sc_C3RSfs  , qpliDivC_32fc_AC4IR ,
qpliDivC_32fc_AC4R  , qpliDivC_32fc_C1IR , qpliDivC_32fc_C1R  , qpliDivC_32fc_C3IR ,
qpliDivC_32fc_C3R  , qpliDivC_32sc_AC4IRSfs  , qpliDivC_32sc_AC4RSfs  , qpliDivC_32sc_C1IRSfs ,
qpliDivC_32sc_C1RSfs  , qpliDivC_32sc_C3IRSfs  , and qpliDivC_32sc_C3RSfs   are deprecated.
Complex format is obsolete for image processing functionality and will be removed in a future release. Use
the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
The in-place flavors of the qpliDivC function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                              Substitution

 qpliDivC_8u_C1IRSfs                              qpliDivC_8u_C1RSfs

 qpliDivC_8u_C3IRSfs                              qpliDivC_8u_C3RSfs

 qpliDivC_8u_C4IRSfs                              qpliDivC_8u_C4RSfs

 qpliDivC_8u_AC4IRSfs                             qpliDivC_8u_AC4RSfs

 qpliDivC_16s_C1IRSfs                             qpliDivC_16s_C1RSfs

 qpliDivC_16s_C3IRSfs                             qpliDivC_16s_C3RSfs

 qpliDivC_16s_C4IRSfs                             qpliDivC_16s_C4RSfs

 qpliDivC_16s_AC4IRSfs                            qpliDivC_16s_AC4RSfs

 qpliDivC_16u_C1IRSfs                             qpliDivC_16u_C1RSfs

 qpliDivC_16u_C3IRSfs                             qpliDivC_16u_C3RSfs

 qpliDivC_16u_C4IRSfs                             qpliDivC_16u_C4RSfs

   124
---------------------Page 125---------------------

                                                            Image Arithmetic and Logical Operations  5 

 Deprecated Function                                Substitution

 qpliDivC_32f_C1IR                                 qpliDivC_32f_C1R

 qpliDivC_32f_C3IR                                 qpliDivC_32f_C3R

 qpliDivC_32f_C4IR                                 qpliDivC_32f_C4R

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function changes image intensity by dividing pixel values of an image buffer by the constant value. For
multi-channel images, pixel channel values are divided by the components of a constant vector value. For
complex data, the function processes both real and imaginary parts of pixel values. In case of operations on
integer data, the resulting values are scaled by scaleFactor and rounded (not truncated).
When the divisor value is zero, the function execution is aborted and the qplStsDivByZeroErr error status
is set. Note that in the alpha channel case (AC4), the alpha channels are not processed.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if srcStep, dstStep , orsrcDstStep
                                   has a zero or negative value.
qplStsDivByZeroErr                 Indicates an error condition if the divisor value is zero.

Abs
Computes absolute pixel values of a source image and
places them into the destination image.
Case 1: Not-in-place operation
QplStatus qpliAbs_<mod>   (const Qpl<datatype>* pSrc    ,  int srcStep ,  Qpl<datatype>* pDst   ,
int dstStep ,  QpliSize roiSize  );
Supported values for mod:

 16s_C1R     32f_C1R

 16s_C3R     32f_C3R

 16s_C4R     32f_C4R

                                                                                              125
---------------------Page 126---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAbs_<mod>  (const Qpl<datatype>* pSrc   , int srcStep  , Qpl<datatype>* pDst  ,
int dstStep , QpliSize roiSize  );
Deprecated values for mod:

 16s_AC4R    32f_AC4R

Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAbs_<mod>  (Qpl<datatype>* pSrcDst   , int srcDstStep  , QpliSize roiSize  );
Deprecated values for mod:

 16s_C1IR    32f_C1IR

 16s_C3IR    32f_C3IR

 16s_C4IR    32f_C4IR

 16s_AC4IR  32f_AC4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
pSrcDst                      Pointer to the source and destination image ROI for the in-place
                             operation.
srcDstStep                   Distance in bytes between starts of consecutive lines in the source
                             and destination image for the in-place operation.
roiSize                      Size of the source and destination ROI in pixels.

Description
Functions qpliAbs_16s_AC4R and qpliAbs_32f_AC4R   are deprecated. These functions are obsolete and will
be removed in a future release. Use C4R flavor instead.
The in-place flavors of the qpliAbs function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                              Substitution

 qpliAbs_16s_C1IR                                qpliAbs_16s_C1R

   126
---------------------Page 127---------------------

                                                          Image Arithmetic and Logical Operations  5 

 Deprecated Function                              Substitution

 qpliAbs_16s_C3IR                                 qpliAbs_16s_C3R

 qpliAbs_16s_C4IR                                 qpliAbs_16s_C4R

 qpliAbs_16s_AC4IR                                qpliAbs_16s_AC4R

 qpliAbs_32f_C1IR                                 qpliAbs_32f_C1R

 qpliAbs_32f_C3IR                                 qpliAbs_32f_C3R

 qpliAbs_32f_C4IR                                 qpliAbs_32f_C4R

 qpliAbs_32f_AC4IR                                qpliAbs_32f_AC4R

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function takes the absolute value of each channel in each pixel of the source image ROI and places the
result into a destination image ROI. It operates on signed data only. Note that the functions with the AC4
descriptor do not process alpha channels.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if one of the specified pointers is
                                  NULL.
qplStsSizeErr                     Indicates an error condition if roiSize has a field with zero or
                                  negative value.

AbsDiff
Calculates absolute difference between two images.

Syntax
QplStatus qpliAbsDiff_<mod>   (const Qpl<datatype>* pSrc1   , int src1Step  , const
Qpl<datatype>* pSrc2  , int src2Step  , Qpl<datatype>* pDst  ,  int dstStep , QpliSize
roiSize);
Supported values for mod:

 8u_C1R    16u_C1R    32f_C1R

 8u_C3R                

Include Files
qplcv.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

                                                                                           127
---------------------Page 128---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Parameters

pSrc1                        Pointer to the first source image.

src1Step                     Distance in bytes between starts of consecutive lines in the first
                             source image.
pSrc2                        Pointer to second source image.

src2Step                     Distance in bytes between starts of consecutive lines in the second
                             source image.
pDst                         Pointer to the destination image.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the image ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function calculates the absolute pixel-wise difference between two images by the formula:
pDst(x,y) = abs(pSrc1(x,y) - pSrc2(x,y))    .

Return Values

qplStsNoErr                       Indicates no error.

qplStsNullPtrErr                  Indicates an error condition if one of the specified pointers is
                                  NULL.
qplStsSizeErr                     Indicates an error condition if roiSize has a field with zero or
                                  negative value.
qplStsStepErr                     Indicates an error when src1Step , src2Step or dstStep is less
                                  than roiSize.width * <pixelSize>   .
qplStsNotEvenStepErr              Indicates an error condition if one of step values for floating-
                                  point images cannot be divided by 4.

AbsDiffC
Calculates absolute difference between image and
scalar value.

Syntax
QplStatus qpliAbsDiffC_<mod>   (const Qpl<datatype>* pSrc   , int srcStep , Qpl<datatype>*
pDst, int dstStep  , QpliSize roiSize  , int value );
Supported values for mod:

 8u_C1R     16u_C1R

QplStatus qpliAbsDiffC_32f_C1R   (const Qpl32f* pSrc  , int srcStep  , Qpl32f* pDst ,  int
dstStep,  QpliSize roiSize ,  Qpl32f value );

Include Files
qplcv.h

   128
---------------------Page 129---------------------

                                                          Image Arithmetic and Logical Operations  5 

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the image ROI in pixels.

value                        Scalar value used to decrement each element of the source image.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function calculates the absolute pixel-wise difference between the source image pSrc and the scalar
value by the formula:
pDst(x,y) = abs(pSrc(x,y) - value    .
The function clips the value to the range [0, 255] for the 8u data type, and to the range [0, 65535] for the
16u data type.

Return Values

qplStsNoErr                       Indicates no error.

qplStsNullPtrErr                  Indicates an error condition if one of the specified pointers is
                                  NULL .
qplStsSizeErr                     Indicates an error condition if roiSize has a field with zero or
                                  negative value.
qplStsStepErr                     Indicates an error when  srcStep or dstStep  is less than
                                  roiSize.width * <pixelSize>   .
qplStsNotEvenStepErr              Indicates an error condition if one of step values for floating-
                                  point images cannot be divided by 4.

Sqr
Squares pixel values of an image and writes them into
the destination image.

Syntax
Case 1: Not-in-place operation on integer data
QplStatus qpliSqr_<mod>  (const Qpl<datatype>* pSrc    , int srcStep ,  Qpl<datatype>* pDst  ,
int dstStep , QpliSize roiSize  ,  int scaleFactor );
Supported values for mod:

 8u_C1RSfs  16u_C1RSfs  16s_C1RSfs

                                                                                            129
---------------------Page 130---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 8u_C3RSfs  16u_C3RSfs  16s_C3RSfs

 8u_C4RSfs  16u_C4RSfs  16s_C4RSfs

 8u_AC4RSfs 16u_AC4RSfs 16s_AC4RSfs

Case 2: Not-in-place operation on floating-point data
QplStatus qpliSqr_<mod> (const Qpl32f* pSrc  , int srcStep , Qpl32f* pDst , int dstStep ,
QpliSize roiSize );
Supported values for mod:

 32f_C1R

 32f_C3R

 32f_C4R

 32f_AC4R

Case 3: In-place operation on integer data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSqr_<mod> (Qpl<datatype>* pSrcDst  , int srcDstStep ,  QpliSize roiSize , int
scaleFactor);
Deprecated values for mod:

 8u_C1IRSfs  16u_C1IRSfs  16s_C1IRSfs

 8u_C3IRSfs  16u_C3IRSfs  16s_C3IRSfs

 8u_C4IRSfs  16u_C4IRSfs  16s_C4IRSfs

 8u_AC4IRSfs 16u_AC4IRSfs 16s_AC4IRSfs

Case 4: In-place operation on floating-point data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSqr_<mod> (Qpl32f* pSrcDst  , int srcDstStep , QpliSize roiSize );
Deprecated values for mod:

 32f_C1IR

 32f_C3IR

 32f_C4IR

 32f_AC4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

   130
---------------------Page 131---------------------

                                                         Image Arithmetic and Logical Operations  5 

Parameters

pSrc                        Pointer to the source image ROI.

srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image.
pDst                        Pointer to the destination image ROI.

dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
pSrcDst                     Pointer to the source and destination image ROI for the in-place
                            operation.
srcDstStep                  Distance in bytes between starts of consecutive lines in the source
                            and destination image for the in-place operation.
roiSize                     Size of the source and destination ROI in pixels.

scaleFactor                 Scale factor (see Integer Result Scaling).

Description
The in-place flavors of the qpliSqr function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                             Substitution

 qpliSqr_8u_C1IRSfs                              qpliSqr_8u_C1RSfs

 qpliSqr_8u_C3IRSfs                              qpliSqr_8u_C3RSfs

 qpliSqr_8u_C4IRSfs                              qpliSqr_8u_C4RSfs

 qpliSqr_8u_AC4IRSfs                             qpliSqr_8u_AC4RSfs

 qpliSqr_16s_C1IRSfs                             qpliSqr_16s_C1RSfs

 qpliSqr_16s_C3IRSfs                             qpliSqr_16s_C3RSfs

 qpliSqr_16s_C4IRSfs                             qpliSqr_16s_C4RSfs

 qpliSqr_16s_AC4IRSfs                            qpliSqr_16s_AC4RSfs

 qpliSqr_16u_C1IRSfs                             qpliSqr_16u_C1RSfs

 qpliSqr_16u_C3IRSfs                             qpliSqr_16u_C3RSfs

 qpliSqr_16u_C4IRSfs                             qpliSqr_16u_C4RSfs

 qpliSqr_16u_AC4IRSfs                            qpliSqr_16u_AC4IRSfs

 qpliSqr_32f_C1IR                                qpliSqr_32f_C1R

 qpliSqr_32f_C3IR                                qpliSqr_32f_C3R

 qpliSqr_32f_C4IR                                qpliSqr_32f_C4R

 qpliSqr_32f_AC4IR                               qpliSqr_32f_AC4IR

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).

                                                                                         131
---------------------Page 132---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

This function squares pixel values of the source image ROI and writes them to the destination image ROI.
The function flavors operating on integer data apply fixed scaling defined by scaleFactor to the internally
computed values, and saturate the results before writing them to the destination image ROI.
Note that the functions with the AC4 descriptor do not process alpha channelss.

Return Values

qplStsNoErr                       Indicates an error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if one of the specified pointers is
                                  NULL .
qplStsSizeErr                     Indicates an error condition if roiSize has a field with zero or
                                  negative value.

Sqrt
Computes square roots of pixel values of a source
image and writes them into the destination image.

Syntax
Case 1: Not-in-place operation on integer data
QplStatus qpliSqrt_<mod>   (const Qpl<datatype>* pSrc   , int srcStep  , Qpl<datatype>* pDst  ,
int dstStep , QpliSize roiSize  ,  int scaleFactor  );
Supported values for mod:

 8u_C1RSfs  16u_C1RSfs  16s_C1RSfs

 8u_C3RSfs  16u_C3RSfs  16s_C3RSfs

 8u_AC4RSfs 16u_AC4RSfs 16s_AC4RSfs

Case 2: Not-in-place operation on floating-point data
QplStatus qpliSqrt_<mod>   (const Qpl32f* pSrc  , int srcStep  , Qpl32f* pDst  , int dstStep ,
QpliSize roiSize  );
Supported values for mod:

 32f_C1R

 32f_C3R

 32f_AC4R

Case 3: In-place operation on integer data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSqrt_<mod>   (Qpl<datatype>* pSrcDst  ,  int srcDstStep  , QpliSize roiSize  , int
scaleFactor );
Deprecated values for mod:

 8u_C1IRSfs  16u_C1IRSfs  16s_C1IRSfs

 8u_C3IRSfs  16u_C3IRSfs  16s_C3IRSfs

   132
---------------------Page 133---------------------

                                                         Image Arithmetic and Logical Operations  5 

 8u_AC4IRSfs 16u_AC4IRSfs 16s_AC4IRSfs

Case 4: In-place operation on floating-point data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliSqrt_<mod>  (Qpl32f* pSrcDst ,  int srcDstStep , QpliSize roiSize  );
Deprecated values for mod:

 32f_C1IR

 32f_C3IR

 32f_C4IR

 32f_AC4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
pSrcDst                      Pointer to the source and destination image ROI for the in-place
                             operation.
srcDstStep                   Distance in bytes between starts of consecutive lines in the source
                             and destination image for the in-place operation.
roiSize                      Size of the source and destination ROI in pixels.

scaleFactor                  Scale factor (see Integer Result Scaling).

Description
The in-place flavors of the qpliSqrt function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                             Substitution

 qpliSqrt_8u_C1IRSfs                             qpliSqrt_8u_C1RSfs

 qpliSqrt_8u_C3IRSfs                             qpliSqrt_8u_C3RSfs

 qpliSqrt_8u_AC4IRSfs                            qpliSqrt_8u_AC4RSfs

 qpliSqrt_16s_C1IRSfs                            qpliSqrt_16s_C1RSfs

 qpliSqrt_16s_C3IRSfs                            qpliSqrt_16s_C3RSfs

                                                                                          133
---------------------Page 134---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 Deprecated Function                               Substitution

 qpliSqrt_16s_AC4IRSfs                             qpliSqrt_16s_AC4RSfs

 qpliSqrt_16u_C1IRSfs                              qpliSqrt_16u_C1RSfs

 qpliSqrt_16u_C3IRSfs                              qpliSqrt_16u_C3RSfs

 qpliSqrt_16u_AC4IRSfs                             qpliSqrt_16u_AC4IRSfs

 qpliSqrt_32f_C1IR                                 qpliSqrt_32f_C1R

 qpliSqrt_32f_C3IR                                 qpliSqrt_32f_C3R

 qpliSqrt_32f_C4IR                                 qpliSqrt_32f_C4R

 qpliSqrt_32f_AC4IR                                qpliSqrt_32f_AC4IR

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function computes square roots of pixel values of the source image ROI and writes them into the
destination image ROI. The function flavors operating on integer data apply fixed scaling defined by
scaleFactor  to the internally computed values, and saturate the results before writing them to the
destination image ROI. If a source pixel value is negative, the function issues a warning and continues
execution with the corresponding result value (see appendix A “Appendix A Handling of Special Cases” for
more information ).
Note that the functions with the AC4 descriptor do not process alpha channelss.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.
qplStsSqrtNegArg                   Indicates a warning that a source pixel has a negative value.

Ln
Computes the natural logarithm of pixel values in a
source image and writes the results into the
destination image.

Syntax
Case 1: Not-in-place operation on integer data
QplStatus qpliLn_<mod>   (const Qpl<datatype>* pSrc    , int srcStep  , Qpl<datatype>* pDst   , int
dstStep , QpliSize roiSize  ,  int scaleFactor  );
Supported values for mod:

 8u_C1RSfs      16u_C1RSfs        16s_C1RSfs

   134
---------------------Page 135---------------------

                                                         Image Arithmetic and Logical Operations  5 

 8u_C3RSfs      16u_C3RSfs      16s_C3RSfs

Case 2: Not-in-place operation on floating-point data
QplStatus qpliLn_<mod> ( const Qpl32f* pSrc , int srcStep ,  Qpl32f* pDst , int dstStep ,
QpliSize roiSize );
Supported values for mod:

 32f_C1R

 32f_C3R

Case 3: In-place operation on integer data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliLn_<mod> ( Qpl<datatype>* pSrcDst ,  int srcDstStep , QpliSize roiSize  , int
scaleFactor);
Deprecated values for mod:

 8u_C1IRSfs     16u_C1IRSfs     16s_C1IRSfs

 8u_C3IRSfs     16u_C3IRSfs     16s_C3IRSfs

Case 4: In-place operation on floating-point data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliLn_<mod> ( Qpl32f* pSrcDst , int srcDstStep ,  QpliSize roiSize );
Deprecated values for mod:

 32f_C1IR

 32f_C3IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI.

srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image.
pDst                        Pointer to the destination image ROI.

dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
pSrcDst                     Pointer to the source and destination image ROI for the in-place
                            operation.
srcDstStep                  Distance in bytes between starts of consecutive lines in the source
                            and destination image for the in-place operation.
roiSize                     Size of the source and destination ROI in pixels.

                                                                                         135
---------------------Page 136---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

scaleFactor                   Scale factor (see Integer Result Scaling).

Description
The in-place flavors of the qpliLn function are deprecated. The table below specifies the corresponding Intel
QPL functions to replace the deprecated in-place functions:
 Deprecated Function                                Substitution

 qpliLn_8u_C1IRSfs                                  qpliLn_8u_C1RSfs

 qpliLn_8u_C3IRSfs                                  qpliLn_8u_C3RSfs

 qpliLn_16s_C1IRSfs                                 qpliLn_16s_C1RSfs

 qpliLn_16s_C3IRSfs                                 qpliLn_16s_C3RSfs

 qpliLn_16u_C1IRSfs                                 qpliLn_16u_C1RSfs

 qpliLn_16u_C3IRSfs                                 qpliLn_16u_C3RSfs

 qpliLn_32f_C1IR                                    qpliLn_32f_C1R

 qpliLn_32f_C3IR                                    qpliLn_32f_C3R

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function computes natural logarithms of pixel values of the source image ROI and writes the resultant
values to the destination image ROI. The function flavors operating on integer data apply fixed scaling
defined by scaleFactor  to the internally computed values, and saturate the results before writing them to
the destination image ROI.
If a source pixel value is zero or negative, the function issues a corresponding warning and continues
execution with the corresponding result value (see appendix A “Appendix A Handling of Special Cases” for
more information).
When several inputs have zero or negative value, the status code returned by the function corresponds to
the first encountered case as illustrated in the code example below.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize  has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if srcStep ,dstStep , or srcDstStep
                                   has a zero or negative value.
qplStsLnZeroArg                    Indicates a warning that a source pixel has a zero value.

qplStsLnNegArg                     dicates a warning that a source pixel has a negative value.

   136
---------------------Page 137---------------------

                                                         Image Arithmetic and Logical Operations  5 

Example
The code example below shows how to use Ln function.
QplStatus ln( void ) {
   Qpl32f img[8*8];
   QpliSize roi = { 8, 8 };
   QplStatus st;
   qpliSet_32f_C1R( (float)QPL_E, img, 8*4, roi );
   img[0] = -0;
   img[1] = -1;
   st = qpliLn_32f_C1IR( img, 8*sizeof(Qpl32f), roi );
   printf( "%f %f %f\n", img[0], img[1], img[2] );
   return st;
}

Output values:
-1.#INF00 -1.#IND00 1.000000

Status value and message:
(7) Zero value(s) of argument in the Ln function

Exp
Computes the exponential of pixel values in a source
image and writes the results into the destination
image.

Syntax
Case 1: Not-in-place operation on integer data
QplStatus qpliExp_<mod>  (const Qpl<datatype>* pSrc  , int srcStep ,  Qpl<datatype>* pDst  ,
int dstStep , QpliSize  , int scaleFactor );
Supported values for mod:

 8u_C1RSfs 16u_C1RSfs 16s_C1RSfs

 8u_C3RSfs 16u_C3RSfs 16s_C3RSfs

Case 2: Not-in-place operation on floating-point data
QplStatus qpliExp_<mod>  (const Qpl32f* pSrc ,  int srcStep , Qpl32f* pDst , int dstStep  ,
QpliSize roiSize );
Supported values for mod:

 32f_C1R

 32f_C3R

Case 3: In-place operation on integer data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliExp_<mod>  (Qpl<datatype>* pSrcDst  , int srcDstStep ,  QpliSize roiSize ,  int
scaleFactor );
Deprecated values for mod:

 8u_C1IRSfs 16u_C1IRSfs 16s_C1IRSfs

                                                                                         137
---------------------Page 138---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 8u_C3IRSfs 16u_C3IRSfs 16s_C3IRSfs

Case 4: In-place operation on floating-point data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliExp_<mod>  (Qpl32f* pSrcDst  , int srcDstStep ,  QpliSize roiSize );
Deprecated values for mod:

 32f_C1IR

 32f_C3IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
pSrcDst                      Pointer to the source and destination image ROI for the in-place
                             operation.
srcDstStep                   Distance in bytes between starts of consecutive lines in the source
                             and destination image for the in-place operation.
roiSize                      Size of the source and destination ROI in pixels.

scaleFactor                  Scale factor (see Integer Result Scaling).

Description
The in-place flavors of the qpliExp function are deprecated. The table below specifies the corresponding
Intel QPL functions to replace the deprecated in-place functions:
 Deprecated Function                             Substitution

 qpliExp_8u_C1IRSfs                              qpliExp_8u_C1RSfs

 qpliExp_8u_C3IRSfs                              qpliExp_8u_C3RSfs

 qpliExp_16s_C1IRSfs                             qpliExp_16s_C1RSfs

 qpliExp_16s_C3IRSfs                             qpliExp_16s_C3RSfs

 qpliExp_16u_C1IRSfs                             qpliExp_16u_C1RSfs

 qpliExp_16u_C3IRSfs                             qpliExp_16u_C3RSfs

 qpliExp_32f_C1IR                                qpliExp_32f_C1R

   138
---------------------Page 139---------------------

                                                            Image Arithmetic and Logical Operations  5 

 Deprecated Function                                Substitution

 qpliExp_32f_C3IR                                  qpliExp_32f_C3R

For more information about the deprecation process use the following link: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function computes e to the power of pixel values of the source image ROI and writes the resultant
values into the destination image ROI. The function flavors operating on integer data apply fixed scaling
defined by scaleFactor  to the internally computed values, and saturate the results before writing them to
the destination image ROI.
When the overflow occurs, the resultant value is determined in accordance with the data type (see appendix
A “Appendix A Handling of Special Cases” for more information).

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if srcStep, dstStep , or srcDstStep
                                   has a zero or negative value.

Complement
DEPRECATED. Converts negative number from the
complement to direct code.

Syntax
QplStatus qpliComplement_32s_C1IR     (Qpl32s* pSrcDst  ,  int srcDstStep  , QpliSize roiSize   );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrcDst                       Pointer to the source and destination image ROI.

srcDstStep                    Distance in bytes between starts of consecutive lines in the source
                              and destination image.
roiSize                       Size of the source and destination ROI in pixels.

Description
The function qpliComplement  is deprecated. This function is obsolete and will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.

                                                                                              139
---------------------Page 140---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a negative integer number from the complement to direct code reserving the sign in
the most significant bit.

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error.

qplStsNullPtrErr                 Indicates an error condition if the pSrcDst pointer is NULL.

qplStsStepErr                    Indicates an error condition if srcDstStep has a zero or
                                 negative value.
qplStsStrideErr                  Indicates an error condition if srcDstStep is less than the
                                 image width.

DotProd
Computes the dot product of pixel values of two
source images.

Syntax
Case 1: Operation on one-channel integer data
QplStatus qpliDotProd_<mod>  (const Qpl<srcDatatype>* pSrc1  ,  int src1Step , const
Qpl<srcDatatype>* pSrc2 ,  int src2Step , QpliSize roiSize ,  Qpl64f* pDp );
Supported values for mod:

 8u64f_C1R        16u64f_C1R          16s64f_C1R         32u64f_C1R         32s64f_C1R

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliDotProd_8s64f_C1R  (const Qpl<srcDatatype>* pSrc1   , int src1Step , const
Qpl<srcDatatype>* pSrc2 ,  int src2Step , QpliSize roiSize ,  Qpl64f* pDp );
Case 2: Operation on three-channel integer data
QplStatus qpliDotProd_<mod>  (const Qpl<srcDatatype>* pSrc1  ,  int src1Step , const
Qpl<srcDatatype>* pSrc2 ,  int src2Step , QpliSize roiSize ,  Qpl64f pDp[3] );
Supported values for mod:

 8u64f_C3R        16u64f_C3R          16s64f_C3R         32u64f_C3R         32s64f_C3R

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliDotProd_8s64f_C3R  (const Qpl<srcDatatype>* pSrc1   , int src1Step , const
Qpl<srcDatatype>* pSrc2 ,  int src2Step , QpliSize roiSize ,  Qpl64f pDp[3] );
Case 3: Operation on four-channel integer data
QplStatus qpliDotProd_<mod>  (const Qpl<srcDatatype>* pSrc1  ,  int src1Step , const
Qpl<srcDatatype>* pSrc2 ,  int src2Step , QpliSize roiSize ,  Qpl64f pDp[4] );
Supported values for mod:

 8u64f_C4R        16u64f_C4R          16s64f_C4R         32u64f_C4R         32s64f_C4R
                                                                            

   140
---------------------Page 141---------------------

                                                       Image Arithmetic and Logical Operations  5 

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliDotProd_8s64f_C4R ( const Qpl8s* pSrc1 , int src1Step , const Qpl8s* pSrc2 ,
int src2Step,  QpliSize roiSize , Qpl64f pDp[4] );
QplStatus qpliDotProd_<mod> (const Qpl<srcDatatype>* pSrc1  , int src1Step , const
Qpl<srcDatatype>* pSrc2 , int src2Step , QpliSize roiSize ,  Qpl64f pDp[3]);
Deprecated values for mod:

 8u64f_AC4R                   16u64f_AC4R                     32u64f_AC4R

 8s64f_AC4R                   16s64f_AC4R                     32s64f_AC4R

Case 4: Operation on floating-point data
QplStatus qpliDotProd_32f64f_C1R  (const Qpl32f* pSrc1 , int src1Step , const Qpl32f*
pSrc2, int src2Step , QpliSize roiSize , Qpl64f* pDp , QplHintAlgorithm hint  );
QplStatus qpliDotProd_32f64f_C3R  (const Qpl32f* pSrc1 , int src1Step , const Qpl32f*
pSrc2, int src2Step , QpliSize roiSize , Qpl64f pDp[3] , QplHintAlgorithm hint  );
QplStatus qpliDotProd_32f64f_C4R  (const Qpl32f* pSrc1 , int src1Step , const Qpl32f*
pSrc2, int src2Step , QpliSize roiSize , Qpl64f pDp[4] , QplHintAlgorithm hint  );
THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliDotProd_32f64f_AC4R  (const Qpl32f* pSrc1 , int src1Step , const Qpl32f*
pSrc2, int src2Step , QpliSize roiSize , Qpl64f pDp[4] , QplHintAlgorithm hint  );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc1, pSrc2                Pointer to the ROI in the source images.

src1Step, src2Step          Distance, in bytes, between the starting points of consecutive lines
                            in the source images.
roiSize                     Size of the source image ROI.

pDp                         Pointer to the dot product or to the array containing the computed
                            dot products for multi-channel images.
hint                        Option to select the algorithmic implementation of the function, see
                            Table “Hint Arguments for Image Moment Functions”.

Description
Functions qpliDotProd_16s64f_AC4R, qpliDotProd_16u64f_AC4R, qpliDotProd_32f64f_AC4R ,
qpliDotProd_32s64f_AC4R , qpliDotProd_32u64f_AC4R , and qpliDotProd_8u64f_AC4R are deprecated.
These functions are obsolete and will be removed in a future release. Use C4R flavor instead. Use out-of-
place variant of this function. Use the following link for details: http://software.intel.com/sites/products/qpl-
deprecated-features-feedback/.

                                                                                       141
---------------------Page 142---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Functions qpliDotProd_8s64f_AC4R  , qpliDotProd_8s64f_C1R   , qpliDotProd_8s64f_C3R  , and
qpliDotProd_8s64f_C4R    are deprecated. 8s data type is obsolete and its support will be removed in a
future release. Use out-of-place variant of this function. Use the following link for details: http://
software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function computes the dot product of pixel values of two source images pSrc1 and pSrc2 using
algorithm indicated by the hint argument (see Table “Hint Arguments for Image Moment Functions”) and
stores the result in pDp. In case of multi-channel images, the dot product is computed for each channel
separately and stored in the array pDp.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error.

qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if one of the step values has zero
                                   or negative value.

DotProdCol
Calculates the dot product of taps vector and columns
of the specified set of rows.

Syntax
QplStatus qpliDotProdCol_32f_L2    (const Qpl32f* const ppSrcRow[]     ,  const Qpl32f* pTaps  ,
int tapsLen ,  Qpl32f* pDst  , int width );
QplStatus qpliDotProdCol_64f_L2    (const Qpl64f* const ppSrcRow[]     ,  const Qpl64f* pTaps  ,
int tapsLen ,  Qpl64f* pDst  , int width );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

ppSrcRow                      Pointer to the set of rows.

pTaps                         Pointer to the taps vector.

tapsLen                       Length of taps vector, is equal to the number of rows.

pDst                          Pointer to the destination row.

width                         Width of the source and destination rows.

Description

This function calculates the dot product of taps vector pTaps and columns of the specified set of the rows
ppSrcRow . It is useful for external vertical filtering pipeline implementation.

   142
---------------------Page 143---------------------

                                                        Image Arithmetic and Logical Operations  5 

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error.

qplStsNullPtrErr                 Indicates an error condition if one of the specified pointers is
                                 NULL.
qplStsSizeErr                    Indicates an error condition if width is less than or equal to 0.

Logical Operations

Functions described in this section perform bitwise operations on pixel values. The operations include logical
AND, NOT, inclusive OR, exclusive OR, and bit shifts.

And
Performs a bitwise AND operation between
corresponding pixels of two images.

Syntax
Case 1: Not-in-place operation
QplStatus qpliAnd_<mod> (const Qpl<datatype>* pSrc1  , int src1Step ,  const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C1R   16u_C1R    32s_C1R

 8u_C3R   16u_C3R    32s_C3R

 8u_C4R   16u_C4R    32s_C4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAnd_<mod> (const Qpl<datatype>* pSrc1  , int src1Step ,  const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Deprecated values for mod:

 8u_AC4R  16u_AC4R  32s_AC4R

Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAnd_<mod> (const Qpl<datatype>* pSrc  , int srcStep ,  Qpl<datatype>* pSrcDst ,
int srcDstStep , QpliSize roiSize );
Deprecated values for mod:

 8u_C1IR  16u_C1IR  32s_C1IR

 8u_C3IR  16u_C3IR  32s_C3IR

 8u_C4IR  16u_C4IR  32s_C4IR

 8u_AC4IR 16u_AC4IR 32s_AC4IR

                                                                                        143
---------------------Page 144---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h , qpls.h
Libraries: qplcore.lib, qplvm.lib , qpls.lib

Parameters

pSrc, pSrc1 , pSrc2           Pointers to the source images ROI.

srcStep , src1Step , src2Step Distances in bytes between starts of consecutive lines in the source
                              images.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
pSrcDst                       Pointer to the source and destination image ROI for the in-place
                              operation.
srcDstStep                    Distance in bytes between starts of consecutive lines in the source
                              and destination imager for the in-place operation.
roiSize                       Size of the source and destination ROI in pixels.

Description
The in-place flavors of qpliAnd are deprecated. In-place functionality will be removed in a future release.
Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
Functions qpliAnd_8u_AC4R  , qpliAnd_16u_AC4R  , and qpliAnd_32s_AC4R   are deprecated. These functions
are obsolete and will be removed in a future release. Use C4R flavor instead. Use the following link for
details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function performs a bitwise AND operation between the values of corresponding pixels of two source
image ROIs, and writes the result into a destination image ROI.
Note that the functions with the AC4 descriptor do not process alpha channelss.

Return Values

qplStsNoErr                         Indicates no error. Any other value indicates an error or a
                                    warning.
qplStsNullPtrErr                    Indicates an error condition if one of the specified pointers is
                                    NULL.
qplStsSizeErr                       Indicates an error condition if roiSize has a field with zero or
                                    negative value.
qplStsStepErr                       Indicates an error condition if any of the specified buffer step
                                    values is zero or negative.

AndC
Performs a bitwise AND operation of each pixel with a
constant.

   144
---------------------Page 145---------------------

                                                       Image Arithmetic and Logical Operations  5 

Syntax
Case 1: Not-in-place operation on one-channel data
QplStatus qpliAndC_<mod> (const Qpl<datatype>* pSrc , int srcStep , Qpl<datatype> value ,
Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
Supported values for mod:

 8u_C1R        16u_C1R         32s_C1R

Case 2: Not-in-place operation on multi-channel data
QplStatus qpliAndC_<mod> (const Qpl<datatype>* pSrc , int srcStep , const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C3R        16u_C3R         32s_C3R
                               

QplStatus qpliAndC_<mod> (const Qpl<datatype>* pSrc , int srcStep , const Qpl<datatype>
value[4], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C4R        16u_C4R         32s_C4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAndC_<mod> (const Qpl<datatype>* pSrc , int srcStep , const Qpl<datatype>
value[3], Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Deprecated values for mod:

                               
 8u_AC4R       16u_AC4R        32s_AC4R

Case 3: In-place operation on one-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAndC_<mod> (Qpl<datatype> value , Qpl<datatype>* pSrcDst , int srcDstStep ,
QpliSize roiSize);
Deprecated values for mod:

 8u_C1IR       16u_C1IR        32s_C1IR

Case 4: In-place operation on multi-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAndC_<mod> (const Qpl<datatype> value[3] ,  Qpl<datatype>* pSrcDst , int
srcDstStep, QpliSize roiSize );
Deprecated values for mod:

 8u_C3IR       16u_C3IR        32s_C3IR

 8u_AC4IR      16u_AC4IR       32s_AC4IR

                                                                                      145
---------------------Page 146---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

QplStatus qpliAndC_<mod>   (const Qpl<datatype> value[4]     , Qpl<datatype>* pSrcDst   ,  int
srcDstStep , QpliSize roiSize   );
Deprecated values for mod:

 8u_C4IR        16u_C4IR          32s_C4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
value                         The constant value to perform the bitwise AND operation on each
                              pixel of the source image ROI (constant vector in case of multi-
                              channel images).
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
pSrcDst                       Pointer to the source and destination image ROI for the in-place
                              operation.
srcDstStep                    Distance in bytes between starts of consecutive lines in the source
                              and destination image buffer for the in-place operation.
roiSize                       Size of the source and destination ROI in pixels.

Description
The in-place flavors of qpliAndC are deprecated. In-place functionality will be removed in a future release.
Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
Functions qpliAndC_8u_AC4R , qpliAndC_16u_AC4R  , and qpliAndC_32s_AC4R   are deprecated. These
functions are obsolete and will be removed in a future release. Use C4R flavor instead. Use the following link
for details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function performs a bitwise AND operation between each pixel value of a source image ROI and constant
value.
Note that the functions with the AC4 descriptor do not process alpha channels.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .

   146
---------------------Page 147---------------------

                                                       Image Arithmetic and Logical Operations  5 

qplStsSizeErr                   Indicates an error condition if roiSize has a field with a zero or
                                negative value.
qplStsStepErr                   Indicates an error condition if srcStep, dstStep, or srcDstStep
                                has a zero or negative value.

Or
Performs bitwise inclusive OR operation between
pixels of two source buffers.

Syntax
Case 1: Not-in-place operation
QplStatus qpliOr_<mod> (const Qpl<datatype>* pSrc1  , int src1Step , const Qpl<datatype>*
pSrc2, int src2Step , Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C1R         16u_C1R       32s_C1R

 8u_C3R         16u_C3R       32s_C3R

 8u_C4R         16u_C4R       32s_C4R

 8u_AC4R                      32s_AC4R

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliOr_16u_AC4R (const Qpl<datatype>* pSrc1  , int src1Step , const
Qpl<datatype>* pSrc2 , int src2Step , Qpl<datatype>* pDst , int dstStep , QpliSize
roiSize);
Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliOr_<mod> (const Qpl<datatype>* pSrc ,  int srcStep,  Qpl<datatype>* pSrcDst ,
int srcDstStep,  QpliSize roiSize );
Deprecated values for mod:

 8u_C1IR       16u_C1IR        32s_C1IR

 8u_C3IR       16u_C3IR        32s_C3IR

 8u_C4IR       16u_C4IR        32s_C4IR

 8u_AC4IR      16u_AC4IR       32s_AC4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

                                                                                       147
---------------------Page 148---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Parameters

pSrc, pSrc1 , pSrc2           Pointers to the source images ROI.

srcStep , src1Step , src2Step Distances in bytes between starts of consecutive lines in the source
                              images.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
pSrcDst                       Pointer to the source and destination image ROI for the in-place
                              operation.
srcDstStep                    Distance in bytes between starts of consecutive lines in the source
                              and destination image for the in-place operation.
roiSize                       Size of the source and destination ROI in pixels.

Description
The in-place flavors of the qpliOr are deprecated. In-place functionality will be removed in a future release.
Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
The function qpliOr_16u_AC4R  is deprecated. This function is obsolete and will be removed in a future
release. Use C4R flavor instead. Use the following link for details: http://software.intel.com/sites/products/
qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function performs a bitwise inclusive OR operation between the values of corresponding pixels of two
source image ROIs, and writes the result into a destination image ROI. Note that the functions with the AC4
descriptor do not process alpha channels.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize  has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if any of the specified buffer step
                                   values is zero or negative.

Example
The code example below show how to use the function qpliOr_8u_C1R .
void func_or()
{
    QpliSize Src1ROI = {8,4};
    QpliSize Src2ROI = {8,4};
    QpliSize DstROI = {5,4};
    Qpl8u src1[8*4];
    Qpl8u src2[8*4];
    Qpl8u dst[8*4];

    qpliSet_8u_C1R(0,dest,8,Src1ROI);
    qpliSet_8u_C1R(5,src1,8,Src1ROI);
    qpliSet_8u_C1R(6,src2,8,Src2ROI);

   148
---------------------Page 149---------------------

                                                        Image Arithmetic and Logical Operations  5 
    qpliOr_8u_C1R(src1,8,src2,8,dst,8,DstROI);

}

Result:
         src1                       src2                       dst
05 05 05 05 05 05 05 05    06 06 06 06 06 06 06 06    07 07 07 07 07 00 00 00
05 05 05 05 05 05 05 05    06 06 06 06 06 06 06 06    07 07 07 07 07 00 00 00
05 05 05 05 05 05 05 05    06 06 06 06 06 06 06 06    07 07 07 07 07 00 00 00
05 05 05 05 05 05 05 05    06 06 06 06 06 06 06 06    07 07 07 07 07 00 00 00

OrC
Performs a bitwise inclusive OR operation between
each pixel of a buffer and a constant.

Syntax
Case 1: Not-in-place operation on one-channel data
QplStatus qpliOrC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype> value  ,
Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C1R  16u_C1R     32s_C1R

Case 2: Not-in-place operation on multi-channel data
QplStatus qpliOrC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , const Qpl<datatype>
value[3], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C3R  16u_C3R     32s_C3R
                     

QplStatus qpliOrC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , const Qpl<datatype>
value[4], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C4R  16u_C4R     32s_C4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliOrC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , const Qpl<datatype>
value[3], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Deprecated values for mod:

                     
 8u_AC4R  16u_AC4R  32s_AC4R

                                                                                       149
---------------------Page 150---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Case 3: In-place operation on one-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliOrC_<mod>  (Qpl<datatype> value ,  const Qpl<datatype>* pSrcDst  , int
srcDstStep,  QpliSize roiSize );
Deprecated values for mod:

 8u_C1IR  16u_C1IR  32s_C1IR

Case 4: In-place operation on multi-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliOrC_<mod>  (const Qpl<datatype> value[3]  , const Qpl<datatype>* pSrcDst   , int
srcDstStep,  QpliSize roiSize );
Deprecated values for mod:

 8u_C3IR  16u_C3IR  32s_C3IR

 8u_AC4IR 16u_AC4IR 32s_AC4IR

QplStatus qpliOrC_<mod>  (const Qpl<datatype> value[4]  , const Qpl<datatype>* pSrcDst   , int
srcDstStep,  QpliSize roiSize );
Deprecated values for mod:

 8u_C4IR                      16u_C4IR                         32s_C4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI.

srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image.
value                       The constant value to perform the bitwise OR operation on each
                            pixel of the source image (constant vector in case of multi-channel
                            images).
pDst                        Pointer to the destination image ROI.

dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
pSrcDst                     Pointer to the source and destination image ROI for the in-place
                            operation.
srcDstStep                  Distance in bytes between starts of consecutive lines in the source
                            and destination image for the in-place operation.
roiSize                     Size of the source and destination ROI in pixels.

   150
---------------------Page 151---------------------

                                                           Image Arithmetic and Logical Operations  5 

Description
The in-place flavors of the qpliOrC are deprecated. In-place functionality will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
Functions qpliOrC_8u_AC4R , qpliOrC_16u_AC4R , and qpliOrC_32s_AC4R   are deprecated. These functions
are obsolete and will be removed in a future release. Use C4R flavor instead. Use the following link for
details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function performs a bitwise inclusive OR operation between each pixel value of a source image ROI and
constant value.
Note that the functions with the AC4 descriptor do not process alpha channels.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL.
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if srcStep, dstStep, or srcDstStep
                                   has a zero or negative value.

Xor
Performs bitwise exclusive OR operation between
pixels of two source buffers.

Syntax
Case 1: Not-in-place operation
QplStatus qpliXor_<mod>   (const Qpl<datatype>* pSrc1    , int src1Step  , const Qpl<datatype>*
pSrc2,  int src2Step ,  Qpl<datatype>* pDst  ,  int dstStep ,  QpliSize roiSize  );
Supported values for mod:

 8u_C1R    16u_C1R    32s_C1R

 8u_C3R    16u_C3R    32s_C3R

 8u_C4R    16u_C4R    32s_C4R

 8u_AC4R  16u_AC4R  32s_AC4R

Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliXor_<mod>   (const Qpl<datatype>* pSrc   ,  int srcStep ,  Qpl<datatype>* pSrcDst   ,
int srcDstStep ,  QpliSize roiSize  );
Deprecated values for mod:

 8u_C1IR  16u_C1IR  32s_C1IR

 8u_C3IR  16u_C3IR  32s_C3IR

                                                                                             151
---------------------Page 152---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 8u_C4IR  16u_C4IR  32s_C4IR

 8u_AC4IR 16u_AC4IR 32s_AC4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc, pSrc1 , pSrc2           Pointers to the source images ROI.

srcStep , src1Step, src2Step  Distances in bytes between starts of consecutive lines in the source
                              images.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
pSrcDst                       Pointer to the source and destination image ROI for the in-place
                              operation.
srcDstStep                    Distance in bytes between starts of consecutive lines in the source
                              and destination image for the in-place operation.
roiSize                       Size of the source and destination ROI in pixels.

Description
The in-place flavors of the qpliXor function are deprecated. In-place functionality will be removed in a
future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
Functions qpliXor_32s_AC4IR  , qpliXor_32s_C1IR  , qpliXor_32s_C3IR  , and qpliXor_32s_C4IR   are
deprecated. These functions are obsolete and will be removed in a future release. Use the following link for
details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function performs a bitwise exclusive OR operation between the values of corresponding pixels of two
source image ROIs, and writes the result into a destination image ROI.
Note that the functions with the AC4 descriptor do not process alpha channels.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize  has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if any of the specified buffer step
                                   values is zero or negative.

   152
---------------------Page 153---------------------

                                                       Image Arithmetic and Logical Operations  5 

XorC
Performs a bitwise exclusive OR operation between
each pixel of a buffer and a constant.

Syntax
Case 1: Not-in-place operation on one-channel data
QplStatus qpliXorC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype> value ,
Qpl<datatype>* pDst , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C1R  16u_C1R     32s_C1R

Case 2: Not-in-place operation on multi-channel data
QplStatus qpliXorC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , const Qpl<datatype>
value[3], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C3R   16u_C3R    32s_C3R

 8u_AC4R  16u_AC4R  32s_AC4R

QplStatus qpliXorC_<mod> (const Qpl<datatype>* pSrc  , int srcStep , const Qpl<datatype>
value[4], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Deprecated values for mod:

 8u_C4R  16u_C4R     32s_C4R

Case 3: In-place operation on one-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliXorC_<mod> (Qpl<datatype> value ,  const Qpl<datatype>* pSrcDst ,  int
srcDstStep, QpliSize roiSize );
Deprecated values for mod:

 8u_C1IR  16u_C1IR  32s_C1IR

Case 4: In-place operation on multi-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliXorC_<mod> (const Qpl<datatype> value[3]  , const Qpl<datatype>* pSrcDst  ,
int srcDstStep,  QpliSize roiSize );
Deprecated values for mod:

 8u_C3IR  16u_C3IR  32s_C3IR

 8u_AC4IR 16u_AC4IR 32s_AC4IR

                                                                                       153
---------------------Page 154---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

QplStatus qpliXorC_<mod>   (const Qpl<datatype> value[4]     , const Qpl<datatype>* pSrcDst     ,
int srcDstStep  , QpliSize roiSize   );
Deprecated values for mod:

 8u_C4IR  16u_C4IR  32s_C4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
value                         The constant value to perform the bitwise XOR operation on each
                              pixel of the source image ROI (constant vector in case of multi-
                              channel images).
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
pSrcDst                       Pointer to the source and destination image ROI for the in-place
                              operation.
srcDstStep                    Distance in bytes between starts of consecutive lines in the source
                              and destination image for the in-place operation.
roiSize                       Size of the source and destination ROI in pixels.

Description
The in-place flavors of the qpliXorC function are deprecated. In-place functionality will be removed in a
future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
Functions qpliXorC_16u_AC4R   and qpliXorC_8u_AC4R   are deprecated. These functions are obsolete and
will be removed in a future release. Use C4R flavor instead. Use the following link for details: http://
software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliXorC_32s_AC4IR  , qpliXorC_32s_AC4R   , qpliXorC_32s_C1IR   , qpliXorC_32s_C3IR  , and
qpliXorC_32s_C4IR   are deprecated. These functions are obsolete and will be removed in a future release.
Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function performs a bitwise exclusive OR operation between each pixel value of a source image ROI and
constant value.
Note that the functions with the AC4 descriptor do not process alpha channels.

   154
---------------------Page 155---------------------

                                                         Image Arithmetic and Logical Operations  5 

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if one of the specified pointers is
                                 NULL .
qplStsSizeErr                    Indicates an error condition if roiSize has a field with zero or
                                 negative value.
qplStsStepErr                    Indicates an error condition if srcStep, dstStep, or srcDstStep
                                 has a zero or negative value.

Not
Performs a bitwise NOT operation on each pixel of a
source buffer.

Syntax
Case 1: Not-in-place operation
QplStatus qpliNot_<mod>  (const Qpl8u* pSrc  , int srcStep , Qpl8u* pDst ,  int dstStep ,
QpliSize roiSize );
Supported values for mod:

 8u_C1R

 8u_C3R

 8u_C4R

 8u_AC4R

Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliNot_<mod>  (Qpl8u* pSrcDst ,  int srcDstStep , QpliSize roiSize  );
Deprecated values for mod:

 8u_C1IR

 8u_C3IR

 8u_C4IR

 8u_AC4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

                                                                                          155
---------------------Page 156---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
pSrcDst                       Pointer to the source and destination image ROI for the in-place
                              operation.
srcDstStep                    Distance in bytes between starts of consecutive lines in the source
                              and destination image for the in-place operation.
roiSize                       Size of the source and destination ROI in pixels.

Description
The in-place flavors of the qpliNot are deprecated. In-place functionality will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function performs a bitwise NOT operation on each pixel value of a source image ROI.
Note that the functions with the AC4 descriptor do not process alpha channels.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL.
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.
qplStsStepErr                      Indicates an error condition if srcStep, dstStep, or srcDstStep
                                   has a zero or negative value.

RShiftC
Shifts bits in pixel values to the right.
Case 1: Not-in-place operation on one-channel data
QplStatus qpliRShiftC_<mod>   (const Qpl<datatype>* pSrc    , int srcStep  , Qpl32u value  ,
Qpl<datatype>* pDst  ,  int dstStep , QpliSize roiSize   );
Supported values for mod:

 8u_C1R                16u_C1R                   16s_C1R                   32s_C1R

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliRShiftC_8s_C1R   (const Qpl<datatype>* pSrc    , int srcStep  , Qpl32u value  ,
Qpl<datatype>* pDst  ,  int dstStep , QpliSize roiSize   );

   156
---------------------Page 157---------------------

                                                      Image Arithmetic and Logical Operations  5 

Case 2: Not-in-place operation on multi-channel data
QplStatus qpliRShiftC_<mod> (const Qpl<datatype>* pSrc , int srcStep, const Qpl32u
value[3], Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
Supported values for mod:

 8u_C3R              16u_C3R                 16s_C3R                32s_C3R
                                                                    

QplStatus qpliRShiftC_<mod> (const Qpl<datatype>* pSrc , int srcStep, const Qpl32u
value[4], Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
Supported values for mod:

 8u_C4R              16u_C4R                 16s_C4R                32s_C4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliRShiftC_8s_C3R (const Qpl<datatype>* pSrc , int srcStep, const Qpl32u
value[3], Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
QplStatus qpliRShiftC_8s_C4R (const Qpl<datatype>* pSrc , int srcStep, const Qpl32u
value[4], Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliRShiftC_<mod> (const Qpl<datatype>* pSrc , int srcStep, const Qpl32u
value[3], Qpl<datatype>* pDst , int dstStep,  QpliSize roiSize);
Deprecated values for mod:

                                                                        
 8u_AC4R          8s_AC4R         16u_AC4R            16s_AC4R           32s_AC4R

Case 3: In-place operation on one-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliRShiftC_<mod> (Qpl32u value, Qpl<datatype>* pSrcDst , int srcDstStep ,
QpliSize roiSize);
Deprecated values for mod:

 8u_C1IR          8s_C1IR         16u_C1IR            16s_C1IR           32s_C1IR

Case 4: In-place operation on multi-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliRShiftC_<mod> (const Qpl32u value[3],  Qpl<datatype>* pSrcDst,  int
srcDstStep, QpliSize roiSize );
Deprecated values for mod:

 8u_C3IR          8s_C3IR          16u_C3IR           16s_C3IR           32s_C3IR

 8u_AC4IR         8s_AC4IR         16u_AC4IR          16s_AC4IR          32s_AC4IR

                                                                                     157
---------------------Page 158---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

QplStatus qpliRShiftC_<mod>    (const Qpl32u value[4]    , Qpl<datatype>* pSrcDst    , int
srcDstStep ,  QpliSize roiSize  );
Deprecated values for mod:

 8u_C4IR            8s_C4IR            16u_C4IR             16s_C4IR              32s_C4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h , qplvm.h , qpls.h
Libraries: qplcore.lib, qplvm.lib , qpls.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
value                         The number of bits to shift (constant vector in case of multi-channel
                              images).
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
pSrcDst                       Pointer to the source and destination image ROI for the in-place
                              operation.
srcDstStep                    Distance in bytes between starts of consecutive lines in the source
                              and destination image for the in-place operation.
roiSize                       Size of the source and destination ROI in pixels.

Description
The in-place flavors of the qpliRShiftC function are deprecated. In-place functionality will be removed in a
future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
Functions qpliRShiftC_16s_AC4R    , qpliRShiftC_16u_AC4R   , qpliRShiftC_32s_AC4R   , and
qpliRShiftC_8u_AC4R    are deprecated. These functions are obsolete and will be removed in a future
release. Use C4R flavor instead. Use the following link for details: http://software.intel.com/sites/products/
qpl-deprecated-features-feedback/.
Functions qpliRShiftC_8s_AC4IR  , qpliRShiftC_8s_AC4R   , qpliRShiftC_8s_C1IR   ,
qpliRShiftC_8s_C1R   , qpliRShiftC_8s_C3IR  , qpliRShiftC_8s_C3R  , qpliRShiftC_8s_C4IR    and
qpliRShiftC_8s_C4R    are deprecated. The 8s data type is obsolete and its support will be removed in a
future release. Use C4R flavor instead. Use the following link for details: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function decreases the intensity of pixels in the source image ROI by shifting the bits in each pixel value
by value bits to the right. The positions vacated after shifting the bits are filled with the sign bit. In case of
multi-channel data, each color channel can have its own shift value. This operation is equivalent to dividing
the pixel values by a constant power of 2.
Note that the functions with the AC4 descriptor do not process alpha channels.

   158
---------------------Page 159---------------------

                                                        Image Arithmetic and Logical Operations  5 

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if one of the specified pointers is
                                 NULL.
qplStsSizeErr                    Indicates an error condition if roiSize has a field with a zero or
                                 negative value.
qplStsStepErr                    Indicates an error condition if srcStep, dstStep, or srcDstStep
                                 has a zero or negative value.

LShiftC
Shifts bits in pixel values to the left.

Syntax
Case 1: Not-in-place operation on one-channel data
QplStatus qpliLShiftC_<mod>  (const Qpl<datatype>* pSrc ,  int srcStep , Qpl32u value ,
Qpl<datatype>* pDst , int dstStep , QpliSize roiSize  );
Supported values for mod:

 8u_C1R        16u_C1R         32s_C1R

Case 2: Not-in-place operation on multi-channel data
QplStatus qpliLShiftC_<mod>  (const Qpl<datatype>* pSrc ,  int srcStep , const Qpl32u
value[3], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C3R    16u_C3R     32s_C3R    32s_AC4R

QplStatus qpliLShiftC_<mod>  (const Qpl<datatype>* pSrc ,  int srcStep , const Qpl32u
value[4], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_C4R        16u_C4R         32s_C4R

THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliLShiftC_<mod>  (const Qpl<datatype>* pSrc ,  int srcStep , const Qpl32u
value[3], Qpl<datatype>* pDst  , int dstStep , QpliSize roiSize );
Deprecated values for mod:

                       
 8u_AC4R               16u_AC4R

                                                                                        159
---------------------Page 160---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Case 3: In-place operation on one-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliLShiftC_<mod>   (Qpl32u value , Qpl<datatype>* pSrcDst   , int srcDstStep  ,
QpliSize roiSize );
Deprecated values for mod:

 8u_C1IR        16u_C1IR        32s_C1IR

Case 4: In-place operation on multi-channel data. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliLShiftC_<mod>   (const Qpl32u value[3]  , Qpl<datatype>* pSrcDst   , int
srcDstStep , QpliSize roiSize  );
Deprecated values for mod:

 8u_C3IR        16u_C3IR         32s_C3IR

 8u_AC4IR       16u_AC4IR        32s_AC4IR

QplStatus qpliLShiftC_<mod>   (const Qpl32u value[4]  , Qpl<datatype>* pSrcDst   , int
srcDstStep , QpliSize roiSize  );
Deprecated values for mod:

 8u_C4IR        16u_C4IR        32s_C4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
value                        The number of bits to shift (constant vector in case of multi-channel
                             images).
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
pSrcDst                      Pointer to the source and destination image ROI for the in-place
                             operation.
srcDstStep                   Distance in bytes between starts of consecutive lines in the source
                             and destination image for the in-place operation.
roiSize                      Size of the source and destination ROI in pixels.

Description
The in-place flavors of qpliLShiftC are deprecated. In-place functionality will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.

   160
---------------------Page 161---------------------

                                                             Image Arithmetic and Logical Operations  5 

Functions qpliLShiftC_16u_AC4R    and qpliLShiftC_8u_AC4R    are deprecated. These functions are
obsolete and will be removed in a future release. Use C4R flavor instead. Use the following link for details:
http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function changes the intensity of pixels in the source image ROI by shifting the bits in each pixel value
by value bits to the left. In case of multi-channel data, each color channel can have its own shift value. The
positions vacated after shifting the bits are filled with zeros. Values obtained as a result of left shift
operations are not saturated. To get saturated values, use multiplication functions instead.
Note that the functions with the AC4 descriptor do not process alpha channels.

Return Values

qplStsNoErr                         Indicates no error. Any other value indicates an error or a
                                    warning.
qplStsNullPtrErr                    Indicates an error condition if one of the specified pointers is
                                    NULL .
qplStsSizeErr                       Indicates an error condition if roiSize  has a field with zero or
                                    negative value.
qplStsStepErr                       Indicates an error condition if srcStep , dstStep, orsrcDstStep
                                    has a zero or negative value.

Example
The code example below illustrates the use of left shift function.

QplStatus lshift( void ) {
   Qpl8u img[8*8] = { 1, 0x7F, 0xFE };
   QpliSize roi = { 8, 8 };
   QplStatus st = qpliLShiftC_8u_C1IR( 1, img, 8, roi );
   printf( "%02x %02x %02x\n", img[0], img[1], img[2] );
   return st;
}

Output values:
02 fe fc

Alpha Composition

The Intel QPL provides functions that composite two image buffers using either the opacity (alpha) channel in
the images or provided alpha values.
These functions operate on image buffers with 8-bit or 16-bit data in RGB or RGBA format. In all compositing
operations a resultant pixel in destination buffer pDst is created by overlaying a pixel from the foreground
image buffer pSrc1 over a pixel from the background image buffer pSrc2. The supported types of images
combining by using alpha values are listed in the table below.
Types of Image Composing Operations
 Type                             Output Pixel                           Description in Imaging
                                                                         Terms
           Color Components               Alpha value
                                                                          
 OVER      αA*A+(1-  αA)* αB*B            αA+(1- α )* α                  A occludes B
                                                  A    B

                                                                                                161
---------------------Page 162---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 IN        αA*A* α                        α *α                          A within B. A acts as a matte
                  B                        A  B
                                                                        for B. A shows only where B
                                                                        is visible.

 OUT       αA*A*(1- αB)                   αA*(1-α )                    A outside B. NOT-B acts as a
                                                 B
                                                                        matte for A. A shows only
                                                                        where B is not visible.

 ATOP      αA*A* αB+(1- αA)* αB*B         α *α                          Combination of (A IN B) and
                                           A  B+(1- α A)* αB
                                                                        (B OUT A). B is both back-
                                                                        ground and matte for A.

 XOR       α                                                            Combination of (A OUT B)
            A*A*(1- αB)+(1- αA)* αB*B     αA*(1-αB)+(1- αA)* αB
                                                                        and (B OUT A). A and B
                                                                        mutually exclude each other.

 PLUS      αA*A+ αB*B                     α                             Blend without precedence
                                           A+α B

In the formulas above, the input image buffers are denoted as A and B for simplicity. The Greek letter α with
subscripts denotes the normalized (scaled) alpha value in the range 0 to 1. It is related to the integer alpha
value alpha as:
α = alpha / max_val
where max_val is 255 for 8-bit or 65535 for 16-bit unsigned pixel data.
For the qpliAlphaComp  function that operates on 4-channel RGBA buffers only, αA andαB are the normalized
alpha values of the two input image buffers, respectively.
For the qpliAlphaCompC  function, αA andαBare the normalized constant alpha values that are passed as
parameters to the function.
Note that in formulas for computing the resultant color channel values, A and B stand for the pixel color
components of the respective input image buffers.
To save a significant amount of computation for some of the alpha compositing operations, use functions 
AlphaPremul  , AlphaPremulC  for pre-multiplying color channel values by the alpha values. This reduces the
number of multiplications required in the compositing operations, which is especially efficient for repeated
compositing of an image.
The type of composition operation that is performed by the function AlphaComp and AlphaCompC is specified
by the parameter alphaType , the table below lists its possible values.
Possible Values of alphaType Parameter
 Operation types                                     Parameter Value

 OVER                qplAlphaOver                             qplAlphaOverPremul

 IN                  qplAlphaIn                               qplAlphaInPremul

 OUT                 qplAlphaOut                              qplAlphaOutPremul

 ATOP                qplAlphaATop                             qplAlphaATopPremul

 XOR                 qplAlphaXor                              qplAlphaXorPremul

 PLUS                qplAlphaPlus                             qplAlphaPlusPremul

AlphaComp
Combines two images using alpha (opacity) values of
both images.

   162
---------------------Page 163---------------------

                                                      Image Arithmetic and Logical Operations  5 

Syntax
QplStatus qpliAlphaComp_<mod> (const Qpl<datatype>* pSrc1 , int src1Step,  const
Qpl<datatype>* pSrc2,  int src2Step, Qpl<datatype>* pDst , int dstStep , QpliSize
roiSize, QpliAlphaType alphaType );
Supported values for mod:

 8u_AC1R    16u_AC1R  1333
                      6222
                      susf
                      ____
                      AAAA
                      CCCC
                      4111
                      RRRR

 8u_AC4R    16u_AC4R  1333
                      6222
                      susf
                      ____
                      AAAA
                      CCCC
                      1444
                      RRRR

QplStatus qpliAlphaComp_<mod> (const Qpl<datatype>* const pSrc1[4] , int src1Step , const
Qpl<datatype>* const pSrc2[4] , int src2Step,  Qpl<datatype>* const pDst[4] , int dstStep,
QpliSize roiSize, QpliAlphaType alphaType );
Supported values for mod:

 8u_AP4R    16u_AP4R

QplStatus qpliAlphaComp_<mod> (const Qpl<datatype>* pSrc1 , int src1Step,  const
Qpl<datatype>* pSrc2,  int src2Step, Qpl<datatype>* pDst , int dstStep , QpliSize
roiSize, QpliAlphaType alphaType );
Supported values for mod:

 8s_AC1R    8s_AC4R

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc1, pSrc2               Pointers to the source image ROI for pixel-order data. An array of
                           pointers to ROI in the separate source color planes in case of planar
                           data.

                                                                                     163
---------------------Page 164---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

src1Step , src2Step           Distances in bytes between starts of consecutive lines in the source
                              images.
pDst                          Pointer to the destination image ROI for pixel-order data. An array
                              of pointers to ROI in the separate destination color planes in case of
                              planar data.
dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
roiSize                       Size of the source and destination ROI in pixels.

alphaType                     The composition type to perform. See Table “Possible Values of the
                              Parameter alphaType” for the type value and description.

Description
Functions qpliAlphaComp_8s_AC1R    and qpliAlphaComp_8s_AC4R    are deprecated. 8s data type is obsolete
and its support will be removed in a future release. Use the following link for details: http://
software.intel.com/sites/products/qpl-deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function performs an image compositing operation on RGBA images using alpha values of both images.
The compositing is done by overlaying pixels (rA, gA,bA, αA) from the foreground image pSrc1 with pixels
(rB,gB,bB, αB) from the background image pSrc2 to produce pixels (rC,gC,bC, αC) in the resultant image
pDst. The alpha values are assumed to be normalized to the range [0..1].
The type of the compositing operation is indicated by the alphaType parameter. Use Table “Possible Values
of the Parameter alphaType” to choose a valid alphaType value depending on the required composition
type. For example, the resulting pixel color components for the OVER operation (see Table “Types of Image
Composing Operations”) are computed as follows:

rC = αA * rA +(1 - αA)* αB *rB
gC = αA * gA +(1 - αA)* αB *gB
bC = αA * bA +(1 - αA)* αB *bB
The resulting (normalized) alpha value is computed as

αC = αA +(1 - αA)* αB
This function can be used for unsigned pixel data only.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize  has a field with zero or
                                   negative value.

AlphaCompC
Combines two images using constant alpha values.

   164
---------------------Page 165---------------------

                                                       Image Arithmetic and Logical Operations  5 

Syntax
QplStatus qpliAlphaCompC_<mod> (const Qpl<datatype>* pSrc1 ,  int src1Step, Qpl<datatype>
alpha1, const Qpl<datatype>* pSrc2 ,  int src2Step, Qpl<datatype> alpha2 ,  Qpl<datatype>*
pDst, int dstStep,  QpliSize roiSize , QpliAlphaType alphaType );
Supported values for mod:

 8u_C1R  8u_C3R  8u_C4R  8u_AC4R

 16u_C1R 16u_C3R 16u_C4R 16u_AC4R

 16s_C1R

 32u_C1R

 32s_C1R

 32f_C1R
                          

QplStatus qpliAlphaCompC_<mod> (const Qpl<datatype>* const pSrc1[4]  , int src1Step ,
Qpl<datatype> alpha1 , const Qpl<datatype>* const pSrc2[4]  , int src2Step,  Qpl<datatype>
alpha2, Qpl<datatype>* const pDst[4] ,  int dstStep, QpliSize roiSize , QpliAlphaType
alphaType);
Supported values for mod:

 8u_AP4R   16u_AP4R

THE FOLLOWING FUNCTION IS DEPRECATED:
QplStatus qpliAlphaCompC_8s_C1R (const Qpl<datatype>* pSrc1 ,  int src1Step, Qpl<datatype>
alpha1, const Qpl<datatype>* pSrc2 ,  int src2Step, Qpl<datatype> alpha2 ,  Qpl<datatype>*
pDst, int dstStep,  QpliSize roiSize , QpliAlphaType alphaType );

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc1, pSrc2               Pointers to the source image ROI for pixel-order data. An array of
                           pointers to ROI in the separate source color planes in case of planar
                           data.
src1Step, src2Step         Distances in bytes between starts of consecutive lines in the source
                           images.
pDst                       Pointer to the destination image ROI for pixel-order data. An array
                           of pointers to ROI in the separate destination color planes in case of
                           planar data.
dstStep                    Distance in bytes between starts of consecutive lines in the
                           destination image.

                                                                                      165
---------------------Page 166---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

roiSize                       Size of the source and destination ROI in pixels.

alpha1 , alpha2               Constant alpha values to use for the compositing operation.

alphaType                     The composition type to perform. See Table “Possible Values of the
                              Parameter alphaType” for the type value and description.

Description
The function qpliAlphaCompC_8s_C1R   is deprecated. 8s data type is obsolete and its support will be
removed in a future release. Use the following link for details: http://software.intel.com/sites/products/qpl-
deprecated-features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function performs an image compositing operation on one-channel image buffers, three-channel RGB
and four-channel RGBA image buffers and on planar images, using constant alpha values alpha1 and
alpha2. These values are passed to the function as parameters.
The compositing is done by overlaying pixels from the foreground image ROI pSrc1 with pixels from the
background image ROI pSrc2  to produce pixels in the resultant image ROI pDst. The alpha values are
normalized to the range [0..1].
The type of the compositing operation is indicated by the alphaType parameter. Use Table “Possible Values
of the Parameter alphaType” to choose a valid alphaType value depending on the required composition
type. For example, the resulting pixel color components for the OVER operation (see Table “Types of Image
Composing Operations”) are computed as follows:

rC = α1 * rA +(1 - α1)* α2 *rB
gC = α1 * gA +(1 - α1)* α2 *gB
bC = α1 * bA +(1 - α1)* α2 *bB
where α1, α2 are the normalised alpha values alpha1, alpha2.
This function can be used for unsigned pixel data only.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize has a field with zero or
                                   negative value.

Example
The code example below shows how to use alpha composition function.

QplStatus acomp( void ) {
   Qpl8u imga[8*8], imgb[8*8], imgc[8*8];
   QpliSize roi = { 8, 8 };
   QplStatus st;
   qpliImageRamp_8u_C1R( imga, 8, roi, 0, 1, qplAxsHorizontal );
   qpliImageRamp_8u_C1R( imgb, 8, roi, 0, 2, qplAxsHorizontal );
   st = qpliAlphaCompC_8u_C1R( imga, 8, 255/3, imgb, 8, 255, imgc, 8, roi, qplAlphaOver );
   printf( "over: a=%d,A=255/3; b=%d,B=255; c=%d //
c=a*A+b*(1-A)*B\n",imga[6],imgb[6],imgc[6] );
   return st;
}

   166
---------------------Page 167---------------------

                                                        Image Arithmetic and Logical Operations  5 

Output
over: a=6,A=255/3; b=12,B=255; c=10 // c=a*A+b*B*(1-A)

AlphaPremul
Pre-multiplies pixel values of an image by its alpha
values.

Syntax
Case 1: Not-in-place operation
QplStatus qpliAlphaPremul_<mod>  (const Qpl<datatype>* pSrc  , int srcStep , Qpl<datatype>*
pDst, int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_AC4R    16u_AC4R

QplStatus qpliAlphaPremul_<mod>  (const Qpl<datatype>* const pSrc[4]  ,  int srcStep,
Qpl<datatype>* const pDst[4]  , int dstStep , QpliSize roiSize );
Supported values for mod:

 8u_AP4R    16u_AP4R

Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAlphaPremul_<mod>  (Qpl<datatype>* pSrcDst ,  int srcDstStep , QpliSize
roiSize);
Deprecated values for mod:

 8u_AC4IR  16u_AC4IR

QplStatus qpliAlphaPremul_<mod>  (Qpl<datatype>* const pSrcDst[4]  , int srcDstStep ,
QpliSize roiSize );
Deprecated values for mod:

 8u_AP4IR  16u_AP4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI for pixel-order data. An array of
                            pointers to ROI in the separate source color planes in case of planar
                            data.
srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image.

                                                                                        167
---------------------Page 168---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

pDst                          Pointer to the destination image ROI for pixel-order data. An array
                              of pointers to ROI in the separate destination color planes in case of
                              planar data.
dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
pSrcDst                       Pointer to the source and destination buffer or an array of pointers
                              to separate source and destination color planes for the in-place
                              operation.
srcDstStep                    Distance in bytes between starts of consecutive lines in the source
                              and destination image for the in-place operation.
roiSize                       Size of the source and destination ROI in pixels.

Description
The in-place flavors of qpliAlphaPremul are deprecated. In-place functionality will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a RGBA source image (pixel order or planar) to the pre-multiplied alpha form. If
(r,g,b,a) are the red, green, blue, and alpha values of a pixel, then new pixel values are (r* α, g*α, b*α, a)
after execution of this function. Here α is the pixel normalized alpha value in the range 0 to 1.
The function qpliAlphaPremul  can be used for unsigned pixel data only.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if one of the specified pointers is
                                   NULL .
qplStsSizeErr                      Indicates an error condition if roiSize  has a field with zero or
                                   negative value.

AlphaPremulC
Pre-multiplies pixel values of an image using constant
alpha (opacity) values.

Syntax
Case 1: Not-in-place operation
QplStatus qpliAlphaPremulC_<mod>     (const Qpl<datatype>* pSrc    , int srcStep  ,  Qpl<datatype>
alpha,  Qpl<datatype>* pDst   , int dstStep  ,  QpliSize roiSize  );
Supported values for mod :

 8u_C1R      16u_C1R

 8u_C3R      16u_C3R

 8u_C4R      16u_C4R

 8u_AC4R     16u_AC4R

   168
---------------------Page 169---------------------

                                                        Image Arithmetic and Logical Operations  5 

QplStatus qpliAlphaPremulC_<mod>  (const Qpl<datatype>* const pSrc[4]   , int srcStep ,
Qpl<datatype> alpha , Qpl<datatype>* const pDst[4]   , int dstStep , QpliSize roiSize  );
Supported values for mod :

 8u_AP4R    16u_AP4R

Case 2: In-place operation. THE FOLLOWING FUNCTIONS ARE DEPRECATED:
QplStatus qpliAlphaPremulC_<mod>  (Qpl<datatype> alpha  , Qpl<datatype>* pSrcDst  , int
srcDstStep,  QpliSize roiSize );
Deprecated values for mod :

 8u_C1IR    16u_C1IR

 8u_C3IR    16u_C3IR

 8u_C4IR    16u_C4IR

 8u_AC4IR  16u_AC4IR

QplStatus qpliAlphaPremulC_<mod>  (Qpl<datatype> alpha  , Qpl<datatype>* const pSrcDst[4]   ,
int srcDstStep , QpliSize roiSize );
Deprecated values for mod :

 8u_AP4IR  16u_AP4IR

Include Files
qpli.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib

Parameters

pSrc                        Pointer to the source image ROI for pixel-order data. An array of
                            pointers to ROI in the separate source color planes in case of planar
                            data.
srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image.
pDst                        Pointer to the destination image ROI for pixel-order data. An array
                            of pointers to separate ROI in the destination color planes in case of
                            planar data.
dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
pSrcDst                     Pointer to the source and destination image ROI or an array of
                            pointers to ROI in the separate source and destination color planes
                            for the in-place operation.
srcDstStep                  Distance in bytes between starts of consecutive lines in the source
                            and destination image for the in-place operation.
roiSize                     Size of the source and destination ROI in pixels.

                                                                                        169
---------------------Page 170---------------------

 5    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

alpha                          Global alpha value used for pre-multiplying pixel values.

Description
The in-place flavors of qpliAlphaPremulC  are deprecated. In-place functionality will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts either a one-, three-, four-channel image or planar RGBA image to the pre-multiplied
alpha form, using the global alpha value alpha. For one-, three-, four-channel image buffers, pixel values in
each channel are multiplied by α; for RGBA (pixel order and planar) images with (r,g,b,a) pixel values, new
pixel values are (r*α, g*α, b*α, alpha) after execution of this function. Here α is the normalized alpha
value in the range 0 to 1.
The function qpliAlphaPremulC   can be used for unsigned pixel data only.

Return Values

qplStsNoErr                          Indicates no error. Any other value indicates an error or a
                                     warning.
qplStsNullPtrErr                     Indicates an error condition if one of the specified pointers is
                                     NULL .
qplStsSizeErr                        Indicates an error condition if roiSize   has a field with zero or
                                     negative value.

   170
---------------------Page 171---------------------

Image Color Conversion                                                                      6

This chapter describes image processing functions that perform different types of image color conversion.
The Intel QPL software supports the following image color conversions:
•     Color models conversion
•     Conversion from color to gray scale and vice versa
•     Different types of format conversion:
   –    from pixel-order to planar format and vice versa
   –    changing number of channels or planes
   –    changing sampling format
   –    altering order of samples or planes
•     Gamma correction
•     Reduction from high bit resolution color to low bit resolution color
•     Intensity transformation using lookup tables
•     Color twist
•     Color keying
All Intel QPL color conversion functions perform point operations on pixels of the source image. For a given
destination pixel, the resultant channel values are computed using channel values of the corresponding
source pixel only, and not involving any neighborhood pixels. Thus, the rectangular region of interest (ROI,
see Regions of Interest in Intel QPL) used in function operations may extend to the size of the whole image.
This chapter starts with introductory material that discusses color space models essential for understanding
of the Intel QPL color conversion functions.
For more information about color spaces and color conversion techniques, see [Jack01], [Rogers85], and 
[Foley90].

Gamma Correction
The luminance intensity generated by most displays is not a linear function of the applied signal but is
proportional to some power (referred to as gamma ) of the signal voltage. As a result, high intensity ranges
are expanded and low intensity ranges are compressed. This nonlinearity must be compensated to achieve
correct color reproduction. To do this, luminance of each of the linear red, green, and blue components is
reduced to a nonlinear form using an inverse transformation. This process is called "gamma correction".
The Intel QPL functions use the following basic equations to convert an RGB image to a gamma-corrected
R'G'B' image:
for R,G,B < 0.018
R' = 4.5R
G' = 4.5G
B' = 4.5B
for R,G,B ≥ 0.018
R' =1.099R  0.45 - 0.099
G' =1.099G  0.45 - 0.099
B' =1.099B  0.45 - 0.099
Note that the channel intensity values are normalized to fit in the range [0..1]. The gamma value is equal to
1/0.45 = 2.22 in conformity with ITU Rec.709 specification (see [ITU709]).

                                                                                                  171
---------------------Page 172---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

CIE Chromaticity Diagram and Color Gamut
Figure CIE xyY Chromaticity Diagram and Color Gamut presents a diagram of all visible colors. It is called a
chromaticity diagram and was developed as a result of the experimental investigations performed by CIE
(International Commission on Illumination, http://members.eunet.at/cie). The diagram presents visible
colors as a function of x (red) and y (green) components called chromaticity coordinates. Positions of
various spectrum colors (from violet to red) are indicated as the points of a tongue-shaped curve called
spectrum locus . The straight line connecting the ends of the curve is called the purple line. The point of
equal energy represents the CIE standard for white light. Any point within the diagram represents some
mixture of spectrum colors. The pure or fully saturated colors lie on the spectrum locus. A straight-line
segment joining any two points in the diagram defines all color variations that can be obtained by additively
combining these two colors. A triangle with vertices at any three points determine the gamut of colors that
can be obtained by combining corresponding three colors.
The structure of the human eye that distinguishes three different stimuli, establishes the three-dimensional
nature of color. The color may be described with a set of three parameters called tristimulus values, or
components. These values may, for example, be dominant wavelength, purity, and luminance, or so-called
primary colors: red, green, and blue.
The chromaticity diagram exhibits that the gamut of any three fixed colors cannot enclose all visible colors.
For example, Figure CIE xyY Chromaticity Diagram and Color Gamut shows schematically the gamut of
reproducible colors for the RGB primaries of a typical color CRT monitor, CMYK color printing, and for the
NTSC television.

CIE xyY Chromaticity Diagram and Color Gamut

Color Models
The purpose of a color model is to facilitate the specification of colors in some standard generally accepted
way. In essence, a color model is a specification of a 3-D coordinate system and a subspace within that
system where each color is represented by a single point.

   172
---------------------Page 173---------------------

                                                                              Image Color Conversion  6   
Each industry that uses color employs the most suitable color model. For example, the RGB color model is
used in computer graphics, YUV or YCbCr are used in video systems, PhotoYCC* is used in PhotoCD*
production and so on. Transferring color information from one industry to another requires transformation
from one set of values to another. Intel QPL provides a wide number of functions to convert different color
spaces to RGB and vice versa.

RGB Color Model
In the RGB model, each color appears as a combination of red, green, and blue. This model is called additive,
and the colors are called primary colors. The primary colors can be added to produce the secondary colors of
light (see Figure "Primary and Secondary Colors for RGB and CMYK Models") - magenta (red plus blue), cyan
(green plus blue), and yellow (red plus green). The combination of red, green, and blue at full intensities
makes white.

Primary and Secondary Colors for RGB and CMYK Models

The color subspace of interest is a cube shown in Figure "RGB and CMY Color Models" (RGB values are
normalized to 0..1), in which RGB values are at three corners; cyan, magenta, and yellow are the three other
corners, black is at their origin; and white is at the corner farthest from the origin.
The gray scale extends from black to white along the diagonal joining these two points. The colors are the
points on or inside the cube, defined by vectors extending from the origin.
Thus, images in the RGB color model consist of three independent image planes, one for each primary color.
As a rule, the Intel QPL color conversion functions operate with non-linear gamma-corrected images R'G'B'.
The importance of the RGB color model is that it relates very closely to the way that the human eye
perceives color. RGB is a basic color model for computer graphics because color displays use red, green, and
blue to create the desired color. Therefore, the choice of the RGB color space simplifies the architecture and
design of the system. Besides, a system that is designed using the RGB color space can take advantage of a
large number of existing software routines, because this color space has been around for a number of years.

RGB and CMY Color Models

                                                                                                   173
---------------------Page 174---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

However, RGB is not very efficient when dealing with real-world images. To generate any color within the
RGB color cube, all three RGB components need to be of equal pixel depth and display resolution. Also, any
modification of the image requires modification of all three planes.

CMYK Color Model
The CMYK color model is a subset of the RGB model and is primarily used in color print production. CMYK is
an acronym for cyan, magenta, and yellow along with black (noted as K). The CMYK color space is
subtractive, meaning that cyan, magenta yellow, and black pigments or inks are applied to a white surface to
subtract some color from white surface to create the final color. For example (see Figure "Primary and
Secondary Colors for RGB and CMYK Models"), cyan is white minus red, magenta is white minus green, and
yellow is white minus blue. Subtracting all colors by combining the CMY at full saturation should, in theory,
render black. However, impurities in the existing CMY inks make full and equal saturation impossible, and
some RGB light does filter through, rendering a muddy brown color. Therefore, the black ink is added to
CMY. The CMY cube is shown in Figure "RGB and CMY Color Models", in which CMY values are at three
corners; red, green, and blue are the three other corners, white is at the origin; and black is at the corner
farthest from the origin.

YUV Color Model
The YUV color model is the basic color model used in analogue color TV broadcasting. Initially YUV is the re-
coding of RGB for transmission efficiency (minimizing bandwidth) and for downward compatibility with black-
and white television. The YUV color space is “derived” from the RGB space. It comprises the luminance (Y)
and two color difference (U, V) components. The luminance can be computed as a weighted sum of red,
green and blue components; the color difference, or chrominance, components are formed by subtracting
luminance from blue and from red.
The principal advantage of the YUV model in image processing is decoupling of luminance and color
information. The importance of this decoupling is that the luminance component of an image can be
processed without affecting its color component. For example, the histogram equalization of the color image
in the YUV format may be performed simply by applying histogram equalization to its Y component.
There are many combinations of YUV values from nominal ranges that result in invalid RGB values, because
the possible RGB colors occupy only part of the YUV space limited by these ranges. Figure "RGB Colors Cube
in the YUV Color Space" shows the valid color block in the YUV space that corresponds to the RGB color cube
RGB values that are normalized to [0..1]).
The Y'U'V'  notation means that the components are derived from gamma-corrected   R'G'B' . Weighted sum
of these non-linear components forms a signal representative of luminance that is called luma Y'. (Luma is
often loosely referred to as luminance, so you need to be careful to determine whether a particular author
assigns a linear or non-linear interpretation to the term luminance).
The Intel QPL functions use the following basic equation ([Jack01]) to convert between gamma-corrected
R'G'B'  and Y'U'V'  models:
Y'= 0.299*R' + 0.587*G' + 0.114*B'
U'= -0.147*R' - 0.289*G' + 0.436*B' = 0.492*(B'- Y')
V'= 0.615*R' - 0.515*G' - 0.100*B' = 0.877*(R'- Y')
R' = Y' + 1.140*V'
G' = Y' - 0.394*U' - 0.581*V'

   174
---------------------Page 175---------------------

                                                                         Image Color Conversion  6 

B' = Y' + 2.032*U'

RGB Colors Cube in the YUV Color Space

There are several YUV sampling formats such as 4:4:4, 4:2:2, and 4:2:0 that are supported by the Intel QPL
color conversion functions and are described later in this chapter in Image Downsampling.

YCbCr and YCCK Color Models
The YCbCr color space is used for component digital video and was developed as part of the ITU-R BT.601
Recommendation. YCbCr is a scaled and offset version of the YUV color space.
The Intel QPL functions use the following basic equations [Jack01] to convert between R'G'B' in the range
0-255 and Y'Cb'Cr'  (this notation means that all components are derived from gamma-corrected R'G'B'):
Y' = 0.257*R' + 0.504*G' + 0.098*B' + 16
Cb' = -0.148*R' - 0.291*G' + 0.439*B' + 128
Cr' = 0.439*R' - 0.368*G' - 0.071*B' + 128
R' = 1.164*(Y'-16) + 1.596*(Cr'-128)
G' = 1.164*(Y'-16) - 0.813*(Cr'-128) - 0.392*(Cb'-128)
B' = 1.164*(Y'-16) + 2.017*(Cb'-128)
The Intel QPL color conversion functions specific for the JPEG codec use different equations:
Y = 0.299*R + 0.587*G + 0.114*B
Cb = -0.16874*R - 0.33126*G + 0.5*B + 128
Cr = 0.5*R - 0.41869*G - 0.08131*B + 128
R = Y + 1.402*Cr - 179,456
G = Y - 0.34414*Cb - 0.71414*Cr + 135.45984
B = Y + 1.772*Cb - 226.816
YCCK model is specific for the JPEG image compression. It is a variant of the YCbCr model containing an
additional K channel (black). The fact is that JPEG codec performs more effectively if the luminance and color
information are decoupled. Therefore, a CMYK image must be converted to YCCK before JPEG compression
(see description of the function qpliCMYKToYCCK_JPEG in Chapter 15 for more details).

                                                                                             175
---------------------Page 176---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Possible RGB colors occupy only part of the YCbCr color space (see Figure "RGB Colors Cube in the YCbCr
Space") limited by the nominal ranges, therefore there are many YCbCr combinations that result in invalid
RGB values.
There are several YCbCr sampling formats such as 4:4:4, 4:2:2, 4:1:1, and 4:2:0, which are supported by
the Intel QPL color conversion functions and are described later in this chapter in Image Downsampling.

RGB Colors Cube in the YCbCr Space

PhotoYCC Color Model
The Kodak* PhotoYCC* was developed for encoding Photo CD* image data. It is based on both the ITU
Recommendations 601 and 709, using luminance-chrominance representation of color like in BT.601 YCbCr
and BT.709 ([ITU709]). This model comprises luminance (Y) and two color difference, or chrominance (C1,
C2) components. The PhotoYCC is optimized for the color photographic material, and provides a color gamut
that is greater than the one that can currently be displayed.
The Intel QPL functions use the following basic equations [Jack01] to convert non-linear gamma-corrected
R'G'B'  to Y'C'C':
Y' = 0.213*R' + 0.419*G' + 0.081*B'
C1' = -0.131*R' - 0.256*G' + 0.387*B'+ 0.612
C2' = 0.373*R' - 0.312*R' - 0.061*B' + 0.537
The equations above are given on the assumption that R',G', and B' values are normalized to the range
[0..1].
Since the PhotoYCC model attempts to preserve the dynamic range of film, decoding PhotoYCC images
requires selection of a color space and range appropriate for the output device. Thus, the decoding equations
are not always the exact inverse of the encoding equations. The following equations [Jack01] are used in
Intel QPL to generate R'G'B' values for driving a CRT display and require a unity relationship between the
luma in the encoded image and the displayed image:
R' = 0.981 * Y + 1.315 * (C2 - 0.537)
G' = 0.981 * Y - 0.311 * (C1 - 0.612)- 0.669 * (C2 - 0.537)
B' = 0.981 * Y + 1.601 * (C1 - 0.612)
The equations above are given on the assumption that source Y, C1 and C2 values are normalized to the
range [0..1], and the display primaries have the chromaticity values in accordance with [ITU709]
specifications.

   176
---------------------Page 177---------------------

                                                                           Image Color Conversion  6  

The possible RGB colors occupy only part of the YCC color space (see Figure  "RGB Colors in the YCC Color
Space") limited by the nominal ranges, therefore there are many YCC combinations that result in invalid RGB
values.

RGB Colors in the YCC Color Space

YCoCg Color Models
The YCoCg color model was developed to increase the effectiveness of the image compression [Malvar03].
This color model comprises the luminance (Y) and two color difference components (Co - offset orange, Cg -
offset green).
The Intel QPL functions use the following simple basic equations [Malvar03] to convert between RGB and
YCoCg:
Y = R/4 + G/2 + B/4
Co = R/2 - B/2
Cg = -R/4 + G/2 - B/4
R = Y + Co - Cg
G = Y + Cg
B = Y - Co - Cg
A variation of this color space which is called YCoCg-R, enables transformation reversibility with a smaller
dynamic range requirements than does YCoCg [Malvar03-1].

                                                                                                177
---------------------Page 178---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

The possible RGB colors occupy only part of the YCoCg color space (see Figure "RGB Color Cube in the YCoCg
Color Space") limited by the nominal ranges, therfore there are many YCoCg combinations that result in
invalid RGB values.

RGB Color Cube in the YCoCg Color Space

HSV, and HLS Color Models
The HLS (hue, lightness, saturation) and HSV (hue, saturation, value) color models were developed to be
more “intuitive” in manipulating with color and were designed to approximate the way humans perceive and
interpret color.
Hue  defines the color itself. The values for the hue axis vary from 0 to 360 beginning and ending with red
and running through green, blue and all intermediary colors.
Saturation indicates the degree to which the hue differs from a neutral gray. The values run from 0, which
means no color saturation, to 1, which is the fullest saturation of a given hue at a given illumination.
Intensity component - lightness (HLS) or value (HSV), indicates the illumination level. Both vary from 0
(black, no light) to 1 (white, full illumination). The difference between the two is that maximum saturation of
hue (S=1) is at value V=1 (full illumination) in the HSV color model, and at lightness L=0.5 in the HLS color
model.
The HSV color space is essentially a cylinder, but usually it is represented as a cone or hexagonal cone
(hexcone) as shown in the Figure "HSV Solid", because the hexcone defines the subset of the HSV space with
valid RGB values. The value V is the vertical axis, and the vertex V=0 corresponds to black color. Similarly, a
color solid, or 3D-representation, of the HLS model is a double hexcone (Figure "HSV Solid") with lightness
as the axis, and the vertex of the second hexcone corresponding to white.

   178
---------------------Page 179---------------------

                                                                            Image Color Conversion  6   
Both color models have intensity component decoupled from the color information. The HSV color space
yields a greater dynamic range of saturation. Conversions from RGBToHSV/RGBToHSV and vice-versa in Intel
QPL are performed in accordance with the respective pseudocode algorithms [Rogers85] given in the
descriptions of corresponding conversion functions.

HSV Solid

HLS Solid

                                                                                                 179
---------------------Page 180---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

CIE XYZ Color Model
The XYZ color space is an international standard developed by the CIE (Commission Internationale de
l'Eclairage). This model is based on three hypothetical primaries, XYZ, and all visible colors can be
represented by using only positive values of X, Y, and Z. The CIE XYZ primaries are hypothetical because
they do not correspond to any real light wavelengths. The Y primary is intentionally defined to match closely
to luminance, while X and Z primaries give color information. The main advantage of the CIE XYZ space (and
any color space based on it) is that this space is completely device-independent. The chromaticity diagram in 
Figure "CIE xyY Chromaticity Diagram and Color Gamut" is in fact a two-dimensional projection of the CIE
XYZ sub-space. Note that arbitrarily combining X, Y, and Z values within nominal ranges can easily lead to a
"color" outside of the visible color spectrum.
The position of the block of RGB-representable colors in the XYZ space is shown in Figure "RGB Colors Cube
in the XYZ Color Space".

RGB Colors Cube in the XYZ Color Space

Intel QPL functions use the following basic equations [Rogers85], to convert between gamma-corrected
R'G'B'  and CIE XYZ  models:
X = 0.412453*R' + 0.35758 *G' + 0.180423*B'
Y = 0.212671*R' + 0.71516 *G' + 0.072169*B'
Z = 0.019334*R' + 0.119193*G' + 0.950227*B'
The equations for X,Y,Z calculation are given on the assumption that R',G', and B' values are normalized
to the range [0..1].
R' = 3.240479 * X - 1.53715 * Y - 0.498535 * Z
G' = -0.969256 * X + 1.875991 * Y + 0.041556 * Z
B' = 0.055648 * X - 0.204043 * Y + 1.057311 * Z
The equations for R',G', and B' calculation are given on the assumption that X,Y, and Z values are in the
range [0..1].

CIE LUV and CIE Lab Color Models
The CIE LUV and CIE Lab color models are considered to be perceptually uniform and are referred to as
uniform color models. Both are uniform derivations from the standard CIE XYZ space. “Perceptually uniform”
means that two colors that are equally distant in the color space are equally distant perceptually. To
accomplish this approach, a uniform chromaticity scale (UCS) diagram was proposed by CIE (Figure "CIE
u',v' Uniform Chromaticity Scale Diagram"). The UCS diagram uses a mathematical formula to transform the

   180
---------------------Page 181---------------------

                                                                         Image Color Conversion  6  

XYZ values or x, y coordinates (Figure "CIE xyY Chromaticity Diagram and Color Gamut"), to a new set of
values that present a visually more accurate two-dimensional model. The Y lightness scale is replaced with a
new scale called L that is approximately uniformly spaced but is more indicative of the actual visual
differences. Chrominance components are U and V for CIE LUV, and a and b (referred to also respectively as
red/blue and yellow/blue chrominances) in CIE Lab. Both color spaces are derived from the CIE XYZ color
space.

CIE u',v' Uniform Chromaticity Scale Diagram

The CIE LUV color space is derived from CIE XYZ as follows ([Rogers85]),
L = 116. * (Y/Y  n)1/3. - 16.
U = 13. * L * (u - u  n)
V = 13. * L * (v - v  n)
where
u = 4.*X / (X + 15.*Y + 3.*Z)
v = 9.*Y / (X + 15.*Y + 3.*Z)
un = 4.*x n / ( -2.*x n + 12.*y n + 3. )
vn = 9.*y n / ( -2.*x n + 12.*y n + 3. )
Inverse conversion is performed in accordance with equations:
Y = Yn * ((L + 16.) / 116.)   3.

X = -9.* Y * u / ((u - 4.)* v - u * v )
Z = (9.* Y - 15*v*Y - v*X) / 3. * v
where
u = U / (13.* L) + u  n
v = V / (13.* L) + v  n
and un, vn are defined above.
Here xn = 0.312713, yn = 0.329016 are the CIE chromaticity coordinates of the D65 white point ([ITU709]),
and Yn = 1.0 is the luminance of the D65 white point. The values of the L component are in the range
[0..100], U component in the range [-134..220], and V component in the range [-140..122].

                                                                                             181
---------------------Page 182---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

The RGB-representable colors occupy only part of the LUV color space (see Figure 6-12) limited by the
nominal ranges, therefore there are many LUV combinations that result in invalid RGB values.

RGB Color Cube in the CIE LUV Color Space

The CIE Lab color space is derived from CIE XYZ as follows:
L = 116. * (Y/Y  n)1/3. - 16 for Y/Yn > 0.008856
L = 903.3 * (Y/Y)   1/3.
                  n      for Y/Yn⩽ 0.008856
a = 500. * [f(X/X  n)-f(Y/Y n)]
b = 200. * [f(Y/Y  n)-f(Z/Z n)]
where
f(t) = t 1/3. - 16 for t > 0.008856
f(t) = 7.787*t + 16/116    for t ⩽ 0.008856
Here Yn = 1.0 is the luminance, and Xn = 0.950455, Zn = 1.088753 are the chrominances for the D65 white
point.
The values of the L component are in the range [0..100], a and b component values are in the range
[-128..127].
Inverse conversion is performed in accordance with equations:
Y = Y * P  3.
     n
X = X                   3.
     n * (P + a/500.)
Z = Z * (P - b/200.)    3.
     n
where
P = (L +16)/116.

Image Downsampling

Conventionally, digital color images are represented by setting specific values of the color space coordinates
for each pixel. Color spaces with decoupled luminance and chrominance coordinates (YUV type) allow the
number of bits required for acceptable color description of an image to be reduced. This reduction is based
on greater sensitivity of the human eye to changes in luminance than to changes in chrominance. The idea
behind this approach is to set individual value of luminance component to each pixel, while assigning the

   182
---------------------Page 183---------------------

                                                                             Image Color Conversion  6   

same color (chrominance components) to certain groups of pixels (sometimes called macropixels) in
accordance with some specific rules. This process is called downsampling and there are different sampling
formats depending on the underlying scheme.
The following sampling formats are supported by the Intel QPL image processing functions (excluding the
JPEG functions):
4:4:4 YUV (YCbCr)    - conventional format, no downsampling, Y, U(Cb), V(Cr) components are sampled at
every pixel. If each component takes 8 bits, than every pixel requires 24 bits. This format is often denoted as
YUV (YCbCr) with the 4:4:4  descriptor omitted.
4:2:2 YUV (YCbCr)    - uses the 2:1 horizontal downsampling. It means that the Y component is sampled at
each pixel, while U(Cb) and V(Cr) components are sampled every 2 pixels in horizontal direction. If each
component takes 8 bits, the pair of pixels requires 32 bits.
4:1:1 YCbCr   - uses the 4:1 horizontal downsampling. It means that the Y component is sampled at each
pixel, while Cb and Cr components are sampled every 4 pixels horizontally. If each component takes 8 bits,
each four horizontal pixels require 48 bits.
4:2:0 YUV (YCbCr)    - uses the 2:1 horizontal downsampling and the 2:1 vertical downsampling. Y is
sampled at each pixel, U(Cb) and V(Cr) are sampled at every block of 2x2 pixels. If each component takes 8
bits, each four-pixel block requires 48 bits.
In JPEG compression, downsampling has specific distinctive features and is denoted in a slightly different
way. In JPEG domain, sampling formats determine the structure of minimal coded units, or MCUs. Therefore,
the Intel QPL functions specific for a JPEG codec, support the following sampling formats:
4:4:4 YCbCr   - for every 8x8 block of Y samples, there is one 8x8 block of each Cb and Cr samples.
4:2:2 YCbCr   - for every two horizontal 8x8 blocks of Y samples, there is one 8x8 block of each Cb and Cr
samples.
4:1:1 YCbCr   - for every four (two in horizontal and two in vertical direction) 8x8 blocks of Y samples, there
is one 8x8 block of each Cb and Cr samples.
Structure of the corresponding MCU for each of these sampling formats is shown in Figure MCU Structure for
Different JPEG Sampling Formats.

MCU Structure for Different JPEG Sampling Formats

RGB Image Formats

In addition to the 24-bit-per-pixel RGB/BGR image formats, the Intel QPL color conversion functions support
32-bit-per-pixel RGB/BGR formats, which include three RGB channels plus alpha channel. For 24-bit formats,
each color is one byte, every pixel is three bytes. For 32-bit formats, each color is one byte and alpha
component is one byte, which yields four bytes per pixel. Memory layout for these formats is given in Table
“Pixel-Order Image Formats”.

                                                                                                  183
---------------------Page 184---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

For 16-bit formats, every pixel is two bytes and each color occupies a specified number of bits. The figure
below shows all the supported 16-bit-per-pixel formats and their memory layout (bit order):

16-bit pixel formats

Pixel and Planar Image Formats

Data storage for an image can be pixel-oriented or planar-oriented (planar). For images in pixel order, all
channel values for each pixel are clustered and stored consecutively. Their layout depends on the color
model and downsampling scheme.
Table “Pixel-Order Image Formats” lists all pixel-order image formats that are supported by the Intel QPL
color conversion functions and shows the corresponding channel values order (here, group of underlined
symbols represents one pixel and symbol A denotes alpha-channel value). The last column of this table gives
an example of an Intel QPL color conversion function that uses the respective image format.
Pixel-Order Image Formats
 Image          Number  Channel Values Order                     Example
 Format         of
                Channel
                s

 RGB           3         R0 G0 B0 R1 G1 B1    R2 G2 B2           qpliRGBTToYUV_8u_ C3R
 RGB444                                                          qpliYCbCrToRGB444_8u16u_ C3R
 RGB555                                                          qpliYCbCrToRGB555_8u16u_ C3R
 RGB565                                                          qpliYCbCrToRGB565_8u16u_ C3R

 RGB           4         R0 G0 B0 A0 R1 G1 B1 A1                 qpliRGBToYUV_8u_A C4R

 BGR           3         B0 G0 R0 B1 G1 R1 B2 G2 R2              qpliYCbCrToBGR_8u_P3C3 R
 BGR444                                                          qpliYCbCrToBGR444_8u16u_ C3R
 BGR555                                                          qpliYCbCrToBGR555_8u16u_ C3R
 BGR565                                                          qpliYCbCrToBGR565_8u16u_ C3R

 BGR           4         B0 G0 R0 A0 B1 G1 R1 A1                 qpliBGRToHLS_8u_A C4R

 YUV           3         Y0 U0 V0   Y1 U1 V1   Y2 U2 V2          qpliYUVToRGB_8u_ C3 R

 YUV           4         Y0 U0 V0 A0 Y1 U1 V1 A1                 qpliYUVToRGB_8u_A  C4R

 4:2:2 YUV     2         Y0 U0   Y1 V0  Y2 U1   Y3 V1            qpliYUV422T0RGB_8u_  C2C3R

   184
---------------------Page 185---------------------

                                                                     Image Color Conversion  6 

 Image         Number  Channel Values Order                   Example
 Format        of
               Channel
               s

 YCbCr         3        Y0 Cb0 Cr0 Y1 Cb1 Cr1                 qpliYCbCrToRGB_8u_ C3R

 YCbCr         4        Y0 Cb0 Cr0 A0 Y1 Cb1 Cr1 A1           qpliYCbCrToRGB_8u_A C4R

 4:2:2 YCbCr   2        Y0 Cb0   Y1 Cr0  Y2 Cb1  Y3 Cr1       qpliYCbCr422ToRGB_8u_ C2C3R

 4:2:2 YCrCb   2        Y0 Cr0   Y1 Cb0  Y2 Cr1  Y3 Cb1       qpliYCrCb422ToYCbCr422_8u_
                                                              C2P3R

 4:2:2 CbYCr   2        Cb0 Y0   Cr0 Y1  Cb1 Y2  Cr1 Y3       qpliCbYCr422ToRGB_8u_ C2C3R

 XYZ           3        X0 Y0 Z0 X1 Y1 Z1 X2 Y2 Z2            qpliXYZToRGB_8u_ C3R

 XYZ           4        X0 Y0 Z0 X1 Y1 Z1 X2 Y2 Z2            qpliXYZToRGB_16u_A C4R

 LUV           3        L0 U0 V0 L1 U1 V1 L2 U2 V2            qpliLUVToRGB_16s_ C3R

 LUV           4        L0 U0 V0 A0 L1 U1 V1 A1               qpliLUVToRGB_32f_A C4R

 YCC           3        Y0 C0 C0 Y1 C1 C1 Y2 C2 C2            qpliYCCToRGB_8u_C3R

 YCC           4        Y0 C0 C0 A0 Y1 C1 C1 A1               qpliYCCToRGB_8u_A C4R

 HLS           3        H0 L0 S0 H1 L1 S1 H2 L2 S2            qpliHLSToRGB_16u_C3R

 HLS           4        H0 L0 S0 A0 H1 L1 S1 A0               qpliHLSToRGB_16u_AC4R

 HSV           3        H0 S0 V0 H1 S1 V1 H2 S2 V2            qpliHSVToRGB_16s_C3R

 HSV           4        H0 S0 V0 A0 H1 S1 C1 A1               qpliHSVToRGB_16s_AC4R

Planar image formats supported by the Intel QPL color conversion functions are listed in Table “Planar Image
Formats” along with examples of the Intel QPL functions using that format. Planes layout and their relative
sizes are shown in Figure Plane Size and Layout: 3-planes Images and Figure Plane Size and Layout: 2-
planes Images.
Planar Image Formats
 Image       Numbe                 Planes Layout              Example
 Format      r of
             Planes    pl.  pl.2     pl.                       
                       1             3

 RGB         3        R    G        B    see Figure below, a  qpliRGBToYUV_8u_P3R

 YUV         3        Y    U        V    see Figure below, a  qpliYUVToRGB_8u_P3R

 4:2:2 YUV   3        Y    U        V    see Figure below, b  qpliYUV422ToRGB_8u_P3

 4:2:0 YUV   3        Y    U        V    see Figure below, d  qpliYUV420ToRGB_8uP3 C3R

 YCbCr       3        Y    Cb       Cr   see Figure below, a  qpliYCbCrToRGB_8u_P3 R

 4:2:2       3        Y    Cb       Cr   see Figure below, b  qpliYCbCr422_8u_P3C2R
 YCbCr
 4:1:1       3        Y    Cb       Cr   see Figure below, c  qpliYCbCr411_8u_P3P2R
 YCbCr
 4:1:1       2        Y    CbCr     -    see Figure below for qpliYCbCr411_8u_P2P3R
 YCbCr                                   2-planes images, a

                                                                                        185
---------------------Page 186---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

 Image        Numbe                  Planes Layout                 Example
 Format       r of
              Planes    pl.  pl.2      pl.                          
                        1              3

 4:2:0        3         Y    Cb        Cr   see Figure below, d   qpliRGBTo YCbCr420 _8u_C3 P3R
 YCbCr
 4:2:0        2         Y    CbCr      -    see Figure below for  qpliYCbCr420 _8u_P2 P3R
 YCbCr                                      2-planes images, b

   186
---------------------Page 187---------------------

                                                                    Image Color Conversion  6 

 Image       Numbe                Planes Layout               Example
 Format      r of
             Planes   pl.  pl.2      pl.                       
                      1              3

 4:2:0       3        Y    Cr       Cb   see Figure below, d qpliYCrCb420ToYCbCr422_8u_ P3R
 YCrCb

Plane Size and Layout - 3-planes Images

Plane Size and Layout - 2-planes Images

                                                                                       187
---------------------Page 188---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Color Model Conversion

RGBToYUV
Converts an RGB image to the YUV color model.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliRGBToYUV_<mod>(const Qpl8u* pSrc    , int srcStep  , Qpl8u* pDst , int dstStep ,
QpliSize roiSize );
Supported values for mod:

 8u_C3R     8u_AC4R

Case 2: Operation on planar data
QplStatus qpliRGBToYUV_8u_P3R(const Qpl8u* const pSrc[3], int srcStep, Qpl8u* pDst[3],
int dstStep, QpliSize roiSize  );
Case 3: Conversion from pixel-order to planar data
QplStatus qpliRGBToYUV_8u_C3P3R(const Qpl8u* pSrc    ,  int srcStep , Qpl8u* pDst[3],int
dstStep,  QpliSize roiSize );
QplStatus qpliRGBToYUV_8u_AC4P4R(const Qpl8u* pSrc     , int srcStep , Qpl8u* pDst[4], int
dstStep,  QpliSize roiSize );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI for pixel-order data. An array of
                             pointers to the source image ROI in separate color planes in case of
                             planar data.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination ROI for pixel-order data. An array of
                             pointers to destination buffers in separate color planes in case of
                             planar data.
dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the gamma-corrected R'G'B' image pSrc to the Y'U'V' image pDst (see Figure
Converting an RGB image to YUV) according to the following formulas:

   188
---------------------Page 189---------------------

                                                                       Image Color Conversion  6 

Y' = 0.299*R' + 0.587*G' + 0.114*B'
U' = -0.147*R' - 0.289*G' + 0.436*B' = 0.492*(B'-Y')
V' = 0.615*R' - 0.515*G' - 0.100*B' = 0.877*(R'-Y')
For digital RGB values in the range [0..255], Y' has the range [0..255], U varies in the range [-112..+112],
and V in the range [-157..+157]. To fit in the range of [0..255], a constant value 128 is added to computed
U and V values, and V is then saturated.

Converting an RGB image to YUV

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst pointer is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

Example
The code example below shows how to use the function qpliRGBToYUV_8u_C3R.
# define nChannels 3

int main () {
      Qpl 8 u src [3*3* nChannels ] = {
         255, 0, 0, 255, 0, 0, 255, 0, 0,
         0, 255, 0, 0, 255, 0, 0, 255, 0,
         0, 0, 255, 0, 0, 255, 0, 0, 255};
      Qpl 8 u dst [3*3* nChannels ];
      QpliSize roiSize = { 3, 3 };
      QplStatus st = qplStsNoErr ;
      int srcStep = 3* nChannels ;
      int dstStep = 3* nChannels ; 
      st = qpliRGBToYUV _8 u _ C 3 R ( src , srcStep , dst , dstStep , roiSize ); 
      if ( st == qplStsNoErr){ 
            printf("\n *************  passed ****************\n");
      }else{ 
            printf("\n *************  failed ****************\t");
      }
      return 0; 
}

Result:
255   0   0 255   0   0 255   0   0
  0 255   0   0 255   0   0 255   0    src 
  0   0 255   0   0 255   0   0 255

                                                                                          189
---------------------Page 190---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing
 76  90 255  76  90 255  76  90 255
149  54   0 149  54   0 149  54   0    dst
 29 239 102  29 239 102  29 239 102

YUVToRGB
Converts a YUV image to the RGB color model.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYUVToRGB_<mod>(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int dstStep,
QpliSize roiSize );
Supported values for mod:

 8u_C3R
 8u_AC4R

QplStatus qpliYUVToRGB_8u_C3C4R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize, Qpli8u aval   );
Case 2: Operation on planar data
QplStatus qpliYUVToRGB_8u_P3R(const Qpl8u* const pSrc[3], int srcStep, Qpl8u* pDst[3],
int dstStep, QpliSize roiSize  );
Case 3: Conversion from planar to pixel-order data
QplStatus qpliYUVToRGB_8u_P3C3R(const Qpl8u* const pSrc[3], int srcStep, Qpl8u* pDst,
int dstStep, QpliSize roiSize  );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source buffer for pixel-order data. An array of
                             pointers to separate source color planes in case of planar data.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination buffer for pixel-order data. An array of
                             pointers to separate destination color planes in case of planar data.
dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
aval                         Constant value to create the fourth channel.

roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).

   190
---------------------Page 191---------------------

                                                                     Image Color Conversion  6 

This function converts the Y'U'V' image pSrc to the gamma-corrected R'G'B' image pDst according to the
following formulas:
R' = Y' + 1.140*V'
G' = Y' - 0.394*U' - 0.581*V'
B' = Y' + 2.032*U'

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                    Indicates an error condition if roiSize has a field with a zero or
                                 negative value.

RGBToYUV422
Converts an RGB image to the YUV color model; uses
4:2:2 sampling.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliRGBToYUV422_8u_C3C2R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );
Case 2: Operation on planar data with ROI
QplStatus qpliRGBToYUV422_8u_P3R(const Qpl8u* const pSrc[3], int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize   );
Case 3: Operation on planar data without ROI
QplStatus qpliRGBToYUV422_8u_P3(const Qpl8u* const pSrc[3], Qpl8u* pDst[3], QpliSize
imgSize);
Case 4: Conversion from pixel-order to planar data with ROI
QplStatus qpliRGBToYUV422_8u_C3P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3], int
dstStep[3], QpliSize roiSize  );
Case 5: Conversion from pixel-order to planar data without ROI
QplStatus qpliRGBToYUV422_8u_C3P3(const Qpl8u* pSrc, Qpl8u* pDst[3], QpliSize imgSize       );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                        Pointer to the source image buffer for pixel-order image. An array of
                            pointers to the source image buffer in each color plane for planar
                            image.

                                                                                         191
---------------------Page 192---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image for operations with ROI.
pDst                          Pointer to the destination image buffer for pixel-order image. An
                              array of pointers to the destination image buffer in each color plane
                              for planar image.
dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image for operations with ROI. An array of three values
                              for planar image.
roiSize                       Size of the source and destination ROI in pixels.

imgSize                       Size of the source and destination images in pixels for operations
                              without ROI.

Description
This function converts the gamma-corrected R'G'B' image pSrc to the Y'U'V' image pDst with Image
Downsampling format, according to the same formulas as the function qpliRGBToYUV does. For more details
on this sampling format, see Table “Pixel-Order Image Formats” and Table “Planar Image Formats”.
For digital RGB values in the range [0..255], Y' has the range [0..255], U varies in the range [-112..+112],
and V in the range [-157..+157]. To fit in the range of [0..255], the constant value 128 is added to
computed U and V values, and V is then saturated.
Some function flavors operates with ROI (see Regions of Interest in Intel QPL). The function flavors that does
not use ROI operate on the assumption that both the source and destination images have the same size and
occupy a contiguous memory area, which means that image rows are not padded with zeroes. In this case
the step parameters are not needed.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst pointer is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize or imgSize has a field
                                   with a zero or negative value.

YUV422ToRGB
Converts a YUV image with the 4:2:2 sampling to the
RGB color model.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYUV422ToRGB_8u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize   );
Case 2: Operation on planar data with ROI
QplStatus qpliYUV422ToRGB_8u_P3R(const Qpl8u* pSrc[3], int srcStep[3], Qpl8u* pDst[3],
int dstStep, QpliSize roiSize    );
Case 3: Operation on planar data without ROI
QplStatus qpliYUV422ToRGB_8u_P3(const Qpl8u* pSrc[3], Qpl8u* pDst[3], QpliSize
imgSize );

   192
---------------------Page 193---------------------

                                                                        Image Color Conversion  6  

Case 4: Conversion from planar to pixel-order data with ROI
QplStatus qpliYUV422ToRGB_<mod>(const Qpl8u* pSrc[3], int srcStep[3], Qpl8u* pDst, int
dstStep, QpliSize roiSize   );
Supported values for mod:

 8u_P3C3R  8u_P3AC4R

Case 5: Conversion from planar to pixel-order data without ROI
QplStatus qpliYUV422ToRGB_8u_P3C3(const Qpl8u* pSrc[3], Qpl8u* pDst, QpliSize imgSize           );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image buffer for pixel-order image. An array of
                             pointers to the source image buffer in each color plane for planar
                             image.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image for operations with ROI. An array of three values in case of
                             planar image.
pDst                         Pointer to the destination image buffer for pixel-order image. An
                             array of pointers to the destination image buffers in each color
                             plane for planar image.
dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image for operations with ROI.
roiSize                      Size of the source and destination ROI in pixels.

imgSize                      Size of the source and destination images in pixels for operations
                             without ROI.

Description
This function converts the Y'U'V' image pSrc to the gamma-corrected R'G'B' image pDst according to the
same formulas as the function qpliYUVToRGB does. The difference is that qpliYUV422ToRGB Image
Downsampling the input data to be in Image Downsampling format (see Table “Pixel-Order Image Formats”
and Table “Planar Image Formats” for more details).
The function qpliYUV422ToRGB_P3AC4R  additionally creates an alpha channel in the destination image with
alpha values set to zero.
Some function flavors operates with ROI (see Regions of Interest in Intel QPL). The function flavors that do
not use ROI operate on the assumption that both the source and destination images have the same size and
occupy a contiguous memory area, which means that image rows are not padded with zeroes. In this case
the step arguments are not needed.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

                                                                                             193
---------------------Page 194---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

qplStsSizeErr                      ndicates an error condition if roiSize or imgSize  has a field
                                   with a zero or negative value.

RGB565ToYUV422
DEPRECATED. Convert 16-bit RGB image to the 4:2:2
YUV image.

Syntax
QplStatus qpliRGB565ToYUV422_16u8u_C3P3R(const Qpl16u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize      );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib , qpli.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
pDst                          Array of pointers to ROI in the separate color planes in the
                              destination image.
dstStep                       Array of distances in bytes between starts of consecutive lines in the
                              destination image planes.
roiSize                       Size of the source and destination ROI in pixels.

Description
The function qpliRGB565ToYUV422  is deprecated. This color format is obsolete and will be removed in a
future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the gamma-corrected R'G'B' image pSrc to the Y'U'V' image pDst according to the
same formulas as the function qpliRGBToYUV does.
The source image pSrc is a packed 16-bit RGB565 image with reduced bit depth; all 3 channel intensities for
a pixel are packed into two consecutive bytes (16u data type) in the following order: 5 bits for red, 6 bits for
green, 5 bits for blue (see Figure 16-bit Pixel Formats).
The destination image pDst has a Image Downsampling format (see Table “Planar Image Formats” for more
details).

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

   194
---------------------Page 195---------------------

                                                                       Image Color Conversion  6  

qplStsDoubleSize                  Indicates a warning if roiSize has a field that is not a multiple
                                  of 2.

RGBToYUV420
Converts an RGB image to the 4:2:0 YUV image.

Syntax
Case 1: Operation on planar data with ROI
QplStatus qpliRGBToYUV420_8u_P3R(const Qpl8u* const pSrc[3], int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize    );
Case 2: Operation on planar data without ROI
QplStatus qpliRGBToYUV420_8u_P3(const Qpl8u* const pSrc[3], Qpl8u* pDst[3], QpliSize
imgSize);
Case 3: Conversion from pixel-order to planar data with ROI
QplStatus qpliRGBToYUV420_8u_C3P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3], int
dstStep[3], QpliSize roiSize   );
Case 4: Conversion from pixel-order to planar data without ROI
QplStatus qpliRGBToYUV420_8u_C3P3(const Qpl8u* pSrc, Qpl8u* pDst[3], QpliSize imgSize         );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image buffer for pixel-order image. An array of
                             pointers to the source image buffers in each color plane for planar
                             image.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image for operations with ROI.
pDst                         An array of pointers to the destination image buffers in each color
                             plane.
dstStep                      An array of distances in bytes between starts of consecutive lines in
                             each plane of the destination image for operations with ROI.
roiSize                      Size of the source and destination ROI in pixels.

imgSize                      Size of the source and destination images in pixels for operations
                             without ROI.

Description
This function converts the gamma-corrected R'G'B' image pSrc to the Y'U'V' image pDst with the Image
Downsampling (see Table “Planar Image Formats” for more details). The conversion is performed in the
accordance with the same formulas as the function qpliRGBToYUV does.
For digital RGB values in the range [0..255], Y' has the range [0..255], U varies in the range [-112..+112],
and V in the range [-157..+157]. To fit in the range of [0..255], a constant value 128 is added to computed
U and V values, and V is then saturated.

                                                                                           195
---------------------Page 196---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Some function flavors operates with ROI see Regions of Interest in Intel QPL).
The function flavors that does not use ROI operate on the assumption that both the source and destination
images have the same size and occupy a contiguous memory area, which means that image rows are not
padded with zeroes. In this case the step parameters are not needed.
roiSize.width  (imgSize.width ) and roiSize.height  (imgSize.height  ) should be multiples of 2.
Otherwise, the function reduces their original values to the nearest multiples of 2, performs operation, and
returns warning message.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize or imgSize has a field
                                  with a zero or negative value.
qplStsDoubleSize                  Indicates a warning if roiSize or imgSize  has a field that is not
                                  a multiple of 2.

YUV420ToRGB
Converts a YUV image that has 4:2:0 sampling format
to the RGB image.

Syntax
Case 1: Operation on planar data with ROI
QplStatus qpliYUV420ToRGB_8u_P3R(const Qpl8u* const pSrc[3], int srcStep[3], Qpl8u*
pDst[3], int dstStep, QpliSize roiSize    );
Case 2: Operation on planar data without ROI
QplStatus qpliYUV420ToRGB_8u_P3(const Qpl8u* const pSrc[3], Qpl8u* pDst[3], QpliSize
imgSize);
Case 3: Conversion from planar to pixel-order data with ROI
QplStatus qpliYUV420ToRGB_<mod>(const Qpl8u* const pSrc[3], int srcStep[3], Qpl8u*
pDst, int dstStep, QpliSize roiSize    );
Supported values for mod:

 8u_P3C3R  8u_P3AC4R

Case 4: Conversion from planar to pixel-order data without ROI
QplStatus qpliYUV420ToRGB_8u_P3C3(const Qpl8u* const pSrc[3], Qpl8u* pDst, QpliSize
imgSize);

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

   196
---------------------Page 197---------------------

                                                                         Image Color Conversion  6  

Parameters

pSrc                          An array of pointers to the source image buffers in each color plane.

srcStep                       An array of distances in bytes between starts of consecutive lines in
                              each source image planes for operations with ROI.
pDst                          Pointer to the destination image buffer for pixel-order images. An
                              array of pointers to the destination image buffers in each color
                              plane for planar images.
dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image for operations with ROI.
roiSize                       Size of the source and destination ROI in pixels.

imgSize                       Size of the source and destination images in pixels for operations
                              without ROI.

Description
This function converts the Y'U'V' image pSrc to the gamma-corrected R'G'B' image pDst according to the
same formulas as the function qpliYUVToRGB does. The difference is that qpliYUV420ToRGB Image
Downsampling the input data to be in Image Downsampling format (see Table “Planar Image Formats” for
more details).
The function qpliYUV420ToRGB_P3AC4R  additionally creates an alpha channel in the destination image with
alpha values set to zero.
Some function flavors operates with ROI see Regions of Interest in Intel QPL ).
The function flavors that does not use ROI operate on the assumption that both the source and destination
images have the same size and occupy a contiguous memory area, which means that image rows are not
padded with zeroes. In this case the step parameters are not needed.
roiSize.width  (imgSize.width  ) and roiSize.height  (imgSize.height ) should be multiples of 2.
Otherwise, the function reduces their original values to the nearest multiples of 2, performs operation, and
returns warning message.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst pointer is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize or imgSize has a field
                                   with a zero or negative value.
qplStsDoubleSize                   Indicates a warning if roiSize or imgSize has a field that is not
                                   a multiple of 2.

BGRToYUV420
Converts an BGR image to the YUV color model; uses
4:2:0 sampling

Syntax
QplStatus qpliBGRToYUV420_8u_AC4P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3], int
dstStep[3], QpliSize roiSize   );

Include Files
qplcc.h

                                                                                             197
---------------------Page 198---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
pDst                          An array of pointers to the destination image buffers in each color
                              plane.
dstStep                       An array of distances in bytes between starts of consecutive lines in
                              each plane of the destination image.
roiSize                       Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the gamma-corrected B'G'R' image pSrc to the Y'U'V' image pDst with the Image
Downsampling (see Table “Planar Image Formats” for more details). The function uses the same formulas as
the function qpliRGBToYUV does.
For digital BGR values in the range [0..255], Y' varies in the range [0..255], U - in the range [-112..+112],
and V - in the range [-157..+157]. To fit in the range of [0..255], a constant value 128 is added to the
computed U and V values, and V is then saturated.
roiSize.width  and roiSize.height   should be multiples of 2. If not the function reduces their original
values to the nearest multiples of 2, performs operation, and returns warning message.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize or imgSize has a field
                                   with a zero or negative value.
qplStsDoubleSize                   Indicates a warning if roiSize or imgSize  has a field that is not
                                   a multiple of 2.

YUV420ToBGR
DEPRECATED. Converts a YUV image that has 4:2:0
sampling to the BGR image.

Syntax
QplStatus qpliYUV420ToBGR_8u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3], Qpl8u* pDst,
int dstStep, QpliSize roiSize    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h

   198
---------------------Page 199---------------------

                                                                         Image Color Conversion  6 

Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                          An array of pointers to ROI in each color plane in the source image.

srcStep                       An array of distances in bytes between starts of consecutive lines in
                              the source image planes.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
roiSize                       Size of the source and destination ROI in pixels.

Description
The function qpliYUV420ToBGR is deprecated. This color format is obsolete and will be removed in a future
release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-features-
feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Y'U'V' image pSrc to the gamma-corrected B'G'R' image pDst according to the
same formulas as the function qpliYUVToRGB does. The input data must be presented in the Image
Downsampling format (see Table “Planar Image Formats” for more details).
roiSize.width  and roiSize.height   should be multiples of 2. Otherwise, the function reduces their
original values to the nearest multiples of 2, performs operation, and returns warning message.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.
qplStsDoubleSize                  Indicates a warning if roiSize  has a field that is not a multiple
                                  of 2.

RGB565ToYUV420
DEPRECATED. Converts 16-bit RGB image to the 4:2:0
YUV image.

Syntax
QplStatus qpliRGB565ToYUV420_16u8u_C3P3R(const Qpl16u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

                                                                                             199
---------------------Page 200---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Array of pointers to ROI in the separate color planes in the
                             destination image.
dstStep                      Array of distances in bytes between starts of consecutive lines in the
                             destination image planes.
roiSize                      Size of the source and destination ROI in pixels.

Description
The function qpliRGB565ToYUV420  is deprecated. This color format is obsolete and will be removed in a
future release. Use the following link for details: http://software.intel.com/sites/products/qpl-deprecated-
features-feedback/.
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the gamma-corrected R'G'B' image pSrc to the Y'U'V' image pDst according to the
same formulas as the function qpliRGBToYUV does.
The source image pSrc is a packed 16-bit RGB565 image with reduced bit depth; all 3 channel intensities for
a pixel are packed into two consecutive bytes (16u data type) in the following order: 5 bits for red, 6 bits for
green, 5 bits for blue (see Figure 16-bit Pixel Formats).
The destination image pDst has a Image Downsampling format (see Table “Planar Image Formats” for more
details).

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsDoubleSize                  Indicates a warning if roiSize has a field that is not a multiple
                                  of 2.

YUV420ToRGB565, YUV420ToRGB555, YUV420ToRGB444
DEPRECATED. Convert a YUV image that has 4:2:0
sampling format to the 16-bit per pixel RGB image.

Syntax
QplStatus qpliYUV420ToRGB565_8u16u_P3C3R(const Qpl8u* const pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYUV420ToRGB555_8u16u_P3C3R(const Qpl8u* const pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYUV420ToRGB444_8u16u_P3C3R(const Qpl8u* const pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );

Include Files
qplcc.h

   200
---------------------Page 201---------------------

                                                                        Image Color Conversion  6  

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         An array of pointers to ROI in each color plane in the source image.

srcStep                      An array of distances in bytes between starts of consecutive lines in
                             the source image planes.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
Functions qpliYUV420ToRGB444 , qpliYUV420ToRGB555  , qpliYUV420ToRGB565  are deprecated. This color
format is obsolete and will be removed in a future release. Use the following link for details: http://
software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliYUV420ToRGB444 , qpliYUV420ToRGB555  , qpliYUV420ToRGB565  operate with ROI (see 
Regions of Interest in Intel QPL).
These functions convert the Y'U'V' image pSrc to the gamma-corrected R'G'B' image pDst according to
the same formulas as the function qpliYUVToRGB does. The difference is that the input data are in Image
Downsampling format (see Table “Planar Image Formats” for more details). The destination image pDst is a
packed 16-bit RGB image with reduced bit depth; all 3 channel intensities for a pixel are packed into two
consecutive bytes (16u data type). It can be in one of three possible formats (see Figure 16-bit Pixel
Formats): RGB565 (5 bits for red, 6 bits for green, 5 bits for blue), RGB555 (5 bits for red, green, blue), or
RGB444 (4 bits for red, green, blue). Bit reduction is performed by discarding the least significant bits in the
image after color conversion.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

YUV420ToRGB565Dither, YUV420ToRGB555Dither, YUV420ToRGB444Dither
DEPRECATED. Convert a YUV image that has 4:2:0
sampling format to the 16-bit per pixel RGB image
with dithering.

Syntax
QplStatus qpliYUV420ToRGB565Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYUV420ToRGB555Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYUV420ToRGB444Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );

                                                                                            201
---------------------Page 202---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                          An array of pointers to ROI in each color plane in the source image.

srcStep                       An array of distances in bytes between starts of consecutive lines in
                              the source image planes.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
roiSize                       Size of the source and destination ROI in pixels.

Description
Functions qpliYUV420ToRGB565Dither  , qpliYUV420ToRGB555Dither   , qpliYUV420ToRGB444Dither   are
deprecated. This color format is obsolete and will be removed in a future release. Use the following link for
details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliYUV420ToRGB565Dither  , qpliYUV420ToRGB555Dither   , qpliYUV420ToRGB444Dither
operate with ROI (see Regions of Interest in Intel QPL).
These functions convert the Y'U'V' image pSrc to the gamma-corrected R'G'B' image pDst according to
the same formulas as the function qpliYUVToRGB does. The difference is that the input data are in Image
Downsampling format (see Table “Planar Image Formats” for more details). The destination image pDst is a
packed 16-bit RGB image with reduced bit depth; all three channel intensities for a pixel are packed into two
consecutive bytes (16u data type). It can be in one of three possible formats (see Figure 16-bit Pixel
Formats): RGB565 (5 bits for red, 6 bits for green, 5 bits for blue), RGB555 (5 bits for red, green, blue), or
RGB444 (4 bits for red, green, blue). Bit reduction is performed using the Bayer's threshold dithering
algorithm with a 4x4 matrix [Tho91].

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with a zero or
                                   negative value.

BGR565ToYUV420, BGR555ToYUV420
DEPRECATED. Convert 16-bit BGR image to the 4:2:0
YUV image.

Syntax
QplStatus qpliBGR565ToYUV420_16u8u_C3P3R(const Qpl16u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize     );
QplStatus qpliBGR555ToYUV420_16u8u_C3P3R(const Qpl16u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize     );

   202
---------------------Page 203---------------------

                                                                        Image Color Conversion  6 

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Array of pointers to ROI in the separate color planes in the
                             destination image.
dstStep                      Array of istances in bytes between starts of consecutive lines in the
                             destination image planes.
roiSize                      Size of the source and destination ROI in pixels.

Description
Functions qpliBGR565ToYUV420  and qpliBGR555ToYUV420   are deprecated. This color format is obsolete
and will be removed in a future release. Use the following link for details: http://software.intel.com/sites/
products/qpl-deprecated-features-feedback/.
Functions qpliBGR565ToYUV420 , qpliBGR555ToYUV420  operate with ROI (see Regions of Interest in Intel
QPL).
These functions convert the gamma-corrected B'G'R' image pSrc to the Y'U'V' image pDst according to
the same formulas as the function qpliRGBToYUV does. The source image pSrc is a packed 16-bit BGR
image with reduced bit depth; all 3 channel intensities for a pixel are packed into two consecutive bytes (16u
data type). It can be in one of two possible formats (see Figure 16-bit Pixel Formats): BGR565 (5 bits for
blue, 6 bits for green, 5 bits for red), and BGR555 (5 bits for blue, green, red). The destination image pDst
has a Image Downsampling format (see Table “Planar Image Formats” for more details).

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize.width is less than 2 or
                                  roiSize.height   is less than 0.

YUV420ToBGR565, YUV420ToBGR555, YUV420ToBGR444
DEPRECATED. Convert a YUV image that has 4:2:0
sampling format to the 16-bit per pixel BGR image.

Syntax
QplStatus qpliYUV420ToBGR565_8u16u_P3C3R(const Qpl8u* const pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYUV420ToBGR555_8u16u_P3C3R(const Qpl8u* const pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );

                                                                                            203
---------------------Page 204---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

QplStatus qpliYUV420ToBGR444_8u16u_P3C3R(const Qpl8u* const pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize      );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib , qpli.lib

Parameters

pSrc                          An array of pointers to ROI in each separate color plane in the
                              source image.
srcStep                       An array of distances in bytes between starts of consecutive lines in
                              the source image planes.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
roiSize                       Size of the source and destination ROI in pixels.

Description
Functions qpliYUV420ToBGR565  , qpliYUV420ToBGR555  , qpliYUV420ToBGR444   are deprecated. This color
format is obsolete and will be removed in a future release. Use the following link for details: http://
software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliYUV420ToBGR565  , qpliYUV420ToBGR555  , qpliYUV420ToBGR444   operate with ROI (see 
Regions of Interest in Intel QPL).
These functions convert the Y'U'V' image pSrc to the gamma-corrected B'G'R' image pDst according to
the same formulas as the function qpliYUVToRGB does. The difference is that the input data are in Image
Downsampling format (see Table “Planar Image Formats” for more details). The destination image pDst is a
packed 16-bit BGR image with reduced bit depth; all 3 channel intensities for a pixel are packed into two
consecutive bytes (16u data type). It can be in one of three possible formats (see Figure 16-bit Pixel
Formats): BGR565 (5 bits for blue, 6 bits for green, 5 bits for red), BGR555 (5 bits for blue, green, red), or
BGR444 (4 bits for blue, green, red). Bit reduction is performed by discarding the least significant bits in the
image after color conversion.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with a zero or
                                   negative value.

YUV420ToBGR565Dither, YUV420ToBGR555Dither, YUV420ToBGR444Dither
DEPRECATED. Convert a YUV image that has 4:2:0
sampling format to the 16-bit per pixel BGR image
with dithering.

   204
---------------------Page 205---------------------

                                                                        Image Color Conversion  6  

Syntax
QplStatus qpliYUV420ToBGR565Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYUV420ToBGR555Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYUV420ToBGR444Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         An array of pointers to ROI in each separate color plane in the
                             source image.
srcStep                      An array of distances in bytes between starts of consecutive lines in
                             the source image planes.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
Functions qpliYUV420ToBGR565Dither  , qpliYUV420ToBGR555Dither  , qpliYUV420ToBGR444Dither    are
deprecated. This color format is obsolete and will be removed in a future release. Use the following link for
details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliYUV420ToBGR565Dither  , qpliYUV420ToBGR555Dither  , qpliYUV420ToBGR444Dither
operate with ROI (see Regions of Interest in Intel QPL).
These functions convert the Y'U'V' image pSrc to the gamma-corrected B'G'R' image pDst according to
the same formulas as the function qpliYUVToRGB does. The difference is that the input data are in Image
Downsampling format (see Table “Planar Image Formats” for more details). The destination image pDst is a
packed 16-bit BGR image with reduced bit depth; all 3 channel intensities for a pixel are packed into two
consecutive bytes (16u data type). It can be in one of three possible formats (see Figure 16-bit Pixel
Formats): BGR565 (5 bits for blue, 6 bits for green, 5 bits for red), BGR555 (5 bits for blue, green, red), or
BGR444 (4 bits for blue, green, red). Bit reduction is performed using the Bayer's threshold dithering
algorithm with a 4x4 matrix [Tho91].

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

                                                                                            205
---------------------Page 206---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

RGBToYCbCr
Converts an RGB image to the YCbCr color model.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliRGBToYCbCr_<mod>(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );
Supported values for mod:
 8u_C3R     8u_AC4R

Case 2: Operation on planar data
QplStatus qpliRGBToYCbCr_8u_P3R(const Qpl8u* const pSrc[3], int srcStep, Qpl8u*
pDst[3], int dstStep, QpliSize roiSize    );
Case 3: Conversion from pixel-order to planar data
QplStatus qpliRGBToYCbCr_<mod>(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3], int
dstStep, QpliSize roiSize  );
Supported values for mod:
 8u_C3P3R  8u_AC4P3R

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI for a pixel-order image. An array of
                             pointers to ROI in each separate source color planes for planar
                             images.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination imnage ROI. Array of pointers to ROI in
                             the separate destination color planes for planar images.
dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the gamma-corrected R'G'B' image pSrc with values in the range [0..255] to the 
Y'Cb'Cr' image pDst according to the following formulas:
Y' = 0.257*R' + 0.504*G' + 0.098*B' + 16
Cb' = -0.148*R' - 0.291*G' + 0.439*B' + 128
Cr' = 0.439*R' - 0.368*G' - 0.071*B' + 128

   206
---------------------Page 207---------------------

                                                                       Image Color Conversion  6 

In the YCbCr model, Y is defined to have a nominal range [16..235], while Cb and Cr are defined to have a
range [16..240], with the value of 128 as corresponding to zero.
Both the source and destination images have the same bit depth.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

YCbCrToRGB
Converts a YCbCr image to the RGB color model.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCrToRGB_<mod>(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );
Supported values for mod:

 8u_C3R         8u_AC4R

Case 2: Operation on planar data
QplStatus qpliYCbCrToRGB_<mod>(const Qpl8u* const pSrc[3], int srcStep, Qpl8u* pDst[3],
int dstStep, QpliSize roiSize   );
Supported values for mod:

 8u_P3R        8u_P3C3R

Case 3: Conversion from planar to pixel-order data
QplStatus qpliYCbCrToRGB_8u_P3C4R(const Qpl8u* pSrc[3], int srcStep, Qpl8u* pDst , int
dstStep, QpliSize roiSize, Qpl8u aval   );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI for pixel-order image. Array of
                             pointers to the ROI in each separate source color planes for planar
                             images.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI. Array of pointers to the ROI in
                             the separate destination color planes for planar images.

                                                                                          207
---------------------Page 208---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

aval                         Constant value to create the fourth channel.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Y'Cb'Cr' image pSrc to the 24-bit gamma-corrected R'G'B' image pDst. The
following formulas are used for conversion:
R' = 1.164*(Y' - 16) + 1.596*(Cr' - 128)
G' = 1.164*(Y' - 16) - 0.813*(Cr' - 128) - 0.392*(Cb' - 128)
B' = 1.164*(Y' - 16) + 2.017*(Cb' - 128)
The output R'G'B' values are saturated to the range [0..255].
The fourth channel is created by setting channel values to the constant value aval.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst pointer is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

YCbCrToBGR
Converts a YCbCr image to the BGR color model.

Syntax
QplStatus qpliYCbCrToBGR_8u_P3C3R(const Qpl8u* pSrc[3], int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );
QplStatus qpliYCbCrToBGR_8u_P3C4R(const Qpl8u* pSrc[3], int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize, Qpl8u aval    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         An array of pointers to ROI in each separate source color planes.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

   208
---------------------Page 209---------------------

                                                                       Image Color Conversion  6 

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

aval                         Constant value to create the fourth channel.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Y'Cb'Cr' image pSrc to the 24-bit gamma-corrected B'G'R' image pDst
according to the same formulas as the function qpliYCbCrToRGB does. The output B'G'R' values are
saturated to the range [0..255].
The fourth channel is created by setting channel values to the constant value aval.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize.width is less than 4 or
                                  roiSize.height  is less than 1.

YCbCrToBGR_709CSC
Converts a YCbCr image to the BGR image for ITU-R
BT.709 CSC signal.

Syntax
QplStatus qpliYCbCrToBGR_709CSC_8u_P3C3R(const Qpl8u* pSrc[3], int srcStep, Qpl8u*
pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCrToBGR_709CSC_8u_P3C4R(const Qpl8u* pSrc[3], int srcStep, Qpl8u*
pDst, int dstStep, QpliSize roiSize, Qpl8u aval     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         An array of pointers to ROI in separate planes of the source image.

srcStep                      An array of distances in bytes between starts of consecutive lines in
                             the source image planes.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

aval                         Constant value to create fourth channel.

                                                                                          209
---------------------Page 210---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a planar Y'Cb'Cr' image pSrc to the three- or four-channel gamma-corrected B'G'R'
image pDst for digital component video signals complied with the ITU-R BT.709 Recommendation [ITU709]
for computer systems consideration (CSC). The conversion is performed according to the following formulas 
[Jack01]:
R' = 1.164*(Y' - 16) + 1.793*(Cr' - 128)
G' = 1.164*(Y' - 16) - 0.534*(Cr' - 128) - 0.213*(Cb' - 128)
B' = 1.164*(Y' - 16) + 2.115*(Cb' - 128)
The output R'G'B' values are saturated to the range [0..255].
The fourth channel is created by setting channel values to the constant value aval.

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                    Indicates an error condition if roiSize has a field with a zero or
                                 negative value.

YCbCrToRGB565, YCbCrToRGB555, YCbCrToRGB444
DEPRECATED. Convert a YCbCr image to the 16-bit
per pixel RGB image.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCrToRGB565_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u* pDst, int
dstStep, QpliSize roiSize  );
QplStatus qpliYCbCrToRGB555_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u* pDst, int
dstStep, QpliSize roiSize  );
QplStatus qpliYCbCrToRGB444_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u* pDst, int
dstStep, QpliSize roiSize  );
Case 2: Conversion from planar to pixel-order data
QplStatus qpliYCbCrToRGB565_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCrToRGB555_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCrToRGB444_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

   210
---------------------Page 211---------------------

                                                                        Image Color Conversion  6  

Parameters

pSrc                         Pointer to the source image ROI for pixel-order image. An array of
                             pointers to ROI in each separate source color planes for planar
                             images.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
Functions qpliYCbCrToRGB565 , qpliYCbCrToRGB555  , qpliYCbCrToRGB444  are deprecated. This color
format is obsolete and will be removed in a future release. Use the following link for details: http://
software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliYCbCrToRGB565 , qpliYCbCrToRGB555  , qpliYCbCrToRGB444  operate with ROI (see Regions
of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc to the gamma-corrected R'G'B' image pDst according to
the same formulas as the function qpliYCbCrToRGB does.
The destination image pDst is a packed 16-bit RGB image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats for more details): RGB565 (5 bits for red, 6 bits for green, 5 bits for blue),
RGB555 (5 bits for red, green, blue), or RGB444 (4 bits for red, green, blue). Bit reduction is performed by
discarding the least significant bits in the image after color conversion.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

YCbCrToRGB565Dither, YCbCrToRGB555Dither, YCbCrToRGB444Dither
Convert a YCbCr image to the 16-bit per pixel RGB
image with dithering.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCrToRGB565Dither_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCrToRGB555Dither_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCrToRGB444Dither_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize    );

                                                                                            211
---------------------Page 212---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Case 2: Conversion from planar to pixel-order data
QplStatus qpliYCbCrToRGB565Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYCbCrToRGB555Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYCbCrToRGB444Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI for pixel-order image. An array of
                             pointers to ROI in each separate source color planes for planar
                             images.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
These functions operate with ROI (see Regions of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc to the gamma-corrected R'G'B' image pDst according to
the same formulas as the function YCbCrToRGB does.
The destination image pDst is a packed 16-bit RGB image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats for more details): RGB565 (5 bits for red, 6 bits for green, 5 bits for blue),
RGB555 (5 bits for red, green, blue), or RGB444 (4 bits for red, green, blue). Bit reduction is performed using
the Bayer's threshold dithering algorithm with a 4x4 matrix [Tho91].

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

YCbCrToBGR565, YCbCrToBGR555, YCbCrToBGR444
DEPRECATED. Convert a YCbCr image to the 16-bit
per pixel BGR image.

   212
---------------------Page 213---------------------

                                                                     Image Color Conversion  6 

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCrToBGR565_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u* pDst, int
dstStep, QpliSize roiSize  );
QplStatus qpliYCbCrToBGR555_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u* pDst, int
dstStep, QpliSize roiSize  );
QplStatus qpliYCbCrToBGR444_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u* pDst, int
dstStep, QpliSize roiSize  );
Case 2: Conversion from planar to pixel-order data
QplStatus qpliYCbCrToBGR565_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCrToBGR555_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCrToBGR444_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                        Pointer to the source image ROI for pixel-order image. An array of
                            pointers to ROI in each separate source color planes for planar
                            images.
srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image.
pDst                        Pointer to the destination image ROI.

dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
roiSize                     Size of the source and destination ROI in pixels.

Description
Functions qpliYCbCrToBGR565, qpliYCbCrToBGR555, qpliYCbCrToBGR444    are deprecated. This color
format is obsolete and will be removed in a future release. Use the following link for details: http://
software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliYCbCrToBGR565, qpliYCbCrToBGR555, qpliYCbCrToBGR444    operate with ROI (see 
Regions of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc to the gamma-corrected B'G'R' image pDst according to
the same formulas as the function qpliYCbCrToRGB does.

                                                                                        213
---------------------Page 214---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

The destination image pDst is a packed 16-bit BGR image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats): BGR565 (5 bits for blue, 6 bits for green, 5 bits for red), BGR555 (5 bits for
blue, green, red), or BGR444 (4 bits for blue, green, red). Bit reduction is performed by discarding the least
significant bits in the image after color conversion.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

YCbCrToBGR565Dither, YCbCrToBGR555Dither, YCbCrToBGR444Dither
DEPRECATED. Convert a YCbCr image to the 16-bit
per pixel BGR image with dithering.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCrToBGR565Dither_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCrToBGR555Dither_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCrToBGR444Dither_8u16u_C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );
Case 2: Conversion from planar to pixel-order data
QplStatus qpliYCbCrToBGR565Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCrToBGR555Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCrToBGR444Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI for pixel-order image. An array of
                             pointers to ROI in each separate source color planes for planar
                             images.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.

   214
---------------------Page 215---------------------

                                                                         Image Color Conversion  6 

pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
roiSize                       Size of the source and destination ROI in pixels.

Description
Functions qpliYCbCrToBGR565Dither, qpliYCbCrToBGR555Dither, qpliYCbCrToBGR444Dither          are
deprecated. This color format is obsolete and will be removed in a future release. Use the following link for
details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliYCbCrToBGR565Dither, qpliYCbCrToBGR555Dither, qpliYCbCrToBGR444Dither
operate with ROI (see Regions of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc to the gamma-corrected B'G'R' image pDst according to
the same formulas as the function YCbCrToBGR does.
The destination image pDst is a packed 16-bit BGR image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats for more details): BGR565 (5 bits for blue, 6 bits for green, 5 bits for red),
BGR555 (5 bits for blue, green, red), or BGR444 (4 bits for blue, green, red). Bit reduction is performed using
the Bayer's threshold dithering algorithm with a 4x4 matrix [Tho91].

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

RGBToYCbCr422
Converts an RGB image to the YCbCr image with
4:2:2 sampling.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliRGBToYCbCr422_8u_C3C2R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize   );
Case 2; Conversion from pixel-order to planar data
QplStatus qpliRGBToYCbCr422_8u_C3P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep[3], QpliSize roiSize    );
Case 2: Conversion from planar to pixel-order data
QplStatus qpliRGBToYCbCr422_8u_P3C2R(const Qpl8u* const pSrc[3], int srcStep, Qpl8u*
pDst, int dstStep, QpliSize roiSize    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

                                                                                             215
---------------------Page 216---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Parameters

pSrc                         Pointer to the source image ROI for pixel-order image. An array of
                             pointers to ROI in each separate source color planes for planar
                             images.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI for pixel-order image. An array
                             of pointer to ROI in each separate planes for the planar destination
                             image.
dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL). This function converts the gamma-
corrected R'G'B' image pSrc to the Y'Cb'Cr' image pDst with Image Downsampling (see Table “Pixel-
Order Image Formats” and Table “Planar Image Formats” for more details). The conversion is performed
according to the same formulas as the function RGBToYCbCr does.
The converted buffer for pixel-order image has the reduced bit depth of a 16 bits per pixel, whereas the
source buffer has 24 bit depth.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

YCbCr422ToRGB
Converts an YCbCr image with the 4:2:2 sampling to
the RGB image.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCr422ToRGB_8u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr422ToRGB_8u_C2C4R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize, Qpl8u aval    );
Case 2: Conversion from pixel-order to planar data
QplStatus qpliYCbCr422ToRGB_8u_C2P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep, QpliSize roiSize   );
Case 3: Conversion from planar to pixel-order data
QplStatus qpliYCbCr422ToRGB_8u_P3C3R(const Qpl8u* const pSrc[3], int srcStep[3], Qpl8u*
pDst, int dstStep, QpliSize roiSize    );

Include Files
qplcc.h

   216
---------------------Page 217---------------------

                                                                       Image Color Conversion  6  

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI for pixel-order image. An array of
                             pointers to ROI in each separate source planes for planar images.
srcStep                      Distance, in bytes, between the starting points of consecutive lines
                             in the source image.
pDst                         Pointer to the ROI in the destination pixel-order image. An array of
                             pointers to ROI in each planes of the destination planar image.
dstStep                      Distance, in bytes, between the starting points of consecutive lines
                             in the destination image.
roiSize                      Size of the source and destination ROI in pixels.

aval                         Constant value to create the fourth channel.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Y'Cb'Cr' image pSrc with the Image Downsampling (see Table “Pixel-Order
Image Formats” and Table “Planar Image Formats” for more details) to the gamma-corrected R'G'B' image
pDst according to the same formulas as the function YCbCrToRGB does. The output R'G'B' values are
saturated to the range [0..255].

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

Example
The code example below demonstrates how to use the qpliYCbCr422ToRGB_8u_C2C4R  function.
    const int WIDTH  = 2;
    const int HEIGHT = 2;

    Qpl8u pSrc[WIDTH * HEIGHT * 2] =
    {
        236,50,236,80,
        236,50,236,80,
    };
    Qpl8u pDstRGB[(WIDTH * HEIGHT) * 4];
    int srcStep = WIDTH * 2, dstStep  = WIDTH * 4;
    QpliSize roiSize = {WIDTH, HEIGHT};
    Qpl8u alphaValue = 0xFF;
    QplStatus status = qpliYCbCr422ToRGB_8u_C2C4R(pSrc, srcStep, pDstRGB, dstStep, roiSize, alphaValue);
    if ( status == qplStsNoErr) 
        printf("\n *************  passed ****************\n");
    else 
        printf("\n *************  failed ****************\n");

                                                                                           217
---------------------Page 218---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

RGBToYCrCb422
Converts 24-bit per pixel RGB image to 16-bit per
pixel YCrCb image

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliRGBToYCrCb422_8u_C3C2R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize   );
Case 2: Conversion from planar to pixel-order data
QplStatus qpliRGBToYCrCb422_8u_P3C2R(const Qpl8u* const pSrc[3], int srcStep, Qpl8u*
pDst, int dstStep, QpliSize roiSize    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI for pixel-order image. An array of
                             pointers to ROI in each separate source color planes for planar
                             images.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL). This function converts the gamma-
corrected R'G'B' image pSrc to the Y'Cb'Cr' image pDst according to the same formulas as the function
qpliRGBToYCbCr RGBToYCbCr does. The difference is that qpliRGBToYCrCb422 uses Image Downsampling
format for the converted image (see Table “Pixel-Order Image Formats” and Table “Planar Image Formats”
for more details).
The converted buffer has the reduced bit depth of 16 bits per pixel, whereas the source buffer has 24 bit
depth.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

   218
---------------------Page 219---------------------

                                                                      Image Color Conversion  6 

YCrCb422ToRGB, YCrCb422ToBGR
Convert 16-bit per pixel YCrCb image to 24 or 32-bit
per pixel RGB or BGR image.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCrCb422ToRGB_8u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );
QplStatus qpliYCrCb422ToRGB_8u_C2C4R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize, Qpl8u aval   );
QplStatus qpliYCrCb422ToBGR_8u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );
QplStatus qpliYCrCb422ToBGR_8u_C2C4R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize, Qpl8u aval   );
Case 2: Conversion from pixel-order to planar data
QplStatus qpliYCrCb422ToRGB_8u_C2P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep, QpliSize roiSize  );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                        Pointer to the source image ROI for pixel-order image. An array of
                            pointers to ROI in each separate source plane for planar images.
srcStep                     Distance, in bytes, between the starting points of consecutive lines
                            in the source image.
pDst                        Pointer to the ROI in the destination pixel-order image. An array of
                            pointers to ROI in each plane of the destination planar image.
dstStep                     Distance, in bytes, between the starting points of consecutive lines
                            in the destination image.
roiSize                     Size of the source and destination ROI in pixels.

aval                        Constant value to create the fourth channel.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Y'Cr'Cb' image pSrc, packed in Image Downsampling format (see Table “Pixel-
Order Image Formats” and Table “Planar Image Formats” for more details) to the 24-bit gamma-corrected
R'G'B' or B'G'R' image pDst according to the same formulas as the function YCbCrToRGBdoes. The output
R'G'B' values are saturated to the range [0..255]. Y'Cr'Cb' image with 4:2:2 sampling is also known as
YVYU format.

                                                                                         219
---------------------Page 220---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                    Indicates an error condition if roiSize has a field with a zero or
                                 negative value.

Example
The code example below demonstrates how to use the qpliYCrCb422ToRGB_8u_C2C4R function.
    #define WIDTH 2
    #define HEIGHT 2

    Qpl8u pSrc[WIDTH * HEIGHT * 2] =
    {
        236,50,236,80,
        236,50,236,80,
    };
    Qpl8u pDstRGB[(WIDTH * HEIGHT) * 4];
    int srcStep = WIDTH * 2, dstStep  = WIDTH * 4;
    QpliSize roiSize = {WIDTH, HEIGHT};
    Qpl8u alphaValue = 0xFF;
    QplStatus status = qpliYCrCb422ToRGB_8u_C2C4R(pSrc, srcStep, pDstRGB, dstStep, roiSize, alphaValue);
    if ( status == qplStsNoErr) 
        printf("\n *************  passed ****************\n");
    else 
        printf("\n *************  failed ****************\n");

BGRToYCbCr422
Converts 24-bit per pixel BGR image to 16-bit per
pixel YCbCr image.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliBGRToYCbCr422_8u_C3C2R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );
QplStatus qpliBGRToYCbCr422_8u_AC4C2R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );
Case 2: Conversion from pixel-order to planar data
QplStatus qpliBGRToYCbCr422_8u_C3P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep[3], QpliSize roiSize  );
QplStatus qpliBGRToYCbCr422_8u_AC4P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep[3], QpliSize roiSize  );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

   220
---------------------Page 221---------------------

                                                                       Image Color Conversion  6 

Parameters

pSrc                         Pointer to the source mage ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the ROI in the destination pixel-order image. An array of
                             pointers to ROI in each planes of the destination planar image.
dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination pixel-order image. An array of distances in bytes for
                             each plane of the destination planar image.
roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a three- or four-channel gamma-corrected B'G'R' image pSrc to the two-channel or
three-planes Y'Cb'Cr' image pDst according to the same formulas as the function RGBToYCbCr does. The
difference is that qpliBGRToYCbCr422 uses the Image Downsampling format (see Table “Pixel-Order Image
Formats” and Table “Planar Image Formats” for more details).

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize.width is less than 2 or
                                  roiSize.height  is less than 1.

YCbCr422ToBGR
Converts a YCbCr image with 4:2:2 sampling to the
BGR image.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCr422ToBGR_8u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );
QplStatus qpliYCbCr422ToBGR_8u_C2C4R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize, Qpl8u aval   );
Case 2: Conversion from planar to pixel-order data
QplStatus qpliYCbCr422ToBGR_8u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3], Qpl8u* pDst,
int dstStep, QpliSize roiSize   );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

                                                                                          221
---------------------Page 222---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Parameters

pSrc                         Pointer to the source image ROI. An array of pointers to the ROI in
                             each separate plane of the source planar image.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image. An array of such distances in bytes for each plane of the
                             source planar image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

aval                         Constant value to create the fourth channel.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Y'Cb'Cr' image pSrc with Image Downsampling (see Table “Pixel-Order Image
Formats” and Table “Planar Image Formats” for more details) to the gamma-corrected B'G'R' image pDst
according to the same formulas as the function YCbCrToRGB does.
The output B'G'R' values are saturated to the range [0..255].
The fourth channel is created by setting channel values to the constant value aval.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize.width is less than 2 or
                                  roiSize.height   is less than 1.

YCbCr422ToGray
Converts an interlaced 4:2:2 YCbCr or YCrCb image to
gray-scale extracting luminance (Y) component.

Syntax
QplStatus qpliYCbCr422ToGray_8u_C2C1R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize   );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI.

   222
---------------------Page 223---------------------

                                                                       Image Color Conversion  6  

srcStep                      Distance, in bytes, between the starting points of consecutive lines
                             in the source image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance, in bytes, between the starting points of consecutive lines
                             in the destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts an interlaced Y'Cb'Cr' or Y'Cr'Cb' image pSrc with the 4:2:2 sampling (see Table
“Pixel-Order Image Formats” and Table “Planar Image Formats” for more details) to the gray-scale image
pDst extracting luminance (Y) component.
Y'Cb'Cr' image with 4:2:2 sampling is also known as YUY2 format, and Y'Cr'Cb' as YVYU.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

Example
The code example below demonstrates how to use the qpliYCbCr422ToGray_8u_C2C1R  function.
    const int WIDTH  = 2;
    const int HEIGHT = 2;

    Qpl8u pSrc[WIDTH * HEIGHT * 2] = {
        190,70,191,80,
        200,71,201,81,
    };
    Qpl8u pDst[WIDTH * HEIGHT];
    int srcStep = WIDTH * 2, dstStep  = WIDTH;
    QpliSize roiSize = {WIDTH, HEIGHT};
    QplStatus status = qpliYCbCr422ToGray_8u_C2C1R(pSrc, srcStep, pDst, dstStep, roiSize);
    if ( status == qplStsNoErr) 
        printf("PASS:\n%3d %3d\n%3d %3d\n", pDst[0], pDst[1], pDst[2], pDst[3]);
    else 
        printf("FAIL: status = %d\n", status);

Result:
PASS:
190 191
200 201

BGR565ToYCbCr422, BGR555ToYCbCr422
DEPRECATED. Converts 16-bit per pixel BGR image to
16-bit per pixel YCbCr image.

                                                                                           223
---------------------Page 224---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliBGR565ToYCbCr422_16u8u_C3C2R(const Qpl16u* pSrc, int srcStep, Qpl8u*
pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliBGR555ToYCbCr422_16u8u_C3C2R(const Qpl16u* pSrc, int srcStep, Qpl8u*
pDst, int dstStep, QpliSize roiSize    );
Case 2: Conversion from pixel-order to planar data
QplStatus qpliBGR565ToYCbCr422_16u8u_C3P3R(const Qpl16u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize     );
QplStatus qpliBGR555ToYCbCr422_16u8u_C3P3R(const Qpl16u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
pDst                          Pointer to the ROI in the destination pixel-order image. An array of
                              pointers to ROI in each planes of the destination planar image.
dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination pixel-order image. An array of distances in bytes for
                              each plane of the destination planar image.
roiSize                       Size of the source and destination ROI in pixels.

Description
Functions qpliBGR565ToYCbCr422  and qpliBGR555ToYCbCr422    are deprecated. This color format is
obsolete and will be removed in a future release. Use the following link for details: http://software.intel.com/
sites/products/qpl-deprecated-features-feedback/.
Functions qpliBGR565ToYCbCr422  and qpliBGR555ToYCbCr422    operate with ROI (see Regions of Interest
in Intel QPL).
These functions convert a three- or four-channel gamma-corrected B'G'R' image pSrc to the two-channel or
three-planes Y'Cb'Cr' image pDst according to the same formulas as the function RGBToYCbCr does. The
difference is that these functions use Image Downsampling format (see Table “Pixel-Order Image Formats”
and Table “Planar Image Formats” for more details).
The source image pSrc is a packed 16-bit BGR image with reduced bit depth; all 3 channel intensities for a
pixel are packed into two consecutive bytes (16u data type). It can be in one of two possible formats (see 
Figure 16-bit Pixel Formats for more details): BGR565 (5 bits for blue, 6 bits for green, 5 bits for red), and
BGR555 (5 bits for blue, green, red).

   224
---------------------Page 225---------------------

                                                                       Image Color Conversion  6 

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize.width is less than 2 or
                                  roiSize.height  is less than 1.

RGBToCbYCr422, RGBToCbYCr422Gamma
Convert 24-bit per pixel RGB image to 16-bit per pixel
CbYCr image.

Syntax
QplStatus qpliRGBToCbYCr422_8u_C3C2R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );
QplStatus qpliRGBToCbYCr422Gamma_8u_C3C2R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst,
int dstStep, QpliSize roiSize   );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
These functions operate with ROI (see Regions of Interest in Intel QPL).
The function qpliRGBToCbYCr422 converts the gamma-corrected R'G'B' image pSrc to the Cb'Y'Cr'
image pDst according to the same formulas as the function RGBToYCbCr does.
The function qpliRGBToCbYCr422Gamma performs gamma-correction of the source RGB image pSrc
according to the same formula as the function GammaFwd does, and then converts it to the Cb'Y'Cr' image
pDst according to the same formulas as the function qpliRGBToYCbCr does.
The functions qpliRGBToCbYCr422 and qpliRGBToCbYCr422Gamma  use Image Downsampling format for the
converted image.
A CbYCr image has the following sequence of bytes: Cb0Y0Cr0Y1, Cb1Y2Cr1Y3, ....

                                                                                          225
---------------------Page 226---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

CbYCr422ToRGB
Converts 16-bit per pixel CbYCr image to 24-bit per
pixel RGB image.

Syntax
QplStatus qpliCbYCr422ToRGB_8u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize   );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Cb'Y'Cr' image pSrc, packed in the Image Downsampling format, to the 24-bit
gamma-corrected R'G'B'  image pDst according to the same formulas as the function YCbCrToRGB does.
A CbYCr image has the following sequence of bytes: Cb0Y0Cr0Y1, Cb1Y2Cr1Y3, ... .
The output R'G'B' values are saturated to the range [0..255].

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

   226
---------------------Page 227---------------------

                                                                       Image Color Conversion  6 

BGRToCbYCr422
Converts 32-bit per pixel BGR image to 16-bit per
pixel CbYCr image.

Syntax
QplStatus qpliBGRToCbYCr422_8u_AC4C2R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize  );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the four-channel gamma-corrected B'G'R' image pSrc to the two-channel Cb'Y'Cr'
image pDst according to the same formulas as the function RGBToYCbCr does. The function
qpliBGRToCbYCr422  uses Image Downsampling format for the converted image. An alpha-channel
information is lost.
An CbYCr image has the following sequence of bytes: Cb0Y0Cr0Y1, Cb1Y2Cr1Y3, ... .

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

BGRToCbYCr422_709HDTV
Converts BGR image to 16-bit per pixel CbYCr image
for ITU-R BT.709 HDTV signal.

Syntax
QplStatus qpliBGRToCbYCr422_709HDTV_8u_C3C2R(const Qpl8u* pSrc, int srcStep, Qpl8u*
pDst, int dstStep, QpliSize roiSize   );

                                                                                          227
---------------------Page 228---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

QplStatus qpliBGRToCbYCr422_709HDTV_8u_AC4C2R(const Qpl8u* pSrc, int srcStep, Qpl8u*
pDst, int dstStep, QpliSize roiSize    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
roiSize                       Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the three- or four-channel gamma-corrected B'G'R' image pSrc to the two-channel 
Cb'Y'Cr'  image pDst for digital component video signals complied with the ITU-R BT.709 Recommendation 
[ITU709] for high-definition TV (HDTV). The source image pixel values are in the range [16..235]. The
conversion is performed according to the following formulas [Jack01]:
Y' = 0.213*R' + 0.715*G' + 0.072*B'
Cb' = -0.117*R' - 0.394*G' + 0.511*B' + 128
Cr' = 0.511*R' - 0.464*G' - 0.047*B' + 128
The values of Y' of the destination image are in the range [16..235], the values of Cb', Cr' are in the range
[16..240]. They should be saturated at the 1 and 254 levels.
The function qpliBGRToCbYCr422_709HDTV   uses the Image Downsampling format for the converted image.
The alpha-channel information is lost.
A CbYCr image has the following sequence of bytes: Cb0Y0Cr0Y1, Cb1Y2Cr1Y3, ... .

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst pointer is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with a zero or
                                   negative value.

CbYCr422ToBGR
Converts 16-bit per pixel CbYCr image to four channel
BGR image.

   228
---------------------Page 229---------------------

                                                                       Image Color Conversion  6 

Syntax
QplStatus qpliCbYCr422ToBGR_8u_C2C4R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst, int
dstStep, QpliSize roiSize, Qpl8u aval    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

aval                         Constant value to create the fourth channel.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Cb'Y'Cr' image pSrc, packed in Image Downsampling format, to the four
channel gamma-corrected B'G'R' image pDst according to the same formulas as the function YCbCrToRGB
does.
A CbYCr image has the following sequence of bytes: Cb0Y0Cr0Y1, Cb1Y2Cr1Y3, ... .
The output B'G'R' values are saturated to the range [0..255].
The fourth channel is created by setting channel values to the constant value aval.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

CbYCr422ToBGR_709HDTV
Converts 16-bit per pixel CbYCr image to the BGR
image for ITU-R BT.709 HDTV signal.

Syntax
QplStatus qpliCbYCr422ToBGR_709HDTV_8u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl8u*
pDst, int dstStep, QpliSize roiSize   );

                                                                                           229
---------------------Page 230---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

QplStatus qpliCbYCr422ToBGR_709HDTV_8u_C2C4R(const Qpl8u* pSrc, int srcStep, Qpl8u*
pDst, int dstStep, QpliSize roiSize, Qpl8u aval      );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
roiSize                       Size of the source and destination ROI in pixels.

aval                          Constant value to create the fourth channel.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Cb'Y'Cr' image pSrc, packed in Image Downsampling format, to the three- or
four-channel gamma-corrected B'G'R' image  pDst for digital component video signals complied with the
ITU-R BT.709 Recommendation [ITU709] for high-definition TV (HDTV). A source CbYCr image has the
following sequence of bytes: Cb0Y0Cr0Y1, Cb1Y2Cr1Y3, ... . The values of Y' are in the range [16..235], the
values of Cb', Cr' are in the range [16..240]. The conversion is performed according to the following
formulas [Jack01]:
R' = Y' + 1.540*(Cr' - 128)
G' = Y' - 0.459*(Cr' - 128) - 0.183*(Cb' - 128)
B' = Y' + 1.816*(Cb' - 128)
The destination image pixel values have a nominal range [16..235]. The resulting R'G'B' values should be
saturated at the 0 and 255 levels.
The output B'G'R' values are saturated to the range [0..255].
The fourth channel is created by setting channel values to the constant value aval.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with a zero or
                                   negative value.

   230
---------------------Page 231---------------------

                                                                     Image Color Conversion  6 

YCbCr422ToRGB565, YCbCr422ToRGB555, YCbCr422ToRGB444
DEPRECATED. Convert 16-bit per pixel YCbCr image to
16-bit per pixel RGB image.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCr422ToRGB565_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize  );
QplStatus qpliYCbCr422ToRGB555_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize  );
QplStatus qpliYCbCr422ToRGB444_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize  );
Case 2: Conversion from planar to pixel-order data
QplStatus qpliYCbCr422ToRGB565_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr422ToRGB555_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr422ToRGB444_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize   );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                        Pointer to the source image ROI for pixel-order images. An array of
                            pointers to ROI in each separate source planes for planar images.
srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image. An array of three values in case of planar data.
pDst                        Pointer to the destination image ROI.

dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
roiSize                     Size of the source and destination ROI in pixels.

Description
Functions qpliYCbCr422ToRGB565, qpliYCbCr422ToRGB565, qpliYCbCr422ToRGB565     are deprecated.
This color format is obsolete and will be removed in a future release. Use the following link for details:
http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliYCbCr422ToRGB565, qpliYCbCr422ToRGB565, qpliYCbCr422ToRGB565     operate with ROI
(see Regions of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc, packed in Image Downsampling format (see Table “Pixel-
Order Image Formats” for more details), to the gamma-corrected R'G'B' image pDst according to the same
formulas as the function YCbCrToRGB does.

                                                                                        231
---------------------Page 232---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

The destination image pDst is a packed 16-bit RGB image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats): RGB565 (5 bits for red, 6 bits for green, 5 bits for blue), RGB555 (5 bits for
red, green, blue), RGB444 (4 bits for red, green, blue).
Bit reduction is performed by discarding the least significant bits in the image after color conversion.

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                    Indicates an error condition if roiSize has a field with a zero or
                                 negative value.

YCbCr422ToRGB565Dither, YCbCr422ToRGB555Dither, YCbCr422ToRGB444Dither
DEPRECATED. Convert 16-bit per pixel YCbCr image to
16-bit per pixel RGB image with dithering.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCr422ToRGB565Dither_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCr422ToRGB555Dither_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCr422ToRGB444Dither_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
Case 2: Conversion from planar to pixel-order data
QplStatus qpliYCbCr422ToRGB565Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCr422ToRGB555Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCr422ToRGB444Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI for pixel-order images. An array of
                             pointers to ROI in each separate source planes for planar images.
srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image. An array of three values in case of planar data.
pDst                         Pointer to the destination image ROI.

   232
---------------------Page 233---------------------

                                                                       Image Color Conversion  6 

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
Functions
qpliYCbCr422ToRGB565Dither, qpliYCbCr422ToRGB565Dither, qpliYCbCr422ToRGB565Dither         are
deprecated. This color format is obsolete and will be removed in a future release. Use the following link for
details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions
qpliYCbCr422ToRGB565Dither, qpliYCbCr422ToRGB565Dither, qpliYCbCr422ToRGB565Dither
operate with ROI (see Regions of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc, packed in Image Downsampling format (see Table “Pixel-
Order Image Formats” for more details), to the gamma-corrected R'G'B' image pDst according to the same
formulas as the function YCbCrToRGB does.
The destination image pDst is a packed 16-bit RGB image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats): RGB565 (5 bits for red, 6 bits for green, 5 bits for blue), RGB555 (5 bits for
red, green, blue), RGB444 (4 bits for red, green, blue).
Bit reduction is performed using the Bayer's threshold dithering algorithm with a 4x4 matrix [Tho91].

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

YCbCr422ToBGR565, YCbCr422ToBGR555, YCbCr422ToBGR444
DEPRECATED. Convert 16-bit per pixel YCbCr image to
16-bit per pixel BGR image.

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCr422ToBGR565_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr422ToBGR555_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr422ToBGR444_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep, Qpl16u*
pDst, int dstStep, QpliSize roiSize   );
Case 2: Conversion from planar to pixel-order data
QplStatus qpliYCbCr422ToBGR565_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCr422ToBGR555_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCr422ToBGR444_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize    );

                                                                                          233
---------------------Page 234---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h , qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib , qpli.lib

Parameters

pSrc                          Pointer to the source image ROI for pixel-order images. An array of
                              pointers to ROI in each separate source planes for planar images.
srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image. An array of three values in case of planar data.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
roiSize                       Size of the source and destination ROI in pixels.

Description
Functions qpliYCbCr422ToBGR565, qpliYCbCr422ToBGR565, qpliYCbCr422ToBGR565          are deprecated.
This color format is obsolete and will be removed in a future release. Use the following link for details:
http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliYCbCr422ToBGR565, qpliYCbCr422ToBGR565, qpliYCbCr422ToBGR565          operate with ROI
(see Regions of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc, packed in Image Downsampling format (see Table “Pixel-
Order Image Formats” for more details), to the gamma-corrected B'G'R' image pDst according to the same
formulas as the function YCbCrToRGB does.
The destination image pDst is a packed 16-bit BGR image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats): BGR565 (5 bits for blue, 6 bits for green, 5 bits for red), BGR555 (5 bits for
blue, green, red), BGR444 (4 bits for blue, green, red).
Bit reduction is performed by discarding the least significant bits in the image after color conversion.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with a zero or
                                   negative value.

YCbCr422ToBGR565Dither, YCbCr422ToBGR555Dither, YCbCr422ToBGR444Dither
DEPRECATED. Convert 16-bit per pixel YCbCr image to
16-bit per pixel BGR image with dithering.

   234
---------------------Page 235---------------------

                                                                     Image Color Conversion  6 

Syntax
Case 1: Operation on pixel-order data
QplStatus qpliYCbCr422ToBGR565Dither_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr422ToBGR555Dither_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr422ToBGR444Dither_8u16u_C2C3R(const Qpl8u* pSrc, int srcStep,
Qpl16u* pDst, int dstStep, QpliSize roiSize   );
Case 2: Conversion from planar to pixel-order data
QplStatus qpliYCbCr422ToBGR565Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr422ToBGR555Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr422ToBGR444Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize   );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                        Pointer to the source image ROI for pixel-order images. An array of
                            pointers to ROI in each separate source planes for planar images.
srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image. An array of three values in case of planar data.
pDst                        Pointer to the destination image ROI.

dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
roiSize                     Size of the source and destination ROI in pixels.

Description
Functions
qpliYCbCr422ToBGR565Dither, qpliYCbCr422ToBGR565Dither, qpliYCbCr422ToBGR565Dither       are
deprecated. This color format is obsolete and will be removed in a future release. Use the following link for
details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions
qpliYCbCr422ToBGR565Dither, qpliYCbCr422ToBGR565Dither, qpliYCbCr422ToBGR565Dither
operate with ROI (see Regions of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc, packed in the Image Downsampling format (see Table
“Pixel-Order Image Formats” for more details), to the gamma-corrected B'G'R' image pDst according to the
same formulas as the function YCbCrToRGB does.

                                                                                        235
---------------------Page 236---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

The destination image pDst is a packed 16-bit BGR image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats): BGR565 (5 bits for blue, 6 bits for green, 5 bits for red), BGR555 (5 bits for
blue, green, red), BGR444 (4 bits for blue, green, red).
Bit reduction is performed using the Bayer's threshold dithering algorithm with a 4x4 matrix [Tho91].

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

RGBToYCbCr420
Converts an RGB image to the YCbCr color model;
uses 4:2:0 sampling.

Syntax
QplStatus qpliRGBToYCbCr420_8u_C3P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep[3], QpliSize roiSize   );
QplStatus qpliRGBToYCbCr420_8u_C3P2R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDstY, int
dstYStep, Qpl8u* pDstCbCr, int dstCbCrStep, QpliSize roiSize       );
QplStatus qpliRGBToYCbCr420_8u_C4P2R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDstY, int
dstYStep, Qpl8u* pDstCbCr, int dstCbCrStep, QpliSize roiSize       );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         An array of pointers to ROI in the separate planes of the destination
                             image for three-plane image.
dstStep                      Array of distances in bytes between starts of consecutive lines in
                             each plane of the destination image for three-plane image.
pDstY                        Pointer to ROI in the luminance plane of the destination image for
                             two-plane image.
dstStep                      Distance in bytes between starts of consecutive lines in the
                             luminance plane for two-plane image.
pDstCbCr                     Pointer to ROI in the interleaved chrominance plane of the
                             destination image for two-plane image.

   236
---------------------Page 237---------------------

                                                                      Image Color Conversion  6 

dstCbCrStep                 Distance in bytes between starts of consecutive lines in the
                            interleaved chrominance plane for two-plane image.
roiSize                     Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the gamma-corrected R'G'B' image pSrc to the Y'Cb'Cr' image according to the
same formulas as the function RGBToYCbCr does. The difference is that qpliRGBToYCbCr420 uses Image
Downsampling format for the converted image (see Table “Planar Image Formats” for more details).
roiSize.width  should be multiple of 2, and roiSize.height should be multiple of 2 (for three-plane
image) or 4 (for two-plane image). If not the function reduces their original values to the nearest multiples of
2 or 4 correspondingly, performs operation, and returns warning message.

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                    Indicates an error condition if roiSize has a field with value
                                 less than 2.
qplStsDoubleSize                 Indicates a warning if roiSize.width is not a multiple of 2, or
                                 if roiSize.height is not a multiple of 2 (for three-plane
                                 image) or 4 (for two-plane image).

YCbCr420ToRGB, YCbCr420ToBGR
Convert a YCbCr image that has 4:2:0 sampling
format to the RGB or BGR color model.

Syntax
QplStatus qpliYCbCr420ToRGB_8u_P3C3R(const Qpl8u* const pSrc[3], int srcStep[3], Qpl8u*
pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr420ToRGB_8u_P2C3R(const Qpl8u* pSrcY, int srcYStep, const Qpl8u*
pSrcCbCr, int srcCbCrStep, Qpl8u* pDst, int dstStep, QpliSize roiSize      );
QplStatus qpliYCbCr420ToRGB_8u_P2C4R(const Qpl8u* pSrcY, int srcYStep, const Qpl8u*
pSrcCbCr, int srcCbCrStep, Qpl8u* pDst, int dstStep, QpliSize roiSize, Qpl8u aval       );
QplStatus qpliYCbCr420ToBGR_8u_P2C3R(const Qpl8u* pSrcY, int srcYStep, const Qpl8u*
pSrcCbCr, int srcCbCrStep, Qpl8u* pDst, int dstStep, QpliSize roiSize      );
QplStatus qpliYCbCr420ToBGR_8u_P2C4R(const Qpl8u* pSrcY, int srcYStep, const Qpl8u*
pSrcCbCr, int srcCbCrStep, Qpl8u* pDst, int dstStep, QpliSize roiSize, Qpl8u aval       );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

                                                                                         237
---------------------Page 238---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Parameters

pSrc                          An array of pointers to ROI in separate planes of the three-plane
                              source image.
srcStep                       An array of distances in bytes between starts of consecutive lines in
                              each plane of the three-plane source image.
pSrcY                         Pointer to ROI in the luminance plane of the two-plane source
                              image.
srcYStep                      Distance in bytes between starts of consecutive lines in the
                              luminance plane of the two-plane source image.
pSrcCbCr                      Pointer to ROI in the interleaved chrominance plane of the two-
                              plane source image.
srcCbCrStep                   Distance in bytes between starts of consecutive lines in the
                              interleaved chrominance plane of the two-plane source image.
pDst                          Pointer to the destination image ROI.

dstStep                       Distance in bytes between starts of consecutive lines in the
                              destination image.
roiSize                       Size of the source and destination ROI in pixels.

aval                          Constant value to create the fourth channel.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Y'Cb'Cr' image pSrc to the gamma-corrected R'G'B' or B'G'R' image pDst
according to the same formulas as the function YCbCrToRGB does. The difference is that the
qpliYCbCr420ToRGB   and qpliYCbCr420ToBGR   functions use the input data in the 4:2:0 sampling format, in
which the number of Cb and Cr samples is reduced by half in both vertical and horizontal directions (see 
Table “Planar Image Formats” for more details). Two-plane Y'Cb'Cr' image with 4:2:0 sampling is also
known as NV12 format.
The value of roiSize.width and roiSize.height   must be a multiple of 2. Otherwise, the function reduces
original values to the nearest multiples of 2, performs operation, and returns a warning message.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with value
                                   less than 2.
qplStsDoubleSize                   Indicates a warning if roiSize  has a field that is not a multiple
                                   of 2.

Example
The code example below demonstrates how to use the qpliYCbCr420ToRGB_8u_P2C4R    function.
    #define WIDTH 4
    #define HEIGHT 4

    Qpl8u pSrcY[WIDTH * HEIGHT] =
    {
        236,236,236,236,
        236,236,236,236,

   238
---------------------Page 239---------------------

                                                                     Image Color Conversion  6 
        236,236,236,236,
        236,236,236,236
    };
    Qpl8u pSrcCbCr[WIDTH * HEIGHT / 2] =
    {
        128,128,128,128,
        128,128,128,128
    };
    Qpl8u pDstRGB[(WIDTH * HEIGHT) * 4];
    int srcYStep = WIDTH, srcCbCrStep = WIDTH, dstStep  = WIDTH * 4;
    QpliSize roiSize = {WIDTH, HEIGHT};
    Qpl8u alphaValue = 0xFF;
    QplStatus status = qpliYCbCr420ToRGB_8u_P2C4R(pSrcY, srcYStep, pSrcCbCr, srcCbCrStep, pDstRGB, 
dstStep, roiSize, alphaValue);
    if ( status == qplStsNoErr) 
        printf("\n *************  passed ****************\n");
    else 
        printf("\n *************  failed ****************\n");

YCbCr420ToRGB565, YCbCr420ToRGB555, YCbCr420ToRGB444
DEPRECATED. Convert a YCbCr image that has 4:2:0
sampling format to the 16-bit per pixel RGB image.

Syntax
QplStatus qpliYCbCr420ToRGB565_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr420ToRGB555_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize   );
QplStatus qpliYCbCr420ToRGB444_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize   );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                        An array of pointers to ROI in separate planes of the source image.

srcStep                     An array of distances in bytes between starts of consecutive lines in
                            the source image planes.
pDst                        Pointer to the destination image ROI.

dstStep                     Distance in bytes between starts of consecutive lines in the
                            destination image.
roiSize                     Size of the source and destination ROI in pixels.

Description
Functions qpliYCbCr420ToRGB565, qpliYCbCr420ToRGB565, qpliYCbCr420ToRGB565    are deprecated.
This color format is obsolete and will be removed in a future release. Use the following link for details:
http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.

                                                                                        239
---------------------Page 240---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Functions qpliYCbCr420ToRGB565, qpliYCbCr420ToRGB565, qpliYCbCr420ToRGB565        operate with ROI
(see Regions of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc, packed in Image Downsampling format (see Table “Pixel-
Order Image Formats” for more details), to the gamma-corrected R'G'B' image pDst according to the same
formulas as the function YCbCrToRGB does.
The destination image pDst is a packed 16-bit RGB image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats): RGB565 (5 bits for red, 6 bits for green, 5 bits for blue), RGB555 (5 bits for
red, green, blue), RGB444 (4 bits for red, green, blue).
Bit reduction is performed by discarding the least significant bits in the image after color conversion.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

YCbCr420ToRGB565Dither, YCbCr420ToRGB555Dither, YCbCr420ToRGB444Dither
DEPRECATED. Convert a YCbCr image that has 4:2:0
sampling format to the 16-bit per pixel RGB image
with dithering.

Syntax
QplStatus qpliYCbCr420ToRGB565Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYCbCr420ToRGB555Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYCbCr420ToRGB444Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         An array of pointers to ROI in separate planes of the source image.

srcStep                      An array of distances in bytes between starts of consecutive lines in
                             the source image planes.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

   240
---------------------Page 241---------------------

                                                                         Image Color Conversion  6  

Description
Functions
qpliYCbCr420ToRGB565Dither, qpliYCbCr420ToRGB555Dither, qpliYCbCr420ToRGB444Dither            are
deprecated. This color format is obsolete and will be removed in a future release. Use the following link for
details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions
qpliYCbCr420ToRGB565Dither, qpliYCbCr420ToRGB555Dither, qpliYCbCr420ToRGB444Dither
operate with ROI (see Regions of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc, packed in the Image Downsampling format (see Table
“Pixel-Order Image Formats” for more details), to the gamma-corrected R'G'B' image pDst according to the
same formulas as the function YCbCrToRGB does.
The destination image pDst is a packed 16-bit RGB image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats for more details): RGB565 (5 bits for red, 6 bits for green, 5 bits for blue),
RGB555 (5 bits for red, green, blue), or RGB444 (4 bits for red, green, blue).
Bit reduction is performed using the Bayer's threshold dithering algorithm with a 4x4 matrix [Tho91].

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with a zero or
                                   negative value.

RGBToYCrCb420
Converts an RGB image to the YCrCb image with
4:2:0 sampling format.

Syntax
QplStatus qpliRGBToYCrCb420_8u_AC4P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep[3], QpliSize roiSize    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
pDst                          Array of pointers to ROI in separate planes of the destination image.

dstStep                       Array of distances in bytes between starts of consecutive lines in the
                              destination image planes.

                                                                                             241
---------------------Page 242---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

roiSize                     Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a four-channel gamma-corrected R'G'B' image pSrc to the planar Y'Cr'Cb' image
pDst with the Image Downsampling (see Table “Planar Image Formats” for more details). The conversion is
performed according to the same formulas as the function RGBToYCbCr does.
roiSize.width  and roiSize.height should be multiples of 2. If not the function reduces their original
values to the nearest multiples of 2, performs the operation, and returns a warning message.

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                    Indicates an error condition if roiSize has a field with a zero or
                                 negative value.
qplStsDoubleSize                 Indicates a warning if roiSize has a field that is not a multiple
                                 of 2.

YCrCb420ToRGB, YCrCb420ToBGR
Convert a YCrCb image with the 4:2:0 sampling to the
RGB or BGR image.

Syntax
QplStatus qpliYCrCb420ToRGB_8u_P3C4R (const Qpl8u* pSrc[3],int srcStep[3], Qpl8u* pDst,
int dstStep, QpliSize roiSize, Qpl8u aval   );
QplStatus qpliYCrCb420ToRGB_8u_P2C4R (const Qpl8u* pSrcY, int srcYStep, const Qpl8u*
pSrcCbCr, int srcCbCrStep, Qpl8u* pDst, int dstStep, QpliSize roiSize, Qpl8u aval       );
QplStatus qpliYCrCb420ToRGB_8u_P2C3R (const Qpl8u* pSrcY, int srcYStep, const Qpl8u*
pSrcCbCr, int srcCbCrStep, Qpl8u* pDst, int dstStep, QpliSize roiSize      );
QplStatus qpliYCrCb420ToBGR_8u_P2C3R (const Qpl8u* pSrcY, int srcYStep, const Qpl8u*
pSrcCbCr, int srcCbCrStep, Qpl8u* pDst, int dstStep, QpliSize roiSize      );
QplStatus qpliYCrCb420ToBGR_8u_P2C4R (const Qpl8u* pSrcY, int srcYStep, const Qpl8u*
pSrcCbCr, int srcCbCrStep, Qpl8u* pDst, int dstStep, QpliSize roiSize, Qpl8u aval       );
QplStatus qpliYCrCb420ToBGR_Filter_8u_P3C4R (const Qpl8u* pSrc[3], int srcStep[3],
Qpl8u* pDst, int dstStep, QpliSize roiSize, Qpl8u aval    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

   242
---------------------Page 243---------------------

                                                                        Image Color Conversion  6  

Parameters

pSrc                         An array of pointers to ROI in separate planes of the three-plane
                             source image.
srcStep                      An array of distances, in bytes, between the starting points of
                             consecutive lines in each plane of the three-plane source image.
pSrcY                        Pointer to ROI in the luminance plane of the two-plane source
                             image.
srcYStep                     Distance, in bytes, between the starting points of consecutive lines
                             in the luminance plane of the two-plane source image.
pSrcCbCr                     Pointer to ROI in the interleaved plane chrominance plane of the
                             two-plane source image.
srcCbCrStep                  Distance, in bytes, between the starting points of consecutive lines
                             in the interleaved chrominance plane of the two-plane source
                             image.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance, in bytes, between the starting points of consecutive lines
                             in the destination image.
roiSize                      Size of the source and destination ROI, in pixels.

aval                         Constant value to create the fourth channel.

Description
This function operates with ROI.
This function converts the Y'Cr'Cb' image pSrc to the gamma-corrected R'G'B' or B'G'R' image pDst
according to the same formulas as the qpliYCbCrToRGB function does. The difference is that the
qpliYCrCb420ToRGB   and qpliYCrCb420ToBGR   functions use the source data in the Image Downsampling
format, in which the number of Cb and Cr samples is reduced by half in both vertical and horizontal
directions (see Table “Planar Image Formats” for more details). Two-plane Y'Cr'Cb image with 4:2:0
sampling is also known as NV21 format.
The value of roiSize.width and roiSize.height  must be a multiple of 2. Otherwise, the function reduces
original values of roiSize.width and roiSize.height to the nearest multiples of 2, performs operation,
and returns a warning.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error when  pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error when  roiSize  has a field with a value less
                                  than 2.
qplStsDoubleSize                  Indicates a warning if roiSize.width  is not a multiple of 2, or
                                  roiSize.height   is not a multiple of 2 (for three-plane image)
                                  or 4 (for two-plane image).

Example
The code example below demonstrates how to use the qpliYCrCb420ToRGB_8u_P2C4R   function.
static void sampleNV21ToRGBA()
{
    Qpl8u pY[4*4]=
    {

                                                                                            243
---------------------Page 244---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

        236,236,236,236,
        236,236,236,236,
        236,236,236,236,
        236,236,236,236
    };
    Qpl8u pCbCr[4*2]=
    {
        128,128,128,128,
        128,128,128,128
    };
    Qpl8u pRGB[(4*4)*4];
    int YStep = 4, CbCrStep = 4, rgbStep  = 4*4;
    QpliSize roiSize = {4,4};
    Qpl8u alpha = 0xFF;
    QplStatus status = qpliYCrCb420ToRGB_8u_P2C4R(pY, YStep, pCbCr, CbCrStep, pRGB, rgbStep, roiSize, 
alpha);
    if ( status == qplStsNoErr) 
        printf("\n *************  passed ****************\n");
    else 
        printf("\n *************  failed ****************\t"); 
}

See Also
Regions of Interest in Intel QPL

BGRToYCbCr420
Converts a BGR image to the YCbCr image with 4:2:0
sampling format.

Syntax
QplStatus qpliBGRToYCbCr420_8u_C3P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep[3], QpliSize roiSize  );
QplStatus qpliBGRToYCbCr420_8u_AC4P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep[3], QpliSize roiSize  );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                        Pointer to the source image ROI.

srcStep                     Distance in bytes between starts of consecutive lines in the source
                            image.
pDst                        An array of pointers to ROI in separate planes of the destination
                            image.
dstStep                     An array of distances in bytes between starts of consecutive lines in
                            the destination image planes.
roiSize                     Size of the source and destination ROI in pixels.

   244
---------------------Page 245---------------------

                                                                       Image Color Conversion  6 

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a three- or four-channel gamma-corrected B'G'R' image pSrc to the planar Y'Cb'Cr'
image pDst according to the same formulas as the function RGBToYCbCr does. The difference is that
qpliBGRToYCbCr420  uses Image Downsampling format (see Table “Planar Image Formats” for more
details).
roiSize.width  and roiSize.height  should be multiples of 2. If not the function reduces their original
values to the nearest multiples of 2, performs operation, and returns warning message.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize.width is less than 2 or
                                  roiSize.height  is less than 2.
qplStsDoubleSize                  Indicates a warning if roiSize has a field that is not a multiple
                                  of 2.

BGRToYCbCr420_709CSC
Converts a BGR image to the YCbCr image with 4:2:0
sampling for ITU-R BT.709 CSC signal.

Syntax
QplStatus qpliBGRToYCbCr420_709CSC_8u_C3P3R(const Qpl8u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize    );
QplStatus qpliBGRToYCbCr420_709CSC_8u_C3P2R(const Qpl8u* pSrc, int srcStep, Qpl8u*
pDstY, int dstYStep, Qpl8u* pDstCbCr, int dstCbCrStep, QpliSize roiSize       );
QplStatus qpliBGRToYCbCr420_709CSC_8u_AC4P3R(const Qpl8u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         An array of pointers to ROI in separate planes of the destination
                             image.
dstStep                      An array of distances in bytes between starts of consecutive lines in
                             the destination image planes.
roiSize                      Size of the source and destination ROI in pixels.

                                                                                          245
---------------------Page 246---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a three- or four-channel gamma-corrected B'G'R' image pSrc to the planar Y'Cb'Cr'
image pDst for digital component video signals complied with the ITU-R BT.709 Recommendation [ITU709]
for computer systems consideration (CSC). The source image pixel values are in the range [0..255]. The
conversion is performed according to the following formulas [Jack01]:
Y' = 0.183*R' + 0.614*G' + 0.062*B' + 16
Cb' = -0.101*R' - 0.338*G' + 0.439*B' + 128
Cr' = 0.439*R' - 0.399*G' - 0.040*B' + 128
The destination image pDst has Image Downsampling format (see Table “Planar Image Formats” for more
details).
The values of roiSize.width and roiSize.height  should be multiples of 2. Otherwise, the function
reduces their original values to the nearest multiples of 2, performs operation, and returns a warning
message.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize.width  is less than 2 or
                                  roiSize.height   is less than 2.
qplStsDoubleSize                  Indicates a warning if roiSize  has a field that is not a multiple
                                  of 2.

BGRToYCbCr420_709HDTV
Converts a BGR image to the YCbCr image with 4:2:0
sampling for ITU-R BT.709 HDTV signal.

Syntax
QplStatus qpliBGRToYCbCr420_709HDTV_8u_AC4P3R(const Qpl8u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         Pointer to the source image ROI.

srcStep                      Distance in bytes between starts of consecutive lines in the source
                             image.
pDst                         An array of pointers to ROI in separate planes of the destination
                             image.

   246
---------------------Page 247---------------------

                                                                        Image Color Conversion  6  

dstStep                      An array of distances in bytes between starts of consecutive lines in
                             the destination image planes.
roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a four-channel gamma-corrected B'G'R' image pSrc to the planar Y'Cb'Cr' image
pDst for digital component video signals complied with the ITU-R BT.709 Recommendation [ITU709] for
high-definition TV (HDTV). The source image pixel values are in the range [16..235]. The conversion is
performed according to the following formulas [Jack01]:
Y' = 0.213*R' + 0.715*G' + 0.072*B'
Cb' = -0.117*R' - 0.394*G' + 0.511*B' + 128
Cr' = 0.511*R' - 0.464*G' - 0.047*B' + 128
The values of Y' of the destination image are in the range [16..235], the values of Cb', Cr' are in the range
[16..240]. They should be saturated at the 1 and 254 levels.
The destination image pDst has the Image Downsampling format (see Table “Planar Image Formats” for
more details).
The values of roiSize.width and roiSize.height  should be multiples of 2. Otherwise, the function
reduces their original values to the nearest multiples of 2, performs the operation, and returns a warning
message.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize.width is less than 2 or
                                  roiSize.height   is less than 2.
qplStsDoubleSize                  Indicates a warning if roiSize has a field that is not a multiple
                                  of 2.

BGRToYCrCb420_709CSC
Converts a BGR image to the YCrCb image with 4:2:0
sampling for ITU-R BT.709 CSC signal.

Syntax
QplStatus qpliBGRToYCrCb420_709CSC_8u_AC4P3R(const Qpl8u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize     );
QplStatus qpliBGRToYCrCb420_709CSC_8u_C3P3R(const Qpl8u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

                                                                                            247
---------------------Page 248---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
pDst                          An array of pointers to ROI in separate planes of the destination
                              image.
dstStep                       An array of distances in bytes between starts of consecutive lines in
                              the destination image planes.
pDstY                         Pointer to the ROI in the luminance plane for a two-plane
                              destination image.
dstYStep                      Distance in bytes between starts of consecutive lines in the
                              luminance plane of a destination image.
pDstCbCr                      Pointer to the ROI in the interleaved chrominance plane for a two-
                              plane destination image.
dstCbCrStep                   Distance in bytes between starts of consecutive lines in the
                              chrominance plane of a destination image.
roiSize                       Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a three- or four-channel gamma-corrected B'G'R' image pSrc to the planar Y'Cr'Cb'
image pDst for digital component video signals complied with the ITU-R BT.709 Recommendation [ITU709]
for computer systems consideration (CSC). The source image pixel values are in the range [0..255]. The
conversion is performed according to the following formulas [Jack01]:
Y' = 0.183*R' + 0.614*G' + 0.062*B' + 16
Cb' = -0.101*R' - 0.338*G' + 0.439*B' + 128
Cr' = 0.439*R' - 0.399*G' - 0.040*B' + 128
The destination image pDst has Image Downsampling format (see Table “Planar Image Formats” for more
details).
The values of roiSize.width and roiSize.height   should be multiples of 2. Otherwise, the function
reduces their original values to the nearest multiples of 2, performs the operation, and returns a warning
message.

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize.width is less than 2 or
                                   roiSize.height   is less than 2.
qplStsDoubleSize                   Indicates a warning if roiSize has a field that is not a multiple
                                   of 2.

YCbCr420ToBGR
Converts a YCbCr image with the 4:2:0 sampling to
the BGR image.

   248
---------------------Page 249---------------------

                                                                        Image Color Conversion  6 

Syntax
QplStatus qpliYCbCr420ToBGR_8u_P3C3R(const Qpl8u* const pSrc[3], int srcStep[3], Qpl8u*
pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCr420ToBGR_8u_P3C4R(const Qpl8u* pSrc[3], int srcStep[3],Qpl8u* pDst,
int dstStep, QpliSize roiSize, Qpl8u aval    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         An array of pointers to ROI in separate planes of the source image.

srcStep                      An array of distances in bytes between starts of consecutive lines in
                             the source image planes.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

aval                         Constant value to create fourth channel.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts the Y'Cb'Cr' image pSrc with the Image Downsampling (see Table “Planar Image
Formats” for more details) to the gamma-corrected three- or four-channel B'G'R' image pDst. The
conversion is performed according to the same formulas as the function YCbCrToRGB does.
Fourth channel is created by setting channel values to the constant value aval.
The values of roiSize.width and roiSize.height  should be multiples of 2. If not the function reduces
their original values to the nearest multiples of 2, performs operation, and returns warning message.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.
qplStsDoubleSize                  Indicates a warning if roiSize has a field that is not a multiple
                                  of 2.

YCbCr420ToBGR_709CSC
Converts a YCbCr image with 4:2:0 sampling to the
BGR image for ITU-R BT.709 CSC signal.

                                                                                           249
---------------------Page 250---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

Syntax
QplStatus qpliYCbCr420ToBGR_709CSC_8u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl8u* pDst, int dstStep, QpliSize roiSize     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         An array of pointers to ROI in separate planes of the source image.

srcStep                      An array of distances in bytes between starts of consecutive lines in
                             the source image planes.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a planar Y'Cb'Cr' image pSrc to the three-channel gamma-corrected B'G'R' image
pDst for digital component video signals complied with the ITU-R BT.709 Recommendation [ITU709] for
computer systems consideration (CSC). The conversion is performed according to the following formulas 
[Jack01]:
R' = 1.164*(Y' - 16) + 1.793*(Cr' - 128)
G' = 1.164*(Y' - 16) - 0.534*(Cr' - 128) - 0.213*(Cb' - 128)
B' = 1.164*(Y' - 16) + 2.115*(Cb' - 128)
The output R'G'B' values are saturated to the range [0..255]. The source image pDst has the Image
Downsampling format (see Table “Planar Image Formats” for more details).
The values of roiSize.width and roiSize.height  should be multiples of 2. Otherwise, the function
reduces their original values to the nearest multiples of 2, performs the operation, and returns a warning
message.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.
qplStsDoubleSize                  Indicates a warning if roiSize  has a field that is not a multiple
                                  of 2.

   250
---------------------Page 251---------------------

                                                                        Image Color Conversion  6  

YCbCr420ToBGR_709HDTV
Converts a YCbCr image with 4:2:0 sampling to the
BGR image for ITU-R BT.709 HDTV signal.

Syntax
QplStatus qpliYCbCr420ToBGR_709HDTV_8u_P3C4R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl8u* pDst, int dstStep, QpliSize roiSize, Qpl8u aval       );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h , qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         An array of pointers to ROI in separate planes of the source image.

srcStep                      An array of distances in bytes between starts of consecutive lines in
                             the source image planes.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

aval                         Constant value to create fourth channel.

Description
This function operates with ROI (see Regions of Interest in Intel QPL).
This function converts a planar Y'Cb'Cr' image pSrc to the four-channel gamma-corrected B'G'R' image
pDst for digital component video signals complied with the ITU-R BT.709 Recommendation [ITU709] for
high-definition TV (HDTV). The values of Y' are in the range [16..235], the values of Cb', Cr' are in the
range [16..240]. The conversion is performed according to the following formulas [Jack01]:
R' = Y' + 1.540*(Cr' - 128)
G' = Y' - 0.459*(Cr' - 128) - 0.183*(Cb' - 128)
B' = Y' + 1.816*(Cb' - 128)
The destination image pixel values have a nominal range [16..235]. The resulting R'G'B' values should be
saturated at the 0 and 255 levels.
The source image pDst has the Image Downsampling format (see Table “Planar Image Formats” for more
details).
The values of roiSize.width and roiSize.height  should be multiples of 2. Otherwise the function
reduces their original values to the nearest multiples of 2, performs operation, and returns a warning
message.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.

                                                                                            251
---------------------Page 252---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with a zero or
                                   negative value.
qplStsDoubleSize                   Indicates a warning if roiSize has a field that is not a multiple
                                   of 2.

BGR565ToYCbCr420, BGR555ToYCbCr420
DEPRECATED. Converts a 16-bit per pixel BGR image
to the YCbCr image that has 4:2:0 sampling format.

Syntax
QplStatus qpliBGR565ToYCbCr420_16u8u_C3P3R(const Qpl16u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize     );
QplStatus qpliBGR555ToYCbCr420_16u8u_C3P3R(const Qpl16u* pSrc, int srcStep, Qpl8u*
pDst[3], int dstStep[3], QpliSize roiSize     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
pDst                          An array of pointers to ROI in separate planes of the destination
                              image.
dstStep                       An array of distances in bytes between starts of consecutive lines in
                              the destination image planes.
roiSize                       Size of the source and destination ROI in pixels.

Description
Functions qpliBGR565ToYCbCr420   and qpliBGR555ToYCbCr420   are deprecated. This color format is
obsolete and will be removed in a future release. Use the following link for details: http://software.intel.com/
sites/products/qpl-deprecated-features-feedback/.
Functions qpliBGR565ToYCbCr420   and qpliBGR555ToYCbCr420   operate with ROI (see Regions of Interest
in Intel QPL).
These functions convert a three-channel gamma-corrected B'G'R' image pSrc to the planar Y'Cb'Cr' image
pDst according to the same formulas as the function RGBToYCbCr does. The destination image has the 
Image Downsampling format (see Table “Planar Image Formats” for more details).
The source image pSrc is a packed 16-bit BGR image with reduced bit depth; all 3 channel intensities for a
pixel are packed into two consecutive bytes (16u data type). It can be in one of two possible formats (see 
Figure 16-bit Pixel Formats for more details): BGR565 (5 bits for blue, 6 bits for green, 5 bits for red), and
BGR555 (5 bits for blue, green, red).

   252
---------------------Page 253---------------------

                                                                      Image Color Conversion  6 

roiSize.width  and roiSize.height  should be multiples of 2. If not the function reduces their original
values to the nearest multiples of 2, performs the operation, and returns a warning message.

Return Values

qplStsNoErr                      Indicates no error. Any other value indicates an error or a
                                 warning.
qplStsNullPtrErr                 Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                    Indicates an error condition if roiSize.width is less than 2 or
                                 roiSize.height   is less than 2.
qplStsDoubleSize                 Indicates a warning if roiSize has a field that is not a multiple
                                 of 2.

YCbCr420ToBGR565, YCbCr420ToBGR555, YCbCr420ToBGR444
DEPRECATED. Convert a YCbCr image that has 4:2:0
sampling format to the 16-bit per pixel BGR image.

Syntax
QplStatus qpliYCbCr420ToBGR565_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCr420ToBGR555_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize    );
QplStatus qpliYCbCr420ToBGR444_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         An array of pointers to ROI in separate planes of the source image.

srcStep                      An array of distances in bytes between starts of consecutive lines in
                             the source image planes.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

Description
Functions qpliYCbCr420ToBGR565, qpliYCbCr420ToBGR565, qpliYCbCr420ToBGR565      are deprecated.
This color format is obsolete and will be removed in a future release. Use the following link for details:
http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
Functions qpliYCbCr420ToBGR565, qpliYCbCr420ToBGR565, qpliYCbCr420ToBGR565      operate with ROI
(see Regions of Interest in Intel QPL).

                                                                                          253
---------------------Page 254---------------------

 6    Intel® Query Processing Library Reference Manual, Volume 2: Image and Video Processing

These functions convert the Y'Cb'Cr' image pSrc, packed in the Image Downsampling format (see Table
“Pixel-Order Image Formats” for more details), to the gamma-corrected B'G'R' image pDst according to
the same formulas as the function YCbCrToRGB does.
The destination image pDst is a packed 16-bit BGR image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats): BGR565 (5 bits for blue, 6 bits for green, 5 bits for red), BGR555 (5 bits for
blue, green, red), BGR444 (4 bits for blue, green, red).
Bit reduction is performed by discarding the least significant bits in the image after color conversion.

Return Values

qplStsNoErr                       Indicates no error. Any other value indicates an error or a
                                  warning.
qplStsNullPtrErr                  Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                     Indicates an error condition if roiSize has a field with a zero or
                                  negative value.

YCbCr420ToBGR565Dither, YCbCr420ToBGR555Dither, YCbCr420ToBGR444Dither
DEPRECATED. Convert a YCbCr image that has 4:2:0
sampling format to the 16-bit per pixel BGR image
with dithering.

Syntax
QplStatus qpliYCbCr420ToBGR565Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYCbCr420ToBGR555Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );
QplStatus qpliYCbCr420ToBGR444Dither_8u16u_P3C3R(const Qpl8u* pSrc[3], int srcStep[3],
Qpl16u* pDst, int dstStep, QpliSize roiSize     );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h, qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                         An array of pointers to ROI in separate planes of the source image.

srcStep                      An array of distances in bytes between starts of consecutive lines in
                             the source image planes.
pDst                         Pointer to the destination image ROI.

dstStep                      Distance in bytes between starts of consecutive lines in the
                             destination image.
roiSize                      Size of the source and destination ROI in pixels.

   254
---------------------Page 255---------------------

                                                                         Image Color Conversion  6  

Description
Functions
qpliYCbCr420ToBGR565Dither, qpliYCbCr420ToBGR555Dither, qpliYCbCr420ToBGR444Dither            are
deprecated. This color format is obsolete and will be removed in a future release. Use the following link for
details: http://software.intel.com/sites/products/qpl-deprecated-features-feedback/.
These functions operate with ROI (see Regions of Interest in Intel QPL).
These functions convert the Y'Cb'Cr' image pSrc, packed in Image Downsampling format (see Table “Pixel-
Order Image Formats” for more details), to the gamma-corrected B'G'R' image pDst according to the same
formulas as the function YCbCrToRGB does.
The destination image pDst is a packed 16-bit BGR image with reduced bit depth; all 3 channel intensities
for a pixel are packed into two consecutive bytes (16u data type). It can be in one of three possible formats
(see Figure 16-bit Pixel Formats for more details): BGR565 (5 bits for blue, 6 bits for green, 5 bits for red),
BGR555 (5 bits for blue, green, red), BGR444 (4 bits for blue, green, red). Bit reduction is performed using
the Bayer's threshold dithering algorithm with a 4x4 matrix [Tho91].

Return Values

qplStsNoErr                        Indicates no error. Any other value indicates an error or a
                                   warning.
qplStsNullPtrErr                   Indicates an error condition if pSrc or pDst is NULL.

qplStsSizeErr                      Indicates an error condition if roiSize has a field with a zero or
                                   negative value.

BGRToYCrCb420
Converts a BGR image to the YCrCb image with 4:2:0
sampling format.

Syntax
QplStatus qpliBGRToYCrCb420_8u_C3P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep[3], QpliSize roiSize    );
QplStatus qpliBGRToYCrCb420_8u_AC4P3R(const Qpl8u* pSrc, int srcStep, Qpl8u* pDst[3],
int dstStep[3], QpliSize roiSize    );

Include Files
qplcc.h

Domain Dependencies
Headers: qplcore.h , qplvm.h, qpls.h, qpli.h
Libraries: qplcore.lib, qplvm.lib, qpls.lib, qpli.lib

Parameters

pSrc                          Pointer to the source image ROI.

srcStep                       Distance in bytes between starts of consecutive lines in the source
                              image.
pDst            