• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Release Version: irci_stable_candrpv_0415_20150521_0458 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 
16 #ifndef _IA_CSS_TYPES_H
17 #define _IA_CSS_TYPES_H
18 
19 /** @file
20  * This file contains types used for the ia_css parameters.
21  * These types are in a separate file because they are expected
22  * to be used in software layers that do not access the CSS API
23  * directly but still need to forward parameters for it.
24  */
25 
26 #include <type_support.h>
27 
28 #include "ia_css_frac.h"
29 
30 #include "isp/kernels/aa/aa_2/ia_css_aa2_types.h"
31 #include "isp/kernels/anr/anr_1.0/ia_css_anr_types.h"
32 #include "isp/kernels/anr/anr_2/ia_css_anr2_types.h"
33 #include "isp/kernels/cnr/cnr_2/ia_css_cnr2_types.h"
34 #include "isp/kernels/csc/csc_1.0/ia_css_csc_types.h"
35 #include "isp/kernels/ctc/ctc_1.0/ia_css_ctc_types.h"
36 #include "isp/kernels/dp/dp_1.0/ia_css_dp_types.h"
37 #include "isp/kernels/de/de_1.0/ia_css_de_types.h"
38 #include "isp/kernels/de/de_2/ia_css_de2_types.h"
39 #include "isp/kernels/fc/fc_1.0/ia_css_formats_types.h"
40 #include "isp/kernels/fpn/fpn_1.0/ia_css_fpn_types.h"
41 #include "isp/kernels/gc/gc_1.0/ia_css_gc_types.h"
42 #include "isp/kernels/gc/gc_2/ia_css_gc2_types.h"
43 #include "isp/kernels/macc/macc_1.0/ia_css_macc_types.h"
44 #include "isp/kernels/ob/ob_1.0/ia_css_ob_types.h"
45 #include "isp/kernels/s3a/s3a_1.0/ia_css_s3a_types.h"
46 #include "isp/kernels/sc/sc_1.0/ia_css_sc_types.h"
47 #include "isp/kernels/sdis/sdis_1.0/ia_css_sdis_types.h"
48 #include "isp/kernels/sdis/sdis_2/ia_css_sdis2_types.h"
49 #include "isp/kernels/tnr/tnr_1.0/ia_css_tnr_types.h"
50 #include "isp/kernels/wb/wb_1.0/ia_css_wb_types.h"
51 #include "isp/kernels/xnr/xnr_1.0/ia_css_xnr_types.h"
52 #include "isp/kernels/xnr/xnr_3.0/ia_css_xnr3_types.h"
53 #ifdef ISP2401
54 #include "isp/kernels/tnr/tnr3/ia_css_tnr3_types.h"
55 #endif
56 #include "isp/kernels/ynr/ynr_1.0/ia_css_ynr_types.h"
57 #include "isp/kernels/ynr/ynr_2/ia_css_ynr2_types.h"
58 #include "isp/kernels/output/output_1.0/ia_css_output_types.h"
59 
60 #define IA_CSS_DVS_STAT_GRID_INFO_SUPPORTED
61 /**< Should be removed after Driver adaptation will be done */
62 
63 #define IA_CSS_VERSION_MAJOR    2
64 #define IA_CSS_VERSION_MINOR    0
65 #define IA_CSS_VERSION_REVISION 2
66 
67 #define IA_CSS_MORPH_TABLE_NUM_PLANES  6
68 
69 /* Min and max exposure IDs. These macros are here to allow
70  * the drivers to get this information. Changing these macros
71  * constitutes a CSS API change. */
72 #define IA_CSS_ISYS_MIN_EXPOSURE_ID 1   /**< Minimum exposure ID */
73 #define IA_CSS_ISYS_MAX_EXPOSURE_ID 250 /**< Maximum exposure ID */
74 
75 /* opaque types */
76 struct ia_css_isp_parameters;
77 struct ia_css_pipe;
78 struct ia_css_memory_offsets;
79 struct ia_css_config_memory_offsets;
80 struct ia_css_state_memory_offsets;
81 
82 /** Virtual address within the CSS address space. */
83 typedef uint32_t ia_css_ptr;
84 
85 /** Generic resolution structure.
86  */
87 struct ia_css_resolution {
88 	uint32_t width;  /**< Width */
89 	uint32_t height; /**< Height */
90 };
91 
92 /** Generic coordinate structure.
93  */
94 struct ia_css_coordinate {
95 	int32_t x;	/**< Value of a coordinate on the horizontal axis */
96 	int32_t y;	/**< Value of a coordinate on the vertical axis */
97 };
98 
99 /** Vector with signed values. This is used to indicate motion for
100  * Digital Image Stabilization.
101  */
102 struct ia_css_vector {
103 	int32_t x; /**< horizontal motion (in pixels) */
104 	int32_t y; /**< vertical motion (in pixels) */
105 };
106 
107 /* Short hands */
108 #define IA_CSS_ISP_DMEM IA_CSS_ISP_DMEM0
109 #define IA_CSS_ISP_VMEM IA_CSS_ISP_VMEM0
110 
111 /** CSS data descriptor */
112 struct ia_css_data {
113 	ia_css_ptr address; /**< CSS virtual address */
114 	uint32_t   size;    /**< Disabled if 0 */
115 };
116 
117 /** Host data descriptor */
118 struct ia_css_host_data {
119 	char      *address; /**< Host address */
120 	uint32_t   size;    /**< Disabled if 0 */
121 };
122 
123 /** ISP data descriptor */
124 struct ia_css_isp_data {
125 	uint32_t   address; /**< ISP address */
126 	uint32_t   size;    /**< Disabled if 0 */
127 };
128 
129 /** Shading Correction types. */
130 enum ia_css_shading_correction_type {
131 #ifndef ISP2401
132 	IA_CSS_SHADING_CORRECTION_TYPE_1 /**< Shading Correction 1.0 (pipe 1.0 on ISP2300, pipe 2.2 on ISP2400) */
133 #else
134 	IA_CSS_SHADING_CORRECTION_NONE,	 /**< Shading Correction is not processed in the pipe. */
135 	IA_CSS_SHADING_CORRECTION_TYPE_1 /**< Shading Correction 1.0 (pipe 1.0 on ISP2300, pipe 2.2 on ISP2400/2401) */
136 #endif
137 
138 	/**< More shading correction types can be added in the future. */
139 };
140 
141 /** Shading Correction information. */
142 struct ia_css_shading_info {
143 	enum ia_css_shading_correction_type type; /**< Shading Correction type. */
144 
145 	union {	/** Shading Correction information of each Shading Correction types. */
146 
147 		/** Shading Correction information of IA_CSS_SHADING_CORRECTION_TYPE_1.
148 		 *
149 		 *  This structure contains the information necessary to generate
150 		 *  the shading table required in the isp.
151 		 *  This structure is filled in the css,
152 		 *  and the driver needs to get it to generate the shading table.
153 		 *
154 		 *  Before the shading correction is applied, NxN-filter and/or scaling
155 		 *  are applied in the isp, depending on the isp binaries.
156 		 *  Then, these should be considered in generating the shading table.
157 		 *    - Bad pixels on left/top sides generated by NxN-filter
158 		 *      (Bad pixels are NOT considered currently,
159 		 *      because they are subtle.)
160 		 *    - Down-scaling/Up-scaling factor
161 		 *
162 		 *  Shading correction is applied to the area
163 		 *  which has real sensor data and margin.
164 		 *  Then, the shading table should cover the area including margin.
165 		 *  This structure has this information.
166 		 *    - Origin coordinate of bayer (real sensor data)
167 		 *      on the shading table
168 		 *
169 		 * ------------------------ISP 2401-----------------------
170 		 *
171 		 *  the shading table directly required from ISP.
172 		 *  This structure is filled in CSS, and the driver needs to get it to generate the shading table.
173 		 *
174 		 *  The shading correction is applied to the bayer area which contains sensor data and padding data.
175 		 *  The shading table should cover this bayer area.
176 		 *
177 		 *  The shading table size directly required from ISP is expressed by these parameters.
178 		 *    1. uint32_t num_hor_grids;
179 		 *    2. uint32_t num_ver_grids;
180 		 *    3. uint32_t bqs_per_grid_cell;
181 		 *
182 		 *  In some isp binaries, the bayer scaling is applied before the shading correction is applied.
183 		 *  Then, this scaling factor should be considered in generating the shading table.
184 		 *  The scaling factor is expressed by these parameters.
185 		 *    4. uint32_t bayer_scale_hor_ratio_in;
186 		 *    5. uint32_t bayer_scale_hor_ratio_out;
187 		 *    6. uint32_t bayer_scale_ver_ratio_in;
188 		 *    7. uint32_t bayer_scale_ver_ratio_out;
189 		 *
190 		 *  The sensor data size inputted to ISP is expressed by this parameter.
191 		 *  This is the size BEFORE the bayer scaling is applied.
192 		 *    8. struct ia_css_resolution isp_input_sensor_data_res_bqs;
193 		 *
194 		 *  The origin of the sensor data area positioned on the shading table at the shading correction
195 		 *  is expressed by this parameter.
196 		 *  The size of this area assumes the size AFTER the bayer scaling is applied
197 		 *  to the isp_input_sensor_data_resolution_bqs.
198 		 *    9. struct ia_css_coordinate sensor_data_origin_bqs_on_sctbl;
199 		 *
200 		 *  ****** Definitions of the shading table and the sensor data at the shading correction ******
201 		 *
202 		 * (0,0)--------------------- TW -------------------------------
203 		 *   |                                            shading table |
204 		 *   |      (ox,oy)---------- W --------------------------      |
205 		 *   |        |                               sensor data |     |
206 		 *   |        |                                           |     |
207 		 *  TH        H             sensor data center            |     |
208 		 *   |        |                  (cx,cy)                  |     |
209 		 *   |        |                                           |     |
210 		 *   |        |                                           |     |
211 		 *   |        |                                           |     |
212 		 *   |         -------------------------------------------      |
213 		 *   |                                                          |
214 		 *    ----------------------------------------------------------
215 		 *
216 		 *    Example of still mode for output 1080p:
217 		 *
218 		 *    num_hor_grids = 66
219 		 *    num_ver_grids = 37
220 		 *    bqs_per_grid_cell = 16
221 		 *    bayer_scale_hor_ratio_in = 1
222 		 *    bayer_scale_hor_ratio_out = 1
223 		 *    bayer_scale_ver_ratio_in = 1
224 		 *    bayer_scale_ver_ratio_out = 1
225 		 *    isp_input_sensor_data_resolution_bqs = {966, 546}
226 		 *    sensor_data_origin_bqs_on_sctbl = {61, 15}
227 		 *
228 		 *    TW, TH [bqs]: width and height of shading table
229 		 *        TW = (num_hor_grids - 1) * bqs_per_grid_cell = (66 - 1) * 16 = 1040
230 		 *        TH = (num_ver_grids - 1) * bqs_per_grid_cell = (37 - 1) * 16 = 576
231 		 *
232 		 *    W, H [bqs]: width and height of sensor data at shading correction
233 		 *        W = sensor_data_res_bqs.width
234 		 *          = isp_input_sensor_data_res_bqs.width
235 		 *              * bayer_scale_hor_ratio_out / bayer_scale_hor_ratio_in + 0.5 = 966
236 		 *        H = sensor_data_res_bqs.height
237 		 *          = isp_input_sensor_data_res_bqs.height
238 		 *               * bayer_scale_ver_ratio_out / bayer_scale_ver_ratio_in + 0.5 = 546
239 		 *
240 		 *    (ox, oy) [bqs]: origin of sensor data positioned on shading table at shading correction
241 		 *        ox = sensor_data_origin_bqs_on_sctbl.x = 61
242 		 *        oy = sensor_data_origin_bqs_on_sctbl.y = 15
243 		 *
244 		 *    (cx, cy) [bqs]: center of sensor data positioned on shading table at shading correction
245 		 *        cx = ox + W/2 = 61 + 966/2 = 544
246 		 *        cy = oy + H/2 = 15 + 546/2 = 288
247 		 *
248 		 *  ****** Relation between the shading table and the sensor data ******
249 		 *
250 		 *    The origin of the sensor data should be on the shading table.
251 		 *        0 <= ox < TW,  0 <= oy < TH
252 		 *
253 		 *  ****** How to center the shading table on the sensor data ******
254 		 *
255 		 *    To center the shading table on the sensor data,
256 		 *    CSS decides the shading table size so that a certain grid point is positioned
257 		 *    on the center of the sensor data at the shading correction.
258 		 *    CSS expects the shading center is set on this grid point
259 		 *    when the shading table data is calculated in AIC.
260 		 *
261 		 *    W, H [bqs]: width and height of sensor data at shading correction
262 		 *	W = sensor_data_res_bqs.width
263 		 *	H = sensor_data_res_bqs.height
264 		 *
265 		 *    (cx, cy) [bqs]: center of sensor data positioned on shading table at shading correction
266 		 *	cx = sensor_data_origin_bqs_on_sctbl.x + W/2
267 		 *	cy = sensor_data_origin_bqs_on_sctbl.y + H/2
268 		 *
269 		 *    CSS decides the shading table size and the sensor data position
270 		 *    so that the (cx, cy) satisfies this condition.
271 		 *	mod(cx, bqs_per_grid_cell) = 0
272 		 *	mod(cy, bqs_per_grid_cell) = 0
273 		 *
274 		 *  ****** How to change the sensor data size by processes in the driver and ISP ******
275 		 *
276 		 *    1. sensor data size: Physical sensor size
277 		 *			   (The struct ia_css_shading_info does not have this information.)
278 		 *    2. process:          Driver applies the sensor cropping/binning/scaling to physical sensor size.
279 		 *    3. sensor data size: ISP input size (== shading_info.isp_input_sensor_data_res_bqs)
280 		 *			   (ISP assumes the ISP input sensor data is centered on the physical sensor.)
281 		 *    4. process:          ISP applies the bayer scaling by the factor of shading_info.bayer_scale_*.
282 		 *    5. sensor data size: Scaling factor * ISP input size (== shading_info.sensor_data_res_bqs)
283 		 *    6. process:          ISP applies the shading correction.
284 		 *
285 		 *  ISP block: SC1
286 		 *  ISP1: SC1 is used.
287 		 *  ISP2: SC1 is used.
288 		 */
289 		struct {
290 #ifndef ISP2401
291 			uint32_t enable;	/**< Shading correction enabled.
292 						     0:disabled, 1:enabled */
293 			uint32_t num_hor_grids;	/**< Number of data points per line
294 						     per color on shading table. */
295 			uint32_t num_ver_grids;	/**< Number of lines of data points
296 						     per color on shading table. */
297 			uint32_t bqs_per_grid_cell; /**< Grid cell size
298 						in BQ(Bayer Quad) unit.
299 						(1BQ means {Gr,R,B,Gb}(2x2 pixels).)
300 						Valid values are 8,16,32,64. */
301 #else
302 			uint32_t num_hor_grids;	/**< Number of data points per line per color on shading table. */
303 			uint32_t num_ver_grids;	/**< Number of lines of data points per color on shading table. */
304 			uint32_t bqs_per_grid_cell; /**< Grid cell size in BQ unit.
305 							 NOTE: bqs = size in BQ(Bayer Quad) unit.
306 							       1BQ means {Gr,R,B,Gb} (2x2 pixels).
307 							       Horizontal 1 bqs corresponds to horizontal 2 pixels.
308 							       Vertical 1 bqs corresponds to vertical 2 pixels. */
309 #endif
310 			uint32_t bayer_scale_hor_ratio_in;
311 			uint32_t bayer_scale_hor_ratio_out;
312 #ifndef ISP2401
313 			/**< Horizontal ratio of bayer scaling
314 			between input width and output width, for the scaling
315 			which should be done before shading correction.
316 			  output_width = input_width * bayer_scale_hor_ratio_out
317 						/ bayer_scale_hor_ratio_in */
318 #else
319 				/**< Horizontal ratio of bayer scaling between input width and output width,
320 				     for the scaling which should be done before shading correction.
321 					output_width = input_width * bayer_scale_hor_ratio_out
322 									/ bayer_scale_hor_ratio_in + 0.5 */
323 #endif
324 			uint32_t bayer_scale_ver_ratio_in;
325 			uint32_t bayer_scale_ver_ratio_out;
326 #ifndef ISP2401
327 			/**< Vertical ratio of bayer scaling
328 			between input height and output height, for the scaling
329 			which should be done before shading correction.
330 			  output_height = input_height * bayer_scale_ver_ratio_out
331 						/ bayer_scale_ver_ratio_in */
332 			uint32_t sc_bayer_origin_x_bqs_on_shading_table;
333 			/**< X coordinate (in bqs) of bayer origin on shading table.
334 			This indicates the left-most pixel of bayer
335 			(not include margin) inputted to the shading correction.
336 			This corresponds to the left-most pixel of bayer
337 			inputted to isp from sensor. */
338 			uint32_t sc_bayer_origin_y_bqs_on_shading_table;
339 			/**< Y coordinate (in bqs) of bayer origin on shading table.
340 			This indicates the top pixel of bayer
341 			(not include margin) inputted to the shading correction.
342 			This corresponds to the top pixel of bayer
343 			inputted to isp from sensor. */
344 #else
345 				/**< Vertical ratio of bayer scaling between input height and output height,
346 				     for the scaling which should be done before shading correction.
347 					output_height = input_height * bayer_scale_ver_ratio_out
348 									/ bayer_scale_ver_ratio_in + 0.5 */
349 			struct ia_css_resolution isp_input_sensor_data_res_bqs;
350 				/**< Sensor data size (in bqs) inputted to ISP. This is the size BEFORE bayer scaling.
351 				     NOTE: This is NOT the size of the physical sensor size.
352 					   CSS requests the driver that ISP inputs sensor data
353 					   by the size of isp_input_sensor_data_res_bqs.
354 					   The driver sends the sensor data to ISP,
355 					   after the adequate cropping/binning/scaling
356 					   are applied to the physical sensor data area.
357 					   ISP assumes the area of isp_input_sensor_data_res_bqs
358 					   is centered on the physical sensor. */
359 			struct ia_css_resolution sensor_data_res_bqs;
360 				/**< Sensor data size (in bqs) at shading correction.
361 				     This is the size AFTER bayer scaling. */
362 			struct ia_css_coordinate sensor_data_origin_bqs_on_sctbl;
363 				/**< Origin of sensor data area positioned on shading table at shading correction.
364 				     The coordinate x,y should be positive values. */
365 #endif
366 		} type_1;
367 
368 		/**< More structures can be added here when more shading correction types will be added
369 		     in the future. */
370 	} info;
371 };
372 
373 #ifndef ISP2401
374 
375 /** Default Shading Correction information of Shading Correction Type 1. */
376 #define DEFAULT_SHADING_INFO_TYPE_1 \
377 { \
378 	IA_CSS_SHADING_CORRECTION_TYPE_1,	/* type */ \
379 	{					/* info */ \
380 		{ \
381 			0,	/* enable */ \
382 			0,	/* num_hor_grids */ \
383 			0,	/* num_ver_grids */ \
384 			0,	/* bqs_per_grid_cell */ \
385 			1,	/* bayer_scale_hor_ratio_in */ \
386 			1,	/* bayer_scale_hor_ratio_out */ \
387 			1,	/* bayer_scale_ver_ratio_in */ \
388 			1,	/* bayer_scale_ver_ratio_out */ \
389 			0,	/* sc_bayer_origin_x_bqs_on_shading_table */ \
390 			0	/* sc_bayer_origin_y_bqs_on_shading_table */ \
391 		} \
392 	} \
393 }
394 
395 #else
396 
397 /** Default Shading Correction information of Shading Correction Type 1. */
398 #define DEFAULT_SHADING_INFO_TYPE_1 \
399 { \
400 	IA_CSS_SHADING_CORRECTION_TYPE_1,	/* type */ \
401 	{					/* info */ \
402 		{ \
403 			0,			/* num_hor_grids */ \
404 			0,			/* num_ver_grids */ \
405 			0,			/* bqs_per_grid_cell */ \
406 			1,			/* bayer_scale_hor_ratio_in */ \
407 			1,			/* bayer_scale_hor_ratio_out */ \
408 			1,			/* bayer_scale_ver_ratio_in */ \
409 			1,			/* bayer_scale_ver_ratio_out */ \
410 			{0, 0},			/* isp_input_sensor_data_res_bqs */ \
411 			{0, 0},			/* sensor_data_res_bqs */ \
412 			{0, 0}			/* sensor_data_origin_bqs_on_sctbl */ \
413 		} \
414 	} \
415 }
416 
417 #endif
418 
419 /** Default Shading Correction information. */
420 #define DEFAULT_SHADING_INFO	DEFAULT_SHADING_INFO_TYPE_1
421 
422 /** structure that describes the 3A and DIS grids */
423 struct ia_css_grid_info {
424 	/** \name ISP input size
425 	  * that is visible for user
426 	  * @{
427 	  */
428 	uint32_t isp_in_width;
429 	uint32_t isp_in_height;
430 	/** @}*/
431 
432 	struct ia_css_3a_grid_info  s3a_grid; /**< 3A grid info */
433 	union ia_css_dvs_grid_u dvs_grid;
434 		/**< All types of DVS statistics grid info union */
435 
436 	enum ia_css_vamem_type vamem_type;
437 };
438 
439 /** defaults for ia_css_grid_info structs */
440 #define DEFAULT_GRID_INFO \
441 { \
442 	0,				/* isp_in_width */ \
443 	0,				/* isp_in_height */ \
444 	DEFAULT_3A_GRID_INFO,		/* s3a_grid */ \
445 	DEFAULT_DVS_GRID_INFO,		/* dvs_grid */ \
446 	IA_CSS_VAMEM_TYPE_1		/* vamem_type */ \
447 }
448 
449 /** Morphing table, used for geometric distortion and chromatic abberration
450  *  correction (GDCAC, also called GDC).
451  *  This table describes the imperfections introduced by the lens, the
452  *  advanced ISP can correct for these imperfections using this table.
453  */
454 struct ia_css_morph_table {
455 	uint32_t enable; /**< To disable GDC, set this field to false. The
456 			  coordinates fields can be set to NULL in this case. */
457 	uint32_t height; /**< Table height */
458 	uint32_t width;  /**< Table width */
459 	uint16_t *coordinates_x[IA_CSS_MORPH_TABLE_NUM_PLANES];
460 	/**< X coordinates that describe the sensor imperfection */
461 	uint16_t *coordinates_y[IA_CSS_MORPH_TABLE_NUM_PLANES];
462 	/**< Y coordinates that describe the sensor imperfection */
463 };
464 
465 struct ia_css_dvs_6axis_config {
466 	unsigned int exp_id;
467 	/**< Exposure ID, see ia_css_event_public.h for more detail */
468 	uint32_t width_y;
469 	uint32_t height_y;
470 	uint32_t width_uv;
471 	uint32_t height_uv;
472 	uint32_t *xcoords_y;
473 	uint32_t *ycoords_y;
474 	uint32_t *xcoords_uv;
475 	uint32_t *ycoords_uv;
476 };
477 
478 /**
479  * This specifies the coordinates (x,y)
480  */
481 struct ia_css_point {
482 	int32_t x; /**< x coordinate */
483 	int32_t y; /**< y coordinate */
484 };
485 
486 /**
487  * This specifies the region
488  */
489 struct ia_css_region {
490 	struct ia_css_point origin; /**< Starting point coordinates for the region */
491 	struct ia_css_resolution resolution; /**< Region resolution */
492 };
493 
494 /**
495  * Digital zoom:
496  * This feature is currently available only for video, but will become
497  * available for preview and capture as well.
498  * Set the digital zoom factor, this is a logarithmic scale. The actual zoom
499  * factor will be 64/x.
500  * Setting dx or dy to 0 disables digital zoom for that direction.
501  * New API change for Digital zoom:(added struct ia_css_region zoom_region)
502  * zoom_region specifies the origin of the zoom region and width and
503  * height of that region.
504  * origin : This is the coordinate (x,y) within the effective input resolution
505  * of the stream. where, x >= 0 and y >= 0. (0,0) maps to the upper left of the
506  * effective input resolution.
507  * resolution : This is resolution of zoom region.
508  * where, x + width <= effective input width
509  * y + height <= effective input height
510  */
511 struct ia_css_dz_config {
512 	uint32_t dx; /**< Horizontal zoom factor */
513 	uint32_t dy; /**< Vertical zoom factor */
514 	struct ia_css_region zoom_region; /**< region for zoom */
515 };
516 
517 /** The still capture mode, this can be RAW (simply copy sensor input to DDR),
518  *  Primary ISP, the Advanced ISP (GDC) or the low-light ISP (ANR).
519  */
520 enum ia_css_capture_mode {
521 	IA_CSS_CAPTURE_MODE_RAW,      /**< no processing, copy data only */
522 	IA_CSS_CAPTURE_MODE_BAYER,    /**< bayer processing, up to demosaic */
523 	IA_CSS_CAPTURE_MODE_PRIMARY,  /**< primary ISP */
524 	IA_CSS_CAPTURE_MODE_ADVANCED, /**< advanced ISP (GDC) */
525 	IA_CSS_CAPTURE_MODE_LOW_LIGHT /**< low light ISP (ANR) */
526 };
527 
528 struct ia_css_capture_config {
529 	enum ia_css_capture_mode mode; /**< Still capture mode */
530 	uint32_t enable_xnr;	       /**< Enable/disable XNR */
531 	uint32_t enable_raw_output;
532 	bool enable_capture_pp_bli;    /**< Enable capture_pp_bli mode */
533 };
534 
535 /** default settings for ia_css_capture_config structs */
536 #define DEFAULT_CAPTURE_CONFIG \
537 { \
538 	IA_CSS_CAPTURE_MODE_PRIMARY,	/* mode (capture) */ \
539 	false,				/* enable_xnr */ \
540 	false,				/* enable_raw_output */ \
541 	false				/* enable_capture_pp_bli */ \
542 }
543 
544 
545 /** ISP filter configuration. This is a collection of configurations
546  *  for each of the ISP filters (modules).
547  *
548  *  NOTE! The contents of all pointers is copied when get or set with the
549  *  exception of the shading and morph tables. For these we only copy the
550  *  pointer, so the caller must make sure the memory contents of these pointers
551  *  remain valid as long as they are used by the CSS. This will be fixed in the
552  *  future by copying the contents instead of just the pointer.
553  *
554  *  Comment:
555  *    ["ISP block", 1&2]   : ISP block is used both for ISP1 and ISP2.
556  *    ["ISP block", 1only] : ISP block is used only for ISP1.
557  *    ["ISP block", 2only] : ISP block is used only for ISP2.
558  */
559 struct ia_css_isp_config {
560 	struct ia_css_wb_config   *wb_config;	/**< White Balance
561 							[WB1, 1&2] */
562 	struct ia_css_cc_config   *cc_config;	/**< Color Correction
563 							[CSC1, 1only] */
564 	struct ia_css_tnr_config  *tnr_config;	/**< Temporal Noise Reduction
565 							[TNR1, 1&2] */
566 	struct ia_css_ecd_config  *ecd_config;	/**< Eigen Color Demosaicing
567 							[DE2, 2only] */
568 	struct ia_css_ynr_config  *ynr_config;	/**< Y(Luma) Noise Reduction
569 							[YNR2&YEE2, 2only] */
570 	struct ia_css_fc_config   *fc_config;	/**< Fringe Control
571 							[FC2, 2only] */
572 	struct ia_css_formats_config   *formats_config;	/**< Formats Control for main output
573 							[FORMATS, 1&2] */
574 	struct ia_css_cnr_config  *cnr_config;	/**< Chroma Noise Reduction
575 							[CNR2, 2only] */
576 	struct ia_css_macc_config *macc_config;	/**< MACC
577 							[MACC2, 2only] */
578 	struct ia_css_ctc_config  *ctc_config;	/**< Chroma Tone Control
579 							[CTC2, 2only] */
580 	struct ia_css_aa_config   *aa_config;	/**< YUV Anti-Aliasing
581 							[AA2, 2only]
582 							(not used currently) */
583 	struct ia_css_aa_config   *baa_config;	/**< Bayer Anti-Aliasing
584 							[BAA2, 1&2] */
585 	struct ia_css_ce_config   *ce_config;	/**< Chroma Enhancement
586 							[CE1, 1only] */
587 	struct ia_css_dvs_6axis_config *dvs_6axis_config;
588 	struct ia_css_ob_config   *ob_config;  /**< Objective Black
589 							[OB1, 1&2] */
590 	struct ia_css_dp_config   *dp_config;  /**< Defect Pixel Correction
591 							[DPC1/DPC2, 1&2] */
592 	struct ia_css_nr_config   *nr_config;  /**< Noise Reduction
593 							[BNR1&YNR1&CNR1, 1&2]*/
594 	struct ia_css_ee_config   *ee_config;  /**< Edge Enhancement
595 							[YEE1, 1&2] */
596 	struct ia_css_de_config   *de_config;  /**< Demosaic
597 							[DE1, 1only] */
598 	struct ia_css_gc_config   *gc_config;  /**< Gamma Correction (for YUV)
599 							[GC1, 1only] */
600 	struct ia_css_anr_config  *anr_config; /**< Advanced Noise Reduction */
601 	struct ia_css_3a_config   *s3a_config; /**< 3A Statistics config */
602 	struct ia_css_xnr_config  *xnr_config; /**< eXtra Noise Reduction */
603 	struct ia_css_dz_config   *dz_config;  /**< Digital Zoom */
604 	struct ia_css_cc_config *yuv2rgb_cc_config; /**< Color Correction
605 							[CCM2, 2only] */
606 	struct ia_css_cc_config *rgb2yuv_cc_config; /**< Color Correction
607 							[CSC2, 2only] */
608 	struct ia_css_macc_table  *macc_table;	/**< MACC
609 							[MACC1/MACC2, 1&2]*/
610 	struct ia_css_gamma_table *gamma_table;	/**< Gamma Correction (for YUV)
611 							[GC1, 1only] */
612 	struct ia_css_ctc_table   *ctc_table;	/**< Chroma Tone Control
613 							[CTC1, 1only] */
614 
615 	/** \deprecated */
616 	struct ia_css_xnr_table   *xnr_table;	/**< eXtra Noise Reduction
617 							[XNR1, 1&2] */
618 	struct ia_css_rgb_gamma_table *r_gamma_table;/**< sRGB Gamma Correction
619 							[GC2, 2only] */
620 	struct ia_css_rgb_gamma_table *g_gamma_table;/**< sRGB Gamma Correction
621 							[GC2, 2only] */
622 	struct ia_css_rgb_gamma_table *b_gamma_table;/**< sRGB Gamma Correction
623 							[GC2, 2only] */
624 	struct ia_css_vector      *motion_vector; /**< For 2-axis DVS */
625 	struct ia_css_shading_table *shading_table;
626 	struct ia_css_morph_table   *morph_table;
627 	struct ia_css_dvs_coefficients *dvs_coefs; /**< DVS 1.0 coefficients */
628 	struct ia_css_dvs2_coefficients *dvs2_coefs; /**< DVS 2.0 coefficients */
629 	struct ia_css_capture_config   *capture_config;
630 	struct ia_css_anr_thres   *anr_thres;
631 	/** @deprecated{Old shading settings, see bugzilla bz675 for details} */
632 	struct ia_css_shading_settings *shading_settings;
633 	struct ia_css_xnr3_config *xnr3_config; /**< eXtreme Noise Reduction v3 */
634 	/** comment from Lasse: Be aware how this feature will affect coordinate
635 	 *  normalization in different parts of the system. (e.g. face detection,
636 	 *  touch focus, 3A statistics and windows of interest, shading correction,
637 	 *  DVS, GDC) from IQ tool level and application level down-to ISP FW level.
638 	 *  the risk for regression is not in the individual blocks, but how they
639 	 *  integrate together. */
640 	struct ia_css_output_config   *output_config;	/**< Main Output Mirroring, flipping */
641 
642 #ifdef ISP2401
643 	struct ia_css_tnr3_kernel_config         *tnr3_config;           /**< TNR3 config */
644 #endif
645 	struct ia_css_scaler_config              *scaler_config;         /**< Skylake: scaler config (optional) */
646 	struct ia_css_formats_config             *formats_config_display;/**< Formats control for viewfinder/display output (optional)
647 										[OSYS, n/a] */
648 	struct ia_css_output_config              *output_config_display; /**< Viewfinder/display output mirroring, flipping (optional) */
649 
650 	struct ia_css_frame                      *output_frame;          /**< Output frame the config is to be applied to (optional) */
651 	uint32_t			isp_config_id;	/**< Unique ID to track which config was actually applied to a particular frame */
652 };
653 
654 #endif /* _IA_CSS_TYPES_H */
655