Commit | Line | Data |
---|---|---|
47bd9530 JC |
1 | /* |
2 | * Copyright (C) 2012 The Android Open Source Project | |
3 | * | |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | /* | |
18 | * @file csc.h | |
19 | * | |
20 | * @brief color space convertion abstract header | |
21 | * | |
22 | * @author Pyoungjae Jung (pjet.jung@samsung.com) | |
23 | * | |
24 | * @version 1.0 | |
25 | * | |
26 | * @history | |
27 | * 2011.12.27 : Create | |
28 | */ | |
29 | ||
30 | #ifndef CSC_H | |
31 | #define CSC_H | |
32 | ||
33 | #ifdef __cplusplus | |
34 | extern "C" { | |
35 | #endif | |
36 | ||
37 | typedef enum _CSC_ERRORCODE { | |
38 | CSC_ErrorNone = 0, | |
39 | CSC_Error, | |
40 | CSC_ErrorNotInit, | |
41 | CSC_ErrorInvalidAddress, | |
42 | CSC_ErrorUnsupportFormat, | |
43 | CSC_ErrorNotImplemented | |
44 | } CSC_ERRORCODE; | |
45 | ||
46 | typedef enum _CSC_METHOD { | |
47 | CSC_METHOD_SW = 0, | |
48 | CSC_METHOD_HW, | |
49 | CSC_METHOD_PREFER_HW | |
50 | } CSC_METHOD; | |
51 | ||
52 | /* | |
53 | * change hal pixel format to omx pixel format | |
54 | * | |
55 | * @param hal_format | |
56 | * hal pixel format[in] | |
57 | * | |
58 | * @return | |
59 | * omx pixel format | |
60 | */ | |
61 | unsigned int hal_2_omx_pixel_format( | |
62 | unsigned int hal_format); | |
63 | ||
64 | /* | |
65 | * change omx pixel format to hal pixel format | |
66 | * | |
67 | * @param hal_format | |
68 | * omx pixel format[in] | |
69 | * | |
70 | * @return | |
71 | * hal pixel format | |
72 | */ | |
73 | unsigned int omx_2_hal_pixel_format( | |
74 | unsigned int omx_format); | |
75 | ||
76 | /* | |
77 | * Init CSC handle | |
78 | * | |
79 | * @return | |
80 | * csc handle | |
81 | */ | |
82 | void *csc_init( | |
83 | CSC_METHOD *method); | |
84 | ||
85 | /* | |
86 | * Deinit CSC handle | |
87 | * | |
88 | * @param handle | |
89 | * CSC handle[in] | |
90 | * | |
91 | * @return | |
92 | * error code | |
93 | */ | |
94 | CSC_ERRORCODE csc_deinit( | |
95 | void *handle); | |
96 | ||
97 | /* | |
98 | * get color space converter method | |
99 | * | |
100 | * @param handle | |
101 | * CSC handle[in] | |
102 | * | |
103 | * @param method | |
104 | * CSC method[out] | |
105 | * | |
106 | * @return | |
107 | * error code | |
108 | */ | |
109 | CSC_ERRORCODE csc_get_method( | |
110 | void *handle, | |
111 | CSC_METHOD *method); | |
112 | ||
113 | /* | |
114 | * Get source format. | |
115 | * | |
116 | * @param handle | |
117 | * CSC handle[in] | |
118 | * | |
119 | * @param width | |
120 | * address of image width[out] | |
121 | * | |
122 | * @param height | |
123 | * address of image height[out] | |
124 | * | |
125 | * @param crop_left | |
126 | * address of image left crop size[out] | |
127 | * | |
128 | * @param crop_top | |
129 | * address of image top crop size[out] | |
130 | * | |
131 | * @param crop_width | |
132 | * address of cropped image width[out] | |
133 | * | |
134 | * @param crop_height | |
135 | * address of cropped image height[out] | |
136 | * | |
137 | * @param color_format | |
138 | * address of source color format(HAL format)[out] | |
139 | * | |
140 | * @return | |
141 | * error code | |
142 | */ | |
143 | CSC_ERRORCODE csc_get_src_format( | |
144 | void *handle, | |
145 | unsigned int *width, | |
146 | unsigned int *height, | |
147 | unsigned int *crop_left, | |
148 | unsigned int *crop_top, | |
149 | unsigned int *crop_width, | |
150 | unsigned int *crop_height, | |
151 | unsigned int *color_format, | |
152 | unsigned int *cacheable); | |
153 | ||
154 | /* | |
155 | * Set source format. | |
156 | * Don't call each converting time. | |
157 | * Pls call this function as below. | |
158 | * 1. first converting time | |
159 | * 2. format is changed | |
160 | * | |
161 | * @param handle | |
162 | * CSC handle[in] | |
163 | * | |
164 | * @param width | |
165 | * image width[in] | |
166 | * | |
167 | * @param height | |
168 | * image height[in] | |
169 | * | |
170 | * @param crop_left | |
171 | * image left crop size[in] | |
172 | * | |
173 | * @param crop_top | |
174 | * image top crop size[in] | |
175 | * | |
176 | * @param crop_width | |
177 | * cropped image width[in] | |
178 | * | |
179 | * @param crop_height | |
180 | * cropped image height[in] | |
181 | * | |
182 | * @param color_format | |
183 | * source color format(HAL format)[in] | |
184 | * | |
185 | * @return | |
186 | * error code | |
187 | */ | |
188 | CSC_ERRORCODE csc_set_src_format( | |
189 | void *handle, | |
190 | unsigned int width, | |
191 | unsigned int height, | |
192 | unsigned int crop_left, | |
193 | unsigned int crop_top, | |
194 | unsigned int crop_width, | |
195 | unsigned int crop_height, | |
196 | unsigned int color_format, | |
197 | unsigned int cacheable); | |
198 | ||
199 | /* | |
200 | * Get destination format. | |
201 | * | |
202 | * @param handle | |
203 | * CSC handle[in] | |
204 | * | |
205 | * @param width | |
206 | * address of image width[out] | |
207 | * | |
208 | * @param height | |
209 | * address of image height[out] | |
210 | * | |
211 | * @param crop_left | |
212 | * address of image left crop size[out] | |
213 | * | |
214 | * @param crop_top | |
215 | * address of image top crop size[out] | |
216 | * | |
217 | * @param crop_width | |
218 | * address of cropped image width[out] | |
219 | * | |
220 | * @param crop_height | |
221 | * address of cropped image height[out] | |
222 | * | |
223 | * @param color_format | |
224 | * address of color format(HAL format)[out] | |
225 | * | |
226 | * @return | |
227 | * error code | |
228 | */ | |
229 | CSC_ERRORCODE csc_get_dst_format( | |
230 | void *handle, | |
231 | unsigned int *width, | |
232 | unsigned int *height, | |
233 | unsigned int *crop_left, | |
234 | unsigned int *crop_top, | |
235 | unsigned int *crop_width, | |
236 | unsigned int *crop_height, | |
237 | unsigned int *color_format, | |
238 | unsigned int *cacheable); | |
239 | ||
240 | /* | |
241 | * Set destination format | |
242 | * Don't call each converting time. | |
243 | * Pls call this function as below. | |
244 | * 1. first converting time | |
245 | * 2. format is changed | |
246 | * | |
247 | * @param handle | |
248 | * CSC handle[in] | |
249 | * | |
250 | * @param width | |
251 | * image width[in] | |
252 | * | |
253 | * @param height | |
254 | * image height[in] | |
255 | * | |
256 | * @param crop_left | |
257 | * image left crop size[in] | |
258 | * | |
259 | * @param crop_top | |
260 | * image top crop size[in] | |
261 | * | |
262 | * @param crop_width | |
263 | * cropped image width[in] | |
264 | * | |
265 | * @param crop_height | |
266 | * cropped image height[in] | |
267 | * | |
268 | * @param color_format | |
269 | * destination color format(HAL format)[in] | |
270 | * | |
271 | * @return | |
272 | * error code | |
273 | */ | |
274 | CSC_ERRORCODE csc_set_dst_format( | |
275 | void *handle, | |
276 | unsigned int width, | |
277 | unsigned int height, | |
278 | unsigned int crop_left, | |
279 | unsigned int crop_top, | |
280 | unsigned int crop_width, | |
281 | unsigned int crop_height, | |
282 | unsigned int color_format, | |
283 | unsigned int cacheable); | |
284 | ||
285 | /* | |
286 | * Setup source buffer | |
287 | * set_format func should be called before this this func. | |
288 | * | |
289 | * @param handle | |
290 | * CSC handle[in] | |
291 | * | |
292 | * @param src_buffer | |
293 | * source buffer pointer array[in] | |
294 | * | |
295 | * @param y | |
296 | * y or RGB destination pointer[in] | |
297 | * | |
298 | * @param u | |
299 | * u or uv destination pointer[in] | |
300 | * | |
301 | * @param v | |
302 | * v or none destination pointer[in] | |
303 | * | |
304 | * @return | |
305 | * error code | |
306 | */ | |
307 | CSC_ERRORCODE csc_set_src_buffer( | |
308 | void *handle, | |
309 | unsigned char *y, | |
310 | unsigned char *u, | |
311 | unsigned char *v, | |
312 | int ion_fd); | |
313 | ||
314 | /* | |
315 | * Setup destination buffer | |
316 | * | |
317 | * @param handle | |
318 | * CSC handle[in] | |
319 | * | |
320 | * @param y | |
321 | * y or RGB destination pointer[in] | |
322 | * | |
323 | * @param u | |
324 | * u or uv destination pointer[in] | |
325 | * | |
326 | * @param v | |
327 | * v or none destination pointer[in] | |
328 | * | |
329 | * @return | |
330 | * error code | |
331 | */ | |
332 | CSC_ERRORCODE csc_set_dst_buffer( | |
333 | void *handle, | |
334 | unsigned char *y, | |
335 | unsigned char *u, | |
336 | unsigned char *v, | |
337 | int ion_fd); | |
338 | ||
339 | /* | |
340 | * Convert color space with presetup color format | |
341 | * | |
342 | * @param handle | |
343 | * CSC handle[in] | |
344 | * | |
345 | * @return | |
346 | * error code | |
347 | */ | |
348 | CSC_ERRORCODE csc_convert( | |
349 | void *handle); | |
350 | ||
351 | #ifdef __cplusplus | |
352 | } | |
353 | #endif | |
354 | ||
355 | #endif |