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_TYPE
;
58 typedef enum _CSC_MEMTYPE
{
66 typedef enum _CSC_HW_ID
{
77 typedef enum _CSC_PLANE
{
85 typedef enum _CSC_HW_TYPE
{
90 typedef enum _CSC_EQ_MODE
{
95 typedef enum _CSC_EQ_COLORSPACE
{
96 CSC_EQ_COLORSPACE_SMPTE170M
= 1,
97 CSC_EQ_COLORSPACE_SMPTE240M
,
98 CSC_EQ_COLORSPACE_REC709
,
99 CSC_EQ_COLORSPACE_BT878
,
100 CSC_EQ_COLORSPACE_470_SYSTEM_M
,
101 CSC_EQ_COLORSPACE_470_SYSTEM_BG
104 typedef enum _CSC_EQ_RANGE
{
105 CSC_EQ_RANGE_NARROW
= 0,
109 typedef enum _CSC_HW_FILTER
{
119 typedef struct _CSC_FORMAT
{
122 unsigned int crop_left
;
123 unsigned int crop_top
;
124 unsigned int crop_width
;
125 unsigned int crop_height
;
126 unsigned int color_format
;
127 unsigned int cacheable
;
128 unsigned int mode_drm
;
131 typedef struct _CSC_BUFFER
{
132 void *planes
[CSC_MAX_PLANES
];
136 typedef struct _CSC_HW_PROPERTY
{
141 typedef struct _CSC_HANDLE
{
142 CSC_FORMAT dst_format
;
143 CSC_FORMAT src_format
;
144 CSC_BUFFER dst_buffer
;
145 CSC_BUFFER src_buffer
;
146 CSC_METHOD csc_method
;
147 CSC_HW_TYPE csc_hw_type
;
149 CSC_HW_PROPERTY hw_property
;
152 CSC_EQ_MODE csc_mode
;
153 CSC_EQ_RANGE csc_range
;
154 CSC_EQ_COLORSPACE colorspace
;
156 /* Denoising filter */
157 CSC_HW_FILTER filter
;
161 * change hal pixel format to omx pixel format
164 * hal pixel format[in]
169 unsigned int hal_2_omx_pixel_format(
170 unsigned int hal_format
);
173 * change omx pixel format to hal pixel format
176 * omx pixel format[in]
181 unsigned int omx_2_hal_pixel_format(
182 unsigned int omx_format
);
202 CSC_ERRORCODE
csc_deinit(
206 * get color space converter method
217 CSC_ERRORCODE
csc_get_method(
222 * set color space converter method
233 CSC_ERRORCODE
csc_set_method(
244 * csc hw property[in]
247 * csc hw property value[in]
252 CSC_ERRORCODE
csc_set_hw_property(
254 CSC_HW_PROPERTY_TYPE property
,
258 * Get csc equation property.
264 * csc equation mode[out]
267 * csc color space[out]
270 * csc equation range[out]
275 CSC_ERRORCODE
csc_get_eq_property(
277 CSC_EQ_MODE
*csc_mode
,
278 CSC_EQ_RANGE
*csc_range
,
279 CSC_EQ_COLORSPACE
*colorspace
);
282 * Set csc equation property.
288 * csc equation mode[in]
291 * csc color space[in]
294 * csc equation range[in]
299 CSC_ERRORCODE
csc_set_eq_property(
301 CSC_EQ_MODE csc_mode
,
302 CSC_EQ_RANGE csc_range
,
303 CSC_EQ_COLORSPACE colorspace
);
306 * Set csc filter property.
312 * csc filter info[in]
317 CSC_ERRORCODE
csc_set_filter_property(
319 CSC_HW_FILTER filter
);
328 * address of image width[out]
331 * address of image height[out]
334 * address of image left crop size[out]
337 * address of image top crop size[out]
340 * address of cropped image width[out]
343 * address of cropped image height[out]
345 * @param color_format
346 * address of source color format(HAL format)[out]
351 CSC_ERRORCODE
csc_get_src_format(
354 unsigned int *height
,
355 unsigned int *crop_left
,
356 unsigned int *crop_top
,
357 unsigned int *crop_width
,
358 unsigned int *crop_height
,
359 unsigned int *color_format
,
360 unsigned int *cacheable
);
364 * Don't call each converting time.
365 * Pls call this function as below.
366 * 1. first converting time
367 * 2. format is changed
379 * image left crop size[in]
382 * image top crop size[in]
385 * cropped image width[in]
388 * cropped image height[in]
390 * @param color_format
391 * source color format(HAL format)[in]
396 CSC_ERRORCODE
csc_set_src_format(
400 unsigned int crop_left
,
401 unsigned int crop_top
,
402 unsigned int crop_width
,
403 unsigned int crop_height
,
404 unsigned int color_format
,
405 unsigned int cacheable
);
408 * Get destination format.
414 * address of image width[out]
417 * address of image height[out]
420 * address of image left crop size[out]
423 * address of image top crop size[out]
426 * address of cropped image width[out]
429 * address of cropped image height[out]
431 * @param color_format
432 * address of color format(HAL format)[out]
437 CSC_ERRORCODE
csc_get_dst_format(
440 unsigned int *height
,
441 unsigned int *crop_left
,
442 unsigned int *crop_top
,
443 unsigned int *crop_width
,
444 unsigned int *crop_height
,
445 unsigned int *color_format
,
446 unsigned int *cacheable
);
449 * Set destination format
450 * Don't call each converting time.
451 * Pls call this function as below.
452 * 1. first converting time
453 * 2. format is changed
465 * image left crop size[in]
468 * image top crop size[in]
471 * cropped image width[in]
474 * cropped image height[in]
476 * @param color_format
477 * destination color format(HAL format)[in]
482 CSC_ERRORCODE
csc_set_dst_format(
486 unsigned int crop_left
,
487 unsigned int crop_top
,
488 unsigned int crop_width
,
489 unsigned int crop_height
,
490 unsigned int color_format
,
491 unsigned int cacheable
);
494 * Setup source buffer
495 * set_format func should be called before this this func.
501 * source buffer pointer array[in]
504 * y or RGB destination pointer[in]
507 * u or uv destination pointer[in]
510 * v or none destination pointer[in]
515 CSC_ERRORCODE
csc_set_src_buffer(
517 void *addr
[CSC_MAX_PLANES
],
521 * Setup destination buffer
527 * y or RGB destination pointer[in]
530 * u or uv destination pointer[in]
533 * v or none destination pointer[in]
538 CSC_ERRORCODE
csc_set_dst_buffer(
540 void *addr
[CSC_MAX_PLANES
],
544 * Convert color space with presetup color format
552 CSC_ERRORCODE
csc_convert(
555 CSC_ERRORCODE
csc_convert_with_rotation(
556 void *handle
, int rotation
, int flip_horizontal
, int flip_vertical
);