libidx
|
00001 /*************************************************************************** 00002 * Copyright (C) 2008 by Pierre Sermanet and Yann LeCun * 00003 * pierre.sermanet@gmail.com, yann@cs.nyu.edu * 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * * Redistributions of source code must retain the above copyright 00008 * notice, this list of conditions and the following disclaimer. 00009 * * Redistributions in binary form must reproduce the above copyright 00010 * notice, this list of conditions and the following disclaimer in the 00011 * documentation and/or other materials provided with the distribution. 00012 * * Redistribution under a license not approved by the Open Source 00013 * Initiative (http://www.opensource.org) must display the 00014 * following acknowledgement in all advertising material: 00015 * This product includes software developed at the Courant 00016 * Institute of Mathematical Sciences (http://cims.nyu.edu). 00017 * * The names of the authors may not be used to endorse or promote products 00018 * derived from this software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 00021 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00022 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00023 * DISCLAIMED. IN NO EVENT SHALL ThE AUTHORS BE LIABLE FOR ANY 00024 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00025 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00026 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00027 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 ***************************************************************************/ 00031 00032 00033 #ifndef IPPOPS_H_ 00034 #define IPPOPS_H_ 00035 00036 #ifdef __IPP__ 00037 #define DO_IF_IPP(with_ipp, without_ipp) with_ipp 00038 #else 00039 #define DO_IF_IPP(with_ipp, without_ipp) without_ipp 00040 #endif 00041 00042 00043 #ifdef __IPP__ 00044 #include <ipp.h> 00045 /* #if IPP_VERSION_MAJOR == 5 */ 00046 /* #pragma message "IPP version is 5.x, ipp_dot is disabled" */ 00047 /* #else */ 00048 /* //TODO: does not compile when IPP_DOT is defined */ 00049 /* // #define __IPP_DOT__ */ 00050 /* #endif */ 00051 //TODO : check version (< 5) 00052 #endif 00053 00054 #include "idx.h" 00055 00056 namespace ebl { 00057 00058 // idx to IPP wrapper functions ////////////////////////////////////////////// 00059 00063 inline void ipp_init(int ncores = -1); 00064 00065 #ifdef __IPP__ 00066 00067 // ipp_convolution /////////////////////////////////////////////////////////// 00068 00073 template <typename T> 00074 inline void ipp_convolution(const idx<T> &in, const idx<T> &ker, idx<T> &out); 00079 template <> 00080 inline void ipp_convolution(const idx<ubyte> &in, const idx<ubyte> &ker, 00081 idx<ubyte> &out); 00086 template <> 00087 inline void ipp_convolution(const idx<int16> &in, const idx<int16> &ker, 00088 idx<int16> &out); 00093 template <> 00094 inline void ipp_convolution(const idx<float32> &in, const idx<float32> &ker, 00095 idx<float32> &out); 00096 00097 // ipp_copy ////////////////////////////////////////////////////////////////// 00098 00100 template <typename T> inline void ipp_copy(const idx<T> &in, idx<T> &out); 00103 template <> inline void ipp_copy(const idx<ubyte> &in, idx<ubyte> &out); 00106 template <> inline void ipp_copy(const idx<uint16> &in, idx<uint16> &out); 00109 template <> inline void ipp_copy(const idx<int16> &in, idx<int16> &out); 00112 template <> inline void ipp_copy(const idx<int32> &in, idx<int32> &out); 00115 template <> inline void ipp_copy(const idx<float32> &in, idx<float32> &out); 00116 00117 // ipp_clear ///////////////////////////////////////////////////////////////// 00118 00120 template <typename T> inline void ipp_clear(idx<T> &inp); 00123 template <> inline void ipp_clear(idx<ubyte> &inp); 00126 template <> inline void ipp_clear(idx<uint16> &inp); 00129 template <> inline void ipp_clear(idx<int16> &inp); 00132 template <> inline void ipp_clear(idx<int32> &inp); 00135 template <> inline void ipp_clear(idx<float32> &inp); 00136 00137 // ipp_fill ////////////////////////////////////////////////////////////////// 00138 00140 template <typename T> inline void ipp_fill(idx<T> &inp, T v); 00143 template <> inline void ipp_fill(idx<ubyte> &inp, ubyte v); 00146 template <> inline void ipp_fill(idx<uint16> &inp, uint16 v); 00149 template <> inline void ipp_fill(idx<int16> &inp, int16 v); 00152 template <> inline void ipp_fill(idx<int32> &inp, int32 v); 00155 template <> inline void ipp_fill(idx<float32> &inp, float32 v); 00156 00157 // ipp_add /////////////////////////////////////////////////////////////////// 00158 00163 template <typename T> inline void ipp_add(const idx<T> &in1, idx<T> &in2); 00168 template <> inline void ipp_add(const idx<float32> &in1, idx<float32> &in2); 00174 template <> inline void ipp_add(const idx<ubyte> &in1, idx<ubyte> &in2); 00180 template <> inline void ipp_add(const idx<uint16> &in1, idx<uint16> &in2); 00186 template <> inline void ipp_add(const idx<int16> &in1, idx<int16> &in2); 00187 00192 template <typename T> inline void ipp_add(const idx<T> &in1, 00193 const idx<T> &in2, idx<T> &out); 00198 template <> inline void ipp_add(const idx<float32> &in1, 00199 const idx<float32> &in2, idx<float32> &out); 00205 template <> inline void ipp_add(const idx<ubyte> &in1, const idx<ubyte> &in2, 00206 idx<ubyte> &out); 00212 template <> inline void ipp_add(const idx<uint16> &in1, 00213 const idx<uint16> &in2, idx<uint16> &out); 00219 template <> inline void ipp_add(const idx<int16> &in1, const idx<int16> &in2, 00220 idx<int16> &out); 00221 00222 // ipp_addc ////////////////////////////////////////////////////////////////// 00223 00226 template <typename T> inline void ipp_addc(idx<T> &in, T c); 00229 template <> inline void ipp_addc(idx<float32> &in, float32 c); 00233 template <> inline void ipp_addc(idx<ubyte> &in, ubyte c); 00237 template <> inline void ipp_addc(idx<uint16> &in, uint16 c); 00241 template <> inline void ipp_addc(idx<int16> &in, int16 c); 00242 00245 template <typename T> inline void ipp_addc(const idx<T> &in, T c, 00246 idx<T> &out); 00249 template <> inline void ipp_addc(const idx<float32> &in, float32 c, 00250 idx<float32> &out); 00254 template <> inline void ipp_addc(const idx<ubyte> &in, ubyte c, 00255 idx<ubyte> &out); 00259 template <> inline void ipp_addc(const idx<uint16> &in, uint16 c, 00260 idx<uint16> &out); 00264 template <> inline void ipp_addc(const idx<int16> &in, int16 c, 00265 idx<int16> &out); 00266 00267 // ipp_sub /////////////////////////////////////////////////////////////////// 00268 00271 template <typename T> 00272 inline void ipp_sub(idx<T> &in1, const idx<T> &in2); 00273 00276 template <> 00277 inline void ipp_sub(idx<float32> &in1, const idx<float32> &in2); 00278 00282 template <> 00283 inline void ipp_sub(idx<ubyte> &in1, const idx<ubyte> &in2); 00284 00288 template <> 00289 inline void ipp_sub(idx<uint16> &in1, const idx<uint16> &in2); 00290 00294 template <> 00295 inline void ipp_sub(idx<int16> &in1, const idx<int16> &in2); 00296 00297 00299 template <typename T> 00300 inline void ipp_sub(const idx<T> &in1, const idx<T> &in2, idx<T> &out); 00301 00304 template <> 00305 inline void ipp_sub(const idx<float32> &in1, const idx<float32> &in2, 00306 idx<float32> &out); 00307 00311 template <> 00312 inline void ipp_sub(const idx<ubyte> &in1, const idx<ubyte> &in2, 00313 idx<ubyte> &out); 00314 00318 template <> 00319 inline void ipp_sub(const idx<uint16> &in1, const idx<uint16> &in2, 00320 idx<uint16> &out); 00321 00325 template <> 00326 inline void ipp_sub(const idx<int16> &in1, const idx<int16> &in2, 00327 idx<int16> &out); 00328 00330 // ipp_subc 00331 00333 template <typename T> 00334 inline void ipp_subc(idx<T> &inp, T c); 00335 00339 template <> 00340 inline void ipp_subc(idx<ubyte> &inp, ubyte c); 00341 00345 template <> 00346 inline void ipp_subc(idx<uint16> &inp, uint16 c); 00347 00351 template <> 00352 inline void ipp_subc(idx<int16> &inp, int16 c); 00353 00356 template <> 00357 inline void ipp_subc(idx<float32> &inp, float32 c); 00358 00359 00362 template <typename T> 00363 inline void ipp_subc(const idx<T> &inp, T c, idx<T> &out); 00364 00369 template <> 00370 inline void ipp_subc(const idx<ubyte> &inp, ubyte c, idx<ubyte> &out); 00371 00376 template <> 00377 inline void ipp_subc(const idx<uint16> &inp, uint16 c, idx<uint16> &out); 00378 00383 template <> 00384 inline void ipp_subc(const idx<int16> &inp, int16 c, idx<int16> &out); 00385 00390 template <> 00391 inline void ipp_subc(const idx<float32> &inp, float32 c, idx<float32> &out); 00392 00394 // ipp_minus 00395 00397 template <typename T> 00398 inline void ipp_minus(const idx<T> &in, idx<T> &out); 00399 00401 // ipp_mul 00402 00404 template <typename T> 00405 inline void ipp_mul(const idx<T> &in1, idx<T> &in2); 00408 template <> 00409 inline void ipp_mul(const idx<float32> &in1, idx<float32> &in2); 00413 template <> 00414 inline void ipp_mul(const idx<ubyte> &in1, idx<ubyte> &in2); 00418 template <> 00419 inline void ipp_mul(const idx<uint16> &in1, idx<uint16> &in2); 00423 template <> 00424 inline void ipp_mul(const idx<int16> &in1, idx<int16> &in2); 00425 00427 template <typename T> 00428 inline void ipp_mul(const idx<T> &in1, const idx<T> &in2, idx<T> &out); 00429 00432 template <> 00433 inline void ipp_mul(const idx<float32> &in1, const idx<float32> &in2, 00434 idx<float32> &out); 00435 00439 template <> 00440 inline void ipp_mul(const idx<ubyte> &in1, const idx<ubyte> &in2, 00441 idx<ubyte> &out); 00442 00446 template <> 00447 inline void ipp_mul(const idx<uint16> &in1, const idx<uint16> &in2, 00448 idx<uint16> &out); 00449 00453 template <> 00454 inline void ipp_mul(const idx<int16> &in1, const idx<int16> &in2, 00455 idx<int16> &out); 00456 00457 // ipp_m2dotm1 /////////////////////////////////////////////////////////////// 00458 00460 template <typename T> 00461 inline void ipp_m2dotm1(const idx<T> &in1, const idx<T> &in2, idx<T> &y); 00463 template <> 00464 inline void ipp_m2dotm1(const idx<float32> &in1, const idx<float32> &in2, 00465 idx<float32> &y); 00467 template <> 00468 inline void ipp_m2dotm1(const idx<float64> &in1, const idx<float64> &in2, 00469 idx<float64> &y); 00470 00471 // ipp_m2dotm2 /////////////////////////////////////////////////////////////// 00472 00474 template <typename T> 00475 inline void ipp_m2dotm2(const idx<T> &in1, const idx<T> &in2, idx<T> &y); 00477 template <> 00478 inline void ipp_m2dotm2(const idx<float32> &in1, const idx<float32> &in2, 00479 idx<float32> &y); 00481 template <> 00482 inline void ipp_m2dotm2(const idx<float64> &in1, const idx<float64> &in2, 00483 idx<float64> &y); 00484 00486 // ipp_dotc 00487 00490 template <typename T> 00491 inline void ipp_dotc(idx<T> &inp, T c); 00492 00495 template <> 00496 inline void ipp_dotc(idx<float32> &inp, float32 c); 00497 00500 template <> 00501 inline void ipp_dotc(idx<ubyte> &inp, ubyte c); 00502 00505 template <> 00506 inline void ipp_dotc(idx<uint16> &inp, uint16 c); 00507 00510 template <> 00511 inline void ipp_dotc(idx<int16> &inp, int16 c); 00512 00513 00516 template <typename T> 00517 inline void ipp_dotc(const idx<T> &inp, T c, idx<T> &out); 00518 00521 template <> 00522 inline void ipp_dotc(const idx<ubyte> &inp, ubyte c, idx<ubyte> &out); 00523 00526 template <> 00527 inline void ipp_dotc(const idx<uint16> &inp, uint16 c, idx<uint16> &out); 00528 00531 template <> 00532 inline void ipp_dotc(const idx<int16> &inp, int16 c, idx<int16> &out); 00533 00536 template <> 00537 inline void ipp_dotc(const idx<float32> &inp, float32 c, idx<float32> &out); 00538 00540 // ipp_div 00541 00547 template <typename T> 00548 inline void ipp_div(idx<T> &in1, const idx<T> &in2); 00549 00552 template <> 00553 inline void ipp_div(idx<float32> &in1, const idx<float32> &in2); 00554 00558 template <> 00559 inline void ipp_div(idx<ubyte> &in1, const idx<ubyte> &in2); 00560 00564 template <> 00565 inline void ipp_div(idx<uint16> &in1, const idx<uint16> &in2); 00566 00570 template <> 00571 inline void ipp_div(idx<int16> &in1, const idx<int16> &in2); 00572 00573 00578 template <typename T> 00579 inline void ipp_div(const idx<T> &in1, const idx<T> &in2, idx<T> &out); 00580 00583 template <> 00584 inline void ipp_div(const idx<float32> &in1, const idx<float32> &in2, 00585 idx<float32> &out); 00586 00590 template <> 00591 inline void ipp_div(const idx<ubyte> &in1, const idx<ubyte> &in2, 00592 idx<ubyte> &out); 00593 00597 template <> 00598 inline void ipp_div(const idx<uint16> &in1, const idx<uint16> &in2, 00599 idx<uint16> &out); 00600 00604 template <> 00605 inline void ipp_div(const idx<int16> &in1, const idx<int16> &in2, 00606 idx<int16> &out); 00607 00609 // ipp_inv 00610 00612 inline void ipp_inv(const idx<float32> &in, idx<float32> &out); 00613 00615 // ipp_abs 00616 00618 template <typename T> 00619 inline void ipp_abs(idx<T> &inp); 00620 00623 template <> 00624 inline void ipp_abs(idx<int16> &inp); 00625 00628 template <> 00629 inline void ipp_abs(idx<float32> &inp); 00630 00631 00633 template <typename T> 00634 inline void ipp_abs(const idx<T> &inp, idx<T> &out); 00635 00638 template <> 00639 inline void ipp_abs(const idx<int16> &inp, idx<int16> &out); 00640 00643 template <> 00644 inline void ipp_abs(const idx<float32> &inp, idx<float32> &out); 00645 00646 00648 // ipp_sqrt 00649 00652 template <typename T> 00653 inline void ipp_sqrt(idx<T> &inp); 00654 00658 template <> 00659 inline void ipp_sqrt(idx<ubyte> &inp); 00660 00664 template <> 00665 inline void ipp_sqrt(idx<uint16> &inp); 00666 00670 template <> 00671 inline void ipp_sqrt(idx<int16> &inp); 00672 00675 template <> 00676 inline void ipp_sqrt(idx<float32> &inp); 00677 00678 00681 template <typename T> 00682 inline void ipp_sqrt(const idx<T> &inp, idx<T> &out); 00683 00687 template <> 00688 inline void ipp_sqrt(const idx<ubyte> &inp, idx<ubyte> &out); 00689 00693 template <> 00694 inline void ipp_sqrt(const idx<uint16> &inp, idx<uint16> &out); 00695 00699 template <> 00700 inline void ipp_sqrt(const idx<int16> &inp, idx<int16> &out); 00701 00704 template <> 00705 inline void ipp_sqrt(const idx<float32> &inp, idx<float32> &out); 00706 00708 // ipp_exp 00709 00712 template <typename T> 00713 inline void ipp_exp(idx<T> &inp); 00714 00718 template <> 00719 inline void ipp_exp(idx<ubyte> &inp); 00720 00724 template <> 00725 inline void ipp_exp(idx<uint16> &inp); 00726 00730 template <> 00731 inline void ipp_exp(idx<int16> &inp); 00732 00735 template <> 00736 inline void ipp_exp(idx<float32> &inp); 00737 00738 00741 template <typename T> 00742 inline void ipp_exp(const idx<T> &inp, idx<T> &out); 00743 00747 template <> 00748 inline void ipp_exp(const idx<ubyte> &inp, idx<ubyte> &out); 00749 00753 template <> 00754 inline void ipp_exp(const idx<uint16> &inp, idx<uint16> &out); 00755 00759 template <> 00760 inline void ipp_exp(const idx<int16> &inp, idx<int16> &out); 00761 00764 template <> 00765 inline void ipp_exp(const idx<float32> &inp, idx<float32> &out); 00766 00768 // ipp_sum 00769 00771 template <typename T> 00772 inline float64 ipp_sum (const idx<T> &inp); 00773 00776 template <> 00777 inline float64 ipp_sum (const idx<ubyte> &inp); 00778 00781 template <> 00782 inline float64 ipp_sum (const idx<uint16> &inp); 00783 00786 template <> 00787 inline float64 ipp_sum (const idx<int16> &inp); 00788 00791 template <> 00792 inline float64 ipp_sum (const idx<float32> &inp); 00793 00795 // ipp_sumacc 00796 00800 template <typename T> 00801 inline float64 ipp_sumacc (const idx<T> &inp, idx<T> &acc); 00802 00804 // ipp_sumabs 00805 00807 template <typename T> 00808 inline float64 ipp_sumabs (const idx<T> &inp); 00809 00812 template <> 00813 inline float64 ipp_sumabs (const idx<ubyte> &inp); 00814 00817 template <> 00818 inline float64 ipp_sumabs (const idx<uint16> &inp); 00819 00822 template <> 00823 inline float64 ipp_sumabs (const idx<int16> &inp); 00824 00827 template <> 00828 inline float64 ipp_sumabs (const idx<float32> &inp); 00829 00831 // ipp_l2norm 00832 00834 template <typename T> 00835 inline float64 ipp_l2norm (const idx<T> &inp); 00836 00839 template <> 00840 inline float64 ipp_l2norm (const idx<ubyte> &inp); 00841 00844 template <> 00845 inline float64 ipp_l2norm (const idx<uint16> &inp); 00846 00849 template <> 00850 inline float64 ipp_l2norm (const idx<int16> &inp); 00851 00854 template <> 00855 inline float64 ipp_l2norm (const idx<float32> &inp); 00856 00858 // ipp_mean 00859 00861 template <typename T> 00862 inline float64 ipp_mean (const idx<T> &inp); 00863 00866 template <> 00867 inline float64 ipp_mean (const idx<ubyte> &inp); 00868 00871 template <> 00872 inline float64 ipp_mean (const idx<uint16> &inp); 00873 00876 template <> 00877 inline float64 ipp_mean (const idx<int16> &inp); 00878 00881 template <> 00882 inline float64 ipp_mean (const idx<float32> &inp); 00883 00885 // ipp_std_normalize 00886 00889 template <typename T> 00890 inline void ipp_std_normalize (const idx<T> &inp, idx<T> &out, 00891 T* mean = NULL); 00892 00896 template <> 00897 inline void ipp_std_normalize (const idx<ubyte> &inp, idx<ubyte> &out, 00898 ubyte* mean); 00899 00902 template <> 00903 inline void ipp_std_normalize (const idx<float32> &inp, idx<float32> &out, 00904 float32* mean); 00905 00906 00907 #ifdef __IPP_DOT__ 00908 00909 // ipp_dot 00910 00912 template <typename T> 00913 inline float64 ipp_dot(const idx<T> &in1, const idx<T> &in2); 00914 00917 template <> 00918 inline float64 ipp_dot(const idx<ubyte> &in1, const idx<ubyte> &in2); 00919 00922 template <> 00923 inline float64 ipp_dot(const idx<byte> &in1, const idx<byte> &in2); 00924 00927 template <> 00928 inline float64 ipp_dot(const idx<uint16> &in1, const idx<uint16> &in2); 00929 00932 template <> 00933 inline float64 ipp_dot(const idx<int16> &in1, const idx<int16> &in2); 00934 00937 template <> 00938 inline float64 ipp_dot(const idx<uint32> &in1, const idx<uint32> &in2); 00939 00942 template <> 00943 inline float64 ipp_dot(const idx<int32> &in1, const idx<int32> &in2); 00944 00947 template <> 00948 inline float64 ipp_dot(const idx<float32> &in1, const idx<float32> &in2); 00949 00951 // ipp_dotacc 00952 00956 template <typename T> 00957 inline float64 ipp_dotacc(const idx<T> &in1, const idx<T> &in2, 00958 idx<T> &acc); 00959 #endif /* __IPP_DOT__ */ 00960 00962 // ipp_max 00963 00965 template <typename T> 00966 inline T ipp_max(const idx<T> &inp); 00967 00970 template <> 00971 inline ubyte ipp_max(const idx<ubyte> &inp); 00972 00975 template <> 00976 inline uint16 ipp_max(const idx<uint16> &inp); 00977 00980 template <> 00981 inline int16 ipp_max(const idx<int16> &inp); 00982 00985 template <> 00986 inline float32 ipp_max(const idx<float32> &inp); 00987 00989 // ipp_indexmax 00990 00993 template <typename T> 00994 inline intg ipp_indexmax(const idx<T> &inp); 00995 00999 template <> 01000 inline intg ipp_indexmax(const idx<ubyte> &inp); 01001 01005 template <> 01006 inline intg ipp_indexmax(const idx<uint16> &inp); 01007 01011 template <> 01012 inline intg ipp_indexmax(const idx<int16> &inp); 01013 01017 template <> 01018 inline intg ipp_indexmax(const idx<float32> &inp); 01019 01021 // ipp_min 01022 01024 template <typename T> 01025 inline T ipp_min(const idx<T> &inp); 01026 01029 template <> 01030 inline ubyte ipp_min(const idx<ubyte> &inp); 01031 01034 template <> 01035 inline uint16 ipp_min(const idx<uint16> &inp); 01036 01039 template <> 01040 inline int16 ipp_min(const idx<int16> &inp); 01041 01044 template <> 01045 inline float32 ipp_min(const idx<float32> &inp); 01046 01048 // ipp_indexmin 01049 01052 template <typename T> 01053 inline intg ipp_indexmin(const idx<T> &inp); 01054 01058 template <> 01059 inline intg ipp_indexmin(const idx<ubyte> &inp); 01060 01064 template <> 01065 inline intg ipp_indexmin(const idx<uint16> &inp); 01066 01070 template <> 01071 inline intg ipp_indexmin(const idx<int16> &inp); 01072 01076 template <> 01077 inline intg ipp_indexmin(const idx<float32> &inp); 01078 01080 // ipp_maxevery (in-place) 01081 01083 template<typename T> 01084 inline void ipp_maxevery(const idx<T> &in1, idx<T> &in2); 01085 01086 // This calls ippiMaxEvery_8u_C1IR 01088 template<> 01089 inline void ipp_maxevery(const idx<ubyte> &in1, idx<ubyte> &in2); 01090 01091 // This calls ippiMaxEvery_16u_C1IR 01093 template<> 01094 inline void ipp_maxevery(const idx<uint16> &in1, idx<uint16> &in2); 01095 01096 // This calls ippiMaxEvery_16s_C1IR 01098 template<> 01099 inline void ipp_maxevery(const idx<int16> &in1, idx<int16> &in2); 01100 01101 // This calls ippiMaxEvery_32f_C1IR 01103 template<> 01104 inline void ipp_maxevery(const idx<float32> &in1, idx<float32> &in2); 01105 01107 // ipp_maxevery (not-in-place) 01108 01111 template<typename T> 01112 inline void ipp_maxevery(const idx<T> &in1, const idx<T> &in2, idx<T> &out); 01113 01115 // ipp_sqrdist 01116 01120 template<typename T> 01121 inline float64 ipp_sqrdist(const idx<T> &i1, const idx<T> &i2); 01122 01125 template<> 01126 inline float64 ipp_sqrdist(const idx<ubyte> &i1, const idx<ubyte> &i2); 01127 01130 template<> 01131 inline float64 ipp_sqrdist(const idx<uint16> &i1, const idx<uint16> &i2); 01132 01135 template<> 01136 inline float64 ipp_sqrdist(const idx<int16> &i1, const idx<int16> &i2); 01137 01140 template<> 01141 inline float64 ipp_sqrdist(const idx<float32> &i1, const idx<float32> &i2); 01142 01143 01150 template<typename T> 01151 inline float64 ipp_sqrdist(const idx<T> &i1, const idx<T> &i2, idx<T> &out); 01152 01154 // ipp_threshold_lt (in-place) 01155 01157 template <typename T> 01158 inline void ipp_threshold_lt(idx<T> &in, T th); 01159 01162 template <> 01163 inline void ipp_threshold_lt(idx<ubyte> &in, ubyte th); 01164 01167 template <> 01168 inline void ipp_threshold_lt(idx<uint16> &in, uint16 th); 01169 01172 template <> 01173 inline void ipp_threshold_lt(idx<int16> &in, int16 th); 01174 01177 template <> 01178 inline void ipp_threshold_lt(idx<float32> &in, float32 th); 01179 01181 // ipp_threshold_lt (not-in-place) 01182 01184 template <typename T> 01185 inline void ipp_threshold_lt(const idx<T> &in, T th, idx<T> &out); 01186 01189 template <> 01190 inline void ipp_threshold_lt(const idx<ubyte> &in, ubyte th, 01191 idx<ubyte> &out); 01192 01195 template <> 01196 inline void ipp_threshold_lt(const idx<uint16> &in, uint16 th, 01197 idx<uint16> &out); 01198 01201 template <> 01202 inline void ipp_threshold_lt(const idx<int16> &in, int16 th, 01203 idx<int16> &out); 01204 01207 template <> 01208 inline void ipp_threshold_lt(const idx<float32> &in, float32 th, 01209 idx<float32> &out); 01210 01212 // ipp_threshold_gt (in-place) 01213 01215 template <typename T> 01216 inline void ipp_threshold_gt(idx<T> &in, T th); 01217 01220 template <> 01221 inline void ipp_threshold_gt(idx<ubyte> &in, ubyte th); 01222 01225 template <> 01226 inline void ipp_threshold_gt(idx<uint16> &in, uint16 th); 01227 01230 template <> 01231 inline void ipp_threshold_gt(idx<int16> &in, int16 th); 01232 01235 template <> 01236 inline void ipp_threshold_gt(idx<float32> &in, float32 th); 01237 01239 // ipp_threshold_gt (not-in-place) 01240 01242 template <typename T> 01243 inline void ipp_threshold_gt(const idx<T> &in, T th, idx<T> &out); 01244 01247 template <> 01248 inline void ipp_threshold_gt(const idx<ubyte> &in, ubyte th, 01249 idx<ubyte> &out); 01250 01253 template <> 01254 inline void ipp_threshold_gt(const idx<uint16> &in, uint16 th, 01255 idx<uint16> &out); 01256 01259 template <> 01260 inline void ipp_threshold_gt(const idx<int16> &in, int16 th, 01261 idx<int16> &out); 01262 01265 template <> 01266 inline void ipp_threshold_gt(const idx<float32> &in, float32 th, 01267 idx<float32> &out); 01268 01270 // ipp_threshold_lt (with value, in-place) 01271 01273 template <typename T> 01274 inline void ipp_threshold_lt(idx<T> &in, T th, T value); 01275 01278 template <> 01279 inline void ipp_threshold_lt(idx<ubyte> &in, ubyte th, ubyte value); 01280 01283 template <> 01284 inline void ipp_threshold_lt(idx<uint16> &in, uint16 th, uint16 value); 01285 01288 template <> 01289 inline void ipp_threshold_lt(idx<int16> &in, int16 th, int16 value); 01290 01293 template <> 01294 inline void ipp_threshold_lt(idx<float32> &in, float32 th, float32 value); 01295 01297 // ipp_threshold_lt (with value, not-in-place) 01298 01300 template <typename T> 01301 inline void ipp_threshold_lt(const idx<T> &in, T th, T value, 01302 idx<T> &out); 01303 01306 template <> 01307 inline void ipp_threshold_lt(const idx<ubyte> &in, ubyte th, ubyte value, 01308 idx<ubyte> &out); 01309 01312 template <> 01313 inline void ipp_threshold_lt(const idx<uint16> &in, uint16 th, uint16 value, 01314 idx<uint16> &out); 01315 01318 template <> 01319 inline void ipp_threshold_lt(const idx<int16> &in, int16 th, int16 value, 01320 idx<int16> &out); 01321 01324 template <> 01325 inline void ipp_threshold_lt(const idx<float32> &in, float32 th, 01326 float32 value, idx<float32> &out); 01327 01329 // ipp_threshold_gt (with value, in-place) 01330 01332 template <typename T> 01333 inline void ipp_threshold_gt(idx<T> &in, T th, T value); 01334 01337 template <> 01338 inline void ipp_threshold_gt(idx<ubyte> &in, ubyte th, ubyte value); 01339 01342 template <> 01343 inline void ipp_threshold_gt(idx<uint16> &in, uint16 th, uint16 value); 01344 01347 template <> 01348 inline void ipp_threshold_gt(idx<int16> &in, int16 th, int16 value); 01349 01352 template <> 01353 inline void ipp_threshold_gt(idx<float32> &in, float32 th, float32 value); 01354 01356 // ipp_threshold_gt (with value, not-in-place) 01357 01359 template <typename T> 01360 inline void ipp_threshold_gt(const idx<T> &in, T th, T value, 01361 idx<T> &out); 01362 01365 template <> 01366 inline void ipp_threshold_gt(const idx<ubyte> &in, ubyte th, ubyte value, 01367 idx<ubyte> &out); 01368 01371 template <> 01372 inline void ipp_threshold_gt(const idx<uint16> &in, uint16 th, uint16 value, 01373 idx<uint16> &out); 01374 01377 template <> 01378 inline void ipp_threshold_gt(const idx<int16> &in, int16 th, int16 value, 01379 idx<int16> &out); 01380 01383 template <> 01384 inline void ipp_threshold_gt(const idx<float32> &in, float32 th, 01385 float32 value, idx<float32> &out); 01386 01387 01388 #endif /* __IPP__ */ 01389 01390 } // end namespace ebl 01391 01392 #include "ippops.hpp" 01393 01394 #endif /* IPPOPS_H_ */