summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeungBeom Kim <sbcrux.kim@samsung.com>2011-08-25 16:43:02 +0900
committerJames Dong <jdong@google.com>2011-08-31 00:30:13 -0700
commit885021a9ca746876f7e34549454eceee214edfe8 (patch)
treef294090cc26c66f46c141c4244ba46578d86793e
parent443b731e42c7c166832f541b993d1c4f339e32d3 (diff)
downloaddevice_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>
-rw-r--r--include/hal_public.h8
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c24
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h9
-rw-r--r--sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h4
-rw-r--r--sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h1
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/h264dec/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/dec/mpeg4dec/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/h264enc/SEC_OMX_H264enc.c38
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/Android.mk2
-rw-r--r--sec_mm/sec_omx/sec_omx_component/video/enc/mpeg4enc/SEC_OMX_Mpeg4enc.c69
-rw-r--r--sec_mm/sec_omx/sec_osal/Android.mk3
-rw-r--r--sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp59
-rw-r--r--sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h1
14 files changed, 182 insertions, 42 deletions
diff --git a/include/hal_public.h b/include/hal_public.h
index 9764ee8..60f33a9 100644
--- a/include/hal_public.h
+++ b/include/hal_public.h
@@ -129,6 +129,14 @@ typedef struct IMG_gralloc_module_public_t
int (*GetPhyAddrs)(struct IMG_gralloc_module_public_t const* module,
buffer_handle_t handle,
unsigned int auiPhyAddr[MAX_SUB_ALLOCS]);
+ /* Custom-blit components in lieu of overlay hardware */
+ int (*Blit)(struct IMG_gralloc_module_public_t const *module,
+ buffer_handle_t src,
+ void *dest[MAX_SUB_ALLOCS], int format);
+
+ int (*Blit2)(struct IMG_gralloc_module_public_t const *module,
+ buffer_handle_t src, buffer_handle_t dest,
+ int w, int h, int x, int y);
}
IMG_gralloc_module_public_t;
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c
index c31e522..9216c7b 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/enc/src/SsbSipMfcEncAPI.c
@@ -167,6 +167,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init_mpeg4.in_luma_pad_val = mpeg4_arg->LumaPadVal;
EncArg.args.enc_init_mpeg4.in_cb_pad_val = mpeg4_arg->CbPadVal;
EncArg.args.enc_init_mpeg4.in_cr_pad_val = mpeg4_arg->CrPadVal;
+ EncArg.args.enc_init_mpeg4.in_frame_map = mpeg4_arg->FrameMap;
EncArg.args.enc_init_mpeg4.in_time_increament_res = mpeg4_arg->TimeIncreamentRes;
EncArg.args.enc_init_mpeg4.in_time_vop_time_increament = mpeg4_arg->VopTimeIncreament;
@@ -218,6 +219,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init_mpeg4.in_luma_pad_val = h263_arg->LumaPadVal;
EncArg.args.enc_init_mpeg4.in_cb_pad_val = h263_arg->CbPadVal;
EncArg.args.enc_init_mpeg4.in_cr_pad_val = h263_arg->CrPadVal;
+ EncArg.args.enc_init_mpeg4.in_frame_map = mpeg4_arg->FrameMap;
EncArg.args.enc_init_mpeg4.in_RC_framerate = h263_arg->FrameRate;
EncArg.args.enc_init_mpeg4.in_RC_bitrate = h263_arg->Bitrate;
@@ -288,6 +290,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init_h264.in_luma_pad_val = h264_arg->LumaPadVal;
EncArg.args.enc_init_h264.in_cb_pad_val = h264_arg->CbPadVal;
EncArg.args.enc_init_h264.in_cr_pad_val = h264_arg->CrPadVal;
+ EncArg.args.enc_init_mpeg4.in_frame_map = mpeg4_arg->FrameMap;
/* rate control*/
EncArg.args.enc_init_h264.in_RC_frm_enable = h264_arg->EnableFRMRateControl;
@@ -422,6 +425,27 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle)
return MFC_RET_OK;
}
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetSize(void *openHandle, SSBSIP_MFC_CODEC_TYPE codecType, int nWidth, int nHeight)
+{
+ _MFCLIB *pCTX = (_MFCLIB *)openHandle;
+
+ if (pCTX == NULL)
+ return MFC_RET_INVALID_PARAM;
+
+ if (nWidth <= 0 || nHeight <= 0)
+ return MFC_RET_INVALID_PARAM;
+ pCTX->width = nWidth;
+ pCTX->height = nHeight;
+
+ if ((H264_ENC != codecType) &&
+ (MPEG4_ENC != codecType) &&
+ (H263_ENC != codecType))
+ return MFC_RET_INVALID_PARAM;
+ pCTX->codec_type = codecType;
+
+ return MFC_RET_OK;
+}
+
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info)
{
int ret_code;
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h
index 646ff0d..a07739a 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/SsbSipMfcApi.h
@@ -56,6 +56,11 @@ typedef enum {
} SSBSIP_MFC_FORCE_SET_FRAME_TYPE;
typedef enum {
+ NV12_LINEAR = 0,
+ NV12_TILE
+} SSBSIP_MFC_INSTRM_MODE_TYPE;
+
+typedef enum {
MFC_DEC_SETCONF_POST_ENABLE = 1,
MFC_DEC_SETCONF_EXTRA_BUFFER_NUM,
MFC_DEC_SETCONF_DISPLAY_DELAY,
@@ -182,6 +187,7 @@ typedef struct {
int LumaPadVal; // [IN] Luma pel value used to fill padding area
int CbPadVal; // [IN] CB pel value used to fill padding area
int CrPadVal; // [IN] CR pel value used to fill padding area
+ int FrameMap; // [IN] Encoding input mode(tile mode or linear mode)
// H.264 specific parameters
int ProfileIDC; // [IN] profile
@@ -224,6 +230,7 @@ typedef struct {
int LumaPadVal; // [IN] Luma pel value used to fill padding area
int CbPadVal; // [IN] CB pel value used to fill padding area
int CrPadVal; // [IN] CR pel value used to fill padding area
+ int FrameMap; // [IN] Encoding input mode(tile mode or linear mode)
// MPEG4 specific parameters
int ProfileIDC; // [IN] profile
@@ -255,6 +262,7 @@ typedef struct {
int LumaPadVal; // [IN] Luma pel value used to fill padding area
int CbPadVal; // [IN] CB pel value used to fill padding area
int CrPadVal; // [IN] CR pel value used to fill padding area
+ int FrameMap; // [IN] Encoding input mode(tile mode or linear mode)
// H.263 specific parameters
int FrameRate; // [IN] rate control parameter(frame rate)
@@ -302,6 +310,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param);
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle);
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetSize(void *openHandle, SSBSIP_MFC_CODEC_TYPE codecType, int nWidth, int nHeight);
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info);
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info);
diff --git a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h
index e7e23c3..f4a1f42 100644
--- a/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h
+++ b/sec_mm/sec_omx/sec_codecs/video/mfc_c110/include/mfc_interface.h
@@ -117,6 +117,8 @@ typedef struct {
int in_cb_pad_val;
int in_cr_pad_val;
+ int in_frame_map; /* [IN] Encoding input NV12 type linear(0) TILE(1) */
+
unsigned int in_mapped_addr;
mfc_strm_ref_buf_arg_t out_u_addr;
mfc_strm_ref_buf_arg_t out_p_addr;
@@ -158,6 +160,8 @@ typedef struct {
int in_cb_pad_val; /* [IN] CB pel value used to fill padding area */
int in_cr_pad_val; /* [IN] CR pel value used to fill padding area */
+ int in_frame_map; /* [IN] Encoding input NV12 type linear(0) TILE(1) */
+
unsigned int in_mapped_addr;
mfc_strm_ref_buf_arg_t out_u_addr;
mfc_strm_ref_buf_arg_t out_p_addr;
diff --git a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h
index bce2263..147f940 100644
--- a/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h
+++ b/sec_mm/sec_omx/sec_omx_component/common/SEC_OMX_Baseport.h
@@ -77,6 +77,7 @@ typedef struct _SEC_OMX_BASEPORT
OMX_BOOL bUseAndroidNativeBuffer;
/* For Android Store Meta Data inBuffer */
OMX_BOOL bStoreMetaDataInBuffer;
+ OMX_PTR pIMGGrallocModule;
} SEC_OMX_BASEPORT;
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)
{
diff --git a/sec_mm/sec_omx/sec_osal/Android.mk b/sec_mm/sec_omx/sec_osal/Android.mk
index 75ceb14..a98e884 100644
--- a/sec_mm/sec_omx/sec_osal/Android.mk
+++ b/sec_mm/sec_omx/sec_osal/Android.mk
@@ -33,6 +33,7 @@ LOCAL_SHARED_LIBRARIES := libcutils libutils \
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \
$(SEC_OMX_TOP)/sec_osal \
- $(SEC_OMX_COMPONENT)/common
+ $(SEC_OMX_COMPONENT)/common \
+ $(SEC_OMX_TOP)/../../include
include $(BUILD_STATIC_LIBRARY)
diff --git a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp
index 21476df..799b550 100644
--- a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp
+++ b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp
@@ -54,6 +54,9 @@ extern "C" {
#include <media/stagefright/HardwareAPI.h>
#include <hardware/hardware.h>
#include <media/stagefright/MetadataBufferType.h>
+#include "hal_public.h"
+
+#define HAL_PIXEL_FORMAT_C110_NV12 0x100
using namespace android;
@@ -360,6 +363,16 @@ EXIT:
return ret;
}
+OMX_BOOL isMetadataBufferTypeGrallocSource(OMX_BYTE pInputDataBuffer)
+{
+ OMX_U32 type = getMetadataBufferType(pInputDataBuffer);
+
+ if (type == kMetadataBufferTypeGrallocSource)
+ return OMX_TRUE;
+ else
+ return OMX_FALSE;
+}
+
OMX_ERRORTYPE preprocessMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_BYTE pInputDataBuffer, BUFFER_ADDRESS_INFO *pInputInfo)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
@@ -387,32 +400,36 @@ OMX_ERRORTYPE preprocessMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_BYTE pI
SEC_OSAL_Memcpy(&pInputInfo->YPhyAddr, pInputDataBuffer + 4, sizeof(void *));
SEC_OSAL_Memcpy(&pInputInfo->CPhyAddr, pInputDataBuffer + 4 + sizeof(void *), sizeof(void *));
} else if (type == kMetadataBufferTypeGrallocSource){
-
- ret = OMX_ErrorNotImplemented;
- goto EXIT;
-
+ IMG_gralloc_module_public_t *module = (IMG_gralloc_module_public_t *)pSECPort->pIMGGrallocModule;
OMX_PTR pUnreadableBuffer = NULL;
OMX_PTR pReadableBuffer = NULL;
- void *pVirAddrs[2];
- OMX_PTR dstYAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YVirAddr;
- OMX_PTR dstCAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CVirAddr;
- SEC_OSAL_Memcpy(&pUnreadableBuffer, pInputDataBuffer + 4, sizeof(void *));
- pReadableBuffer = (OMX_PTR)getVADDRfromANB(pUnreadableBuffer,
- (OMX_U32)pSECPort->portDefinition.format.video.nFrameWidth,
- (OMX_U32)pSECPort->portDefinition.format.video.nFrameHeight,
- pVirAddrs);
-
+ OMX_PTR pVirAddrs[2];
+ int err = 0;
+
+ pVirAddrs[0] = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YVirAddr;
+ pVirAddrs[1] = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CVirAddr;
+
+ if (module == NULL) {
+ err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&module);
+ if(err) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "hw_get_module failed (err=%d)\n", err);
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+ pSECPort->pIMGGrallocModule = (OMX_PTR)module;
+ }
/**************************************/
- /* IMG CSC RGB to NV12(NV12T) */
+ /* IMG CSC RGB to NV12 */
/**************************************/
- /*
- source : pReadableBuffer
- destination : dstYAddr, dstCAddr
- */
-
-
- putVADDRtoANB(pUnreadableBuffer);
+ SEC_OSAL_Memcpy(&pUnreadableBuffer, pInputDataBuffer + 4, sizeof(void *));
+ android_native_buffer_t *buf = (android_native_buffer_t *)pUnreadableBuffer;
+ err = module->Blit(module, buf->handle, pVirAddrs, HAL_PIXEL_FORMAT_C110_NV12);
+ if(err) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "module->Blit() failed (err=%d)\n", err);
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
pInputInfo->YPhyAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr;
pInputInfo->CPhyAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr;
diff --git a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h
index 3699c7d..da7e8f3 100644
--- a/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h
+++ b/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h
@@ -53,6 +53,7 @@ OMX_ERRORTYPE useAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR Componen
OMX_U32 getVADDRfromANB(OMX_PTR pUnreadableBuffer, OMX_U32 Width, OMX_U32 Height, void *vaddress[]);
OMX_U32 putVADDRtoANB(OMX_PTR pUnreadableBuffer);
OMX_ERRORTYPE enableStoreMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure);
+OMX_BOOL isMetadataBufferTypeGrallocSource(OMX_BYTE pInputDataBuffer);
OMX_ERRORTYPE preprocessMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_BYTE pInputDataBuffer, BUFFER_ADDRESS_INFO *pInputInfo);
#ifdef __cplusplus