mm-video: venc: Expose OMX_QTIIndexParamIframeSizeType

OMX_QTIIndexParamIframeSizeType allows clients to control the size of
I-frames.

Change-Id: I091f425a26c28207b208f1737904a0176f45bb0b
CRs-Fixed: 1082285
This commit is contained in:
Deepak Kushwah 2016-11-21 13:18:17 +05:30 committed by Gerrit - the friendly Code Review server
parent c40ef32c84
commit fbda0b5b73
4 changed files with 74 additions and 0 deletions

View file

@ -636,6 +636,8 @@ enum OMX_QCOM_EXTN_INDEXTYPE
/* Dither control for 10bit */
OMX_QTIIndexParamDitherControl = 0x7F000069,
/* Suggest how big Iframe sizes should be */
OMX_QTIIndexParamIframeSizeType = 0x7F000070,
};
/**
@ -1907,6 +1909,18 @@ typedef struct QOMX_VIDEO_H264ENTROPYCODINGTYPE {
OMX_U32 nCabacInitIdc;
} QOMX_VIDEO_H264ENTROPYCODINGTYPE;
typedef enum QOMX_VIDEO_IFRAMESIZE_TYPE {
QOMX_IFRAMESIZE_DEFAULT,
QOMX_IFRAMESIZE_MEDIUM,
QOMX_IFRAMESIZE_HUGE,
QOMX_IFRAMESIZE_UNLIMITED,
} QOMX_VIDEO_IFRAMESIZE_TYPE;
typedef struct QOMX_VIDEO_IFRAMESIZE {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
QOMX_VIDEO_IFRAMESIZE_TYPE eType;
} QOMX_VIDEO_IFRAMESIZE;
/* VIDEO POSTPROCESSING CTRLS AND ENUMS */
/* MUST KEEP SAME AS IN vpp.h */

View file

@ -575,6 +575,7 @@ class venc_dev
bool venc_set_colorspace(OMX_U32 primaries, OMX_U32 range, OMX_U32 transfer_chars, OMX_U32 matrix_coeffs);
OMX_ERRORTYPE venc_set_temporal_layers(OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE *pTemporalParams);
OMX_ERRORTYPE venc_set_temporal_layers_internal();
bool venc_set_iframesize_type(QOMX_VIDEO_IFRAMESIZE_TYPE type);
#ifdef MAX_RES_1080P
OMX_U32 pmem_free();

View file

@ -1727,6 +1727,16 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
(OMX_INDEXTYPE)OMX_QTIIndexParamDisablePQ);
break;
}
case OMX_QTIIndexParamIframeSizeType:
{
VALIDATE_OMX_PARAM_DATA(paramData, QOMX_VIDEO_IFRAMESIZE);
if (!handle->venc_set_param(paramData,
(OMX_INDEXTYPE)OMX_QTIIndexParamIframeSizeType)) {
DEBUG_PRINT_ERROR("ERROR: Setting OMX_QTIIndexParamIframeSizeType failed");
return OMX_ErrorUnsupportedSetting;
}
break;
}
case OMX_IndexParamVideoSliceFMO:
default:
{

View file

@ -1707,6 +1707,7 @@ bool venc_dev::venc_set_param(void *paramData, OMX_INDEXTYPE index)
struct v4l2_format fmt;
struct v4l2_requestbuffers bufreq;
int ret;
bool isCBR;
switch ((int)index) {
case OMX_IndexParamPortDefinition:
@ -2516,6 +2517,23 @@ bool venc_dev::venc_set_param(void *paramData, OMX_INDEXTYPE index)
#endif
break;
}
case OMX_QTIIndexParamIframeSizeType:
{
QOMX_VIDEO_IFRAMESIZE* pParam =
(QOMX_VIDEO_IFRAMESIZE *)paramData;
isCBR = rate_ctrl.rcmode == V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_VFR ||
rate_ctrl.rcmode == V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_CFR;
if (!isCBR) {
DEBUG_PRINT_ERROR("venc_set_param: OMX_QTIIndexParamIframeSizeType not allowed for this configuration isCBR(%d)",
isCBR);
return OMX_ErrorUnsupportedSetting;
}
if (!venc_set_iframesize_type(pParam->eType)) {
DEBUG_PRINT_ERROR("ERROR: Setting OMX_QTIIndexParamIframeSizeType failed");
return OMX_ErrorUnsupportedSetting;
}
break;
}
case OMX_IndexParamVideoSliceFMO:
default:
DEBUG_PRINT_ERROR("ERROR: Unsupported parameter in venc_set_param: %u",
@ -6549,6 +6567,37 @@ bool venc_dev::venc_set_low_latency(OMX_BOOL enable)
return true;
}
bool venc_dev::venc_set_iframesize_type(QOMX_VIDEO_IFRAMESIZE_TYPE type)
{
struct v4l2_control control;
control.id = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_TYPE;
switch (type) {
case QOMX_IFRAMESIZE_DEFAULT:
control.value = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_DEFAULT;
break;
case QOMX_IFRAMESIZE_MEDIUM:
control.value = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_MEDIUM;
break;
case QOMX_IFRAMESIZE_HUGE:
control.value = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_HUGE;
break;
case QOMX_IFRAMESIZE_UNLIMITED:
control.value = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_UNLIMITED;
break;
default:
DEBUG_PRINT_INFO("Unknown Iframe Size found setting it to default");
control.value = V4L2_CID_MPEG_VIDC_VIDEO_IFRAME_SIZE_DEFAULT;
}
if (ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control)) {
DEBUG_PRINT_ERROR("Failed to set iframe size hint");
return false;
}
return true;
}
bool venc_dev::venc_set_baselayerid(OMX_U32 baseid)
{
struct v4l2_control control;