filter.h
Go to the documentation of this file.
00001 /*
00002 Copyright 2012. All rights reserved.
00003 Institute of Measurement and Control Systems
00004 Karlsruhe Institute of Technology, Germany
00005 
00006 This file is part of libelas.
00007 Authors: Julius Ziegler, Andreas Geiger
00008 
00009 libelas is free software; you can redistribute it and/or modify it under the
00010 terms of the GNU General Public License as published by the Free Software
00011 Foundation; either version 3 of the License, or any later version.
00012 
00013 libelas is distributed in the hope that it will be useful, but WITHOUT ANY
00014 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00015 PARTICULAR PURPOSE. See the GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License along with
00018 libelas; if not, write to the Free Software Foundation, Inc., 51 Franklin
00019 Street, Fifth Floor, Boston, MA 02110-1301, USA
00020 */
00021 
00022 #ifndef __FILTER_H__
00023 #define __FILTER_H__
00024 
00025 //SSE2 header
00026 #include <emmintrin.h>
00027 #include <pmmintrin.h>
00028 
00029 // define fixed-width datatypes for Visual Studio projects
00030 #ifndef _MSC_VER
00031   #include <stdint.h>
00032 #else
00033   typedef __int8            int8_t;
00034   typedef __int16           int16_t;
00035   typedef __int32           int32_t;
00036   typedef __int64           int64_t;
00037   typedef unsigned __int8   uint8_t;
00038   typedef unsigned __int16  uint16_t;
00039   typedef unsigned __int32  uint32_t;
00040   typedef unsigned __int64  uint64_t;
00041 #endif
00042 
00043 // fast filters: implements 3x3 and 5x5 sobel filters and
00044 //               5x5 blob and corner filters based on SSE2/3 instructions
00045 namespace filter {
00046 
00047   // private namespace, public user functions at the bottom of this file
00048   namespace detail {
00049     void integral_image( const uint8_t* in, int32_t* out, int w, int h );
00050     void unpack_8bit_to_16bit( const __m128i a, __m128i& b0, __m128i& b1 );
00051     void pack_16bit_to_8bit_saturate( const __m128i a0, const __m128i a1, __m128i& b );
00052 
00053     // convolve image with a (1,4,6,4,1) row vector. Result is accumulated into output.
00054     // output is scaled by 1/128, then clamped to [-128,128], and finally shifted to [0,255].
00055     void convolve_14641_row_5x5_16bit( const int16_t* in, uint8_t* out, int w, int h );
00056 
00057     // convolve image with a (1,2,0,-2,-1) row vector. Result is accumulated into output.
00058     // This one works on 16bit input and 8bit output.
00059     // output is scaled by 1/128, then clamped to [-128,128], and finally shifted to [0,255].
00060     void convolve_12021_row_5x5_16bit( const int16_t* in, uint8_t* out, int w, int h );
00061 
00062     // convolve image with a (1,2,1) row vector. Result is accumulated into output.
00063     // This one works on 16bit input and 8bit output.
00064     // output is scaled by 1/4, then clamped to [-128,128], and finally shifted to [0,255].
00065     void convolve_121_row_3x3_16bit( const int16_t* in, uint8_t* out, int w, int h );
00066 
00067     // convolve image with a (1,0,-1) row vector. Result is accumulated into output.
00068     // This one works on 16bit input and 8bit output.
00069     // output is scaled by 1/4, then clamped to [-128,128], and finally shifted to [0,255].
00070     void convolve_101_row_3x3_16bit( const int16_t* in, uint8_t* out, int w, int h );
00071 
00072     void convolve_cols_5x5( const unsigned char* in, int16_t* out_v, int16_t* out_h, int w, int h );
00073 
00074     void convolve_col_p1p1p0m1m1_5x5( const unsigned char* in, int16_t* out, int w, int h );
00075 
00076     void convolve_row_p1p1p0m1m1_5x5( const int16_t* in, int16_t* out, int w, int h );
00077 
00078     void convolve_cols_3x3( const unsigned char* in, int16_t* out_v, int16_t* out_h, int w, int h );
00079   }
00080 
00081   void sobel3x3( const uint8_t* in, uint8_t* out_v, uint8_t* out_h, int w, int h );
00082 
00083   void sobel5x5( const uint8_t* in, uint8_t* out_v, uint8_t* out_h, int w, int h );
00084 
00085   // -1 -1  0  1  1
00086   // -1 -1  0  1  1
00087   //  0  0  0  0  0
00088   //  1  1  0 -1 -1
00089   //  1  1  0 -1 -1
00090   void checkerboard5x5( const uint8_t* in, int16_t* out, int w, int h );
00091 
00092   // -1 -1 -1 -1 -1
00093   // -1  1  1  1 -1
00094   // -1  1  8  1 -1
00095   // -1  1  1  1 -1
00096   // -1 -1 -1 -1 -1
00097   void blob5x5( const uint8_t* in, int16_t* out, int w, int h );
00098 };
00099 
00100 #endif


dlut_libvo
Author(s): Zhuang Yan
autogenerated on Thu Jun 6 2019 20:03:29