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 __IA_CSS_SDIS_HOST_H
17 #define __IA_CSS_SDIS_HOST_H
18 
19 #include "ia_css_sdis_types.h"
20 #include "ia_css_binary.h"
21 #include "ia_css_stream.h"
22 #include "sh_css_params.h"
23 
24 extern const struct ia_css_dvs_coefficients default_sdis_config;
25 
26 /* Opaque here, since size is binary dependent. */
27 struct sh_css_isp_sdis_hori_coef_tbl;
28 struct sh_css_isp_sdis_vert_coef_tbl;
29 struct sh_css_isp_sdis_hori_proj_tbl;
30 struct sh_css_isp_sdis_vert_proj_tbl;
31 
32 void ia_css_sdis_horicoef_vmem_encode(
33     struct sh_css_isp_sdis_hori_coef_tbl *to,
34     const struct ia_css_dvs_coefficients *from,
35     unsigned int size);
36 
37 void ia_css_sdis_vertcoef_vmem_encode(
38     struct sh_css_isp_sdis_vert_coef_tbl *to,
39     const struct ia_css_dvs_coefficients *from,
40     unsigned int size);
41 
42 void ia_css_sdis_horiproj_encode(
43     struct sh_css_isp_sdis_hori_proj_tbl *to,
44     const struct ia_css_dvs_coefficients *from,
45     unsigned int size);
46 
47 void ia_css_sdis_vertproj_encode(
48     struct sh_css_isp_sdis_vert_proj_tbl *to,
49     const struct ia_css_dvs_coefficients *from,
50     unsigned int size);
51 
52 void ia_css_get_isp_dis_coefficients(
53     struct ia_css_stream *stream,
54     short *horizontal_coefficients,
55     short *vertical_coefficients);
56 
57 int
58 ia_css_get_dvs_statistics(
59     struct ia_css_dvs_statistics	       *host_stats,
60     const struct ia_css_isp_dvs_statistics *isp_stats);
61 
62 void
63 ia_css_translate_dvs_statistics(
64     struct ia_css_dvs_statistics               *host_stats,
65     const struct ia_css_isp_dvs_statistics_map *isp_stats);
66 
67 struct ia_css_isp_dvs_statistics *
68 ia_css_isp_dvs_statistics_allocate(
69     const struct ia_css_dvs_grid_info *grid);
70 
71 void
72 ia_css_isp_dvs_statistics_free(
73     struct ia_css_isp_dvs_statistics *me);
74 
75 size_t ia_css_sdis_hor_coef_tbl_bytes(const struct ia_css_binary *binary);
76 size_t ia_css_sdis_ver_coef_tbl_bytes(const struct ia_css_binary *binary);
77 
78 void
79 ia_css_sdis_init_info(
80     struct ia_css_sdis_info *dis,
81     unsigned int sc_3a_dis_width,
82     unsigned int sc_3a_dis_padded_width,
83     unsigned int sc_3a_dis_height,
84     unsigned int isp_pipe_version,
85     unsigned int enabled);
86 
87 void ia_css_sdis_clear_coefficients(
88     struct ia_css_dvs_coefficients *dvs_coefs);
89 
90 void ia_css_sdis_horicoef_debug_dtrace(
91     const struct ia_css_dvs_coefficients *config, unsigned int level);
92 
93 void ia_css_sdis_vertcoef_debug_dtrace(
94     const struct ia_css_dvs_coefficients *config, unsigned int level);
95 
96 void ia_css_sdis_horiproj_debug_dtrace(
97     const struct ia_css_dvs_coefficients *config, unsigned int level);
98 
99 void ia_css_sdis_vertproj_debug_dtrace(
100     const struct ia_css_dvs_coefficients *config, unsigned int level);
101 
102 #endif /* __IA_CSS_SDIS_HOST_H */
103