00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __FILTER_H__
00023 #define __FILTER_H__
00024
00025 #include <emmintrin.h>
00026 #include <pmmintrin.h>
00027
00028
00029 #ifndef _MSC_VER
00030 #include <stdint.h>
00031 #else
00032 typedef __int8 int8_t;
00033 typedef __int16 int16_t;
00034 typedef __int32 int32_t;
00035 typedef __int64 int64_t;
00036 typedef unsigned __int8 uint8_t;
00037 typedef unsigned __int16 uint16_t;
00038 typedef unsigned __int32 uint32_t;
00039 typedef unsigned __int64 uint64_t;
00040 #endif
00041
00042
00043
00044 namespace filter {
00045
00046
00047 namespace detail {
00048 void integral_image( const uint8_t* in, int32_t* out, int w, int h );
00049 void unpack_8bit_to_16bit( const __m128i a, __m128i& b0, __m128i& b1 );
00050 void pack_16bit_to_8bit_saturate( const __m128i a0, const __m128i a1, __m128i& b );
00051
00052
00053
00054 void convolve_14641_row_5x5_16bit( const int16_t* in, uint8_t* out, int w, int h );
00055
00056
00057
00058
00059 void convolve_12021_row_5x5_16bit( const int16_t* in, uint8_t* out, int w, int h );
00060
00061
00062
00063
00064 void convolve_121_row_3x3_16bit( const int16_t* in, uint8_t* out, int w, int h );
00065
00066
00067
00068
00069 void convolve_101_row_3x3_16bit( const int16_t* in, uint8_t* out, int w, int h );
00070
00071 void convolve_cols_5x5( const unsigned char* in, int16_t* out_v, int16_t* out_h, int w, int h );
00072
00073 void convolve_col_p1p1p0m1m1_5x5( const unsigned char* in, int16_t* out, int w, int h );
00074
00075 void convolve_row_p1p1p0m1m1_5x5( const int16_t* in, int16_t* out, int w, int h );
00076
00077 void convolve_cols_3x3( const unsigned char* in, int16_t* out_v, int16_t* out_h, int w, int h );
00078 }
00079
00080 void sobel3x3( const uint8_t* in, uint8_t* out_v, uint8_t* out_h, int w, int h );
00081
00082 void sobel5x5( const uint8_t* in, uint8_t* out_v, uint8_t* out_h, int w, int h );
00083
00084
00085
00086
00087
00088
00089 void checkerboard5x5( const uint8_t* in, int16_t* out, int w, int h );
00090
00091
00092
00093
00094
00095
00096 void blob5x5( const uint8_t* in, int16_t* out, int w, int h );
00097 };
00098
00099 #endif