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 __IA_CSS_UTIL_H__ 16 #define __IA_CSS_UTIL_H__ 17 18 #include <linux/errno.h> 19 20 #include <ia_css_err.h> 21 #include <type_support.h> 22 #include <ia_css_frame_public.h> 23 #include <ia_css_stream_public.h> 24 #include <ia_css_stream_format.h> 25 26 /* @brief convert "errno" error code to "ia_css_err" error code 27 * 28 * @param[in] "errno" error code 29 * @return "ia_css_err" error code 30 * 31 */ 32 int ia_css_convert_errno( 33 int in_err); 34 35 /* @brief check vf frame info. 36 * 37 * @param[in] info 38 * @return 0 or error code upon error. 39 * 40 */ 41 int ia_css_util_check_vf_info( 42 const struct ia_css_frame_info *const info); 43 44 /* @brief check input configuration. 45 * 46 * @param[in] stream_config 47 * @param[in] must_be_raw 48 * @return 0 or error code upon error. 49 * 50 */ 51 int ia_css_util_check_input( 52 const struct ia_css_stream_config *const stream_config, 53 bool must_be_raw, 54 bool must_be_yuv); 55 56 /* @brief check vf and out frame info. 57 * 58 * @param[in] out_info 59 * @param[in] vf_info 60 * @return 0 or error code upon error. 61 * 62 */ 63 int ia_css_util_check_vf_out_info( 64 const struct ia_css_frame_info *const out_info, 65 const struct ia_css_frame_info *const vf_info); 66 67 /* @brief check width and height 68 * 69 * @param[in] width 70 * @param[in] height 71 * @return 0 or error code upon error. 72 * 73 */ 74 int ia_css_util_check_res( 75 unsigned int width, 76 unsigned int height); 77 78 /* ISP2401 */ 79 /* @brief compare resolutions (less or equal) 80 * 81 * @param[in] a resolution 82 * @param[in] b resolution 83 * @return true if both dimensions of a are less or 84 * equal than those of b, false otherwise 85 * 86 */ 87 bool ia_css_util_res_leq( 88 struct ia_css_resolution a, 89 struct ia_css_resolution b); 90 91 /* ISP2401 */ 92 /** 93 * @brief Check if resolution is zero 94 * 95 * @param[in] resolution The resolution to check 96 * 97 * @returns true if resolution is zero 98 */ 99 bool ia_css_util_resolution_is_zero( 100 const struct ia_css_resolution resolution); 101 102 /* ISP2401 */ 103 /** 104 * @brief Check if resolution is even 105 * 106 * @param[in] resolution The resolution to check 107 * 108 * @returns true if resolution is even 109 */ 110 bool ia_css_util_resolution_is_even( 111 const struct ia_css_resolution resolution); 112 113 /* @brief check width and height 114 * 115 * @param[in] stream_format 116 * @param[in] two_ppc 117 * @return bits per pixel based on given parameters. 118 * 119 */ 120 unsigned int ia_css_util_input_format_bpp( 121 enum atomisp_input_format stream_format, 122 bool two_ppc); 123 124 /* @brief check if input format it raw 125 * 126 * @param[in] stream_format 127 * @return true if the input format is raw or false otherwise 128 * 129 */ 130 bool ia_css_util_is_input_format_raw( 131 enum atomisp_input_format stream_format); 132 133 /* @brief check if input format it yuv 134 * 135 * @param[in] stream_format 136 * @return true if the input format is yuv or false otherwise 137 * 138 */ 139 bool ia_css_util_is_input_format_yuv( 140 enum atomisp_input_format stream_format); 141 142 #endif /* __IA_CSS_UTIL_H__ */ 143