blob: 9f13d62b321f79723e1bcef1375c449aaf76afd6 [file] [log] [blame]
Dima Zavin1a6a35d2012-04-16 16:25:38 -07001/*
2 *
3 * Copyright 2012 Samsung Electronics S.LSI Co. LTD
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#define LOG_TAG "libcsc_helper"
19#include <cutils/log.h>
20
Jiho Chang3b540842012-04-26 13:39:20 -070021#include <system/graphics.h>
22
Dima Zavin1a6a35d2012-04-16 16:25:38 -070023#include "Exynos_OMX_Def.h"
24
25#include "csc.h"
26#include "exynos_format.h"
27
28OMX_COLOR_FORMATTYPE hal_2_omx_pixel_format(
29 unsigned int hal_format)
30{
31 OMX_COLOR_FORMATTYPE omx_format;
32 switch (hal_format) {
Jiho Chang3b540842012-04-26 13:39:20 -070033 case HAL_PIXEL_FORMAT_YCbCr_422_I:
34 omx_format = OMX_COLOR_FormatYCbYCr;
35 break;
Dima Zavin1a6a35d2012-04-16 16:25:38 -070036 case HAL_PIXEL_FORMAT_YCbCr_420_P:
37 omx_format = OMX_COLOR_FormatYUV420Planar;
38 break;
39 case HAL_PIXEL_FORMAT_YCbCr_420_SP:
40 omx_format = OMX_COLOR_FormatYUV420SemiPlanar;
41 break;
Jiho Chang3b540842012-04-26 13:39:20 -070042 case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED:
43 omx_format = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
44 break;
Dima Zavin1a6a35d2012-04-16 16:25:38 -070045 case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
46 omx_format = OMX_SEC_COLOR_FormatNV12Tiled;
47 break;
48 case HAL_PIXEL_FORMAT_ARGB888:
49 omx_format = OMX_COLOR_Format32bitARGB8888;
50 break;
51 default:
52 omx_format = OMX_COLOR_FormatYUV420Planar;
53 break;
54 }
55 return omx_format;
56}
57
58unsigned int omx_2_hal_pixel_format(
59 OMX_COLOR_FORMATTYPE omx_format)
60{
61 unsigned int hal_format;
62 switch (omx_format) {
Jiho Chang3b540842012-04-26 13:39:20 -070063 case OMX_COLOR_FormatYCbYCr:
64 hal_format = HAL_PIXEL_FORMAT_YCbCr_422_I;
65 break;
Dima Zavin1a6a35d2012-04-16 16:25:38 -070066 case OMX_COLOR_FormatYUV420Planar:
67 hal_format = HAL_PIXEL_FORMAT_YCbCr_420_P;
68 break;
69 case OMX_COLOR_FormatYUV420SemiPlanar:
70 hal_format = HAL_PIXEL_FORMAT_YCbCr_420_SP;
71 break;
Jiho Chang3b540842012-04-26 13:39:20 -070072 case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
73 hal_format = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED;
74 break;
Dima Zavin1a6a35d2012-04-16 16:25:38 -070075 case OMX_SEC_COLOR_FormatNV12Tiled:
76 hal_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED;
77 break;
78 case OMX_COLOR_Format32bitARGB8888:
79 hal_format = HAL_PIXEL_FORMAT_ARGB888;
80 break;
81 default:
82 hal_format = HAL_PIXEL_FORMAT_YCbCr_420_P;
83 break;
84 }
85 return hal_format;
86}