1/*M///////////////////////////////////////////////////////////////////////////////////////
2//
3//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4//
5//  By downloading, copying, installing or using the software you agree to this license.
6//  If you do not agree to this license, do not download, install,
7//  copy or use the software.
8//
9//
10//                        Intel License Agreement
11//                For Open Source Computer Vision Library
12//
13// Copyright (C) 2000, Intel Corporation, all rights reserved.
14// Third party copyrights are property of their respective owners.
15//
16// Redistribution and use in source and binary forms, with or without modification,
17// are permitted provided that the following conditions are met:
18//
19//   * Redistribution's of source code must retain the above copyright notice,
20//     this list of conditions and the following disclaimer.
21//
22//   * Redistribution's in binary form must reproduce the above copyright notice,
23//     this list of conditions and the following disclaimer in the documentation
24//     and/or other materials provided with the distribution.
25//
26//   * The name of Intel Corporation may not be used to endorse or promote products
27//     derived from this software without specific prior written permission.
28//
29// This software is provided by the copyright holders and contributors "as is" and
30// any express or implied warranties, including, but not limited to, the implied
31// warranties of merchantability and fitness for a particular purpose are disclaimed.
32// In no event shall the Intel Corporation or contributors be liable for any direct,
33// indirect, incidental, special, exemplary, or consequential damages
34// (including, but not limited to, procurement of substitute goods or services;
35// loss of use, data, or profits; or business interruption) however caused
36// and on any theory of liability, whether in contract, strict liability,
37// or tort (including negligence or otherwise) arising in any way out of
38// the use of this software, even if advised of the possibility of such damage.
39//
40//M*/
41
42#ifndef _CXCORE_IPP_H_
43#define _CXCORE_IPP_H_
44
45/****************************************************************************************\
46*                                      Copy/Set                                          *
47\****************************************************************************************/
48
49/* temporary disable ipp zero and copy functions as they affect subsequent functions' performance */
50IPCVAPI_EX( CvStatus, icvCopy_8u_C1R, "ippiCopy_8u_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/,
51                  ( const uchar* src, int src_step,
52                    uchar* dst, int dst_step, CvSize size ))
53
54IPCVAPI_EX( CvStatus, icvSetByte_8u_C1R, "ippiSet_8u_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/,
55                  ( uchar value, uchar* dst, int dst_step, CvSize size ))
56
57IPCVAPI_EX( CvStatus, icvCvt_32f64f, "ippsConvert_32f64f",
58            CV_PLUGINS1(CV_PLUGIN_IPPS), ( const float* src, double* dst, int len ))
59IPCVAPI_EX( CvStatus, icvCvt_64f32f, "ippsConvert_64f32f",
60            CV_PLUGINS1(CV_PLUGIN_IPPS), ( const double* src, float* dst, int len ))
61
62#define IPCV_COPYSET( flavor, arrtype, scalartype )                                 \
63IPCVAPI_EX( CvStatus, icvCopy##flavor, "ippiCopy" #flavor,                          \
64                                    CV_PLUGINS1(CV_PLUGIN_IPPI),                    \
65                                   ( const arrtype* src, int srcstep,               \
66                                     arrtype* dst, int dststep, CvSize size,        \
67                                     const uchar* mask, int maskstep ))             \
68IPCVAPI_EX( CvStatus, icvSet##flavor, "ippiSet" #flavor,                            \
69                                    0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/,              \
70                                  ( arrtype* dst, int dststep,                      \
71                                    const uchar* mask, int maskstep,                \
72                                    CvSize size, const arrtype* scalar ))
73
74IPCV_COPYSET( _8u_C1MR, uchar, int )
75IPCV_COPYSET( _16s_C1MR, ushort, int )
76IPCV_COPYSET( _8u_C3MR, uchar, int )
77IPCV_COPYSET( _8u_C4MR, int, int )
78IPCV_COPYSET( _16s_C3MR, ushort, int )
79IPCV_COPYSET( _16s_C4MR, int64, int64 )
80IPCV_COPYSET( _32f_C3MR, int, int )
81IPCV_COPYSET( _32f_C4MR, int, int )
82IPCV_COPYSET( _64s_C3MR, int64, int64 )
83IPCV_COPYSET( _64s_C4MR, int64, int64 )
84
85
86/****************************************************************************************\
87*                                       Arithmetics                                      *
88\****************************************************************************************/
89
90#define IPCV_BIN_ARITHM( name )                                     \
91IPCVAPI_EX( CvStatus, icv##name##_8u_C1R,                           \
92    "ippi" #name "_8u_C1RSfs", CV_PLUGINS1(CV_PLUGIN_IPPI),         \
93( const uchar* src1, int srcstep1, const uchar* src2, int srcstep2, \
94  uchar* dst, int dststep, CvSize size, int scalefactor ))          \
95IPCVAPI_EX( CvStatus, icv##name##_16u_C1R,                          \
96    "ippi" #name "_16u_C1RSfs", CV_PLUGINS1(CV_PLUGIN_IPPI),        \
97( const ushort* src1, int srcstep1, const ushort* src2, int srcstep2,\
98  ushort* dst, int dststep, CvSize size, int scalefactor ))         \
99IPCVAPI_EX( CvStatus, icv##name##_16s_C1R,                          \
100    "ippi" #name "_16s_C1RSfs", CV_PLUGINS1(CV_PLUGIN_IPPI),        \
101( const short* src1, int srcstep1, const short* src2, int srcstep2, \
102  short* dst, int dststep, CvSize size, int scalefactor ))          \
103IPCVAPI_EX( CvStatus, icv##name##_32s_C1R,                          \
104    "ippi" #name "_32s_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),           \
105( const int* src1, int srcstep1, const int* src2, int srcstep2,     \
106  int* dst, int dststep, CvSize size ))                             \
107IPCVAPI_EX( CvStatus, icv##name##_32f_C1R,                          \
108    "ippi" #name "_32f_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),           \
109( const float* src1, int srcstep1, const float* src2, int srcstep2, \
110  float* dst, int dststep, CvSize size ))                           \
111IPCVAPI_EX( CvStatus, icv##name##_64f_C1R,                          \
112    "ippi" #name "_64f_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),           \
113( const double* src1, int srcstep1, const double* src2, int srcstep2,\
114  double* dst, int dststep, CvSize size ))
115
116
117IPCV_BIN_ARITHM( Add )
118IPCV_BIN_ARITHM( Sub )
119
120#undef IPCV_BIN_ARITHM
121
122/****************************************************************************************\
123*                                     Logical operations                                 *
124\****************************************************************************************/
125
126#define IPCV_LOGIC( name )                                              \
127IPCVAPI_EX( CvStatus, icv##name##_8u_C1R,                               \
128    "ippi" #name "_8u_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/,           \
129( const uchar* src1, int srcstep1, const uchar* src2, int srcstep2,     \
130  uchar* dst, int dststep, CvSize size ))
131
132IPCV_LOGIC( And )
133IPCV_LOGIC( Or )
134IPCV_LOGIC( Xor )
135
136#undef IPCV_LOGIC
137
138IPCVAPI_EX( CvStatus, icvNot_8u_C1R, "ippiNot_8u_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),
139( const uchar* src, int step1, uchar* dst, int step, CvSize size ))
140
141/****************************************************************************************\
142*                                Image Statistics                                        *
143\****************************************************************************************/
144
145///////////////////////////////////////// Mean //////////////////////////////////////////
146
147#define IPCV_DEF_MEAN_MASK( flavor, srctype )           \
148IPCVAPI_EX( CvStatus, icvMean_##flavor##_C1MR,          \
149"ippiMean_" #flavor "_C1MR", CV_PLUGINS1(CV_PLUGIN_IPPCV), \
150( const srctype* img, int imgstep, const uchar* mask,   \
151  int maskStep, CvSize size, double* mean ))            \
152IPCVAPI_EX( CvStatus, icvMean_##flavor##_C2MR,          \
153"ippiMean_" #flavor "_C2MR", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/, \
154( const srctype* img, int imgstep, const uchar* mask,   \
155  int maskStep, CvSize size, double* mean ))            \
156IPCVAPI_EX( CvStatus, icvMean_##flavor##_C3MR,          \
157"ippiMean_" #flavor "_C3MR", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/, \
158( const srctype* img, int imgstep, const uchar* mask,   \
159  int maskStep, CvSize size, double* mean ))            \
160IPCVAPI_EX( CvStatus, icvMean_##flavor##_C4MR,          \
161"ippiMean_" #flavor "_C4MR", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/, \
162( const srctype* img, int imgstep, const uchar* mask,   \
163  int maskStep, CvSize size, double* mean ))
164
165IPCV_DEF_MEAN_MASK( 8u, uchar )
166IPCV_DEF_MEAN_MASK( 16u, ushort )
167IPCV_DEF_MEAN_MASK( 16s, short )
168IPCV_DEF_MEAN_MASK( 32s, int )
169IPCV_DEF_MEAN_MASK( 32f, float )
170IPCV_DEF_MEAN_MASK( 64f, double )
171
172#undef IPCV_DEF_MEAN_MASK
173
174//////////////////////////////////// Mean_StdDev ////////////////////////////////////////
175
176#undef IPCV_MEAN_SDV_PLUGIN
177#define ICV_MEAN_SDV_PLUGIN 0 /* CV_PLUGINS1(IPPCV) */
178
179#define IPCV_DEF_MEAN_SDV( flavor, srctype )                                \
180IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C1R,                        \
181"ippiMean_StdDev_" #flavor "_C1R", ICV_MEAN_SDV_PLUGIN,                     \
182( const srctype* img, int imgstep, CvSize size, double* mean, double* sdv ))\
183IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C2R,                        \
184"ippiMean_StdDev_" #flavor "_C2R", ICV_MEAN_SDV_PLUGIN,                     \
185( const srctype* img, int imgstep, CvSize size, double* mean, double* sdv ))\
186IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C3R,                        \
187"ippiMean_StdDev_" #flavor "_C3R", ICV_MEAN_SDV_PLUGIN,                     \
188( const srctype* img, int imgstep, CvSize size, double* mean, double* sdv ))\
189IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C4R,                        \
190"ippiMean_StdDev_" #flavor "_C4R", ICV_MEAN_SDV_PLUGIN,                     \
191( const srctype* img, int imgstep, CvSize size, double* mean, double* sdv ))\
192                                                                            \
193IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C1MR,                       \
194"ippiMean_StdDev_" #flavor "_C1MR", ICV_MEAN_SDV_PLUGIN,                    \
195( const srctype* img, int imgstep,                                          \
196  const uchar* mask, int maskStep,                                          \
197  CvSize size, double* mean, double* sdv ))                                 \
198IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C2MR,                       \
199"ippiMean_StdDev_" #flavor "_C2MR", ICV_MEAN_SDV_PLUGIN,                    \
200( const srctype* img, int imgstep,  const uchar* mask, int maskStep,        \
201  CvSize size, double* mean, double* sdv ))                                 \
202IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C3MR,                       \
203"ippiMean_StdDev_" #flavor "_C3MR", ICV_MEAN_SDV_PLUGIN,                    \
204( const srctype* img, int imgstep,                                          \
205  const uchar* mask, int maskStep,                                          \
206  CvSize size, double* mean, double* sdv ))                                 \
207IPCVAPI_EX( CvStatus, icvMean_StdDev_##flavor##_C4MR,                       \
208"ippiMean_StdDev_" #flavor "_C4MR", ICV_MEAN_SDV_PLUGIN,                    \
209( const srctype* img, int imgstep,                                          \
210  const uchar* mask, int maskStep,                                          \
211  CvSize size, double* mean, double* sdv ))
212
213IPCV_DEF_MEAN_SDV( 8u, uchar )
214IPCV_DEF_MEAN_SDV( 16u, ushort )
215IPCV_DEF_MEAN_SDV( 16s, short )
216IPCV_DEF_MEAN_SDV( 32s, int )
217IPCV_DEF_MEAN_SDV( 32f, float )
218IPCV_DEF_MEAN_SDV( 64f, double )
219
220#undef IPCV_DEF_MEAN_SDV
221#undef IPCV_MEAN_SDV_PLUGIN
222
223//////////////////////////////////// MinMaxIndx /////////////////////////////////////////
224
225#define IPCV_DEF_MIN_MAX_LOC( flavor, srctype, extrtype, plugin ) \
226IPCVAPI_EX( CvStatus, icvMinMaxIndx_##flavor##_C1R,             \
227"ippiMinMaxIndx_" #flavor "_C1R", plugin,                       \
228( const srctype* img, int imgstep,                              \
229  CvSize size, extrtype* minVal, extrtype* maxVal,              \
230  CvPoint* minLoc, CvPoint* maxLoc ))                           \
231                                                                \
232IPCVAPI_EX( CvStatus, icvMinMaxIndx_##flavor##_C1MR,            \
233"ippiMinMaxIndx_" #flavor "_C1MR", plugin,                      \
234( const srctype* img, int imgstep,                              \
235  const uchar* mask, int maskStep,                              \
236  CvSize size, extrtype* minVal, extrtype* maxVal,              \
237  CvPoint* minLoc, CvPoint* maxLoc ))
238
239IPCV_DEF_MIN_MAX_LOC( 8u, uchar, float, CV_PLUGINS1(CV_PLUGIN_IPPCV) )
240IPCV_DEF_MIN_MAX_LOC( 16u, ushort, float, 0 )
241IPCV_DEF_MIN_MAX_LOC( 16s, short, float, CV_PLUGINS1(CV_PLUGIN_IPPCV) )
242IPCV_DEF_MIN_MAX_LOC( 32s, int, double, 0 )
243#if !defined WIN64 && (defined WIN32 || defined __i386__)
244IPCV_DEF_MIN_MAX_LOC( 32f, int, float, CV_PLUGINS1(CV_PLUGIN_IPPCV) )
245#else
246IPCV_DEF_MIN_MAX_LOC( 32f, int, float, 0 )
247#endif
248IPCV_DEF_MIN_MAX_LOC( 64f, int64, double, 0 )
249
250#undef IPCV_DEF_MIN_MAX_LOC
251
252////////////////////////////////////////// Sum //////////////////////////////////////////
253
254#define IPCV_DEF_SUM_NOHINT( flavor, srctype, plugin )                      \
255IPCVAPI_EX( CvStatus, icvSum_##flavor##_C1R,                                \
256            "ippiSum_" #flavor "_C1R", plugin,                              \
257            ( const srctype* img, int imgstep, CvSize size, double* sum ))  \
258IPCVAPI_EX( CvStatus, icvSum_##flavor##_C2R,                                \
259           "ippiSum_" #flavor "_C2R", plugin,                               \
260            ( const srctype* img, int imgstep, CvSize size, double* sum ))  \
261IPCVAPI_EX( CvStatus, icvSum_##flavor##_C3R,                                \
262           "ippiSum_" #flavor "_C3R", plugin,                               \
263            ( const srctype* img, int imgstep, CvSize size, double* sum ))  \
264IPCVAPI_EX( CvStatus, icvSum_##flavor##_C4R,                                \
265           "ippiSum_" #flavor "_C4R", plugin,                               \
266            ( const srctype* img, int imgstep, CvSize size, double* sum ))
267
268#define IPCV_DEF_SUM_HINT( flavor, srctype )                                \
269IPCVAPI_EX( CvStatus, icvSum_##flavor##_C1R,                                \
270            "ippiSum_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),         \
271                        ( const srctype* img, int imgstep,                  \
272                          CvSize size, double* sum, CvHintAlgorithm ))      \
273IPCVAPI_EX( CvStatus, icvSum_##flavor##_C2R,                                \
274           "ippiSum_" #flavor "_C2R", CV_PLUGINS1(CV_PLUGIN_IPPI),          \
275                        ( const srctype* img, int imgstep,                  \
276                          CvSize size, double* sum, CvHintAlgorithm ))      \
277IPCVAPI_EX( CvStatus, icvSum_##flavor##_C3R,                                \
278           "ippiSum_" #flavor "_C3R", CV_PLUGINS1(CV_PLUGIN_IPPI),          \
279                        ( const srctype* img, int imgstep,                  \
280                          CvSize size, double* sum, CvHintAlgorithm ))      \
281IPCVAPI_EX( CvStatus, icvSum_##flavor##_C4R,                                \
282           "ippiSum_" #flavor "_C4R", CV_PLUGINS1(CV_PLUGIN_IPPI),          \
283                        ( const srctype* img, int imgstep,                  \
284                          CvSize size, double* sum, CvHintAlgorithm ))
285
286IPCV_DEF_SUM_NOHINT( 8u, uchar, CV_PLUGINS1(CV_PLUGIN_IPPI) )
287IPCV_DEF_SUM_NOHINT( 16s, short, CV_PLUGINS1(CV_PLUGIN_IPPI) )
288IPCV_DEF_SUM_NOHINT( 16u, ushort, 0 )
289IPCV_DEF_SUM_NOHINT( 32s, int, 0 )
290IPCV_DEF_SUM_HINT( 32f, float )
291IPCV_DEF_SUM_NOHINT( 64f, double, 0 )
292
293#undef IPCV_DEF_SUM_NOHINT
294#undef IPCV_DEF_SUM_HINT
295
296////////////////////////////////////////// CountNonZero /////////////////////////////////
297
298#define IPCV_DEF_NON_ZERO( flavor, srctype )                            \
299IPCVAPI_EX( CvStatus, icvCountNonZero_##flavor##_C1R,                   \
300    "ippiCountNonZero_" #flavor "_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/,   \
301    ( const srctype* img, int imgstep, CvSize size, int* nonzero ))
302
303IPCV_DEF_NON_ZERO( 8u, uchar )
304IPCV_DEF_NON_ZERO( 16s, ushort )
305IPCV_DEF_NON_ZERO( 32s, int )
306IPCV_DEF_NON_ZERO( 32f, int )
307IPCV_DEF_NON_ZERO( 64f, int64 )
308
309#undef IPCV_DEF_NON_ZERO
310
311////////////////////////////////////////// Norms /////////////////////////////////
312
313#define IPCV_DEF_NORM_NOHINT_C1( flavor, srctype, plugin )                              \
314IPCVAPI_EX( CvStatus, icvNorm_Inf_##flavor##_C1R,                                       \
315            "ippiNorm_Inf_" #flavor "_C1R", plugin,                                     \
316            ( const srctype* img, int imgstep, CvSize size, double* norm ))             \
317IPCVAPI_EX( CvStatus, icvNorm_L1_##flavor##_C1R,                                        \
318           "ippiNorm_L1_" #flavor "_C1R", plugin,                                       \
319            ( const srctype* img, int imgstep, CvSize size, double* norm ))             \
320IPCVAPI_EX( CvStatus, icvNorm_L2_##flavor##_C1R,                                        \
321           "ippiNorm_L2_" #flavor "_C1R", plugin,                                       \
322            ( const srctype* img, int imgstep, CvSize size, double* norm ))             \
323IPCVAPI_EX( CvStatus, icvNormDiff_Inf_##flavor##_C1R,                                   \
324           "ippiNormDiff_Inf_" #flavor "_C1R", plugin,                                  \
325                                             ( const srctype* img1, int imgstep1,       \
326                                               const srctype* img2, int imgstep2,       \
327                                               CvSize size, double* norm ))             \
328IPCVAPI_EX( CvStatus, icvNormDiff_L1_##flavor##_C1R,                                    \
329           "ippiNormDiff_L1_" #flavor "_C1R", plugin,                                   \
330                                             ( const srctype* img1, int imgstep1,       \
331                                               const srctype* img2, int imgstep2,       \
332                                               CvSize size, double* norm ))             \
333IPCVAPI_EX( CvStatus, icvNormDiff_L2_##flavor##_C1R,                                    \
334           "ippiNormDiff_L2_" #flavor "_C1R", plugin,                                   \
335                                             ( const srctype* img1, int imgstep1,       \
336                                               const srctype* img2, int imgstep2,       \
337                                               CvSize size, double* norm ))
338
339#define IPCV_DEF_NORM_HINT_C1( flavor, srctype )                                        \
340IPCVAPI_EX( CvStatus, icvNorm_Inf_##flavor##_C1R,                                       \
341            "ippiNorm_Inf_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),                \
342                                        ( const srctype* img, int imgstep,              \
343                                          CvSize size, double* norm ))                  \
344IPCVAPI_EX( CvStatus, icvNorm_L1_##flavor##_C1R,                                        \
345           "ippiNorm_L1_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),                  \
346                                        ( const srctype* img, int imgstep,              \
347                                          CvSize size, double* norm, CvHintAlgorithm )) \
348IPCVAPI_EX( CvStatus, icvNorm_L2_##flavor##_C1R,                                        \
349           "ippiNorm_L2_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),                  \
350                                        ( const srctype* img, int imgstep,              \
351                                          CvSize size, double* norm, CvHintAlgorithm )) \
352IPCVAPI_EX( CvStatus, icvNormDiff_Inf_##flavor##_C1R,                                   \
353           "ippiNormDiff_Inf_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),             \
354                                        ( const srctype* img1, int imgstep1,            \
355                                          const srctype* img2, int imgstep2,            \
356                                          CvSize size, double* norm ))                  \
357IPCVAPI_EX( CvStatus, icvNormDiff_L1_##flavor##_C1R,                                    \
358           "ippiNormDiff_L1_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),              \
359                                        ( const srctype* img1, int imgstep1,            \
360                                          const srctype* img2, int imgstep2,            \
361                                          CvSize size, double* norm, CvHintAlgorithm )) \
362IPCVAPI_EX( CvStatus, icvNormDiff_L2_##flavor##_C1R,                                    \
363           "ippiNormDiff_L2_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),              \
364                                        ( const srctype* img1, int imgstep1,            \
365                                          const srctype* img2, int imgstep2,            \
366                                          CvSize size, double* norm, CvHintAlgorithm ))
367
368#define IPCV_DEF_NORM_MASK_C1( flavor, srctype, plugin )                                \
369IPCVAPI_EX( CvStatus, icvNorm_Inf_##flavor##_C1MR,                                      \
370           "ippiNorm_Inf_" #flavor "_C1MR", plugin,                                     \
371                                             ( const srctype* img, int imgstep,         \
372                                               const uchar* mask, int maskstep,         \
373                                               CvSize size, double* norm ))             \
374IPCVAPI_EX( CvStatus, icvNorm_L1_##flavor##_C1MR,                                       \
375            "ippiNorm_L1_" #flavor "_C1MR", plugin,                                     \
376                                             ( const srctype* img, int imgstep,         \
377                                                const uchar* mask, int maskstep,        \
378                                                CvSize size, double* norm ))            \
379IPCVAPI_EX( CvStatus, icvNorm_L2_##flavor##_C1MR,                                       \
380           "ippiNorm_L2_" #flavor "_C1MR", plugin,                                      \
381                                             ( const srctype* img, int imgstep,         \
382                                               const uchar* mask, int maskstep,         \
383                                               CvSize size, double* norm ))             \
384IPCVAPI_EX( CvStatus, icvNormDiff_Inf_##flavor##_C1MR,                                  \
385           "ippiNormDiff_Inf_" #flavor "_C1MR", plugin,                                 \
386                                             ( const srctype* img1, int imgstep1,       \
387                                               const srctype* img2, int imgstep2,       \
388                                               const uchar* mask, int maskstep,         \
389                                               CvSize size, double* norm ))             \
390IPCVAPI_EX( CvStatus, icvNormDiff_L1_##flavor##_C1MR,                                   \
391           "ippiNormDiff_L1_" #flavor "_C1MR", plugin,                                  \
392                                             ( const srctype* img1, int imgstep1,       \
393                                               const srctype* img2, int imgstep2,       \
394                                               const uchar* mask, int maskstep,         \
395                                               CvSize size, double* norm ))             \
396IPCVAPI_EX( CvStatus, icvNormDiff_L2_##flavor##_C1MR,                                   \
397           "ippiNormDiff_L2_" #flavor "_C1MR", plugin,                                  \
398                                             ( const srctype* img1, int imgstep1,       \
399                                               const srctype* img2, int imgstep2,       \
400                                               const uchar* mask, int maskstep,         \
401                                               CvSize size, double* norm ))
402
403IPCV_DEF_NORM_NOHINT_C1( 8u, uchar, CV_PLUGINS1(CV_PLUGIN_IPPI) )
404IPCV_DEF_NORM_MASK_C1( 8u, uchar, CV_PLUGINS1(CV_PLUGIN_IPPCV) )
405
406IPCV_DEF_NORM_NOHINT_C1( 16u, ushort, 0 )
407IPCV_DEF_NORM_MASK_C1( 16u, ushort, 0 )
408
409IPCV_DEF_NORM_NOHINT_C1( 16s, short, CV_PLUGINS1(CV_PLUGIN_IPPI) )
410IPCV_DEF_NORM_MASK_C1( 16s, short, CV_PLUGINS1(CV_PLUGIN_IPPCV) )
411
412IPCV_DEF_NORM_NOHINT_C1( 32s, int, 0 )
413IPCV_DEF_NORM_MASK_C1( 32s, int, 0 )
414
415IPCV_DEF_NORM_HINT_C1( 32f, float )
416IPCV_DEF_NORM_MASK_C1( 32f, float, CV_PLUGINS1(CV_PLUGIN_IPPCV) )
417
418IPCV_DEF_NORM_NOHINT_C1( 64f, double, 0 )
419IPCV_DEF_NORM_MASK_C1( 64f, double, 0 )
420
421#undef IPCV_DEF_NORM_HONINT_C1
422#undef IPCV_DEF_NORM_HINT_C1
423#undef IPCV_DEF_NORM_MASK_C1
424
425
426////////////////////////////////////// AbsDiff ///////////////////////////////////////////
427
428#define IPCV_ABS_DIFF( flavor, arrtype )                    \
429IPCVAPI_EX( CvStatus, icvAbsDiff_##flavor##_C1R,            \
430"ippiAbsDiff_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPCV),\
431( const arrtype* src1, int srcstep1,                        \
432  const arrtype* src2, int srcstep2,                        \
433  arrtype* dst, int dststep, CvSize size ))
434
435IPCV_ABS_DIFF( 8u, uchar )
436IPCV_ABS_DIFF( 16u, ushort )
437IPCV_ABS_DIFF( 16s, short )
438IPCV_ABS_DIFF( 32s, int )
439IPCV_ABS_DIFF( 32f, float )
440IPCV_ABS_DIFF( 64f, double )
441
442#undef IPCV_ABS_DIFF
443
444////////////////////////////// Comparisons //////////////////////////////////////////
445
446#define IPCV_CMP( arrtype, flavor )                                                 \
447IPCVAPI_EX( CvStatus, icvCompare_##flavor##_C1R,                                    \
448            "ippiCompare_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),             \
449            ( const arrtype* src1, int srcstep1, const arrtype* src2, int srcstep2, \
450              arrtype* dst, int dststep, CvSize size, int cmp_op ))                 \
451IPCVAPI_EX( CvStatus, icvCompareC_##flavor##_C1R,                                   \
452            "ippiCompareC_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),            \
453            ( const arrtype* src1, int srcstep1, arrtype scalar,                    \
454              arrtype* dst, int dststep, CvSize size, int cmp_op ))                 \
455IPCVAPI_EX( CvStatus, icvThreshold_GT_##flavor##_C1R,                               \
456            "ippiThreshold_GT_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),        \
457            ( const arrtype* pSrc, int srcstep, arrtype* pDst, int dststep,         \
458              CvSize size, arrtype threshold ))                                     \
459IPCVAPI_EX( CvStatus, icvThreshold_LT_##flavor##_C1R,                               \
460            "ippiThreshold_LT_" #flavor "_C1R", CV_PLUGINS1(CV_PLUGIN_IPPI),        \
461            ( const arrtype* pSrc, int srcstep, arrtype* pDst, int dststep,         \
462              CvSize size, arrtype threshold ))
463IPCV_CMP( uchar, 8u )
464IPCV_CMP( short, 16s )
465IPCV_CMP( float, 32f )
466#undef IPCV_CMP
467
468/****************************************************************************************\
469*                                       Utilities                                        *
470\****************************************************************************************/
471
472////////////////////////////// Copy Pixel <-> Plane /////////////////////////////////
473
474#define IPCV_PIX_PLANE( flavor, arrtype )                                           \
475IPCVAPI_EX( CvStatus, icvCopy_##flavor##_C2P2R,                                     \
476    "ippiCopy_" #flavor "_C2P2R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/,                 \
477    ( const arrtype* src, int srcstep, arrtype** dst, int dststep, CvSize size ))   \
478IPCVAPI_EX( CvStatus, icvCopy_##flavor##_C3P3R,                                     \
479    "ippiCopy_" #flavor "_C3P3R", CV_PLUGINS1(CV_PLUGIN_IPPI),                      \
480    ( const arrtype* src, int srcstep, arrtype** dst, int dststep, CvSize size ))   \
481IPCVAPI_EX( CvStatus, icvCopy_##flavor##_C4P4R,                                     \
482    "ippiCopy_" #flavor "_C4P4R", CV_PLUGINS1(CV_PLUGIN_IPPI),                      \
483    ( const arrtype* src, int srcstep, arrtype** dst, int dststep, CvSize size ))   \
484IPCVAPI_EX( CvStatus, icvCopy_##flavor##_CnC1CR,                                    \
485    "ippiCopy_" #flavor "_CnC1CR", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/,               \
486    ( const arrtype* src, int srcstep, arrtype* dst, int dststep,                   \
487      CvSize size, int cn, int coi ))                                               \
488IPCVAPI_EX( CvStatus, icvCopy_##flavor##_C1CnCR,                                    \
489    "ippiCopy_" #flavor "_CnC1CR", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/,               \
490    ( const arrtype* src, int srcstep, arrtype* dst, int dststep,                   \
491      CvSize size, int cn, int coi ))                                               \
492IPCVAPI_EX( CvStatus, icvCopy_##flavor##_P2C2R,                                     \
493    "ippiCopy_" #flavor "_P2C2R", 0/*CV_PLUGINS1(CV_PLUGIN_IPPI)*/,                 \
494    ( const arrtype** src, int srcstep, arrtype* dst, int dststep, CvSize size ))   \
495IPCVAPI_EX( CvStatus, icvCopy_##flavor##_P3C3R,                                     \
496    "ippiCopy_" #flavor "_P3C3R", CV_PLUGINS1(CV_PLUGIN_IPPI),                      \
497    ( const arrtype** src, int srcstep, arrtype* dst, int dststep, CvSize size ))   \
498IPCVAPI_EX( CvStatus, icvCopy_##flavor##_P4C4R,                                     \
499    "ippiCopy_" #flavor "_P4C4R", CV_PLUGINS1(CV_PLUGIN_IPPI),                      \
500    ( const arrtype** src, int srcstep, arrtype* dst, int dststep, CvSize size ))
501
502IPCV_PIX_PLANE( 8u, uchar )
503IPCV_PIX_PLANE( 16s, ushort )
504IPCV_PIX_PLANE( 32f, int )
505IPCV_PIX_PLANE( 64f, int64 )
506
507#undef IPCV_PIX_PLANE
508
509/****************************************************************************************/
510/*                            Math routines and RNGs                                    */
511/****************************************************************************************/
512
513IPCVAPI_EX( CvStatus, icvInvSqrt_32f, "ippsInvSqrt_32f_A21",
514           CV_PLUGINS1(CV_PLUGIN_IPPVM),
515           ( const float* src, float* dst, int len ))
516IPCVAPI_EX( CvStatus, icvSqrt_32f, "ippsSqrt_32f_A21, ippsSqrt_32f",
517           CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
518           ( const float* src, float* dst, int len ))
519IPCVAPI_EX( CvStatus, icvInvSqrt_64f, "ippsInvSqrt_64f_A50",
520           CV_PLUGINS1(CV_PLUGIN_IPPVM),
521           ( const double* src, double* dst, int len ))
522IPCVAPI_EX( CvStatus, icvSqrt_64f, "ippsSqrt_64f_A50, ippsSqrt_64f",
523           CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
524           ( const double* src, double* dst, int len ))
525
526IPCVAPI_EX( CvStatus, icvLog_32f, "ippsLn_32f_A21, ippsLn_32f",
527           CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
528           ( const float *x, float *y, int n ) )
529IPCVAPI_EX( CvStatus, icvLog_64f, "ippsLn_64f_A50, ippsLn_64f",
530           CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
531           ( const double *x, double *y, int n ) )
532IPCVAPI_EX( CvStatus, icvExp_32f, "ippsExp_32f_A21, ippsExp_32f",
533           CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
534           ( const float *x, float *y, int n ) )
535IPCVAPI_EX( CvStatus, icvExp_64f, "ippsExp_64f_A50, ippsExp_64f",
536           CV_PLUGINS2(CV_PLUGIN_IPPVM,CV_PLUGIN_IPPS),
537           ( const double *x, double *y, int n ) )
538IPCVAPI_EX( CvStatus, icvFastArctan_32f, "ippibFastArctan_32f",
539           CV_PLUGINS1(CV_PLUGIN_IPPCV),
540           ( const float* y, const float* x, float* angle, int len ))
541
542/****************************************************************************************/
543/*                                  Error handling functions                            */
544/****************************************************************************************/
545
546IPCVAPI_EX( CvStatus, icvCheckArray_32f_C1R,
547           "ippiCheckArray_32f_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/,
548           ( const float* src, int srcstep,
549             CvSize size, int flags,
550             double min_val, double max_val ))
551
552IPCVAPI_EX( CvStatus, icvCheckArray_64f_C1R,
553           "ippiCheckArray_64f_C1R", 0/*CV_PLUGINS1(CV_PLUGIN_OPTCV)*/,
554           ( const double* src, int srcstep,
555             CvSize size, int flags,
556             double min_val, double max_val ))
557
558/****************************************************************************************/
559/*                    Affine transformations of matrix/image elements                   */
560/****************************************************************************************/
561
562#define IPCV_TRANSFORM( suffix, ipp_suffix, cn )                \
563IPCVAPI_EX( CvStatus, icvColorTwist##suffix##_C##cn##R,         \
564        "ippiColorTwist" #ipp_suffix "_C" #cn                   \
565        "R,ippiColorTwist" #ipp_suffix "_C" #cn "R",            \
566        CV_PLUGINS2(CV_PLUGIN_IPPI, CV_PLUGIN_IPPCC),           \
567        ( const void* src, int srcstep, void* dst, int dststep, \
568          CvSize roisize, const float* twist_matrix ))
569
570IPCV_TRANSFORM( _8u, 32f_8u, 3 )
571IPCV_TRANSFORM( _16u, 32f_16u, 3 )
572IPCV_TRANSFORM( _16s, 32f_16s, 3 )
573IPCV_TRANSFORM( _32f, _32f, 3 )
574IPCV_TRANSFORM( _32f, _32f, 4 )
575
576#undef IPCV_TRANSFORM
577
578#define IPCV_TRANSFORM_N1( suffix )                             \
579IPCVAPI_EX( CvStatus, icvColorToGray##suffix,                   \
580        "ippiColorToGray" #suffix ",ippiColorToGray" #suffix,   \
581        CV_PLUGINS2(CV_PLUGIN_IPPI,CV_PLUGIN_IPPCC),            \
582        ( const void* src, int srcstep, void* dst, int dststep, \
583          CvSize roisize, const float* coeffs ))
584
585IPCV_TRANSFORM_N1( _8u_C3C1R )
586IPCV_TRANSFORM_N1( _16u_C3C1R )
587IPCV_TRANSFORM_N1( _16s_C3C1R )
588IPCV_TRANSFORM_N1( _32f_C3C1R )
589IPCV_TRANSFORM_N1( _8u_AC4C1R )
590IPCV_TRANSFORM_N1( _16u_AC4C1R )
591IPCV_TRANSFORM_N1( _16s_AC4C1R )
592IPCV_TRANSFORM_N1( _32f_AC4C1R )
593
594#undef IPCV_TRANSFORM_N1
595
596/****************************************************************************************/
597/*                  Matrix routines from BLAS/LAPACK compatible libraries               */
598/****************************************************************************************/
599
600IPCVAPI_C_EX( void, icvBLAS_GEMM_32f, "sgemm, mkl_sgemm", CV_PLUGINS2(CV_PLUGIN_MKL,CV_PLUGIN_MKL),
601                        (const char *transa, const char *transb, int *n, int *m, int *k,
602                         const void *alpha, const void *a, int *lda, const void *b, int *ldb,
603                         const void *beta, void *c, int *ldc ))
604
605IPCVAPI_C_EX( void, icvBLAS_GEMM_64f, "dgemm, mkl_dgemm", CV_PLUGINS2(CV_PLUGIN_MKL,CV_PLUGIN_MKL),
606                        (const char *transa, const char *transb, int *n, int *m, int *k,
607                         const void *alpha, const void *a, int *lda, const void *b, int *ldb,
608                         const void *beta, void *c, int *ldc ))
609
610IPCVAPI_C_EX( void, icvBLAS_GEMM_32fc, "cgemm, mkl_cgemm", CV_PLUGINS2(CV_PLUGIN_MKL,CV_PLUGIN_MKL),
611                        (const char *transa, const char *transb, int *n, int *m, int *k,
612                         const void *alpha, const void *a, int *lda, const void *b, int *ldb,
613                         const void *beta, void *c, int *ldc ))
614
615IPCVAPI_C_EX( void, icvBLAS_GEMM_64fc, "zgemm, mkl_zgemm", CV_PLUGINS2(CV_PLUGIN_MKL,CV_PLUGIN_MKL),
616                        (const char *transa, const char *transb, int *n, int *m, int *k,
617                         const void *alpha, const void *a, int *lda, const void *b, int *ldb,
618                         const void *beta, void *c, int *ldc ))
619
620
621#define IPCV_DFT( init_flavor, fwd_flavor, inv_flavor )                                 \
622IPCVAPI_EX( CvStatus, icvDFTInitAlloc_##init_flavor, "ippsDFTInitAlloc_" #init_flavor,  \
623            CV_PLUGINS1(CV_PLUGIN_IPPS), ( void**, int, int, CvHintAlgorithm ))         \
624                                                                                        \
625IPCVAPI_EX( CvStatus, icvDFTFree_##init_flavor, "ippsDFTFree_" #init_flavor,            \
626            CV_PLUGINS1(CV_PLUGIN_IPPS), ( void* ))                                     \
627                                                                                        \
628IPCVAPI_EX( CvStatus, icvDFTGetBufSize_##init_flavor, "ippsDFTGetBufSize_" #init_flavor,\
629            CV_PLUGINS1(CV_PLUGIN_IPPS), ( const void* spec, int* buf_size ))           \
630                                                                                        \
631IPCVAPI_EX( CvStatus, icvDFTFwd_##fwd_flavor, "ippsDFTFwd_" #fwd_flavor,                \
632            CV_PLUGINS1(CV_PLUGIN_IPPS), ( const void* src, void* dst,                  \
633            const void* spec, void* buffer ))                                           \
634                                                                                        \
635IPCVAPI_EX( CvStatus, icvDFTInv_##inv_flavor, "ippsDFTInv_" #inv_flavor,                \
636            CV_PLUGINS1(CV_PLUGIN_IPPS), ( const void* src, void* dst,                  \
637            const void* spec, void* buffer ))
638
639IPCV_DFT( C_32fc, CToC_32fc, CToC_32fc )
640IPCV_DFT( R_32f, RToPack_32f, PackToR_32f )
641IPCV_DFT( C_64fc, CToC_64fc, CToC_64fc )
642IPCV_DFT( R_64f, RToPack_64f, PackToR_64f )
643#undef IPCV_DFT
644
645#endif /*_CXCORE_IPP_H_*/
646
647