diff options
Diffstat (limited to 'sec_mm/sec_omx/sec_omx_component/video')
6 files changed, 95 insertions, 20 deletions
diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/Android.mk b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/Android.mk index 516ee04..1248e5e 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/Android.mk +++ b/sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/Android.mk @@ -16,7 +16,7 @@ LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec libsecosal libsecbasecomponent \ libsecmfcdecapi libseccsc -LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui +LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui libhardware LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \ $(SEC_OMX_INC)/sec \ diff --git a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/Android.mk b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/Android.mk index 290cad5..1e7d1e5 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/Android.mk +++ b/sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/Android.mk @@ -16,7 +16,7 @@ LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec libsecosal libsecbasecomponent \ libsecmfcdecapi libseccsc -LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui +LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui libhardware LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \ $(SEC_OMX_INC)/sec \ diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/Android.mk b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/Android.mk index d4dfd1d..a0c59b6 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/Android.mk +++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/Android.mk @@ -16,7 +16,7 @@ LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libSEC_OMX_Venc libsecosal libsecbasecomponent \ libsecmfcencapi libseccsc -LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui +LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui libhardware LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \ $(SEC_OMX_INC)/sec \ diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c index 2bb12b8..f038e17 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c +++ b/sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c @@ -231,6 +231,26 @@ void Set_H264ENC_Param(SSBSIP_MFC_ENC_H264_PARAM *pH264Arg, SEC_OMX_BASECOMPONEN pH264Arg->StaticDisable = 1; pH264Arg->ActivityDisable = 1; + switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) { + case OMX_COLOR_FormatYUV420SemiPlanar: + pH264Arg->FrameMap = NV12_LINEAR; + break; + case OMX_SEC_COLOR_FormatNV12TPhysicalAddress: + default: + pH264Arg->FrameMap = NV12_TILE; + break; + } + +#ifdef USE_ANDROID_EXTENSION + if (pSECInputPort->bStoreMetaDataInBuffer != OMX_FALSE) { + SEC_OMX_DATA *pInputData = &pSECComponent->processData[INPUT_PORT_INDEX]; + if(isMetadataBufferTypeGrallocSource(pInputData->dataBuffer) == OMX_TRUE) + pH264Arg->FrameMap = NV12_LINEAR; + else + pH264Arg->FrameMap = NV12_TILE; + } +#endif + SEC_OSAL_Log(SEC_LOG_TRACE, "pSECPort->eControlRate: 0x%x", pSECOutputPort->eControlRate); switch (pSECOutputPort->eControlRate) { case OMX_Video_ControlRateDisable: @@ -708,6 +728,7 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent) { OMX_ERRORTYPE ret = OMX_ErrorNone; SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; + SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX]; SEC_H264ENC_HANDLE *pH264Enc = NULL; OMX_PTR hMFCHandle = NULL; OMX_S32 returnCodec = 0; @@ -727,13 +748,9 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent) } pH264Enc->hMFCH264Handle.hMFCHandle = hMFCHandle; - Set_H264ENC_Param(&(pH264Enc->hMFCH264Handle.mfcVideoAvc), pSECComponent); - - returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pH264Enc->hMFCH264Handle.mfcVideoAvc)); - if (returnCodec != MFC_RET_OK) { - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } + SsbSipMfcEncSetSize(hMFCHandle, H264_ENC, + pSECOutputPort->portDefinition.format.video.nFrameWidth, + pSECOutputPort->portDefinition.format.video.nFrameHeight); /* Allocate encoder's input buffer */ returnCodec = SsbSipMfcEncGetInBuf(hMFCHandle, &(pH264Enc->hMFCH264Handle.inputInfo)); @@ -801,6 +818,13 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA FunctionIn(); if (pH264Enc->hMFCH264Handle.bConfiguredMFC == OMX_FALSE) { + Set_H264ENC_Param(&(pH264Enc->hMFCH264Handle.mfcVideoAvc), pSECComponent); + returnCodec = SsbSipMfcEncInit(pH264Enc->hMFCH264Handle.hMFCHandle, &(pH264Enc->hMFCH264Handle.mfcVideoAvc)); + if (returnCodec != MFC_RET_OK) { + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + returnCodec = SsbSipMfcEncGetOutBuf(pH264Enc->hMFCH264Handle.hMFCHandle, &outputInfo); if (returnCodec != MFC_RET_OK) { diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/Android.mk b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/Android.mk index de6be61..edefec6 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/Android.mk +++ b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/Android.mk @@ -16,7 +16,7 @@ LOCAL_ARM_MODE := arm LOCAL_STATIC_LIBRARIES := libSEC_OMX_Venc libsecosal libsecbasecomponent \ libsecmfcencapi libseccsc -LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui +LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui libhardware LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \ $(SEC_OMX_INC)/sec \ diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c index cc9998f..8c29d47 100644 --- a/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c +++ b/sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c @@ -215,6 +215,26 @@ void Set_Mpeg4Enc_Param(SSBSIP_MFC_ENC_MPEG4_PARAM *pMpeg4Param, SEC_OMX_BASECOM pMpeg4Param->NumberBFrames = 0; /* 0(not used) ~ 2 */ pMpeg4Param->DisableQpelME = 1; + switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) { + case OMX_COLOR_FormatYUV420SemiPlanar: + pMpeg4Param->FrameMap = NV12_LINEAR; + break; + case OMX_SEC_COLOR_FormatNV12TPhysicalAddress: + default: + pMpeg4Param->FrameMap = NV12_TILE; + break; + } + +#ifdef USE_ANDROID_EXTENSION + if (pSECInputPort->bStoreMetaDataInBuffer != OMX_FALSE) { + SEC_OMX_DATA *pInputData = &pSECComponent->processData[INPUT_PORT_INDEX]; + if(isMetadataBufferTypeGrallocSource(pInputData->dataBuffer) == OMX_TRUE) + pMpeg4Param->FrameMap = NV12_LINEAR; + else + pMpeg4Param->FrameMap = NV12_TILE; + } +#endif + SEC_OSAL_Log(SEC_LOG_TRACE, "pSECPort->eControlRate: 0x%x", pSECOutputPort->eControlRate); switch (pSECOutputPort->eControlRate) { case OMX_Video_ControlRateDisable: @@ -260,6 +280,26 @@ void Set_H263Enc_Param(SSBSIP_MFC_ENC_H263_PARAM *pH263Param, SEC_OMX_BASECOMPON pH263Param->FrameRate = (pSECInputPort->portDefinition.format.video.xFramerate) >> 16; + switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) { + case OMX_COLOR_FormatYUV420SemiPlanar: + pH263Param->FrameMap = NV12_LINEAR; + break; + case OMX_SEC_COLOR_FormatNV12TPhysicalAddress: + default: + pH263Param->FrameMap = NV12_TILE; + break; + } + +#ifdef USE_ANDROID_EXTENSION + if (pSECInputPort->bStoreMetaDataInBuffer != OMX_FALSE) { + SEC_OMX_DATA *pInputData = &pSECComponent->processData[INPUT_PORT_INDEX]; + if(isMetadataBufferTypeGrallocSource(pInputData->dataBuffer) == OMX_TRUE) + pH263Param->FrameMap = NV12_LINEAR; + else + pH263Param->FrameMap = NV12_TILE; + } +#endif + SEC_OSAL_Log(SEC_LOG_TRACE, "pSECPort->eControlRate: 0x%x", pSECOutputPort->eControlRate); switch (pSECOutputPort->eControlRate) { case OMX_Video_ControlRateDisable: @@ -845,7 +885,7 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent) { OMX_ERRORTYPE ret = OMX_ErrorNone; SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - SEC_OMX_BASEPORT *pSECPort = NULL; + SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX]; SEC_MPEG4ENC_HANDLE *pMpeg4Enc = NULL; OMX_HANDLETYPE hMFCHandle = NULL; OMX_S32 returnCodec = 0; @@ -867,15 +907,13 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent) /* set MFC ENC VIDEO PARAM and initialize MFC encoder instance */ if (pMpeg4Enc->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) { - Set_Mpeg4Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam), pSECComponent); - returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam)); + SsbSipMfcEncSetSize(hMFCHandle, MPEG4_ENC, + pSECOutputPort->portDefinition.format.video.nFrameWidth, + pSECOutputPort->portDefinition.format.video.nFrameHeight); } else { - Set_H263Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam), pSECComponent); - returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam)); - } - if (returnCodec != MFC_RET_OK) { - ret = OMX_ErrorInsufficientResources; - goto EXIT; + SsbSipMfcEncSetSize(hMFCHandle, H263_ENC, + pSECOutputPort->portDefinition.format.video.nFrameWidth, + pSECOutputPort->portDefinition.format.video.nFrameHeight); } /* allocate encoder's input buffer */ @@ -942,6 +980,19 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DAT FunctionIn(); if (pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFC == OMX_FALSE) { + /* set MFC ENC VIDEO PARAM and initialize MFC encoder instance */ + if (pMpeg4Enc->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) { + Set_Mpeg4Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam), pSECComponent); + returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam)); + } else { + Set_H263Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam), pSECComponent); + returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam)); + } + if (returnCodec != MFC_RET_OK) { + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + returnCodec = SsbSipMfcEncGetOutBuf(hMFCHandle, &outputInfo); if (returnCodec != MFC_RET_OK) { |