1 #ifndef _MOTION_DETECT_H 2 #define _MOTION_DETECT_H 3 4 #ifndef WIN32 5 #include "arm_neon.h" 6 #else 7 #include "NEON_2_SSE.h" 8 #endif 9 10 //#include <stdint.h> 11 #include <iostream> 12 #include <stdio.h> 13 #include <stdlib.h> 14 #include <string.h> 15 //#include "common.h" 16 17 #define SIGN(a) (((a) > 0) ? (1) : (-(1))) 18 //#define MIN(a,b) ((a) <= (b) ? (a):(b)) 19 //#define MAX(a,b) ((a) >= (b) ? (a):(b)) 20 #define CLIP(a, min_v, max_v) (((a) < (min_v)) ? (min_v) : (((a) > (max_v)) ? (max_v) : (a))) 21 #define ABS(a) (((a) > 0) ? (a) : (-(a))) 22 //#define ROUND_F(x) (int32_t)(((float)x)+(((x) > 0) ? 0.5 : (-0.5))) 23 #define ROUND_INT(x, shf_bit) (int)((((x) > 0) ? 1 : -1) * ((ABS(x) + (1<<((shf_bit)-1)))>>(shf_bit))) 24 #define ROUND_UINT16(x, shf_bit) ((uint16_t) (MIN(x, (1 << (uint32_t)16) - 1) + (1<<(shf_bit - 1))) >> (shf_bit)) 25 26 27 #define IMG_DOWN_SCALE_X_BIT 2 28 #define IMG_DOWN_SCALE_Y_BIT 3 29 30 #define IMG_DOWN_SCALE_X (1 << IMG_DOWN_SCALE_X_BIT) 31 #define IMG_DOWN_SCALE_Y (1 << IMG_DOWN_SCALE_Y_BIT) 32 #define LDIFF_DOWN_SCALE_X_BIT 3 33 #define LDIFF_DOWN_SCALE_Y_BIT 3 34 #define LDIFF_DOWN_SCALE_X (1 << LDIFF_DOWN_SCALE_X_BIT) 35 #define LDIFF_DOWN_SCALE_Y (1 << LDIFF_DOWN_SCALE_Y_BIT) 36 37 38 #define GAUS_FILTER_RADIUS_X 1 39 #define GAUS_FILTER_RADIUS_Y 1 40 #define SIGMA_FILTER_RADIUS_X 4 41 #define SIGMA_FILTER_RADIUS_Y 4 42 43 #define ALPHA_FIX_BITS 7 44 #define UV_RATIO_FIX_BITS 7 45 #define ALPHA_DIV_FIX_BITS (7 + 7) 46 47 #define RATIO_BITS_NUM 7 48 #define RATIO_BITS_R_NUM 5 49 50 51 52 #define MT_VERSION 1 53 #define ENABLE_NEON 54 55 void motion_detect( 56 uint8_t *pCurIn, 57 uint8_t *pPreIn, 58 int16_t *pTmpBuf, 59 uint8_t *pAlpha, 60 uint8_t *pPreAlpha, 61 uint8_t *gain_table_u8, 62 int imgHeight, 63 int imgWidth, 64 int proHeight, 65 int proWidth, 66 int gainStride, 67 float sigmaHScale, 68 float sigmaLScale, 69 float uv_ratio, 70 float light_clip, 71 int static_ratio_r_bit); 72 73 74 #endif 75