diff options
author | SeungBeom Kim <sbcrux.kim@samsung.com> | 2011-08-25 16:43:02 +0900 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-08-31 00:30:13 -0700 |
commit | 885021a9ca746876f7e34549454eceee214edfe8 (patch) | |
tree | f294090cc26c66f46c141c4244ba46578d86793e /sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c | |
parent | 443b731e42c7c166832f541b993d1c4f339e32d3 (diff) | |
download | device_samsung_crespo-885021a9ca746876f7e34549454eceee214edfe8.zip device_samsung_crespo-885021a9ca746876f7e34549454eceee214edfe8.tar.gz device_samsung_crespo-885021a9ca746876f7e34549454eceee214edfe8.tar.bz2 |
Change SEC-OMX for surface texture encoding.
Adding support for NV12 encoding.
Adding use IMG Blit API.
Dependencies
- Change I753540bb: S5PC11X: MFC: Adding support for NV12 encoding.
also fixed bug: 5226617
Change-Id: Id3d4dfa9c3f7c4aebe05482db71902d3af4e994d
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
Diffstat (limited to 'sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c')
-rw-r--r-- | sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c | 69 |
1 files changed, 60 insertions, 9 deletions
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) { |