fix build warning
[platform/adaptation/ap_samsung/libomxil-e3250-v4l2.git] / exynos / libcsc / csc_helper.c
1 /*
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 #ifndef TIZEN_FEATURE_E3250 /* build env */
20 #include <cutils/log.h>
21 #include <system/graphics.h>
22 #endif
23
24 #include "Exynos_OMX_Def.h"
25
26 #include "csc.h"
27 #include "exynos_format.h"
28
29 OMX_COLOR_FORMATTYPE hal_2_omx_pixel_format(
30     unsigned int hal_format)
31 {
32     OMX_COLOR_FORMATTYPE omx_format;
33     switch (hal_format) {
34 #ifndef TIZEN_FEATURE_E3250 /* build env */ /* useless */
35     case HAL_PIXEL_FORMAT_YCbCr_422_I:
36         omx_format = OMX_COLOR_FormatYCbYCr;
37         break;
38 #endif
39     case HAL_PIXEL_FORMAT_YCbCr_420_P:
40         omx_format = OMX_COLOR_FormatYUV420Planar;
41         break;
42     case HAL_PIXEL_FORMAT_YCbCr_420_SP:
43         omx_format = OMX_COLOR_FormatYUV420SemiPlanar;
44         break;
45 /*
46     case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED:
47         omx_format = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
48         break;
49 */
50     case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
51         omx_format = OMX_SEC_COLOR_FormatNV12Tiled;
52         break;
53     case HAL_PIXEL_FORMAT_ARGB888:
54         omx_format = OMX_COLOR_Format32bitARGB8888;
55         break;
56     default:
57         omx_format = OMX_COLOR_FormatYUV420Planar;
58         break;
59     }
60     return omx_format;
61 }
62
63 unsigned int omx_2_hal_pixel_format(
64     OMX_COLOR_FORMATTYPE omx_format)
65 {
66     unsigned int hal_format;
67     switch ((int)omx_format) {
68 #ifndef TIZEN_FEATURE_E3250 /* build env */ /* useless */
69     case OMX_COLOR_FormatYCbYCr:
70         hal_format = HAL_PIXEL_FORMAT_YCbCr_422_I;
71         break;
72 #endif
73     case OMX_COLOR_FormatYUV420Planar:
74         hal_format = HAL_PIXEL_FORMAT_YCbCr_420_P;
75         break;
76     case OMX_COLOR_FormatYUV420SemiPlanar:
77         hal_format = HAL_PIXEL_FORMAT_YCbCr_420_SP;
78         break;
79 /*
80     case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
81         hal_format = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED;
82         break;
83 */
84     case OMX_SEC_COLOR_FormatNV12Tiled:
85         hal_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED;
86         break;
87     case OMX_COLOR_Format32bitARGB8888:
88         hal_format = HAL_PIXEL_FORMAT_ARGB888;
89         break;
90     default:
91         hal_format = HAL_PIXEL_FORMAT_YCbCr_420_P;
92         break;
93     }
94     return hal_format;
95 }