summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Verma <dverma@codeaurora.org>2013-08-16 17:19:08 +0530
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2014-01-23 16:08:27 +0000
commitc53dbe469911a8d5e489f192cc0ecc3307ce8273 (patch)
treebc9507c16248074cacf0d01b349e2ba724c032e5
parent797e73d26d9153732fae0c75cf4f8f64fb40b06c (diff)
downloadandroid_hardware_qcom_media-c53dbe469911a8d5e489f192cc0ecc3307ce8273.tar.gz
android_hardware_qcom_media-c53dbe469911a8d5e489f192cc0ecc3307ce8273.tar.bz2
android_hardware_qcom_media-c53dbe469911a8d5e489f192cc0ecc3307ce8273.zip
mm-video: venc: Distinguish between normal NV12 and aligned NV12
Encoder has a hard-requirement of 2K alignment of UV plane. Apps and other non-camera sources (not aware of this alignment) will queue YUV420SP buffers, which need an explicit alignment. But for some other apps(e.g VT) that are aware that the component wants aligned NV12 and would align it themselves, causing the component to muck up the buffer by realigning it. To prevent the confusion, the component now makes a distinction between NV12 (OMX_COLOR_FormatYUV420SemiPlanar) and aligned NV12 (QOMX_COLOR_\ FORMATYUV420PackedSemiPlanar32). Clients who prefer to provide aligned buffers will now set the latter as the input port format. Change-Id: I73c337660fb825e9b267663266fd4b9d6e35443e Conflicts: mm-core/inc/OMX_QCOMExtns.h mm-video-legacy/vidc/venc/src/omx_video_base.cpp
-rw-r--r--mm-video-legacy/vidc/venc/src/omx_video_base.cpp30
-rw-r--r--mm-video-legacy/vidc/venc/src/omx_video_encoder.cpp13
-rw-r--r--mm-video-legacy/vidc/venc/src/video_encoder_device.cpp4
3 files changed, 26 insertions, 21 deletions
diff --git a/mm-video-legacy/vidc/venc/src/omx_video_base.cpp b/mm-video-legacy/vidc/venc/src/omx_video_base.cpp
index 84099b28..479d4045 100644
--- a/mm-video-legacy/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video-legacy/vidc/venc/src/omx_video_base.cpp
@@ -1575,23 +1575,25 @@ OMX_ERRORTYPE omx_video::get_parameter(OMX_IN OMX_HANDLETYPE hComp,
if(portFmt->nPortIndex == (OMX_U32) PORT_INDEX_IN)
{
int index = portFmt->nIndex;
-
- if (index > 1) {
+ //we support following formats
+ //index 0 - YUV420SP32m
+ //index 1 - opaque which internally maps to YUV420SP.
+ //index 2 - YUV420SP
+ //this can be extended in the future
+ int supportedFormats[] = {
+ [0] = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
+ [1] = QOMX_COLOR_FormatAndroidOpaque,
+ [2] = OMX_COLOR_FormatYUV420SemiPlanar,
+ };
+
+ if (index > sizeof(supportedFormats)/sizeof(*supportedFormats)) {
eRet = OMX_ErrorNoMore;
} else {
memcpy(portFmt, &m_sInPortFormat, sizeof(m_sInPortFormat));
-#ifdef _ANDROID_ICS_
- if (index == 1) {
- //we support two formats
- //index 0 - YUV420SP
- //index 1 - opaque which internally maps to YUV420SP.
- //this can be extended in the future
- portFmt->nIndex = index; //restore index set from client
- portFmt->eColorFormat =
- (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FormatAndroidOpaque;
- }
+ portFmt->nIndex = index; //restore index set from client
+ portFmt->eColorFormat =
+ (OMX_COLOR_FORMATTYPE)supportedFormats[index];
}
-#endif
}
else if(portFmt->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
{
@@ -3442,7 +3444,7 @@ OMX_ERRORTYPE omx_video::empty_this_buffer_proxy(OMX_IN OMX_HANDLETYPE
buffer->nFilledLen);
DEBUG_PRINT_LOW("memcpy() done in ETBProxy for i/p Heap UseBuf");
} else if (m_sInPortDef.format.video.eColorFormat ==
- OMX_COLOR_FormatYUV420SemiPlanar && !mUseProxyColorFormat) {
+ OMX_COLOR_FormatYUV420SemiPlanar) {
//For the case where YUV420SP buffers are qeueued to component
//by sources other than camera (Apps via MediaCodec), alignment
//of chroma-plane to 2K is necessary.
diff --git a/mm-video-legacy/vidc/venc/src/omx_video_encoder.cpp b/mm-video-legacy/vidc/venc/src/omx_video_encoder.cpp
index f669dbe1..0ed3f3b4 100644
--- a/mm-video-legacy/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-legacy/vidc/venc/src/omx_video_encoder.cpp
@@ -255,7 +255,8 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role)
m_sInPortDef.format.video.nSliceHeight = OMX_CORE_QCIF_HEIGHT;
m_sInPortDef.format.video.nBitrate = 64000;
m_sInPortDef.format.video.xFramerate = 15 << 16;
- m_sInPortDef.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+ m_sInPortDef.format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)
+ QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m;
m_sInPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
if(dev_get_buf_req(&m_sInPortDef.nBufferCountMin,
@@ -303,7 +304,8 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role)
OMX_INIT_STRUCT(&m_sInPortFormat, OMX_VIDEO_PARAM_PORTFORMATTYPE);
m_sInPortFormat.nPortIndex = (OMX_U32) PORT_INDEX_IN;
m_sInPortFormat.nIndex = 0;
- m_sInPortFormat.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+ m_sInPortFormat.eColorFormat = (OMX_COLOR_FORMATTYPE)
+ QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m;
m_sInPortFormat.eCompressionFormat = OMX_VIDEO_CodingUnused;
@@ -532,8 +534,8 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
#ifdef _ANDROID_ICS_
if (portDefn->format.video.eColorFormat == (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FormatAndroidOpaque) {
- m_sInPortDef.format.video.eColorFormat =
- OMX_COLOR_FormatYUV420SemiPlanar;
+ m_sInPortDef.format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)
+ QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m;
if(secure_session) {
secure_color_format = (int) QOMX_COLOR_FormatAndroidOpaque;
mUseProxyColorFormat = false;
@@ -613,7 +615,8 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
#ifdef _ANDROID_ICS_
if (portFmt->eColorFormat ==
(OMX_COLOR_FORMATTYPE)QOMX_COLOR_FormatAndroidOpaque) {
- m_sInPortFormat.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+ m_sInPortFormat.eColorFormat = (OMX_COLOR_FORMATTYPE)
+ QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m;
if(secure_session) {
secure_color_format = (int) QOMX_COLOR_FormatAndroidOpaque;
mUseProxyColorFormat = false;
diff --git a/mm-video-legacy/vidc/venc/src/video_encoder_device.cpp b/mm-video-legacy/vidc/venc/src/video_encoder_device.cpp
index eb1b6fbf..5386f465 100644
--- a/mm-video-legacy/vidc/venc/src/video_encoder_device.cpp
+++ b/mm-video-legacy/vidc/venc/src/video_encoder_device.cpp
@@ -2447,8 +2447,8 @@ bool venc_dev::venc_set_color_format(OMX_COLOR_FORMATTYPE color_format)
venc_ioctl_msg ioctl_msg = {NULL, NULL};
DEBUG_PRINT_LOW("\n venc_set_color_format: color_format = %u ", color_format);
- if(color_format == OMX_COLOR_FormatYUV420SemiPlanar)
- {
+ if(color_format == OMX_COLOR_FormatYUV420SemiPlanar ||
+ color_format == QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m) {
#ifdef MAX_RES_1080P
m_sVenc_cfg.inputformat= VEN_INPUTFMT_NV12_16M2KA;
#else