From 13bdc6512d6b7ee90de2ced4459b76e05ce797af Mon Sep 17 00:00:00 2001 From: Chang Ying Date: Wed, 20 Jun 2012 14:58:03 +0800 Subject: [Port from R3]AVCE: Low bitrate/resolution VQ tuning BZ: 40475 41836 Impacted parameters: 1.disable_deblocking_filter_idc always set to '0' 2.intra period set to '30' 3.slice number set to '2' for resolution <= VGA BZ41836 can also be fixed by intra period setup. Change-Id: Ic5612210a2afe41660f709411e400591cd48526f Signed-off-by: Chang Ying Reviewed-on: http://android.intel.com:8080/53395 Reviewed-by: Ding, Haitao Tested-by: Ding, Haitao Reviewed-by: Yuan, Shengquan Reviewed-by: Zhao, Leo Reviewed-by: buildbot Tested-by: buildbot Reviewed-on: http://android.intel.com:8080/57185 --- videocodec/OMXVideoEncoderAVC.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'videocodec/OMXVideoEncoderAVC.cpp') diff --git a/videocodec/OMXVideoEncoderAVC.cpp b/videocodec/OMXVideoEncoderAVC.cpp index 647b369..25d6852 100644 --- a/videocodec/OMXVideoEncoderAVC.cpp +++ b/videocodec/OMXVideoEncoderAVC.cpp @@ -113,12 +113,22 @@ OMX_ERRORTYPE OMXVideoEncoderAVC::SetVideoEncoderParam(void) { mVideoEncoder->getParameters(mEncoderParams); mEncoderParams->profile = (VAProfile)VAProfileH264Baseline; + // 0 - all luma and chroma block edges of the slice are filtered + // 1 - deblocking is disabled for all block edges of the slice + // 2 - all luma and chroma block edges of the slice are filtered + // with exception of the block edges that coincide with slice boundaries + mEncoderParams->disableDeblocking = 0; OMXVideoEncoderBase::SetVideoEncoderParam(); mVideoEncoder->getParameters(mAVCParams); if(mParamIntelAvcVui.bVuiGeneration == OMX_TRUE) { mAVCParams->VUIFlag = 1; } + // For resolution below VGA, single core can hit the performance target and provide VQ gain + if (mEncoderParams->resolution.width <= 640 && mEncoderParams->resolution.height <= 480) { + mConfigIntelSliceNumbers.nISliceNumber = 1; + mConfigIntelSliceNumbers.nPSliceNumber = 1; + } mAVCParams->sliceNum.iSliceNum = mConfigIntelSliceNumbers.nISliceNumber; mAVCParams->sliceNum.pSliceNum = mConfigIntelSliceNumbers.nPSliceNumber; mAVCParams->idrInterval = mConfigAvcIntraPeriod.nIDRPeriod; @@ -126,6 +136,18 @@ OMX_ERRORTYPE OMXVideoEncoderAVC::SetVideoEncoderParam(void) { ret = mVideoEncoder ->setParameters(mAVCParams); CHECK_ENCODE_STATUS("setParameters"); + VideoConfigAVCIntraPeriod avcIntraPreriod; + avcIntraPreriod.idrInterval = mConfigAvcIntraPeriod.nIDRPeriod; + // hardcode intra period for AVC encoder, get value from OMX_VIDEO_PARAM_AVCTYPE.nPFrames or + // OMX_VIDEO_CONFIG_AVCINTRAPERIOD.nPFrames is a more flexible method + if (mParamAvc.nPFrames == 0) { + avcIntraPreriod.intraPeriod = 0; + } else { + avcIntraPreriod.intraPeriod = 30; + } + ret = mVideoEncoder->setConfig(&avcIntraPreriod); + CHECK_ENCODE_STATUS("setConfig"); + LOGV("VUIFlag = %d\n", mAVCParams->VUIFlag); LOGV("sliceNum.iSliceNum = %d\n", mAVCParams->sliceNum.iSliceNum); LOGV("sliceNum.pSliceNum = %d\n", mAVCParams->sliceNum.pSliceNum); -- cgit v1.2.3