blob: 9f13d62b321f79723e1bcef1375c449aaf76afd6 [file] [log] [blame]
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "libcsc_helper"
#include <cutils/log.h>
#include <system/graphics.h>
#include "Exynos_OMX_Def.h"
#include "csc.h"
#include "exynos_format.h"
OMX_COLOR_FORMATTYPE hal_2_omx_pixel_format(
unsigned int hal_format)
{
OMX_COLOR_FORMATTYPE omx_format;
switch (hal_format) {
case HAL_PIXEL_FORMAT_YCbCr_422_I:
omx_format = OMX_COLOR_FormatYCbYCr;
break;
case HAL_PIXEL_FORMAT_YCbCr_420_P:
omx_format = OMX_COLOR_FormatYUV420Planar;
break;
case HAL_PIXEL_FORMAT_YCbCr_420_SP:
omx_format = OMX_COLOR_FormatYUV420SemiPlanar;
break;
case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED:
omx_format = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
break;
case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
omx_format = OMX_SEC_COLOR_FormatNV12Tiled;
break;
case HAL_PIXEL_FORMAT_ARGB888:
omx_format = OMX_COLOR_Format32bitARGB8888;
break;
default:
omx_format = OMX_COLOR_FormatYUV420Planar;
break;
}
return omx_format;
}
unsigned int omx_2_hal_pixel_format(
OMX_COLOR_FORMATTYPE omx_format)
{
unsigned int hal_format;
switch (omx_format) {
case OMX_COLOR_FormatYCbYCr:
hal_format = HAL_PIXEL_FORMAT_YCbCr_422_I;
break;
case OMX_COLOR_FormatYUV420Planar:
hal_format = HAL_PIXEL_FORMAT_YCbCr_420_P;
break;
case OMX_COLOR_FormatYUV420SemiPlanar:
hal_format = HAL_PIXEL_FORMAT_YCbCr_420_SP;
break;
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
hal_format = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED;
break;
case OMX_SEC_COLOR_FormatNV12Tiled:
hal_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED;
break;
case OMX_COLOR_Format32bitARGB8888:
hal_format = HAL_PIXEL_FORMAT_ARGB888;
break;
default:
hal_format = HAL_PIXEL_FORMAT_YCbCr_420_P;
break;
}
return hal_format;
}