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
00026 #include <emmintrin.h>
00027 #include <pmmintrin.h>
00028
00029
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
00044
00045 namespace filter {
00046
00047
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
00054
00055 void convolve_14641_row_5x5_16bit( const int16_t* in, uint8_t* out, int w, int h );
00056
00057
00058
00059
00060 void convolve_12021_row_5x5_16bit( const int16_t* in, uint8_t* out, int w, int h );
00061
00062
00063
00064
00065 void convolve_121_row_3x3_16bit( const int16_t* in, uint8_t* out, int w, int h );
00066
00067
00068
00069
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
00086
00087
00088
00089
00090 void checkerboard5x5( const uint8_t* in, int16_t* out, int w, int h );
00091
00092
00093
00094
00095
00096
00097 void blob5x5( const uint8_t* in, int16_t* out, int w, int h );
00098 };
00099
00100 #endif