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_PIPE_BINARYDESC_H__
17 #define __IA_CSS_PIPE_BINARYDESC_H__
18 
19 #include <ia_css_types.h>		/* ia_css_pipe */
20 #include <ia_css_frame_public.h>	/* ia_css_frame_info */
21 #include <ia_css_binary.h>		/* ia_css_binary_descr */
22 
23 /* @brief Get a binary descriptor for copy.
24  *
25  * @param[in] pipe
26  * @param[out] copy_desc
27  * @param[in/out] in_info
28  * @param[in/out] out_info
29  * @param[in/out] vf_info
30  * @return    None
31  *
32  */
33 void ia_css_pipe_get_copy_binarydesc(
34     struct ia_css_pipe const *const pipe,
35     struct ia_css_binary_descr *copy_descr,
36     struct ia_css_frame_info *in_info,
37     struct ia_css_frame_info *out_info,
38     struct ia_css_frame_info *vf_info);
39 
40 /* @brief Get a binary descriptor for vfpp.
41  *
42  * @param[in] pipe
43  * @param[out] vfpp_descr
44  * @param[in/out] in_info
45  * @param[in/out] out_info
46  * @return    None
47  *
48  */
49 void ia_css_pipe_get_vfpp_binarydesc(
50     struct ia_css_pipe const *const pipe,
51     struct ia_css_binary_descr *vf_pp_descr,
52     struct ia_css_frame_info *in_info,
53     struct ia_css_frame_info *out_info);
54 
55 /* @brief Get numerator and denominator of bayer downscaling factor.
56  *
57  * @param[in] bds_factor: The bayer downscaling factor.
58  *		(= The bds_factor member in the sh_css_bds_factor structure.)
59  * @param[out] bds_factor_numerator: The numerator of the bayer downscaling factor.
60  *		(= The numerator member in the sh_css_bds_factor structure.)
61  * @param[out] bds_factor_denominator: The denominator of the bayer downscaling factor.
62  *		(= The denominator member in the sh_css_bds_factor structure.)
63  * @return	0 or error code upon error.
64  *
65  */
66 int sh_css_bds_factor_get_numerator_denominator(
67     unsigned int bds_factor,
68     unsigned int *bds_factor_numerator,
69     unsigned int *bds_factor_denominator);
70 
71 /* @brief Get a binary descriptor for preview stage.
72  *
73  * @param[in] pipe
74  * @param[out] preview_descr
75  * @param[in/out] in_info
76  * @param[in/out] bds_out_info
77  * @param[in/out] out_info
78  * @param[in/out] vf_info
79  * @return	0 or error code upon error.
80  *
81  */
82 int ia_css_pipe_get_preview_binarydesc(
83     struct ia_css_pipe *const pipe,
84     struct ia_css_binary_descr *preview_descr,
85     struct ia_css_frame_info *in_info,
86     struct ia_css_frame_info *bds_out_info,
87     struct ia_css_frame_info *out_info,
88     struct ia_css_frame_info *vf_info);
89 
90 /* @brief Get a binary descriptor for video stage.
91  *
92  * @param[in/out] pipe
93  * @param[out] video_descr
94  * @param[in/out] in_info
95  * @param[in/out] bds_out_info
96  * @param[in/out] vf_info
97  * @return	0 or error code upon error.
98  *
99  */
100 int ia_css_pipe_get_video_binarydesc(
101     struct ia_css_pipe *const pipe,
102     struct ia_css_binary_descr *video_descr,
103     struct ia_css_frame_info *in_info,
104     struct ia_css_frame_info *bds_out_info,
105     struct ia_css_frame_info *out_info,
106     struct ia_css_frame_info *vf_info,
107     int stream_config_left_padding);
108 
109 /* @brief Get a binary descriptor for yuv scaler stage.
110  *
111  * @param[in/out] pipe
112  * @param[out] yuv_scaler_descr
113  * @param[in/out] in_info
114  * @param[in/out] out_info
115  * @param[in/out] internal_out_info
116  * @param[in/out] vf_info
117  * @return    None
118  *
119  */
120 void ia_css_pipe_get_yuvscaler_binarydesc(
121     struct ia_css_pipe const *const pipe,
122     struct ia_css_binary_descr *yuv_scaler_descr,
123     struct ia_css_frame_info *in_info,
124     struct ia_css_frame_info *out_info,
125     struct ia_css_frame_info *internal_out_info,
126     struct ia_css_frame_info *vf_info);
127 
128 /* @brief Get a binary descriptor for capture pp stage.
129  *
130  * @param[in/out] pipe
131  * @param[out] capture_pp_descr
132  * @param[in/out] in_info
133  * @param[in/out] vf_info
134  * @return    None
135  *
136  */
137 void ia_css_pipe_get_capturepp_binarydesc(
138     struct ia_css_pipe *const pipe,
139     struct ia_css_binary_descr *capture_pp_descr,
140     struct ia_css_frame_info *in_info,
141     struct ia_css_frame_info *out_info,
142     struct ia_css_frame_info *vf_info);
143 
144 /* @brief Get a binary descriptor for primary capture.
145  *
146  * @param[in] pipe
147  * @param[out] prim_descr
148  * @param[in/out] in_info
149  * @param[in/out] out_info
150  * @param[in/out] vf_info
151  * @return    None
152  *
153  */
154 void ia_css_pipe_get_primary_binarydesc(
155     struct ia_css_pipe const *const pipe,
156     struct ia_css_binary_descr *prim_descr,
157     struct ia_css_frame_info *in_info,
158     struct ia_css_frame_info *out_info,
159     struct ia_css_frame_info *vf_info,
160     unsigned int stage_idx);
161 
162 /* @brief Get a binary descriptor for pre gdc stage.
163  *
164  * @param[in] pipe
165  * @param[out] pre_gdc_descr
166  * @param[in/out] in_info
167  * @param[in/out] out_info
168  * @return    None
169  *
170  */
171 void ia_css_pipe_get_pre_gdc_binarydesc(
172     struct ia_css_pipe const *const pipe,
173     struct ia_css_binary_descr *gdc_descr,
174     struct ia_css_frame_info *in_info,
175     struct ia_css_frame_info *out_info);
176 
177 /* @brief Get a binary descriptor for gdc stage.
178  *
179  * @param[in] pipe
180  * @param[out] gdc_descr
181  * @param[in/out] in_info
182  * @param[in/out] out_info
183  * @return    None
184  *
185  */
186 void ia_css_pipe_get_gdc_binarydesc(
187     struct ia_css_pipe const *const pipe,
188     struct ia_css_binary_descr *gdc_descr,
189     struct ia_css_frame_info *in_info,
190     struct ia_css_frame_info *out_info);
191 
192 /* @brief Get a binary descriptor for post gdc.
193  *
194  * @param[in] pipe
195  * @param[out] post_gdc_descr
196  * @param[in/out] in_info
197  * @param[in/out] out_info
198  * @param[in/out] vf_info
199  * @return    None
200  *
201  */
202 void ia_css_pipe_get_post_gdc_binarydesc(
203     struct ia_css_pipe const *const pipe,
204     struct ia_css_binary_descr *post_gdc_descr,
205     struct ia_css_frame_info *in_info,
206     struct ia_css_frame_info *out_info,
207     struct ia_css_frame_info *vf_info);
208 
209 /* @brief Get a binary descriptor for de.
210  *
211  * @param[in] pipe
212  * @param[out] pre_de_descr
213  * @param[in/out] in_info
214  * @param[in/out] out_info
215  * @return    None
216  *
217  */
218 void ia_css_pipe_get_pre_de_binarydesc(
219     struct ia_css_pipe const *const pipe,
220     struct ia_css_binary_descr *pre_de_descr,
221     struct ia_css_frame_info *in_info,
222     struct ia_css_frame_info *out_info);
223 
224 /* @brief Get a binary descriptor for pre anr stage.
225  *
226  * @param[in] pipe
227  * @param[out] pre_anr_descr
228  * @param[in/out] in_info
229  * @param[in/out] out_info
230  * @return    None
231  *
232  */
233 void ia_css_pipe_get_pre_anr_binarydesc(
234     struct ia_css_pipe const *const pipe,
235     struct ia_css_binary_descr *pre_anr_descr,
236     struct ia_css_frame_info *in_info,
237     struct ia_css_frame_info *out_info);
238 
239 /* @brief Get a binary descriptor for ANR stage.
240  *
241  * @param[in] pipe
242  * @param[out] anr_descr
243  * @param[in/out] in_info
244  * @param[in/out] out_info
245  * @return    None
246  *
247  */
248 void ia_css_pipe_get_anr_binarydesc(
249     struct ia_css_pipe const *const pipe,
250     struct ia_css_binary_descr *anr_descr,
251     struct ia_css_frame_info *in_info,
252     struct ia_css_frame_info *out_info);
253 
254 /* @brief Get a binary descriptor for post anr stage.
255  *
256  * @param[in] pipe
257  * @param[out] post_anr_descr
258  * @param[in/out] in_info
259  * @param[in/out] out_info
260  * @param[in/out] vf_info
261  * @return    None
262  *
263  */
264 void ia_css_pipe_get_post_anr_binarydesc(
265     struct ia_css_pipe const *const pipe,
266     struct ia_css_binary_descr *post_anr_descr,
267     struct ia_css_frame_info *in_info,
268     struct ia_css_frame_info *out_info,
269     struct ia_css_frame_info *vf_info);
270 
271 /* @brief Get a binary descriptor for ldc stage.
272  *
273  * @param[in/out] pipe
274  * @param[out] capture_pp_descr
275  * @param[in/out] in_info
276  * @param[in/out] vf_info
277  * @return    None
278  *
279  */
280 void ia_css_pipe_get_ldc_binarydesc(
281     struct ia_css_pipe const *const pipe,
282     struct ia_css_binary_descr *ldc_descr,
283     struct ia_css_frame_info *in_info,
284     struct ia_css_frame_info *out_info);
285 
286 /* @brief Calculates the required BDS factor
287  *
288  * @param[in] input_res
289  * @param[in] output_res
290  * @param[in/out] bds_factor
291  * @return	0 or error code upon error.
292  */
293 int binarydesc_calculate_bds_factor(
294     struct ia_css_resolution input_res,
295     struct ia_css_resolution output_res,
296     unsigned int *bds_factor);
297 
298 #endif /* __IA_CSS_PIPE_BINARYDESC_H__ */
299