[go: nahoru, domu]

mm-video-v4l2: Deprecate Hybrid HP api

Client cannot set Hybrid HP api directly via extension.
Client needs to rely on standard encoding extension to enable
layer encoding. OMX component internally decides to enable
Hybrid HP layer encoding based on VBR_CFR RC mode.

CRs-Fixed: 2261962
Change-Id: Ia981bf44209cb25f48a16aa80f476c5d94bb7720
diff --git a/mm-core/inc/OMX_QCOMExtns.h b/mm-core/inc/OMX_QCOMExtns.h
index 8187485..9324f8f 100755
--- a/mm-core/inc/OMX_QCOMExtns.h
+++ b/mm-core/inc/OMX_QCOMExtns.h
@@ -517,9 +517,6 @@
     /* Max Hierarchical P layers */
     OMX_QcomIndexMaxHierarchicallayers = 0x7F000041,
 
-    /* Set Hybrid Hier-p layers */
-    OMX_QcomIndexParamVideoHybridHierpMode = 0x7F000043,
-
     OMX_QcomIndexFlexibleYUVDescription = 0x7F000044,
 
     /* Vpp Hqv Control Type */
@@ -739,37 +736,6 @@
    OMX_U32 nNumHierLayers;
 } QOMX_EXTNINDEX_VIDEO_HIER_P_LAYERS;
 
-
-/**
-* This is custom extension to configure Hybrid Hier-p settings.
-* This mode is different from enabling Hier-p mode. This
-* property enables Hier-p encoding with LTR referencing in each
-* sub-GOP.
-*
-* STRUCT MEMBERS
-*
-* nSize         : Size of Structure in bytes
-* nVersion      : OpenMAX IL specification version information
-* nKeyFrameInterval : Indicates the I frame interval
-* nHpLayers     : Set the number of Hier-p layers for the session
-*                  - This should be <= 6. (1 Base layer +
-*                    5 Enhancement layers)
-* nTemporalLayerBitrateRatio[OMX_VIDEO_MAX_HP_LAYERS] : Bitrate to
-*                    be set for each enhancement layer
-* nMinQuantizer  : minimum session QP
-* nMaxQuantizer  : Maximun session QP
-*/
-
-typedef struct QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE {
-   OMX_U32 nSize;
-   OMX_VERSIONTYPE nVersion;
-   OMX_U32 nKeyFrameInterval;
-   OMX_U32 nTemporalLayerBitrateRatio[OMX_VIDEO_MAX_HP_LAYERS];
-   OMX_U32 nMinQuantizer;
-   OMX_U32 nMaxQuantizer;
-   OMX_U32 nHpLayers;
-} QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE;
-
 /**
  * Initial QP parameter.  This structure is used to enable
  * vendor specific extension to let client enable setting
diff --git a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
index 4d75da2..5948ba4 100644
--- a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
+++ b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
@@ -347,8 +347,6 @@
         OMX_ERRORTYPE venc_set_hp(OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE &temporalSettings);
         OMX_ERRORTYPE venc_set_hhp(OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE &temporalSettings);
         OMX_ERRORTYPE venc_set_bitrate_ratio(OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE &temporalSettings);
-        bool venc_convert_abs2cum_bitrate(QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE *,
-                                OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE &temporalSettings);
         bool venc_validate_temporal_settings();
         bool venc_validate_temporal_extn(OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE &temporalSettings);
         OMX_ERRORTYPE venc_set_temporal_settings(OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE &temporalSettings);
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
index f19e71d..e30e863 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -1557,16 +1557,6 @@
                 }
                 break;
             }
-        case OMX_QcomIndexParamVideoHybridHierpMode:
-            {
-                VALIDATE_OMX_PARAM_DATA(paramData, QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE);
-               if(!handle->venc_set_param(paramData,
-                         (OMX_INDEXTYPE)OMX_QcomIndexParamVideoHybridHierpMode)) {
-                   DEBUG_PRINT_ERROR("Request to Enable Hybrid Hier-P failed");
-                   return OMX_ErrorUnsupportedSetting;
-                }
-                break;
-            }
         case OMX_QcomIndexParamBatchSize:
             {
                 VALIDATE_OMX_PARAM_DATA(paramData, OMX_PARAM_U32TYPE);
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index 4158f1e..b7650c5 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -2704,55 +2704,6 @@
                 }
                 break;
             }
-        case OMX_QcomIndexParamVideoHybridHierpMode:
-            {
-                QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE* pParam =
-                        (QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE*)paramData;
-                OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE temporalParams;
-                OMX_U32 i = 0, cumulativeBitrate = 0, cumulativeRatio = 0;
-                OMX_QCOM_VIDEO_PARAM_IPB_QPRANGETYPE qp_range;
-
-                memset(&temporalParams, 0, sizeof(temporalParams));
-                temporalParams.nPLayerCountActual   = pParam->nHpLayers;
-                temporalParams.ePattern             = OMX_VIDEO_AndroidTemporalLayeringPatternAndroid;
-                temporalParams.nBLayerCountActual   = 0;
-                temporalParams.nLayerCountMax       = pParam->nHpLayers;
-                temporalParams.nBLayerCountMax      = 0;
-
-                if (!venc_convert_abs2cum_bitrate(pParam, temporalParams)) {
-                    DEBUG_PRINT_ERROR("Failed to convert Hybrid param to internal struct");
-                    return false;
-                }
-
-                if (!venc_validate_temporal_extn(temporalParams)) {
-                    DEBUG_PRINT_ERROR("Invalid settings for Hybrid HP");
-                    return false;
-                }
-
-                venc_copy_temporal_settings(temporalParams);
-
-                if (!venc_set_intra_period(pParam->nKeyFrameInterval, 0)) {
-                   DEBUG_PRINT_ERROR("Failed to set Intraperiod: %d", pParam->nKeyFrameInterval);
-                   return false;
-                }
-
-                temporal_layers_config.nKeyFrameInterval = intra_period.num_pframes;
-
-                qp_range.minIQP = pParam->nMinQuantizer;
-                qp_range.maxIQP = pParam->nMaxQuantizer;
-                qp_range.minPQP = pParam->nMinQuantizer;
-                qp_range.maxPQP = pParam->nMaxQuantizer;
-                qp_range.minBQP = pParam->nMinQuantizer;
-                qp_range.maxBQP = pParam->nMaxQuantizer;
-                if(!venc_set_session_qp_range (&qp_range)) {
-                    DEBUG_PRINT_ERROR("ERROR: Setting QP Range for hybridHP [%u %u] failed",
-                        (unsigned int)pParam->nMinQuantizer, (unsigned int)pParam->nMaxQuantizer);
-                    return false;
-                }
-                temporal_layers_config.nMinQuantizer = pParam->nMinQuantizer;
-                temporal_layers_config.nMaxQuantizer = pParam->nMaxQuantizer;
-                break;
-            }
         case OMX_QcomIndexParamBatchSize:
             {
                 OMX_PARAM_U32TYPE* pParam =
@@ -6734,7 +6685,6 @@
     }
     return OMX_ErrorNone;
 }
-
 OMX_ERRORTYPE venc_dev::venc_disable_hhp() {
 
     if (m_sVenc_cfg.codectype != V4L2_PIX_FMT_H264) {
@@ -6836,41 +6786,6 @@
     return OMX_ErrorNone;
 }
 
-bool venc_dev::venc_convert_abs2cum_bitrate(QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE *pHybrid,
-                OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE &temporal_settings) {
-
-    OMX_U32 cumulativeBitrate   = 0;
-    OMX_U32 cumulativeRatio     = 0;
-    OMX_U32 i = 0;
-
-    if (pHybrid == NULL) {
-        DEBUG_PRINT_ERROR("TemporalLayer: Invalid arg %s", __func__);
-        return false;
-    }
-
-    DEBUG_PRINT_LOW("TemporalLayer: Converting layered bitrate to cumulative bitrate in percentage");
-
-    for (i = 0; i < temporal_settings.nPLayerCountActual; i++) {
-        cumulativeBitrate += pHybrid->nTemporalLayerBitrateRatio[i];
-    }
-
-    if (cumulativeBitrate == 0) {
-        temporal_settings.bBitrateRatiosSpecified = OMX_FALSE;
-        return true;
-    }
-
-    DEBUG_PRINT_LOW("TemporalLayer: Cumulative bitrate is: %u", cumulativeBitrate);
-    for (i = 0; i < temporal_settings.nPLayerCountActual; i++) {
-        temporal_settings.nBitrateRatios[i] = ((pHybrid->nTemporalLayerBitrateRatio[i] * 100)/cumulativeBitrate) + cumulativeRatio;
-        cumulativeRatio = temporal_settings.nBitrateRatios[i];
-        DEBUG_PRINT_LOW("TemporalLayer: Layer %u bitrate %u percent %u", i,
-            pHybrid->nTemporalLayerBitrateRatio[i], temporal_settings.nBitrateRatios[i]);
-    }
-    temporal_settings.bBitrateRatiosSpecified = OMX_TRUE;
-
-    return true;
-}
-
 bool venc_dev::venc_validate_temporal_settings() {
 
     if (intra_period.num_bframes > 0 || intra_period.num_pframes == 0) {