1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
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.
8  *
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
12  * more details.
13  */
14 
15 #ifndef _SH_CSS_DEFS_H_
16 #define _SH_CSS_DEFS_H_
17 
18 #include "isp.h"
19 
20 /*#include "vamem.h"*/ /* Cannot include for VAMEM properties this file is visible on ISP -> pipeline generator */
21 
22 #include "math_support.h"	/* max(), min, etc etc */
23 
24 /* ID's for refcount */
25 #define IA_CSS_REFCOUNT_PARAM_SET_POOL  0xCAFE0001
26 #define IA_CSS_REFCOUNT_PARAM_BUFFER    0xCAFE0002
27 
28 /* Digital Image Stabilization */
29 #define SH_CSS_DIS_DECI_FACTOR_LOG2       6
30 
31 /* UV offset: 1:uv=-128...127, 0:uv=0...255 */
32 #define SH_CSS_UV_OFFSET_IS_0             0
33 
34 /* Bits of bayer is adjusted as 13 in ISP */
35 #define SH_CSS_BAYER_BITS                 13
36 
37 /* Max value of bayer data (unsigned 13bit in ISP) */
38 #define SH_CSS_BAYER_MAXVAL               ((1U << SH_CSS_BAYER_BITS) - 1)
39 
40 /* Bits of yuv in ISP */
41 #define SH_CSS_ISP_YUV_BITS               8
42 
43 #define SH_CSS_DP_GAIN_SHIFT              5
44 #define SH_CSS_BNR_GAIN_SHIFT             13
45 #define SH_CSS_YNR_GAIN_SHIFT             13
46 #define SH_CSS_AE_YCOEF_SHIFT             13
47 #define SH_CSS_AF_FIR_SHIFT               13
48 #define SH_CSS_YEE_DETAIL_GAIN_SHIFT      8  /* [u5.8] */
49 #define SH_CSS_YEE_SCALE_SHIFT            8
50 #define SH_CSS_TNR_COEF_SHIFT             13
51 #define SH_CSS_MACC_COEF_SHIFT            11 /* [s2.11] for ISP1 */
52 #define SH_CSS_MACC2_COEF_SHIFT           13 /* [s[exp].[13-exp]] for ISP2 */
53 #define SH_CSS_DIS_COEF_SHIFT             13
54 
55 /* enumeration of the bayer downscale factors. When a binary supports multiple
56  * factors, the OR of these defines is used to build the mask of supported
57  * factors. The BDS factor is used in pre-processor expressions so we cannot
58  * use an enum here. */
59 #define SH_CSS_BDS_FACTOR_1_00	(0)
60 #define SH_CSS_BDS_FACTOR_1_25	(1)
61 #define SH_CSS_BDS_FACTOR_1_50	(2)
62 #define SH_CSS_BDS_FACTOR_2_00	(3)
63 #define SH_CSS_BDS_FACTOR_2_25	(4)
64 #define SH_CSS_BDS_FACTOR_2_50	(5)
65 #define SH_CSS_BDS_FACTOR_3_00	(6)
66 #define SH_CSS_BDS_FACTOR_4_00	(7)
67 #define SH_CSS_BDS_FACTOR_4_50	(8)
68 #define SH_CSS_BDS_FACTOR_5_00	(9)
69 #define SH_CSS_BDS_FACTOR_6_00	(10)
70 #define SH_CSS_BDS_FACTOR_8_00	(11)
71 #define NUM_BDS_FACTORS		(12)
72 
73 #define PACK_BDS_FACTOR(factor)	(1 << (factor))
74 
75 /* Following macros should match with the type enum ia_css_pipe_version in
76  * ia_css_pipe_public.h. The reason to add these macros is that enum type
77  * will be evaluted to 0 in preprocessing time. */
78 #define SH_CSS_ISP_PIPE_VERSION_1	1
79 #define SH_CSS_ISP_PIPE_VERSION_2_2	2
80 #define SH_CSS_ISP_PIPE_VERSION_2_6_1	3
81 #define SH_CSS_ISP_PIPE_VERSION_2_7	4
82 
83 /*--------------- sRGB Gamma -----------------
84 CCM        : YCgCo[0,8191] -> RGB[0,4095]
85 sRGB Gamma : RGB  [0,4095] -> RGB[0,8191]
86 CSC        : RGB  [0,8191] -> YUV[0,8191]
87 
88 CCM:
89 Y[0,8191],CgCo[-4096,4095],coef[-8192,8191] -> RGB[0,4095]
90 
91 sRGB Gamma:
92 RGB[0,4095] -(interpolation step16)-> RGB[0,255] -(LUT 12bit)-> RGB[0,4095] -> RGB[0,8191]
93 
94 CSC:
95 RGB[0,8191],coef[-8192,8191] -> RGB[0,8191]
96 --------------------------------------------*/
97 /* Bits of input/output of sRGB Gamma */
98 #define SH_CSS_RGB_GAMMA_INPUT_BITS       12 /* [0,4095] */
99 #define SH_CSS_RGB_GAMMA_OUTPUT_BITS      13 /* [0,8191] */
100 
101 /* Bits of fractional part of interpolation in vamem, [0,4095]->[0,255] */
102 #define SH_CSS_RGB_GAMMA_FRAC_BITS        \
103 	(SH_CSS_RGB_GAMMA_INPUT_BITS - SH_CSS_ISP_RGB_GAMMA_TABLE_SIZE_LOG2)
104 #define SH_CSS_RGB_GAMMA_ONE              BIT(SH_CSS_RGB_GAMMA_FRAC_BITS)
105 
106 /* Bits of input of CCM,  = 13, Y[0,8191],CgCo[-4096,4095] */
107 #define SH_CSS_YUV2RGB_CCM_INPUT_BITS     SH_CSS_BAYER_BITS
108 
109 /* Bits of output of CCM,  = 12, RGB[0,4095] */
110 #define SH_CSS_YUV2RGB_CCM_OUTPUT_BITS    SH_CSS_RGB_GAMMA_INPUT_BITS
111 
112 /* Maximum value of output of CCM */
113 #define SH_CSS_YUV2RGB_CCM_MAX_OUTPUT     \
114 	((1 << SH_CSS_YUV2RGB_CCM_OUTPUT_BITS) - 1)
115 
116 #define SH_CSS_NUM_INPUT_BUF_LINES        4
117 
118 /* Left cropping only applicable for sufficiently large nway */
119 #if ISP_VEC_NELEMS == 16
120 #define SH_CSS_MAX_LEFT_CROPPING          0
121 #define SH_CSS_MAX_TOP_CROPPING           0
122 #else
123 #define SH_CSS_MAX_LEFT_CROPPING          12
124 #define SH_CSS_MAX_TOP_CROPPING           12
125 #endif
126 
127 #define	SH_CSS_SP_MAX_WIDTH               1280
128 
129 /* This is the maximum grid we can handle in the ISP binaries.
130  * The host code makes sure no bigger grid is ever selected. */
131 #define SH_CSS_MAX_BQ_GRID_WIDTH          80
132 #define SH_CSS_MAX_BQ_GRID_HEIGHT         60
133 
134 /* The minimum dvs envelope is 12x12(for IPU2) to make sure the
135  * invalid rows/columns that result from filter initialization are skipped. */
136 #define SH_CSS_MIN_DVS_ENVELOPE           12U
137 
138 /* The FPGA system (vec_nelems == 16) only supports upto 5MP */
139 #if ISP_VEC_NELEMS == 16
140 #define SH_CSS_MAX_SENSOR_WIDTH           2560
141 #define SH_CSS_MAX_SENSOR_HEIGHT          1920
142 #else
143 #define SH_CSS_MAX_SENSOR_WIDTH           4608
144 #define SH_CSS_MAX_SENSOR_HEIGHT          3450
145 #endif
146 
147 /* Limited to reduce vmem pressure */
148 #if ISP_VMEM_DEPTH >= 3072
149 #define SH_CSS_MAX_CONTINUOUS_SENSOR_WIDTH  SH_CSS_MAX_SENSOR_WIDTH
150 #define SH_CSS_MAX_CONTINUOUS_SENSOR_HEIGHT SH_CSS_MAX_SENSOR_HEIGHT
151 #else
152 #define SH_CSS_MAX_CONTINUOUS_SENSOR_WIDTH  3264
153 #define SH_CSS_MAX_CONTINUOUS_SENSOR_HEIGHT 2448
154 #endif
155 /* When using bayer decimation */
156 /*
157 #define SH_CSS_MAX_CONTINUOUS_SENSOR_WIDTH_DEC  4224
158 #define SH_CSS_MAX_CONTINUOUS_SENSOR_HEIGHT_DEC 3168
159 */
160 #define SH_CSS_MAX_CONTINUOUS_SENSOR_WIDTH_DEC  SH_CSS_MAX_SENSOR_WIDTH
161 #define SH_CSS_MAX_CONTINUOUS_SENSOR_HEIGHT_DEC SH_CSS_MAX_SENSOR_HEIGHT
162 
163 #define SH_CSS_MIN_SENSOR_WIDTH           2
164 #define SH_CSS_MIN_SENSOR_HEIGHT          2
165 
166 /*
167 #define SH_CSS_MAX_VF_WIDTH_DEC               1920
168 #define SH_CSS_MAX_VF_HEIGHT_DEC              1080
169 */
170 #define SH_CSS_MAX_VF_WIDTH_DEC               SH_CSS_MAX_VF_WIDTH
171 #define SH_CSS_MAX_VF_HEIGHT_DEC              SH_CSS_MAX_VF_HEIGHT
172 
173 /* We use 16 bits per coordinate component, including integer
174    and fractional bits */
175 #define SH_CSS_MORPH_TABLE_GRID               ISP_VEC_NELEMS
176 #define SH_CSS_MORPH_TABLE_ELEM_BYTES         2
177 #define SH_CSS_MORPH_TABLE_ELEMS_PER_DDR_WORD \
178 	(HIVE_ISP_DDR_WORD_BYTES / SH_CSS_MORPH_TABLE_ELEM_BYTES)
179 
180 
181 #define ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR   (SH_CSS_MAX_BQ_GRID_WIDTH + 1)
182 #define ISP2400_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR   (SH_CSS_MAX_BQ_GRID_HEIGHT + 1)
183 
184 #define ISP2400_SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR \
185 	CEIL_MUL(ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
186 
187 /* TODO: I will move macros of "*_SCTBL_*" to SC kernel.
188    "+ 2" should be "+ SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT". (michie, Sep/23/2014) */
189 #define ISP2401_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR   (SH_CSS_MAX_BQ_GRID_WIDTH + 2)
190 #define ISP2401_SH_CSS_MAX_SCTBL_HEIGHT_PER_COLOR   (SH_CSS_MAX_BQ_GRID_HEIGHT + 2)
191 
192 #define ISP2401_SH_CSS_MAX_SCTBL_ALIGNED_WIDTH_PER_COLOR \
193 	CEIL_MUL(ISP2400_SH_CSS_MAX_SCTBL_WIDTH_PER_COLOR, ISP_VEC_NELEMS)
194 
195 /* Each line of this table is aligned to the maximum line width. */
196 #define SH_CSS_MAX_S3ATBL_WIDTH              SH_CSS_MAX_BQ_GRID_WIDTH
197 
198 /* Video mode specific DVS define */
199 /* The video binary supports a delay of 1 or 2 frames */
200 #define VIDEO_FRAME_DELAY		2
201 /* +1 because DVS reads the previous and writes the current frame concurrently */
202 #define MAX_NUM_VIDEO_DELAY_FRAMES	(VIDEO_FRAME_DELAY + 1)
203 
204 /* Preview mode specific DVS define. */
205 /* In preview we only need GDC functionality (and not the DVS functionality) */
206 /* The minimum number of DVS frames you need is 2, one were GDC reads from and another where GDC writes into */
207 #define NUM_PREVIEW_DVS_FRAMES		(2)
208 
209 /* TNR is no longer exclusive to video, SkyCam preview has TNR too (same kernel as video).
210  * All uses the generic define NUM_TNR_FRAMES. The define NUM_VIDEO_TNR_FRAMES has been deprecated.
211  *
212  * Notes
213  * 1) The value depends on the used TNR kernel and is not something that depends on the mode
214  *    and it is not something you just could choice.
215  * 2) For the luma only pipeline a version that supports two different sets of TNR reference frames
216  * is being used.
217  *.
218  */
219 #define NUM_VALID_TNR_REF_FRAMES		(1) /* At least one valid TNR reference frame is required */
220 #define NUM_TNR_FRAMES_PER_REF_BUF_SET		(2)
221 /* In luma-only mode alternate illuminated frames are supported, that requires two double buffers */
222 #define NUM_TNR_REF_BUF_SETS	(1)
223 
224 #define NUM_TNR_FRAMES		(NUM_TNR_FRAMES_PER_REF_BUF_SET * NUM_TNR_REF_BUF_SETS)
225 
226 #define NUM_VIDEO_TNR_FRAMES		2
227 
228 /* Note that this is the define used to configure all data structures common for all modes */
229 /* It should be equal or bigger to the max number of DVS frames for all possible modes */
230 /* Rules: these implement logic shared between the host code and ISP firmware.
231    The ISP firmware needs these rules to be applied at pre-processor time,
232    that's why these are macros, not functions. */
233 #define _ISP_BQS(num)  ((num) / 2)
234 #define _ISP_VECS(width) CEIL_DIV(width, ISP_VEC_NELEMS)
235 
236 #define ISP_BQ_GRID_WIDTH(elements_per_line, deci_factor_log2) \
237 	CEIL_SHIFT(elements_per_line / 2,  deci_factor_log2)
238 #define ISP_BQ_GRID_HEIGHT(lines_per_frame, deci_factor_log2) \
239 	CEIL_SHIFT(lines_per_frame / 2,  deci_factor_log2)
240 #define ISP_C_VECTORS_PER_LINE(elements_per_line) \
241 	_ISP_VECS(elements_per_line / 2)
242 
243 /* The morphing table is similar to the shading table in the sense that we
244    have 1 more value than we have cells in the grid. */
245 #define _ISP_MORPH_TABLE_WIDTH(int_width) \
246 	(CEIL_DIV(int_width, SH_CSS_MORPH_TABLE_GRID) + 1)
247 #define _ISP_MORPH_TABLE_HEIGHT(int_height) \
248 	(CEIL_DIV(int_height, SH_CSS_MORPH_TABLE_GRID) + 1)
249 #define _ISP_MORPH_TABLE_ALIGNED_WIDTH(width) \
250 	CEIL_MUL(_ISP_MORPH_TABLE_WIDTH(width), \
251 		 SH_CSS_MORPH_TABLE_ELEMS_PER_DDR_WORD)
252 
253 #define _ISP2400_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
254 	(ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + 1)
255 #define _ISP2400_SCTBL_HEIGHT(input_height, deci_factor_log2) \
256 	(ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + 1)
257 #define _ISP2400_SCTBL_ALIGNED_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
258 	CEIL_MUL(_ISP_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2), \
259 		 ISP_VEC_NELEMS)
260 
261 /* To position the shading center grid point on the center of output image,
262  * one more grid cell is needed as margin. */
263 #define SH_CSS_SCTBL_CENTERING_MARGIN	1
264 
265 /* The shading table width and height are the number of grids, not cells. The last grid should be counted. */
266 #define SH_CSS_SCTBL_LAST_GRID_COUNT	1
267 
268 /* Number of horizontal grids per color in the shading table. */
269 #define _ISP2401_SCTBL_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
270 	(ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + \
271 	SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT)
272 
273 /* Number of vertical grids per color in the shading table. */
274 #define _ISP2401_SCTBL_HEIGHT(input_height, deci_factor_log2) \
275 	(ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + \
276 	SH_CSS_SCTBL_CENTERING_MARGIN + SH_CSS_SCTBL_LAST_GRID_COUNT)
277 
278 
279 /* ISP2401: Legacy API: Number of horizontal grids per color in the shading table. */
280 #define _ISP_SCTBL_LEGACY_WIDTH_PER_COLOR(input_width, deci_factor_log2) \
281 	(ISP_BQ_GRID_WIDTH(input_width, deci_factor_log2) + SH_CSS_SCTBL_LAST_GRID_COUNT)
282 
283 /* ISP2401: Legacy API: Number of vertical grids per color in the shading table. */
284 #define _ISP_SCTBL_LEGACY_HEIGHT(input_height, deci_factor_log2) \
285 	(ISP_BQ_GRID_HEIGHT(input_height, deci_factor_log2) + SH_CSS_SCTBL_LAST_GRID_COUNT)
286 
287 
288 /* *****************************************************************
289  * Statistics for 3A (Auto Focus, Auto White Balance, Auto Exposure)
290  * *****************************************************************/
291 /* if left cropping is used, 3A statistics are also cropped by 2 vectors. */
292 #define _ISP_S3ATBL_WIDTH(in_width, deci_factor_log2) \
293 	(_ISP_BQS(in_width) >> deci_factor_log2)
294 #define _ISP_S3ATBL_HEIGHT(in_height, deci_factor_log2) \
295 	(_ISP_BQS(in_height) >> deci_factor_log2)
296 #define _ISP_S3A_ELEMS_ISP_WIDTH(width, left_crop) \
297 	(width - ((left_crop) ? 2 * ISP_VEC_NELEMS : 0))
298 
299 #define _ISP_S3ATBL_ISP_WIDTH(in_width, deci_factor_log2) \
300 	CEIL_SHIFT(_ISP_BQS(in_width), deci_factor_log2)
301 #define _ISP_S3ATBL_ISP_HEIGHT(in_height, deci_factor_log2) \
302 	CEIL_SHIFT(_ISP_BQS(in_height), deci_factor_log2)
303 #define ISP_S3ATBL_VECTORS \
304 	_ISP_VECS(SH_CSS_MAX_S3ATBL_WIDTH * \
305 		  (sizeof(struct ia_css_3a_output) / sizeof(int32_t)))
306 #define ISP_S3ATBL_HI_LO_STRIDE \
307 	(ISP_S3ATBL_VECTORS * ISP_VEC_NELEMS)
308 #define ISP_S3ATBL_HI_LO_STRIDE_BYTES \
309 	(sizeof(unsigned short) * ISP_S3ATBL_HI_LO_STRIDE)
310 
311 /* Viewfinder support */
312 #define __ISP_MAX_VF_OUTPUT_WIDTH(width, left_crop) \
313 	(width - 2 * ISP_VEC_NELEMS + ((left_crop) ? 2 * ISP_VEC_NELEMS : 0))
314 
315 #define __ISP_VF_OUTPUT_WIDTH_VECS(out_width, vf_log_downscale) \
316 	(_ISP_VECS((out_width) >> (vf_log_downscale)))
317 
318 #define _ISP_VF_OUTPUT_WIDTH(vf_out_vecs) ((vf_out_vecs) * ISP_VEC_NELEMS)
319 #define _ISP_VF_OUTPUT_HEIGHT(out_height, vf_log_ds) \
320 	((out_height) >> (vf_log_ds))
321 
322 #define _ISP_LOG_VECTOR_STEP(mode) \
323 	((mode) == IA_CSS_BINARY_MODE_CAPTURE_PP ? 2 : 1)
324 
325 /* It is preferred to have not more than 2x scaling at one step
326  * in GDC (assumption is for capture_pp and yuv_scale stages) */
327 #define MAX_PREFERRED_YUV_DS_PER_STEP	2
328 
329 /* Rules for computing the internal width. This is extremely complicated
330  * and definitely needs to be commented and explained. */
331 #define _ISP_LEFT_CROP_EXTRA(left_crop) ((left_crop) > 0 ? 2 * ISP_VEC_NELEMS : 0)
332 
333 #define __ISP_MIN_INTERNAL_WIDTH(num_chunks, pipelining, mode) \
334 	((num_chunks) * (pipelining) * (1 << _ISP_LOG_VECTOR_STEP(mode)) * \
335 	 ISP_VEC_NELEMS)
336 
337 #define __ISP_PADDED_OUTPUT_WIDTH(out_width, dvs_env_width, left_crop) \
338 	((out_width) + MAX(dvs_env_width, _ISP_LEFT_CROP_EXTRA(left_crop)))
339 
340 #define __ISP_CHUNK_STRIDE_ISP(mode) \
341 	((1 << _ISP_LOG_VECTOR_STEP(mode)) * ISP_VEC_NELEMS)
342 
343 #define __ISP_CHUNK_STRIDE_DDR(c_subsampling, num_chunks) \
344 	((c_subsampling) * (num_chunks) * HIVE_ISP_DDR_WORD_BYTES)
345 #define __ISP_INTERNAL_WIDTH(out_width, \
346 			     dvs_env_width, \
347 			     left_crop, \
348 			     mode, \
349 			     c_subsampling, \
350 			     num_chunks, \
351 			     pipelining) \
352 	CEIL_MUL2(CEIL_MUL2(MAX(__ISP_PADDED_OUTPUT_WIDTH(out_width, \
353 							    dvs_env_width, \
354 							    left_crop), \
355 				  __ISP_MIN_INTERNAL_WIDTH(num_chunks, \
356 							   pipelining, \
357 							   mode) \
358 				 ), \
359 			  __ISP_CHUNK_STRIDE_ISP(mode) \
360 			 ), \
361 		 __ISP_CHUNK_STRIDE_DDR(c_subsampling, num_chunks) \
362 		)
363 
364 #define __ISP_INTERNAL_HEIGHT(out_height, dvs_env_height, top_crop) \
365 	((out_height) + (dvs_env_height) + top_crop)
366 
367 /* @GC: Input can be up to sensor resolution when either bayer downscaling
368  *	or raw binning is enabled.
369  *	Also, during continuous mode, we need to align to 4*NWAY since input
370  *	should support binning */
371 #define _ISP_MAX_INPUT_WIDTH(max_internal_width, enable_ds, enable_fixed_bayer_ds, enable_raw_bin, \
372 				enable_continuous) \
373 	((enable_ds) ? \
374 	   SH_CSS_MAX_SENSOR_WIDTH :\
375 	 (enable_fixed_bayer_ds) ? \
376 	   CEIL_MUL(SH_CSS_MAX_CONTINUOUS_SENSOR_WIDTH_DEC, 4 * ISP_VEC_NELEMS) : \
377 	 (enable_raw_bin) ? \
378 	   CEIL_MUL(SH_CSS_MAX_CONTINUOUS_SENSOR_WIDTH, 4 * ISP_VEC_NELEMS) : \
379 	 (enable_continuous) ? \
380 	   SH_CSS_MAX_CONTINUOUS_SENSOR_WIDTH \
381 	   : max_internal_width)
382 
383 #define _ISP_INPUT_WIDTH(internal_width, ds_input_width, enable_ds) \
384 	((enable_ds) ? (ds_input_width) : (internal_width))
385 
386 #define _ISP_MAX_INPUT_HEIGHT(max_internal_height, enable_ds, enable_fixed_bayer_ds, enable_raw_bin, \
387 				enable_continuous) \
388 	((enable_ds) ? \
389 	   SH_CSS_MAX_SENSOR_HEIGHT :\
390 	 (enable_fixed_bayer_ds) ? \
391 	   SH_CSS_MAX_CONTINUOUS_SENSOR_HEIGHT_DEC : \
392 	 (enable_raw_bin || enable_continuous) ? \
393 	   SH_CSS_MAX_CONTINUOUS_SENSOR_HEIGHT \
394 	   : max_internal_height)
395 
396 #define _ISP_INPUT_HEIGHT(internal_height, ds_input_height, enable_ds) \
397 	((enable_ds) ? (ds_input_height) : (internal_height))
398 
399 #define SH_CSS_MAX_STAGES 8 /* primary_stage[1-6], capture_pp, vf_pp */
400 
401 /* For CSI2+ input system, it requires extra paddinga from vmem */
402 #ifdef CONFIG_CSI2_PLUS
403 #define _ISP_EXTRA_PADDING_VECS 2
404 #else
405 #define _ISP_EXTRA_PADDING_VECS 0
406 #endif /* CONFIG_CSI2_PLUS */
407 
408 #endif /* _SH_CSS_DEFS_H_ */
409