2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #ifndef __IA_CSS_SDIS_COMMON_TYPES_H
16 #define __IA_CSS_SDIS_COMMON_TYPES_H
19 * CSS-API header file for DVS statistics parameters.
22 #include <type_support.h>
24 /* DVS statistics grid dimensions in number of cells.
27 struct ia_css_dvs_grid_dim {
28 uint32_t width; /** Width of DVS grid table in cells */
29 uint32_t height; /** Height of DVS grid table in cells */
32 /* DVS statistics dimensions in number of cells for
33 * grid, coeffieicient and projection.
36 struct ia_css_sdis_info {
38 struct ia_css_dvs_grid_dim dim; /* Dimensions */
39 struct ia_css_dvs_grid_dim pad; /* Padded dimensions */
41 uint32_t deci_factor_log2;
44 #define IA_CSS_DEFAULT_SDIS_INFO \
46 { { 0, 0 }, /* dim */ \
49 { { 0, 0 }, /* dim */ \
52 { { 0, 0 }, /* dim */ \
55 0, /* dis_deci_factor_log2 */ \
58 /* DVS statistics grid
60 * ISP block: SDVS1 (DIS/DVS Support for DIS/DVS ver.1 (2-axes))
61 * SDVS2 (DVS Support for DVS ver.2 (6-axes))
62 * ISP1: SDVS1 is used.
63 * ISP2: SDVS2 is used.
65 struct ia_css_dvs_grid_res {
66 uint32_t width; /** Width of DVS grid table.
67 (= Horizontal number of grid cells
68 in table, which cells have effective
70 For DVS1, this is equal to
71 the number of vertical statistics. */
72 uint32_t aligned_width; /** Stride of each grid line.
73 (= Horizontal number of grid cells
75 the allocated width.) */
76 uint32_t height; /** Height of DVS grid table.
77 (= Vertical number of grid cells
78 in table, which cells have effective
80 For DVS1, This is equal to
81 the number of horizontal statistics. */
82 uint32_t aligned_height;/** Stride of each grid column.
83 (= Vertical number of grid cells
85 the allocated height.) */
88 /* TODO: use ia_css_dvs_grid_res in here.
89 * However, that implies driver I/F changes
91 struct ia_css_dvs_grid_info {
92 uint32_t enable; /** DVS statistics enabled.
93 0:disabled, 1:enabled */
94 uint32_t width; /** Width of DVS grid table.
95 (= Horizontal number of grid cells
96 in table, which cells have effective
98 For DVS1, this is equal to
99 the number of vertical statistics. */
100 uint32_t aligned_width; /** Stride of each grid line.
101 (= Horizontal number of grid cells
102 in table, which means
103 the allocated width.) */
104 uint32_t height; /** Height of DVS grid table.
105 (= Vertical number of grid cells
106 in table, which cells have effective
108 For DVS1, This is equal to
109 the number of horizontal statistics. */
110 uint32_t aligned_height;/** Stride of each grid column.
111 (= Vertical number of grid cells
112 in table, which means
113 the allocated height.) */
114 uint32_t bqs_per_grid_cell; /** Grid cell size in BQ(Bayer Quad) unit.
115 (1BQ means {Gr,R,B,Gb}(2x2 pixels).)
116 For DVS1, valid value is 64.
117 For DVS2, valid value is only 64,
119 uint32_t num_hor_coefs; /** Number of horizontal coefficients. */
120 uint32_t num_ver_coefs; /** Number of vertical coefficients. */
123 /* Number of DVS statistics levels
125 #define IA_CSS_DVS_STAT_NUM_OF_LEVELS 3
127 /* DVS statistics generated by accelerator global configuration
129 struct dvs_stat_public_dvs_global_cfg {
131 /** DVS statistics global configuration - kappa */
132 unsigned char match_shift;
133 /** DVS statistics global configuration - match_shift */
134 unsigned char ybin_mode;
135 /** DVS statistics global configuration - y binning mode */
138 /* DVS statistics generated by accelerator level grid
141 struct dvs_stat_public_dvs_level_grid_cfg {
142 unsigned char grid_width;
143 /** DVS statistics grid width */
144 unsigned char grid_height;
145 /** DVS statistics grid height */
146 unsigned char block_width;
147 /** DVS statistics block width */
148 unsigned char block_height;
149 /** DVS statistics block height */
152 /* DVS statistics generated by accelerator level grid start
155 struct dvs_stat_public_dvs_level_grid_start {
156 unsigned short x_start;
157 /** DVS statistics level x start */
158 unsigned short y_start;
159 /** DVS statistics level y start */
160 unsigned char enable;
161 /** DVS statistics level enable */
164 /* DVS statistics generated by accelerator level grid end
167 struct dvs_stat_public_dvs_level_grid_end {
168 unsigned short x_end;
169 /** DVS statistics level x end */
170 unsigned short y_end;
171 /** DVS statistics level y end */
174 /* DVS statistics generated by accelerator Feature Extraction
175 * Region Of Interest (FE-ROI) configuration
177 struct dvs_stat_public_dvs_level_fe_roi_cfg {
178 unsigned char x_start;
179 /** DVS statistics fe-roi level x start */
180 unsigned char y_start;
181 /** DVS statistics fe-roi level y start */
183 /** DVS statistics fe-roi level x end */
185 /** DVS statistics fe-roi level y end */
188 /* DVS statistics generated by accelerator public configuration
190 struct dvs_stat_public_dvs_grd_cfg {
191 struct dvs_stat_public_dvs_level_grid_cfg grd_cfg;
192 /** DVS statistics level grid configuration */
193 struct dvs_stat_public_dvs_level_grid_start grd_start;
194 /** DVS statistics level grid start configuration */
195 struct dvs_stat_public_dvs_level_grid_end grd_end;
196 /** DVS statistics level grid end configuration */
199 /* DVS statistics grid generated by accelerator
201 struct ia_css_dvs_stat_grid_info {
202 struct dvs_stat_public_dvs_global_cfg dvs_gbl_cfg;
203 /** DVS statistics global configuration (kappa, match, binning) */
204 struct dvs_stat_public_dvs_grd_cfg grd_cfg[IA_CSS_DVS_STAT_NUM_OF_LEVELS];
205 /** DVS statistics grid configuration (blocks and grids) */
206 struct dvs_stat_public_dvs_level_fe_roi_cfg fe_roi_cfg[IA_CSS_DVS_STAT_NUM_OF_LEVELS];
207 /** DVS statistics FE ROI (region of interest) configuration */
210 /* DVS statistics generated by accelerator default grid info
212 #define DEFAULT_DVS_GRID_INFO { \
214 { 0, 0, 0}, /* GBL CFG reg: kappa, match_shifrt, binning mode*/ \
215 {{{0, 0, 0, 0}, {0, 0, 0}, {0, 0} }, \
216 {{0, 0, 0, 0}, {0, 0, 0}, {0, 0} }, \
217 {{0, 0, 0, 0}, {0, 0, 0}, {0, 0} } }, \
218 {{0, 0, 0, 0}, {4, 0, 0, 0}, {0, 0, 0, 0} } } \
222 /* Union that holds all types of DVS statistics grid info in
225 union ia_css_dvs_grid_u {
226 struct ia_css_dvs_stat_grid_info dvs_stat_grid_info;
227 /** DVS statistics produced by accelerator grid info */
228 struct ia_css_dvs_grid_info dvs_grid_info;
229 /** DVS (DVS1/DVS2) grid info */
232 #endif /* __IA_CSS_SDIS_COMMON_TYPES_H */