• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
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 _SH_CSS_PARAMS_DVS_H_
17 #define _SH_CSS_PARAMS_DVS_H_
18 
19 #include <math_support.h>
20 #include <ia_css_types.h>
21 #include <sh_css_dvs_info.h>
22 #include "gdc_global.h" /* gdc_warp_param_mem_t */
23 
24 #define DVS_ENV_MIN_X (12)
25 #define DVS_ENV_MIN_Y (12)
26 
27 #define DVS_BLOCKDIM_X (64)        /* X block height*/
28 #define DVS_BLOCKDIM_Y_LUMA (64)   /* Y block height*/
29 #define DVS_BLOCKDIM_Y_CHROMA (32) /* UV height block size is half the Y block height*/
30 
31 /* ISP2400 */
32 /* horizontal 64x64 blocks round up to DVS_BLOCKDIM_X, make even */
33 #define DVS_NUM_BLOCKS_X(X)		(CEIL_MUL(CEIL_DIV((X), DVS_BLOCKDIM_X), 2))
34 
35 /* ISP2400 */
36 /* vertical   64x64 blocks round up to DVS_BLOCKDIM_Y */
37 #define DVS_NUM_BLOCKS_Y(X)		(CEIL_DIV((X), DVS_BLOCKDIM_Y_LUMA))
38 #define DVS_NUM_BLOCKS_X_CHROMA(X)	(CEIL_DIV((X), DVS_BLOCKDIM_X))
39 #define DVS_NUM_BLOCKS_Y_CHROMA(X)	(CEIL_DIV((X), DVS_BLOCKDIM_Y_CHROMA))
40 
41 #define DVS_TABLE_IN_BLOCKDIM_X_LUMA(X)	(DVS_NUM_BLOCKS_X(X) + 1)  /* N blocks have N + 1 set of coords */
42 #define DVS_TABLE_IN_BLOCKDIM_X_CHROMA(X)   (DVS_NUM_BLOCKS_X_CHROMA(X) + 1)
43 #define DVS_TABLE_IN_BLOCKDIM_Y_LUMA(X)		(DVS_NUM_BLOCKS_Y(X) + 1)
44 #define DVS_TABLE_IN_BLOCKDIM_Y_CHROMA(X)	(DVS_NUM_BLOCKS_Y_CHROMA(X) + 1)
45 
46 #define DVS_ENVELOPE_X(X) (((X) == 0) ? (DVS_ENV_MIN_X) : (X))
47 #define DVS_ENVELOPE_Y(X) (((X) == 0) ? (DVS_ENV_MIN_Y) : (X))
48 
49 #define DVS_COORD_FRAC_BITS (10)
50 
51 /* ISP2400 */
52 #define DVS_INPUT_BYTES_PER_PIXEL (1)
53 
54 #define XMEM_ALIGN_LOG2 (5)
55 
56 #define DVS_6AXIS_COORDS_ELEMS CEIL_MUL(sizeof(gdc_warp_param_mem_t) \
57 					, HIVE_ISP_DDR_WORD_BYTES)
58 
59 /* currently we only support two output with the same resolution, output 0 is th default one. */
60 #define DVS_6AXIS_BYTES(binary) \
61 	(DVS_6AXIS_COORDS_ELEMS \
62 	* DVS_NUM_BLOCKS_X((binary)->out_frame_info[0].res.width) \
63 	* DVS_NUM_BLOCKS_Y((binary)->out_frame_info[0].res.height))
64 
65 /*
66  * ISP2400:
67  * Bilinear interpolation (HRT_GDC_BLI_MODE) is the supported method currently.
68  * Bicubic interpolation (HRT_GDC_BCI_MODE) is not supported yet */
69 #define DVS_GDC_INTERP_METHOD HRT_GDC_BLI_MODE
70 
71 struct ia_css_dvs_6axis_config *
72 generate_dvs_6axis_table(const struct ia_css_resolution	*frame_res,
73 			 const struct ia_css_resolution *dvs_offset);
74 
75 struct ia_css_dvs_6axis_config *
76 generate_dvs_6axis_table_from_config(struct ia_css_dvs_6axis_config
77 				     *dvs_config_src);
78 
79 void
80 free_dvs_6axis_table(struct ia_css_dvs_6axis_config  **dvs_6axis_config);
81 
82 void
83 copy_dvs_6axis_table(struct ia_css_dvs_6axis_config *dvs_config_dst,
84 		     const struct ia_css_dvs_6axis_config *dvs_config_src);
85 
86 #endif
87