00001 /*!@file Util/mmx-sse.H Optimized implementations of low-level functions 00002 for MMX/SSE */ 00003 00004 // //////////////////////////////////////////////////////////////////// // 00005 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2003 // 00006 // by the University of Southern California (USC) and the iLab at USC. // 00007 // See http://iLab.usc.edu for information about this project. // 00008 // //////////////////////////////////////////////////////////////////// // 00009 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00010 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00011 // in Visual Environments, and Applications'' by Christof Koch and // 00012 // Laurent Itti, California Institute of Technology, 2001 (patent // 00013 // pending; application number 09/912,225 filed July 23, 2001; see // 00014 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00015 // //////////////////////////////////////////////////////////////////// // 00016 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00017 // // 00018 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00019 // redistribute it and/or modify it under the terms of the GNU General // 00020 // Public License as published by the Free Software Foundation; either // 00021 // version 2 of the License, or (at your option) any later version. // 00022 // // 00023 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00024 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00025 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00026 // PURPOSE. See the GNU General Public License for more details. // 00027 // // 00028 // You should have received a copy of the GNU General Public License // 00029 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00030 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00031 // Boston, MA 02111-1307 USA. // 00032 // //////////////////////////////////////////////////////////////////// // 00033 // 00034 // Primary maintainer for this file: Nitin Dhavale <dhavale@usc.edu> 00035 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Util/mmx-sse.H $ 00036 // $Id: mmx-sse.H 10118 2008-08-18 23:51:38Z ilab24 $ 00037 // 00038 00039 00040 #ifndef __SSE_MMX_H__ 00041 #define __SSE_MMX_H__ 00042 #include <string.h> 00043 typedef int int32; 00044 typedef unsigned char byte; 00045 typedef float float32; 00046 00047 //! In all the functions 00048 00049 #ifdef INVT_USE_MMX 00050 #endif 00051 00052 #ifdef INVT_USE_SSE 00053 /*! All the sse_absDiff() functions subtract image 'b' from 'a' and put the absolute 00054 value of the result into 'diff'. 00055 */ 00056 void sse_absDiff(const double *a, const double *b, double *diff, const int32 sz); 00057 00058 //! The pixel values composing the image 'img' are summed up to give 'sum' 00059 void sse_sum(const double *img, double *sum, const int32 sz); 00060 00061 /*! sse_clampedDiff() routines take the clamped difference of 2 images 00062 'a' and 'b' 00063 */ 00064 void sse_clampedDiff(const byte *a, const byte *b, byte *result, const int32 sz); 00065 void sse_clampedDiff(const float32 *a, const float32 *b, float32 *result, const int sz); 00066 void sse_clampedDiff(const int32 *a, const int32 *b, int32 *c, const int32 sz); 00067 00068 /*! sse_binaryReverse() takes the distance of each pixel in 'src' from 'val' and the 00069 resulting image is stored in 'result' 00070 */ 00071 void sse_binaryReverse(const byte *src, byte *result, const byte val, const int sz); 00072 void sse_binaryReverse(const float *src, float *result, const float val, const int sz); 00073 void sse_binaryReverse(const int32 *src, int32 *result, const int32 val, const int sz); 00074 00075 //! sse_cvt_byte_to_int() converts an image<byte> into a image<int> 00076 void sse_cvt_byte_to_int(const byte *a, int32 *b, const int32 sz); 00077 00078 00079 /*! The filter functions take 4 params, the 'src' one indicating the image 00080 to be filtered, dest is a pre-allocated array that holds the results 00081 after processing, 'h' & 'w' are respectively the height and width of the 00082 source image 00083 */ 00084 void sse_lowPass3x(const float *src, float *dest, int w, int h); 00085 void sse_lowPass3y(const float *src, float *dest, const int w, const int h); 00086 void sse_lowPass5x(const float *src, float *dest, const int h, const int w); 00087 void sse_lowPass5y(const float *src, float *dest, const int h, const int w); 00088 00089 /*! The yuv2rgb conversion functions take 3 params, the 'src' indicates 00090 the yuv image, 'dest' is a byte array that will hold the rgb values 00091 after conversion. 'nbpix2' is the number of bytes in the yuv image. 00092 */ 00093 void sse_yuv411_to_rgb_mode_640x480(const byte *src, byte *dest, 00094 const int nbpix2); 00095 #endif 00096 00097 #ifdef INVT_USE_MMXSSE2 00098 void sse2_sum(const float *a, double *sum, const int32 sz); 00099 void sse2_sum(const int32 *a, double *sum, const int32 sz); 00100 void sse2_sum(const byte *a, double *sum, const int32 sz); 00101 void sse2_cvt_byte_to_float(const byte *a, float32 *b, const int32 sz); 00102 void sse2_cvt_byte_to_double(const byte *a, double *b, int32 sz); 00103 void sse2_cvt_int_to_float(const int32 *a, float *b, const int32 sz); 00104 void sse2_cvt_int_to_double(const int32 *a, double *b, const int32 sz); 00105 void sse2_cvt_float_to_int(const float *a, int *b, const int32 sz); 00106 void sse2_cvt_float_to_double(const float *a, double *b, const int32 sz); 00107 void sse2_absDiff(const float *a, const float *b, float *diff, const int32 sz); 00108 void sse2_absDiff(const int32 *a, const int32 *b, int32 *diff, const int32 sz); 00109 void sse2_absDiff(const byte *a, const byte *b, byte *diff, const int32 sz); 00110 #endif 00111 00112 void sse_lowPass9x(const float *, float *, int, int ); 00113 00114 #endif 00115 00116 // ###################################################################### 00117 /* So things look consistent in everyone's emacs... */ 00118 /* Local Variables: */ 00119 /* indent-tabs-mode: nil */ 00120 /* End: */