2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
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.
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
15 #ifndef __IA_CSS_UTIL_H__
16 #define __IA_CSS_UTIL_H__
18 #include <ia_css_err.h>
19 #include <error_support.h>
20 #include <type_support.h>
21 #include <ia_css_frame_public.h>
22 #include <ia_css_stream_public.h>
23 #include <ia_css_stream_format.h>
25 /** @brief convert "errno" error code to "ia_css_err" error code
27 * @param[in] "errno" error code
28 * @return "ia_css_err" error code
31 enum ia_css_err
ia_css_convert_errno(
34 /** @brief check vf frame info.
37 * @return IA_CSS_SUCCESS or error code upon error.
40 extern enum ia_css_err
ia_css_util_check_vf_info(
41 const struct ia_css_frame_info
* const info
);
43 /** @brief check input configuration.
45 * @param[in] stream_config
46 * @param[in] must_be_raw
47 * @return IA_CSS_SUCCESS or error code upon error.
50 extern enum ia_css_err
ia_css_util_check_input(
51 const struct ia_css_stream_config
* const stream_config
,
55 /** @brief check vf and out frame info.
59 * @return IA_CSS_SUCCESS or error code upon error.
62 extern enum ia_css_err
ia_css_util_check_vf_out_info(
63 const struct ia_css_frame_info
* const out_info
,
64 const struct ia_css_frame_info
* const vf_info
);
66 /** @brief check width and height
70 * @return IA_CSS_SUCCESS or error code upon error.
73 extern enum ia_css_err
ia_css_util_check_res(
78 /** @brief compare resolutions (less or equal)
80 * @param[in] a resolution
81 * @param[in] b resolution
82 * @return true if both dimensions of a are less or
83 * equal than those of b, false otherwise
86 extern bool ia_css_util_res_leq(
87 struct ia_css_resolution a
,
88 struct ia_css_resolution b
);
91 * @brief Check if resolution is zero
93 * @param[in] resolution The resolution to check
95 * @returns true if resolution is zero
97 extern bool ia_css_util_resolution_is_zero(
98 const struct ia_css_resolution resolution
);
101 * @brief Check if resolution is even
103 * @param[in] resolution The resolution to check
105 * @returns true if resolution is even
107 extern bool ia_css_util_resolution_is_even(
108 const struct ia_css_resolution resolution
);
111 /** @brief check width and height
113 * @param[in] stream_format
115 * @return bits per pixel based on given parameters.
118 extern unsigned int ia_css_util_input_format_bpp(
119 enum ia_css_stream_format stream_format
,
122 /** @brief check if input format it raw
124 * @param[in] stream_format
125 * @return true if the input format is raw or false otherwise
128 extern bool ia_css_util_is_input_format_raw(
129 enum ia_css_stream_format stream_format
);
131 /** @brief check if input format it yuv
133 * @param[in] stream_format
134 * @return true if the input format is yuv or false otherwise
137 extern bool ia_css_util_is_input_format_yuv(
138 enum ia_css_stream_format stream_format
);
140 #endif /* __IA_CSS_UTIL_H__ */