3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2015, Intel Corporation.
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.
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
17 Support for Intel Camera Imaging ISP subsystem.
18 Copyright (c) 2010 - 2015, Intel Corporation.
20 This program is free software; you can redistribute it and/or modify it
21 under the terms and conditions of the GNU General Public License,
22 version 2, as published by the Free Software Foundation.
24 This program is distributed in the hope it will be useful, but WITHOUT
25 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31 #ifndef __IA_CSS_FRAME_H__
32 #define __IA_CSS_FRAME_H__
35 #include <ia_css_types.h>
37 #include <ia_css_frame_format.h>
38 #include <ia_css_frame_public.h>
41 /*********************************************************************
43 **********************************************************************/
44 /** @brief Sets the given width and alignment to the frame info
47 * @param[in] info The info to which parameters would set
48 * @param[in] width The width to be set to info
49 * @param[in] aligned The aligned to be set to info
52 void ia_css_frame_info_set_width(struct ia_css_frame_info *info,
54 unsigned int min_padded_width);
56 /** @brief Sets the given format to the frame info
59 * @param[in] info The info to which parameters would set
60 * @param[in] format The format to be set to info
63 void ia_css_frame_info_set_format(struct ia_css_frame_info *info,
64 enum ia_css_frame_format format);
66 /** @brief Sets the frame info with the given parameters
69 * @param[in] info The info to which parameters would set
70 * @param[in] width The width to be set to info
71 * @param[in] height The height to be set to info
72 * @param[in] format The format to be set to info
73 * @param[in] aligned The aligned to be set to info
76 void ia_css_frame_info_init(struct ia_css_frame_info *info,
79 enum ia_css_frame_format format,
80 unsigned int aligned);
82 /** @brief Checks whether 2 frame infos has the same resolution
85 * @param[in] frame_a The first frame to be compared
86 * @param[in] frame_b The second frame to be compared
87 * @return Returns true if the frames are equal
89 bool ia_css_frame_info_is_same_resolution(
90 const struct ia_css_frame_info *info_a,
91 const struct ia_css_frame_info *info_b);
93 /** @brief Check the frame info is valid
96 * @param[in] info The frame attributes to be initialized
97 * @return The error code.
99 enum ia_css_err ia_css_frame_check_info(const struct ia_css_frame_info *info);
101 /*********************************************************************
103 **********************************************************************/
105 /** @brief Initialize the plane depending on the frame type
108 * @param[in] frame The frame attributes to be initialized
109 * @return The error code.
111 enum ia_css_err ia_css_frame_init_planes(struct ia_css_frame *frame);
113 /** @brief Free an array of frames
116 * @param[in] num_frames The number of frames to be freed in the array
117 * @param[in] **frames_array The array of frames to be removed
120 void ia_css_frame_free_multiple(unsigned int num_frames,
121 struct ia_css_frame **frames_array);
123 /** @brief Allocate a CSS frame structure of given size in bytes..
125 * @param frame The allocated frame.
126 * @param[in] size_bytes The frame size in bytes.
127 * @param[in] contiguous Allocate memory physically contiguously or not.
128 * @return The error code.
130 * Allocate a frame using the given size in bytes.
131 * The frame structure is partially null initialized.
133 enum ia_css_err ia_css_frame_allocate_with_buffer_size(
134 struct ia_css_frame **frame,
135 const unsigned int size_bytes,
136 const bool contiguous);
138 /** @brief Check whether 2 frames are same type
141 * @param[in] frame_a The first frame to be compared
142 * @param[in] frame_b The second frame to be compared
143 * @return Returns true if the frames are equal
145 bool ia_css_frame_is_same_type(
146 const struct ia_css_frame *frame_a,
147 const struct ia_css_frame *frame_b);
149 /** @brief Configure a dma port from frame info
152 * @param[in] config The DAM port configuration
153 * @param[in] info The frame info
156 void ia_css_dma_configure_from_info(
157 struct dma_port_config *config,
158 const struct ia_css_frame_info *info);
161 /** @brief Finds the cropping resolution
162 * This function finds the maximum cropping resolution in an input image keeping
163 * the aspect ratio for the given output resolution.Calculates the coordinates
164 * for cropping from the center and returns the starting pixel location of the
165 * region in the input image. Also returns the dimension of the cropping
169 * @param[in] in_res Resolution of input image
170 * @param[in] out_res Resolution of output image
171 * @param[out] crop_res Crop resolution of input image
172 * @return Returns IA_CSS_SUCCESS or IA_CSS_ERR_INVALID_ARGUMENTS on error
175 ia_css_frame_find_crop_resolution(const struct ia_css_resolution *in_res,
176 const struct ia_css_resolution *out_res,
177 struct ia_css_resolution *crop_res);
180 #endif /* __IA_CSS_FRAME_H__ */