2 * Copyright (C) 2012 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 * @brief color space convertion abstract header
22 * @author Pyoungjae Jung (pjet.jung@samsung.com)
37 #define CSC_MAX_PLANES 3
39 typedef enum _CSC_ERRORCODE
{
43 CSC_ErrorInvalidAddress
,
44 CSC_ErrorUnsupportFormat
,
45 CSC_ErrorNotImplemented
48 typedef enum _CSC_METHOD
{
53 typedef enum _CSC_HW_PROPERTY_TYPE
{
54 CSC_HW_PROPERTY_FIXED_NODE
= 0,
55 CSC_HW_PROPERTY_MODE_DRM
,
56 CSC_HW_PROPERTY_HW_TYPE
,
57 } CSC_HW_PROPERTY_TYPE
;
59 typedef enum _CSC_HW_TYPE
{
67 * change hal pixel format to omx pixel format
70 * hal pixel format[in]
75 unsigned int hal_2_omx_pixel_format(
76 unsigned int hal_format
);
79 * change omx pixel format to hal pixel format
82 * omx pixel format[in]
87 unsigned int omx_2_hal_pixel_format(
88 unsigned int omx_format
);
91 * change hal pixel format to g2d color format
94 * hal pixel format[in]
99 unsigned int hal_2_g2d_color_format(unsigned int hal_format
);
102 * change hal pixel format to g2d pixel order
105 * hal pixel format[in]
110 unsigned int hal_2_g2d_pixel_order(unsigned int hal_format
);
113 * change hal pixel format to g2d "bpp" (actual bpp for RGB formats, 8 bpp for
117 * hal pixel format[in]
122 size_t hal_2_g2d_bpp(unsigned int hal_format
);
142 CSC_ERRORCODE
csc_deinit(
146 * get color space converter method
157 CSC_ERRORCODE
csc_get_method(
162 * set color space converter method
173 CSC_ERRORCODE
csc_set_method(
184 * csc hw property[in]
187 * csc hw property value[in]
192 CSC_ERRORCODE
csc_set_hw_property(
194 CSC_HW_PROPERTY_TYPE property
,
204 * address of image width[out]
207 * address of image height[out]
210 * address of image left crop size[out]
213 * address of image top crop size[out]
216 * address of cropped image width[out]
219 * address of cropped image height[out]
221 * @param color_format
222 * address of source color format(HAL format)[out]
227 CSC_ERRORCODE
csc_get_src_format(
230 unsigned int *height
,
231 unsigned int *crop_left
,
232 unsigned int *crop_top
,
233 unsigned int *crop_width
,
234 unsigned int *crop_height
,
235 unsigned int *color_format
,
236 unsigned int *cacheable
);
240 * Don't call each converting time.
241 * Pls call this function as below.
242 * 1. first converting time
243 * 2. format is changed
255 * image left crop size[in]
258 * image top crop size[in]
261 * cropped image width[in]
264 * cropped image height[in]
266 * @param color_format
267 * source color format(HAL format)[in]
272 CSC_ERRORCODE
csc_set_src_format(
276 unsigned int crop_left
,
277 unsigned int crop_top
,
278 unsigned int crop_width
,
279 unsigned int crop_height
,
280 unsigned int color_format
,
281 unsigned int cacheable
);
284 * Get destination format.
290 * address of image width[out]
293 * address of image height[out]
296 * address of image left crop size[out]
299 * address of image top crop size[out]
302 * address of cropped image width[out]
305 * address of cropped image height[out]
307 * @param color_format
308 * address of color format(HAL format)[out]
313 CSC_ERRORCODE
csc_get_dst_format(
316 unsigned int *height
,
317 unsigned int *crop_left
,
318 unsigned int *crop_top
,
319 unsigned int *crop_width
,
320 unsigned int *crop_height
,
321 unsigned int *color_format
,
322 unsigned int *cacheable
);
325 * Set destination format
326 * Don't call each converting time.
327 * Pls call this function as below.
328 * 1. first converting time
329 * 2. format is changed
341 * image left crop size[in]
344 * image top crop size[in]
347 * cropped image width[in]
350 * cropped image height[in]
352 * @param color_format
353 * destination color format(HAL format)[in]
358 CSC_ERRORCODE
csc_set_dst_format(
362 unsigned int crop_left
,
363 unsigned int crop_top
,
364 unsigned int crop_width
,
365 unsigned int crop_height
,
366 unsigned int color_format
,
367 unsigned int cacheable
);
370 * Setup source buffer
371 * set_format func should be called before this this func.
377 * source buffer pointer array[in]
380 * y or RGB destination pointer[in]
383 * u or uv destination pointer[in]
386 * v or none destination pointer[in]
391 CSC_ERRORCODE
csc_set_src_buffer(
393 void *addr
[CSC_MAX_PLANES
]);
396 * Setup destination buffer
402 * y or RGB destination pointer[in]
405 * u or uv destination pointer[in]
408 * v or none destination pointer[in]
413 CSC_ERRORCODE
csc_set_dst_buffer(
415 void *addr
[CSC_MAX_PLANES
]);
418 * Convert color space with presetup color format
426 CSC_ERRORCODE
csc_convert(
429 CSC_ERRORCODE
csc_convert_with_rotation(
430 void *handle
, int rotation
, int flip_horizontal
, int flip_vertical
);
432 CSC_ERRORCODE
csc_set_filter_property(void *handle
);