1/*
2 * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef __HI_ISP_DEFINES_H__
17#define __HI_ISP_DEFINES_H__
18
19#ifdef __cplusplus
20#if __cplusplus
21extern "C" {
22#endif
23#endif /* End of #ifdef __cplusplus */
24
25/* isp sys part */
26#define ISP_STRIPING_MAX_NUM                      3
27#define ISP_NORMAL_BLOCK_NUM                      1
28#define ISP_DEFAULT_BLOCK_NUM                     2
29#define ISP_SBS_BLOCK_NUM                         2
30
31#define ISP_BE0_PIPE_ID                           0
32#define ISP_BE1_PIPE_ID                           8
33#define ISP_MAX_BE_NUM                            1
34#define ISP_MAX_STITCH_NUM                        1
35
36#define ISP_MAX_PHY_PIPE_NUM                      4
37#define ISP_MAX_VIR_PIPE_NUM                      1
38#define ISP_MAX_PIPE_NUM                          (ISP_MAX_PHY_PIPE_NUM + ISP_MAX_VIR_PIPE_NUM)
39
40#define ISP_STRIPING_OVERLAP_DEFAULT              256
41
42#define ISP_WDR_CHN_MAX                           4
43#define ISP_SUPPORT_DE_MODULE                     1
44
45#define SENSOR_RES_WIDTH_MAX                      4608
46#define SENSOR_RES_HEIGHT_MAX                     4608
47#define ISP_RES_WIDTH_MAX                         4608, 3840, 2048, 2048 /* need change when pipe num is change */
48#define ISP_RES_HEIGHT_MAX                        4608, 3840, 2048, 2048 /* need change when pipe num is change */
49
50/* isp alg part */
51#define HI_ISP_CLUT_LUT_LENGTH                    5508
52#define HI_ISP_CA_YRATIO_LUT_LENGTH               128
53
54#define STATIC_DP_COUNT_NORMAL                    2048
55#define STATIC_DP_COUNT_MAX                       (STATIC_DP_COUNT_NORMAL * ISP_STRIPING_MAX_NUM)
56#define ISP_SUPPORT_OFFLINE_DPC_CALIBRATION       1
57#define ISP_DPC_SET_NUM                           3
58#define ISP_DPC_LCH_SET_NUM                       5
59#define ISP_DPC_MAX_CHN_NUM                       4
60
61#define HI_ISP_SPECAWB_FACT_ELEMENT_LUT0          4096
62#define HI_ISP_SPECAWB_FACT_ELEMENT_LUT1          4096
63#define HI_ISP_SPECAWB_FACT_ELEMENT_LUT2          4096
64#define HI_ISP_SPECAWB_FACT_ELEMENT_LUT3          4096
65#define HI_ISP_SPECAWB_FACT_ELEMENT_LUT4          4096
66#define HI_ISP_SPECAWB_FACT_ELEMENT_LUT5          4096
67#define HI_ISP_SPECAWB_FACT_ELEMENT_LUT6          4096
68#define HI_ISP_SPECAWB_WB_CNVTBL_LUT              16384
69#define HI_ISP_SPECAWB_KELDBB_LUT                 16384
70#define HI_ISP_SPECAWB_BBL_LUT                    240
71#define HI_ISP_SPECAWB_CAA_LUT1                   16384
72#define HI_ISP_SPECAWB_CAA_LUT2                   16384
73#define HI_ISP_SPECAWB_CAA_LUT3                   16384
74#define ISP_SPECAWB_BUF_SIZE                      110832
75
76#define AWB_ZONE_BIN                              1
77#define AWB_LIB_NUM                               (ISP_MAX_PIPE_NUM)
78#define AE_LIB_NUM                                (ISP_MAX_PIPE_NUM)
79
80#define HI_ISP_SHARPEN_RGAIN                      31
81#define HI_ISP_SHARPEN_RGAIN_MAX                  31
82#define HI_ISP_SHARPEN_RGAIN_BIT                  31
83#define HI_ISP_SHARPEN_GGAIN                      32
84#define HI_ISP_SHARPEN_GGAIN_MAX                  255
85#define HI_ISP_SHARPEN_GGAIN_BIT                  255
86#define HI_ISP_SHARPEN_BGAIN                      31
87#define HI_ISP_SHARPEN_BGAIN_MAX                  31
88#define HI_ISP_SHARPEN_BGAIN_BIT                  31
89#define HI_ISP_SHARPEN_LUMAWGT_MAX                127
90#define HI_ISP_SHARPEN_LUMAWGT                    127
91#define HI_ISP_SHARPEN_LUMAWGT_BIT                127
92#define HI_ISP_SHARPEN_EdgeFiltMaxCap             18
93#define HI_ISP_SHARPEN_EdgeFiltMaxCap_MAX         47
94#define HI_ISP_SHARPEN_EdgeFiltMaxCap_BIT         63
95
96#define GAMMA_REG_NODE_NUM                        257
97#define GAMMA_OUTSEG_NUM                          8
98
99#define HI_ISP_DRC_STRENGTH_MAX                   1023
100#define HI_ISP_DRC_SPA_FLT_COEF_MAX               5
101
102#define HI_ISP_DEMOSAIC_DETAIL_SMOOTH_RANGE_MAX   7
103#define HI_ISP_DEMOSAIC_DETAIL_SMOOTH_RANGE_MIN   1
104#define HI_ISP_DEMOSAIC_NONDIR_MFDETALEHC_STR_MAX 127
105#define HI_ISP_DEMOSAIC_COLOR_NOISE_THDY_MAX       255
106#define HI_ISP_DEMOSAIC_COLOR_NOISE_STRY_MAX       255
107
108#define HI_ISP_LDCI_HEPOSWGT_MAX                  255
109#define HI_ISP_LDCI_HENEGWGT_MAX                  255
110
111#define HI_ISP_PREGAMMA_LUT_MAX                   0xFFFFF
112#define HI_ISP_PREGAMMA_SEG_NUM                   8
113
114#define EXPANDER_NODE_NUM                         257
115
116#define DEFOG_ZONE_ROW                            32
117#define DEFOG_ZONE_COLUMN                         32
118#define DEFOG_ZONE_NUM                            1024
119#define DEFOG_MAX_ZONE_NUM                        1024
120#define DEFOG_LUT_NUM                             256
121#define DEFOG_REG_NUM                             2
122#define HI_ISP_GE_MAX_CHN_NUM                     4
123#define HI_ISP_FPN_CHN_NUM                        4
124
125#define HI_ISP_LSC_MESHSTR_MAX                    65535
126#define HI_ISP_LSC_DEFAULT_MESH_STRENGTH          4096
127#define HI_ISP_LSC_DEFAULT_WEIGHT                 256
128#define HI_ISP_LSC_GRID_COL                       33
129#define HI_ISP_LSC_GRID_ROW                       33
130#define HI_ISP_LSC_GRID_POINTS                    (HI_ISP_LSC_GRID_COL * HI_ISP_LSC_GRID_ROW)
131#define HI_ISP_LSC_DEFAULT_MESH_SCALE             3
132#define hi_isp_lsc_xgrid_width_max(x)             ((x) / 4 - 60)
133#define hi_isp_lsc_ygrid_width_max(x)             ((x) / 4 - 60)
134#define HI_ISP_LSC_MESHSCALE_NUM                  8
135#define HI_ISP_LSC_MESHSCALE0_DEF_GAIN            512
136#define HI_ISP_LSC_MESHSCALE1_DEF_GAIN            256
137#define HI_ISP_LSC_MESHSCALE2_DEF_GAIN            128
138#define HI_ISP_LSC_MESHSCALE3_DEF_GAIN            64
139#define HI_ISP_LSC_MAX_GAIN                       1023
140#define HI_ISP_LSC_GAIN_BITWIDTH                  10
141
142#define AF_GAMMA_VALUE_MAX                        6
143#define HI_EXT_SYSTEM_MANUAL_DEHAZE_HBLK_DEFAULT  32
144#define HI_EXT_SYSTEM_MANUAL_DEHAZE_VBLK_DEFAULT  32
145
146#define HI_ISP_CR_SLOPE_MAX                       14
147#define HI_ISP_CR_THR_MAX                         16383
148#define HI_ISP_CR_NPOFFSET_MAX                    16383
149#define HI_ISP_CR_NPOFFSET_MIN                    512
150
151#define HI_ISP_FE_AF_SUPPORT                      0
152#define HI_ISP_BE_AF_SUPPORT                      1
153#define HI_ISP_AF_ENABLE_MASK                     ((HI_ISP_BE_AF_SUPPORT << 1) + HI_ISP_FE_AF_SUPPORT)
154
155#ifdef __cplusplus
156#if __cplusplus
157}
158#endif
159#endif /* End of #ifdef __cplusplus */
160
161#endif /* __HI_ISP_DEFINES_H__ */
162