xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/algos/amd/md_lib/motion_detect.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 #define     MT_VERSION                          1
52 #define     ENABLE_NEON
53 
54 void motion_detect(
55     uint8_t *pCurIn,
56     uint8_t *pPreIn,
57     int16_t *pTmpBuf,
58     uint8_t *pAlpha,
59     uint8_t *pPreAlpha,
60     uint8_t *gain_table_u8,
61     int     imgHeight,
62     int     imgWidth,
63     int     proHeight,
64     int     proWidth,
65     int     gainStride,
66     float   sigmaHScale,
67     float   sigmaLScale,
68     float   uv_ratio,
69     float   light_clip,
70     int     static_ratio_r_bit);
71 
72 
73 #endif