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