diff options
author | Cong Jiajia <jcong@codeaurora.org> | 2017-10-19 13:09:25 +0800 |
---|---|---|
committer | Cong Jiajia <jcong@codeaurora.org> | 2017-11-06 15:51:36 +0800 |
commit | d1189e2b83640f236fee89191f4c3ede00957644 (patch) | |
tree | 6e14f28a0e8a89136dd3867bd8cb7018d92b3312 | |
parent | 6604784e2bf1d67c17c5b5c525c6974089cb4cb4 (diff) | |
download | media-d1189e2b83640f236fee89191f4c3ede00957644.tar.gz |
mm-video-v4l2: venc: enable MPEG4Level6 in sw encoder
Change-Id: Ie9a3e54d8e9ea2384027c99027a1d7ce843ef3d9
-rw-r--r-- | mm-core/inc/OMX_Video.h | 17 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/vdec/src/omx_swvdec.cpp | 4 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp | 65 |
3 files changed, 67 insertions, 19 deletions
diff --git a/mm-core/inc/OMX_Video.h b/mm-core/inc/OMX_Video.h index 64dbe87b..f89f62f0 100644 --- a/mm-core/inc/OMX_Video.h +++ b/mm-core/inc/OMX_Video.h @@ -614,14 +614,15 @@ typedef enum OMX_VIDEO_MPEG4PROFILETYPE { * sizes, bit rates, decoder frame rates. No need */ typedef enum OMX_VIDEO_MPEG4LEVELTYPE { - OMX_VIDEO_MPEG4Level0 = 0x01, /**< Level 0 */ - OMX_VIDEO_MPEG4Level0b = 0x02, /**< Level 0b */ - OMX_VIDEO_MPEG4Level1 = 0x04, /**< Level 1 */ - OMX_VIDEO_MPEG4Level2 = 0x08, /**< Level 2 */ - OMX_VIDEO_MPEG4Level3 = 0x10, /**< Level 3 */ - OMX_VIDEO_MPEG4Level4 = 0x20, /**< Level 4 */ - OMX_VIDEO_MPEG4Level4a = 0x40, /**< Level 4a */ - OMX_VIDEO_MPEG4Level5 = 0x80, /**< Level 5 */ + OMX_VIDEO_MPEG4Level0 = 0x01, /**< Level 0 */ + OMX_VIDEO_MPEG4Level0b = 0x02, /**< Level 0b */ + OMX_VIDEO_MPEG4Level1 = 0x04, /**< Level 1 */ + OMX_VIDEO_MPEG4Level2 = 0x08, /**< Level 2 */ + OMX_VIDEO_MPEG4Level3 = 0x10, /**< Level 3 */ + OMX_VIDEO_MPEG4Level4 = 0x20, /**< Level 4 */ + OMX_VIDEO_MPEG4Level4a = 0x40, /**< Level 4a */ + OMX_VIDEO_MPEG4Level5 = 0x80, /**< Level 5 */ + OMX_VIDEO_MPEG4Level6 = 0x100, /**< Level 6 */ OMX_VIDEO_MPEG4LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_MPEG4LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_VIDEO_MPEG4LevelMax = 0x7FFFFFFF diff --git a/mm-video-v4l2/vidc/vdec/src/omx_swvdec.cpp b/mm-video-v4l2/vidc/vdec/src/omx_swvdec.cpp index b7a3d799..47bc07ac 100644 --- a/mm-video-v4l2/vidc/vdec/src/omx_swvdec.cpp +++ b/mm-video-v4l2/vidc/vdec/src/omx_swvdec.cpp @@ -3140,9 +3140,9 @@ OMX_ERRORTYPE omx_swvdec::get_supported_profilelevel( if (p_profilelevel->nProfileIndex == 0) { p_profilelevel->eProfile = OMX_VIDEO_MPEG4ProfileSimple; - p_profilelevel->eLevel = OMX_VIDEO_MPEG4Level5; + p_profilelevel->eLevel = OMX_VIDEO_MPEG4Level6; - OMX_SWVDEC_LOG_HIGH("MPEG-4 simple profile, level 5"); + OMX_SWVDEC_LOG_HIGH("MPEG-4 simple profile, level 6"); } else if (p_profilelevel->nProfileIndex == 1) { diff --git a/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp b/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp index e10ef99f..ade82a41 100644 --- a/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp +++ b/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp @@ -892,10 +892,32 @@ OMX_ERRORTYPE omx_venc::set_parameter __FUNCTION__, Ret); RETURN(OMX_ErrorUnsupportedSetting); } + else + { + m_sIntraperiod.nPFrames = pParam->nPFrames; + m_sIntraperiod.nBFrames = pParam->nBFrames; + } + + /* set profile/level */ + if (pParam->eProfile && pParam->eLevel) + { + DEBUG_PRINT_LOW("pParam->eProfile : %d, pParam->eLevel : %d", pParam->eProfile, pParam->eLevel); + Ret = swvenc_set_profile_level(pParam->eProfile, pParam->eLevel); + if (Ret != SWVENC_S_SUCCESS) + { + DEBUG_PRINT_ERROR("%sm swvenc_set_profile_level failed (%d)", + __FUNCTION__, Ret); + RETURN(OMX_ErrorUnsupportedSetting); + } + else + { + m_sParamProfileLevel.eProfile = pParam->eProfile; + m_sParamProfileLevel.eLevel = pParam->eLevel; + } + } - memcpy(&m_sParamMPEG4,pParam, sizeof(struct OMX_VIDEO_PARAM_MPEG4TYPE)); - m_sIntraperiod.nPFrames = m_sParamMPEG4.nPFrames; - m_sIntraperiod.nBFrames = m_sParamMPEG4.nBFrames; + // NOTE: m_sParamMPEG4.eProfile/eLevel may be overwritten to 0 if client didn't set them + memcpy(&m_sParamMPEG4, pParam, sizeof(struct OMX_VIDEO_PARAM_MPEG4TYPE)); break; } @@ -913,10 +935,32 @@ OMX_ERRORTYPE omx_venc::set_parameter __FUNCTION__, Ret); RETURN(OMX_ErrorUnsupportedSetting); } + else + { + m_sIntraperiod.nPFrames = pParam->nPFrames; + m_sIntraperiod.nBFrames = pParam->nBFrames; + } + /* set profile/level */ + if (pParam->eProfile && pParam->eLevel) + { + DEBUG_PRINT_LOW("pParam->eProfile : %d, pParam->eLevel : %d", pParam->eProfile, pParam->eLevel); + Ret = swvenc_set_profile_level(pParam->eProfile, pParam->eLevel); + if (Ret != SWVENC_S_SUCCESS) + { + DEBUG_PRINT_ERROR("%sm swvenc_set_profile_level failed (%d)", + __FUNCTION__, Ret); + RETURN(OMX_ErrorUnsupportedSetting); + } + else + { + m_sParamProfileLevel.eProfile = pParam->eProfile; + m_sParamProfileLevel.eLevel = pParam->eLevel; + } + } + + // NOTE: m_sParamH263.eProfile/eLevel may be overwritten to 0 if client didn't set them memcpy(&m_sParamH263,pParam, sizeof(struct OMX_VIDEO_PARAM_H263TYPE)); - m_sIntraperiod.nPFrames = m_sParamH263.nPFrames; - m_sIntraperiod.nBFrames = m_sParamH263.nBFrames; break; } @@ -2492,9 +2536,9 @@ OMX_ERRORTYPE omx_venc::dev_get_supported_profile_level(OMX_VIDEO_PARAM_PROFILEL if (profileLevelType->nProfileIndex == 0) { profileLevelType->eProfile = OMX_VIDEO_H263ProfileBaseline; - profileLevelType->eLevel = OMX_VIDEO_H263Level40; + profileLevelType->eLevel = OMX_VIDEO_H263Level70; - DEBUG_PRINT_HIGH("H.263 baseline profile, level 40"); + DEBUG_PRINT_HIGH("H.263 baseline profile, level 70"); } else { @@ -2508,9 +2552,9 @@ OMX_ERRORTYPE omx_venc::dev_get_supported_profile_level(OMX_VIDEO_PARAM_PROFILEL if (profileLevelType->nProfileIndex == 0) { profileLevelType->eProfile = OMX_VIDEO_MPEG4ProfileSimple; - profileLevelType->eLevel = OMX_VIDEO_MPEG4Level5; + profileLevelType->eLevel = OMX_VIDEO_MPEG4Level6; - DEBUG_PRINT_LOW("MPEG-4 simple profile, level 5"); + DEBUG_PRINT_LOW("MPEG-4 simple profile, level 6"); } else { @@ -3254,6 +3298,9 @@ SWVENC_STATUS omx_venc::swvenc_set_profile_level case OMX_VIDEO_MPEG4Level5: Level.mpeg4 = SWVENC_LEVEL_MPEG4_5; break; + case OMX_VIDEO_MPEG4Level6: + Level.mpeg4 = SWVENC_LEVEL_MPEG4_6; + break; default: DEBUG_PRINT_ERROR("ERROR: UNKNOWN LEVEL"); Ret = SWVENC_S_FAILURE; |