diff options
author | Emilian Peev <epeev@mm-sol.com> | 2012-09-04 12:09:17 +0300 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-26 20:09:17 +0200 |
commit | 09b5ff4a75238f8e33b84d56851ff21e447f6016 (patch) | |
tree | c42d4bc778d26aaa9854639e8bea138735206dc1 /camera | |
parent | b10ee605cdfa5fd96c7bfeea7d0b3c702525185c (diff) | |
download | hardware_ti_omap4-09b5ff4a75238f8e33b84d56851ff21e447f6016.zip hardware_ti_omap4-09b5ff4a75238f8e33b84d56851ff21e447f6016.tar.gz hardware_ti_omap4-09b5ff4a75238f8e33b84d56851ff21e447f6016.tar.bz2 |
CameraHal: Add support for UYVY reprocessing
NOTE: Currently UYVY is mapped to
'CameraParameters::PIXEL_FORMAT_YUV422I' which
is not entirely correct. The Google pixelformat
expects YUYV ordering of the components.
Change-Id: Ia82e08363d6804e51c447eb845da2ca23fc29ae9
Signed-off-by: Emilian Peev <epeev@mm-sol.com>
Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
Diffstat (limited to 'camera')
-rw-r--r-- | camera/BufferSourceAdapter.cpp | 7 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXReprocess.cpp | 6 | ||||
-rw-r--r-- | camera/inc/CameraHal.h | 1 |
3 files changed, 11 insertions, 3 deletions
diff --git a/camera/BufferSourceAdapter.cpp b/camera/BufferSourceAdapter.cpp index a595b4b..97a7809 100644 --- a/camera/BufferSourceAdapter.cpp +++ b/camera/BufferSourceAdapter.cpp @@ -31,8 +31,7 @@ static int getANWFormat(const char* parameters_format) if (parameters_format != NULL) { if (strcmp(parameters_format, android::CameraParameters::PIXEL_FORMAT_YUV422I) == 0) { CAMHAL_LOGDA("CbYCrY format selected"); - // TODO(XXX): not defined yet - format = -1; + format = HAL_PIXEL_FORMAT_TI_UYVY; } else if (strcmp(parameters_format, android::CameraParameters::PIXEL_FORMAT_YUV420SP) == 0) { CAMHAL_LOGDA("YUV420SP format selected"); format = HAL_PIXEL_FORMAT_TI_NV12; @@ -78,6 +77,8 @@ static const char* getFormatFromANW(int format) return android::CameraParameters::PIXEL_FORMAT_YUV420SP; case HAL_PIXEL_FORMAT_TI_Y16: return android::CameraParameters::PIXEL_FORMAT_BAYER_RGGB; + case HAL_PIXEL_FORMAT_TI_UYVY: + return android::CameraParameters::PIXEL_FORMAT_YUV422I; default: break; } @@ -88,6 +89,7 @@ static CameraFrame::FrameType formatToOutputFrameType(const char* format) { switch (getANWFormat(format)) { case HAL_PIXEL_FORMAT_TI_NV12: case HAL_PIXEL_FORMAT_TI_Y16: + case HAL_PIXEL_FORMAT_TI_UYVY: // Assuming NV12 1D is RAW or Image frame return CameraFrame::RAW_FRAME; default: @@ -102,6 +104,7 @@ static int getHeightFromFormat(const char* format, int stride, int size) { case HAL_PIXEL_FORMAT_TI_NV12: return (size / (3 * stride)) * 2; case HAL_PIXEL_FORMAT_TI_Y16: + case HAL_PIXEL_FORMAT_TI_UYVY: return (size / stride) / 2; default: break; diff --git a/camera/OMXCameraAdapter/OMXReprocess.cpp b/camera/OMXCameraAdapter/OMXReprocess.cpp index 9057c1c..6fdbe7b 100644 --- a/camera/OMXCameraAdapter/OMXReprocess.cpp +++ b/camera/OMXCameraAdapter/OMXReprocess.cpp @@ -60,6 +60,9 @@ status_t OMXCameraAdapter::setParametersReprocess(const android::CameraParameter } else if (strcmp(valstr, android::CameraParameters::PIXEL_FORMAT_BAYER_RGGB) == 0) { CAMHAL_LOGDA("RAW Picture format selected"); pixFormat = OMX_COLOR_FormatRawBayer10bit; + } else if (strcmp(valstr, android::CameraParameters::PIXEL_FORMAT_YUV422I) == 0) { + CAMHAL_LOGDA("YUV422i Picture format selected"); + pixFormat = OMX_COLOR_FormatCbYCrY; } else { CAMHAL_LOGDA("Format not supported, selecting YUV420SP by default"); pixFormat = OMX_COLOR_FormatYUV420SemiPlanar; @@ -74,7 +77,8 @@ status_t OMXCameraAdapter::setParametersReprocess(const android::CameraParameter portData->mWidth = w; portData->mHeight = h; - if ( OMX_COLOR_FormatRawBayer10bit == pixFormat ) { + if ( ( OMX_COLOR_FormatRawBayer10bit == pixFormat ) || + ( OMX_COLOR_FormatCbYCrY == pixFormat ) ) { portData->mStride = w * 2; } else { portData->mStride = s; diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h index c7ac257..a97ae96 100644 --- a/camera/inc/CameraHal.h +++ b/camera/inc/CameraHal.h @@ -60,6 +60,7 @@ #define HAL_PIXEL_FORMAT_TI_NV12 0x100 #define HAL_PIXEL_FORMAT_TI_Y8 0x103 #define HAL_PIXEL_FORMAT_TI_Y16 0x104 +#define HAL_PIXEL_FORMAT_TI_UYVY 0x105 #define MIN_WIDTH 640 #define MIN_HEIGHT 480 |