exynos: reorganized and updated from insignal

Changes needed on exynos4210 devices:

libcsc -> libseccscapi
libswconverter -> remove

TARGET_HAL_PATH := hardware/samsung/exynos4/hal
TARGET_OMX_PATH := hardware/samsung/exynos/multimedia/openmax
$(call inherit-product, hardware/samsung/exynos4210.mk)

Change-Id: Ic59ef95b85ef37b3f38fb36cf6a364a5414685ee
This commit is contained in:
codeworkx 2012-05-20 12:00:36 +02:00
parent e54debb12e
commit 62f02ba4f4
389 changed files with 72598 additions and 6530 deletions

View file

@ -808,71 +808,6 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
return MFC_RET_OK;
}
void *SsbSipMfcDecAllocInputBuffer(void *openHandle, void **phyInBuf, int inputBufferSize)
{
int ret_code;
_MFCLIB *pCTX;
struct mfc_common_args user_addr_arg, phys_addr_arg;
if (inputBufferSize < 0) {
LOGE("SsbSipMfcDecAllocInputBuffer] inputBufferSize = %d is invalid\n", inputBufferSize);
return NULL;
}
if (openHandle == NULL) {
LOGE("SsbSipMfcDecAllocInputBuffer] openHandle is NULL\n");
return NULL;
}
pCTX = (_MFCLIB *)openHandle;
user_addr_arg.args.mem_alloc.type = DECODER;
user_addr_arg.args.mem_alloc.buff_size = inputBufferSize;
user_addr_arg.args.mem_alloc.mapped_addr = pCTX->mapped_addr;
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_IN_BUF, &user_addr_arg);
if (ret_code < 0) {
LOGE("SsbSipMfcDecAllocInputBuffer] IOCTL_MFC_GET_IN_BUF failed");
return NULL;
}
phys_addr_arg.args.real_addr.key = user_addr_arg.args.mem_alloc.offset;
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_REAL_ADDR, &phys_addr_arg);
if (ret_code < 0) {
LOGE("SsbSipMfcDecGetInBuf] IOCTL_MFC_GET_PHYS_ADDR failed");
return NULL;
}
pCTX->virStrmBuf = pCTX->mapped_addr + user_addr_arg.args.mem_alloc.offset;
pCTX->phyStrmBuf = phys_addr_arg.args.real_addr.addr;
pCTX->sizeStrmBuf = inputBufferSize;
pCTX->inter_buff_status |= MFC_USE_STRM_BUFF;
*phyInBuf = (void *)pCTX->phyStrmBuf;
return (void *)pCTX->virStrmBuf;
}
void SsbSipMfcDecFreeInputBuffer(void *openHandle, void *phyInBuf)
{
int ret;
_MFCLIB *pCTX;
struct mfc_common_args free_arg;
if (openHandle == NULL) {
LOGE("SsbSipMfcDecFreeInputBuffer] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
pCTX = (_MFCLIB *)openHandle;
if (pCTX->inter_buff_status & MFC_USE_STRM_BUFF) {
free_arg.args.mem_free.key = pCTX->virStrmBuf;
ret = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg);
}
pCTX->inter_buff_status = MFC_USE_NONE;
return MFC_RET_OK;
}
/* CRESPO */
#if 1
int tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos)

View file

@ -71,15 +71,9 @@ typedef enum {
typedef enum {
NV12_LINEAR = 0,
NV12_TILE,
NV21_LINEAR
NV12_TILE
} SSBSIP_MFC_INSTRM_MODE_TYPE;
typedef enum {
FRAME = 0,
SLICE,
} SSBSIP_MFC_OUTSTRM_MODE_TYPE;
typedef enum {
NO_CACHE = 0,
CACHE = 1
@ -251,7 +245,6 @@ typedef struct {
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) */
SSBSIP_MFC_OUTSTRM_MODE_TYPE OutputMode; /* [IN] Output mode: Frame/Slice */
/* H.264 specific parameters */
int ProfileIDC; /* [IN] profile */
@ -295,7 +288,6 @@ typedef struct {
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) */
SSBSIP_MFC_OUTSTRM_MODE_TYPE OutputMode; /* [IN] Output mode: Frame/Slice */
/* MPEG4 specific parameters */
int ProfileIDC; /* [IN] profile */
@ -392,9 +384,6 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_
SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value);
SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value);
void *SsbSipMfcDecAllocInputBuffer(void *openHandle, void **phyInBuf, int inputBufferSize);
void SsbSipMfcDecFreeInputBuffer(void *openHandle, void *phyInBuf);
/*--------------------------------------------------------------------------------*/
/* Encoding APIs */
/*--------------------------------------------------------------------------------*/

View file

@ -129,7 +129,6 @@ struct mfc_enc_init_common_arg {
unsigned int in_pixelcache;
unsigned int in_mapped_addr;
struct mfc_strm_ref_buf_arg out_u_addr;
struct mfc_strm_ref_buf_arg out_p_addr;

View file

@ -16,7 +16,7 @@ LOCAL_SRC_FILES := \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(BOARD_HAL_PATH)/include
device/samsung/$(TARGET_BOARD_PLATFORM)/include
LOCAL_MODULE := libsecmfcapi

View file

@ -73,8 +73,7 @@ typedef enum {
typedef enum {
NV12_LINEAR = 0,
NV12_TILE,
NV21_LINEAR
NV12_TILE
} SSBSIP_MFC_INSTRM_MODE_TYPE;
typedef enum {

View file

@ -16,14 +16,14 @@ LOCAL_SRC_FILES := \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(BOARD_HAL_PATH)/include
device/samsung/$(TARGET_BOARD_PLATFORM)/include
LOCAL_MODULE := libsecmfcapi
LOCAL_PRELINK_MODULE := false
ifeq ($(BOARD_USE_S3D_SUPPORT), true)
LOCAL_CFLAGS += -DS3D_SUPPORT
ifeq ($(BOARD_USES_MFC_FPS),true)
LOCAL_CFLAGS := -DCONFIG_MFC_FPS
endif
LOCAL_ARM_MODE := arm

View file

@ -43,6 +43,10 @@
#define LOG_TAG "MFC_DEC_APP"
#include <utils/Log.h>
#ifdef CONFIG_MFC_FPS
#include <sys/time.h>
#endif
/*#define CRC_ENABLE
#define SLICE_MODE_ENABLE */
#define POLL_DEC_WAIT_TIMEOUT 25
@ -51,12 +55,13 @@
#define VOP_START_CODE (0x000001B6)
#define MP4_START_CODE (0x000001)
#ifdef CONFIG_MFC_FPS
unsigned int framecount, over30ms;
struct timeval mTS1, mTS2, mDec1, mDec2;
#endif
#define DEFAULT_NUMBER_OF_EXTRA_DPB 5
#define CLEAR(x) memset (&(x), 0, sizeof(x))
#ifdef S3D_SUPPORT
#define OPERATE_BIT(x, mask, shift) ((x & (mask << shift)) >> shift)
#define FRAME_PACK_SEI_INFO_NUM 4
#endif
enum {
NV12MT_FMT = 0,
@ -149,11 +154,9 @@ int v4l2_mfc_s_fmt(int fd, enum v4l2_buf_type type,
case VC1RCV_DEC:
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VC1_RCV;
break;
#if defined (MFC6x_VERSION)
case VP8_DEC:
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VP8;
break;
#endif
default:
LOGE("[%s] Does NOT support the codec type (%d)", __func__, pixelformat);
return -1;
@ -162,11 +165,7 @@ int v4l2_mfc_s_fmt(int fd, enum v4l2_buf_type type,
} else if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
switch (pixelformat) {
case NV12MT_FMT:
#if defined (MFC6x_VERSION)
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT_16X16;
#else
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT;
#endif
break;
case NV12M_FMT:
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M;
@ -273,42 +272,6 @@ int v4l2_mfc_g_ctrl(int fd, int id, int *value)
return ret;
}
#ifdef S3D_SUPPORT
int v4l2_mfc_ext_g_ctrl(int fd, SSBSIP_MFC_DEC_CONF conf_type, void *value)
{
struct v4l2_ext_control ext_ctrl[FRAME_PACK_SEI_INFO_NUM];
struct v4l2_ext_controls ext_ctrls;
struct mfc_frame_pack_sei_info *sei_info;
int ret, i;
ext_ctrls.ctrl_class = V4L2_CTRL_CLASS_CODEC;
switch (conf_type) {
case MFC_DEC_GETCONF_FRAME_PACKING:
sei_info = (struct mfc_frame_pack_sei_info *)value;
for (i=0; i<FRAME_PACK_SEI_INFO_NUM; i++)
CLEAR(ext_ctrl[i]);
ext_ctrls.count = FRAME_PACK_SEI_INFO_NUM;
ext_ctrls.controls = ext_ctrl;
ext_ctrl[0].id = V4L2_CID_CODEC_FRAME_PACK_SEI_AVAIL;
ext_ctrl[1].id = V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_ID;
ext_ctrl[2].id = V4L2_CID_CODEC_FRAME_PACK_SEI_INFO;
ext_ctrl[3].id = V4L2_CID_CODEC_FRAME_PACK_GRID_POS;
ret = ioctl(fd, VIDIOC_G_EXT_CTRLS, &ext_ctrls);
sei_info->sei_avail = ext_ctrl[0].value;
sei_info->arrgment_id = ext_ctrl[1].value;
sei_info->sei_info = ext_ctrl[2].value;
sei_info->grid_pos = ext_ctrl[3].value;
break;
}
return ret;
}
#endif
int v4l2_mfc_qbuf(int fd, struct v4l2_buffer *qbuf, enum v4l2_buf_type type,
enum v4l2_memory memory, int index,
struct v4l2_plane *planes, int frame_length)
@ -473,6 +436,12 @@ void *SsbSipMfcDecOpen(void)
LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
#ifdef CONFIG_MFC_FPS
framecount = 0;
over30ms = 0;
gettimeofday(&mTS1, NULL);
#endif
pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
if (pCTX == NULL) {
LOGE("[%s] malloc failed.",__func__);
@ -591,6 +560,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
int ret, i;
_MFCLIB *pCTX;
#ifdef CONFIG_MFC_FPS
LOGI(">>> MFC");
gettimeofday(&mTS2, NULL);
LOGI(">>> time=%d", mTS2.tv_sec-mTS1.tv_sec);
LOGI(">>> framecount=%d", framecount);
LOGI(">>> 30ms over=%d", over30ms);
#endif
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
@ -929,7 +906,7 @@ int resolution_change(void *openHandle)
_MFCLIB *pCTX;
pCTX = (_MFCLIB *) openHandle;
ret = v4l2_mfc_streamoff(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
ret = v4l2_mfc_streamoff(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
if (ret != 0)
goto error_case;
@ -973,6 +950,9 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
int poll_state;
int poll_revents;
#ifdef CONFIG_MFC_FPS
framecount++;
#endif
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
@ -983,10 +963,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
return MFC_RET_INVALID_PARAM;
}
#ifdef CONFIG_MFC_FPS
gettimeofday(&mDec1, NULL);
#endif
pCTX = (_MFCLIB *) openHandle;
if ((lengthBufFill > 0) && (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe)) {
if (pCTX->displayStatus != MFC_GETOUTBUF_DISPLAY_ONLY) {
/* Queue the stream frame */
ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, lengthBufFill);
@ -1028,7 +1010,6 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
break;
} while(0 == poll_state);
}
ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP);
if (ret != 0) {
@ -1096,17 +1077,6 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
}
} while (ret != 0);
ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_DISPLAY_STATUS, &ctrl_value);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed", __func__);
return MFC_RET_DEC_EXE_ERR;
}
if (ctrl_value == 3) {
pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_END;
pCTX->decOutInfo.disp_pic_frame_type = -1;
return MFC_RET_OK;
}
pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][0];
@ -1162,6 +1132,10 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP,
buf.index, planes, 0);
#ifdef CONFIG_MFC_FPS
gettimeofday(&mDec2, NULL);
if (mDec2.tv_usec-mDec1.tv_usec > 30000) over30ms++;
#endif
return MFC_RET_OK;
}
@ -1173,6 +1147,9 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill)
struct v4l2_buffer buf;
struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
#ifdef CONFIG_MFC_FPS
framecount++;
#endif
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
@ -1185,8 +1162,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill)
pCTX = (_MFCLIB *) openHandle;
if ((lengthBufFill > 0) && (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe)
&& (pCTX->displayStatus != MFC_GETOUTBUF_DISPLAY_ONLY)) {
if ((lengthBufFill > 0) && (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe)) {
/* Queue the stream frame */
ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, lengthBufFill);
@ -1252,7 +1228,6 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_
pCTX = (_MFCLIB *) openHandle;
if (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe) {
if (pCTX->displayStatus != MFC_GETOUTBUF_DISPLAY_ONLY) {
/* wait for decoding */
do {
poll_state = v4l2_mfc_poll(pCTX->hMFC, &poll_revents, POLL_DEC_WAIT_TIMEOUT);
@ -1281,8 +1256,7 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_
if (isBreak_loop(pCTX))
break;
} while (0 == poll_state);
}
} while (poll_state == 0);
ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP);
if (ret != 0) {
@ -1341,17 +1315,6 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_
}
} while (ret != 0);
ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_DISPLAY_STATUS, &ctrl_value);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed", __func__);
return MFC_RET_DEC_GET_CONF_FAIL;
}
if (ctrl_value == 3) {
pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_END;
pCTX->decOutInfo.disp_pic_frame_type = -1;
return SsbSipMfcDecGetOutBuf(pCTX, output_info);;
}
pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][0];
@ -1620,12 +1583,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
id = V4L2_CID_CODEC_LOOP_FILTER_MPEG4_ENABLE;
ctrl_value = *((unsigned int*)value);
break;
#ifdef S3D_SUPPORT
case MFC_DEC_SETCONF_SEI_PARSE:
id = V4L2_CID_CODEC_FRAME_PACK_SEI_PARSE;
ctrl_value = 1;
break;
#endif
default:
LOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
return MFC_RET_INVALID_PARAM;
@ -1647,10 +1605,6 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
SSBSIP_MFC_IMG_RESOLUTION *img_resolution;
int ret;
SSBSIP_MFC_CRC_DATA *crc_data;
#ifdef S3D_SUPPORT
SSBSIP_MFC_FRAME_PACKING *frame_packing;
struct mfc_frame_pack_sei_info sei_info;
#endif
SSBSIP_MFC_CROP_INFORMATION *crop_information;
if (openHandle == NULL) {
@ -1697,32 +1651,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
LOGI("[%s] crc_data->luma0=0x%x\n", __func__, crc_data->luma0);
LOGI("[%s] crc_data->chroma0=0x%x\n", __func__, crc_data->chroma0);
break;
#ifdef S3D_SUPPORT
case MFC_DEC_GETCONF_FRAME_PACKING:
frame_packing = (SSBSIP_MFC_FRAME_PACKING *)value;
ret = v4l2_mfc_ext_g_ctrl(pCTX->hMFC, conf_type, &sei_info);
if (ret != 0) {
printf("Error to do ext_g_ctrl.\n");
}
frame_packing->available = sei_info.sei_avail;
frame_packing->arrangement_id = sei_info.arrgment_id;
frame_packing->arrangement_cancel_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 0);
frame_packing->arrangement_type = OPERATE_BIT(sei_info.sei_info, 0x3f, 1);
frame_packing->quincunx_sampling_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 8);
frame_packing->content_interpretation_type = OPERATE_BIT(sei_info.sei_info, 0x3f, 9);
frame_packing->spatial_flipping_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 15);
frame_packing->frame0_flipped_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 16);
frame_packing->field_views_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 17);
frame_packing->current_frame_is_frame0_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 18);
frame_packing->frame0_grid_pos_x = OPERATE_BIT(sei_info.sei_info, 0xf, 0);
frame_packing->frame0_grid_pos_y = OPERATE_BIT(sei_info.sei_info, 0xf, 4);
frame_packing->frame1_grid_pos_x = OPERATE_BIT(sei_info.sei_info, 0xf, 8);
frame_packing->frame1_grid_pos_y = OPERATE_BIT(sei_info.sei_info, 0xf, 12);
break;
#endif
case MFC_DEC_GETCONF_CROP_INFO:
crop_information = (SSBSIP_MFC_CROP_INFORMATION *)value;
crop_information->crop_top_offset = pCTX->decOutInfo.crop_top_offset;

View file

@ -50,17 +50,6 @@
static char *mfc_dev_name = SAMSUNG_MFC_DEV_NAME;
static int mfc_dev_node = 7;
#if defined (MFC5x_VERSION)
#define H263_CTRL_NUM 19
#define MPEG4_CTRL_NUM 27
#define H264_CTRL_NUM 50
#elif defined (MFC6x_VERSION)
#define H263_CTRL_NUM 20
#define MPEG4_CTRL_NUM 28
#define H264_CTRL_NUM 67
#endif
static void getMFCName(char *devicename, int size)
{
snprintf(devicename, size, "%s%d", SAMSUNG_MFC_DEV_NAME, mfc_dev_node);
@ -238,17 +227,18 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
struct pollfd poll_events;
int poll_state;
struct v4l2_ext_control ext_ctrl_mpeg4[MPEG4_CTRL_NUM];
struct v4l2_ext_control ext_ctrl_h263[H263_CTRL_NUM];
struct v4l2_ext_control ext_ctrl[H264_CTRL_NUM];
struct v4l2_ext_control ext_ctrl_mpeg4[28];
struct v4l2_ext_control ext_ctrl_h263[20];
struct v4l2_ext_control ext_ctrl[48];
struct v4l2_ext_controls ext_ctrls;
SSBSIP_MFC_ENC_H264_PARAM *h264_arg;
SSBSIP_MFC_ENC_MPEG4_PARAM *mpeg4_arg;
SSBSIP_MFC_ENC_H263_PARAM *h263_arg;
if (openHandle == NULL)
if (openHandle == NULL) {
return MFC_RET_INVALID_PARAM;
}
pCTX = (_MFCLIB *) openHandle;
@ -296,23 +286,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
if (mpeg4_arg->SliceMode == 0) {
ext_ctrl_mpeg4[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
ext_ctrl_mpeg4[5].value = 1; /* default */
#if defined (MFC5x_VERSION)
ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
ext_ctrl_mpeg4[6].value = 1900; /* default */
#elif defined (MFC6x_VERSION)
ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
ext_ctrl_mpeg4[6].value = 2800; /* based on MFC6.x */
#endif
} else if (mpeg4_arg->SliceMode == 1) {
ext_ctrl_mpeg4[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
ext_ctrl_mpeg4[5].value = mpeg4_arg->SliceArgument;
#if defined (MFC5x_VERSION)
ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
ext_ctrl_mpeg4[6].value = 1900; /* default */
#elif defined (MFC6x_VERSION)
ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
ext_ctrl_mpeg4[6].value = 2800; /* based on MFC6.x */
#endif
} else if (mpeg4_arg->SliceMode == 3) {
ext_ctrl_mpeg4[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
ext_ctrl_mpeg4[5].value = 1; /* default */
@ -320,7 +300,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ext_ctrl_mpeg4[6].value = mpeg4_arg->SliceArgument;
}
/*
* It should be set using mpeg4_arg->NumberBFrames after being handled by appl.
It should be set using mpeg4_arg->NumberBFrames after being handled by appl.
*/
ext_ctrl_mpeg4[7].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_B_FRAMES;
ext_ctrl_mpeg4[7].value = mpeg4_arg->NumberBFrames;
@ -379,10 +359,8 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ext_ctrl_mpeg4[26].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT;
ext_ctrl_mpeg4[26].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
#if defined (MFC6x_VERSION)
ext_ctrl_mpeg4[27].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MB_ENABLE; /* MFC 6.x Only */
ext_ctrl_mpeg4[27].value = mpeg4_arg->EnableMBRateControl;
#endif
break;
case H263_ENC:
@ -445,10 +423,8 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ext_ctrl_h263[18].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT;
ext_ctrl_h263[18].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
#if defined (MFC6x_VERSION)
ext_ctrl_h263[19].id = V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MB_ENABLE; /* MFC 6.x Only */
ext_ctrl_h263[19].value = h263_arg->EnableMBRateControl;
#endif
break;
case H264_ENC:
@ -467,23 +443,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
if (h264_arg->SliceMode == 0) {
ext_ctrl[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
ext_ctrl[6].value = 1; /* default */
#if defined (MFC5x_VERSION)
ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
ext_ctrl[7].value = 1900; /* default */
#elif defined (MFC6x_VERSION)
ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
ext_ctrl[7].value = 2800; /* based on MFC6.x */
#endif
} else if (h264_arg->SliceMode == 1) {
ext_ctrl[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
ext_ctrl[6].value = h264_arg->SliceArgument;
#if defined (MFC5x_VERSION)
ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
ext_ctrl[7].value = 1900; /* default */
#elif defined (MFC6x_VERSION)
ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
ext_ctrl[7].value = 2800; /* based on MFC6.x */
#endif
} else if (h264_arg->SliceMode == 3) {
ext_ctrl[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
ext_ctrl[6].value = 1; /* default */
@ -491,7 +457,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ext_ctrl[7].value = h264_arg->SliceArgument;
}
/*
* It should be set using h264_arg->NumberBFrames after being handled by appl.
It should be set using h264_arg->NumberBFrames after being handled by appl.
*/
ext_ctrl[8].id = V4L2_CID_CODEC_MFC5X_ENC_H264_B_FRAMES;
ext_ctrl[8].value = h264_arg->NumberBFrames;
@ -571,155 +537,40 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ext_ctrl[37].value = 0;
ext_ctrl[38].id = V4L2_CID_CODEC_MFC5X_ENC_SEQ_HDR_MODE;
ext_ctrl[38].value = 0; /* 0: seperated header, 1: header + first frame */
ext_ctrl[38].value = 0; /* 0: seperated header
1: header + first frame */
ext_ctrl[39].id = V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_ENABLE;
ext_ctrl[39].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
ext_ctrl[40].id = V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_IDC;
ext_ctrl[40].value = 0;
ext_ctrl[41].id = V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_WIDTH;
ext_ctrl[39].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT; /* MFC5.x Only */
ext_ctrl[39].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
ext_ctrl[40].id = V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_ENABLE;
ext_ctrl[40].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
ext_ctrl[41].id = V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_IDC;
ext_ctrl[41].value = 0;
ext_ctrl[42].id = V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_HEIGHT;
ext_ctrl[42].id = V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_WIDTH;
ext_ctrl[42].value = 0;
ext_ctrl[43].id = V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_HEIGHT;
ext_ctrl[43].value = 0;
if (pCTX->hier_p_enable) {
ext_ctrl[43].id = V4L2_CID_CODEC_MFC5X_ENC_H264_HIER_P_ENABLE;
ext_ctrl[43].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
ext_ctrl[44].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER0_QP;
ext_ctrl[44].value = pCTX->hier_qp_value.t0_frame_qp;
ext_ctrl[45].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER1_QP;
ext_ctrl[45].value = pCTX->hier_qp_value.t2_frame_qp;
ext_ctrl[46].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER2_QP;
ext_ctrl[46].value = pCTX->hier_qp_value.t3_frame_qp;
ext_ctrl[44].id = V4L2_CID_CODEC_MFC5X_ENC_H264_HIER_P_ENABLE;
ext_ctrl[44].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
ext_ctrl[45].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER0_QP;
ext_ctrl[45].value = pCTX->hier_qp_value.t0_frame_qp;
ext_ctrl[46].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER1_QP;
ext_ctrl[46].value = pCTX->hier_qp_value.t2_frame_qp;
ext_ctrl[47].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER2_QP;
ext_ctrl[47].value = pCTX->hier_qp_value.t3_frame_qp;
} else {
ext_ctrl[43].id = V4L2_CID_CODEC_MFC5X_ENC_H264_HIER_P_ENABLE;
ext_ctrl[43].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
ext_ctrl[44].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER0_QP;
ext_ctrl[44].value = 0;
ext_ctrl[45].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER1_QP;
ext_ctrl[44].id = V4L2_CID_CODEC_MFC5X_ENC_H264_HIER_P_ENABLE;
ext_ctrl[44].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
ext_ctrl[45].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER0_QP;
ext_ctrl[45].value = 0;
ext_ctrl[46].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER2_QP;
ext_ctrl[46].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER1_QP;
ext_ctrl[46].value = 0;
}
#ifdef S3D_SUPPORT
if (pCTX->sei_info.sei_gen_enable) {
ext_ctrl[47].id = V4L2_CID_CODEC_FRAME_PACK_FRM0_FLAG;
ext_ctrl[47].value = pCTX->sei_info.curr_frame_frm0_flag;
ext_ctrl[48].id = V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_TYPE;
ext_ctrl[48].value = pCTX->sei_info.frame_pack_arrgment_type;
} else {
ext_ctrl[47].id = V4L2_CID_CODEC_FRAME_PACK_FRM0_FLAG;
ext_ctrl[47].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER2_QP;
ext_ctrl[47].value = 0;
ext_ctrl[48].id = V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_TYPE;
ext_ctrl[48].value = 3;
}
#else
ext_ctrl[47].id = V4L2_CID_CODEC_FRAME_PACK_FRM0_FLAG;
ext_ctrl[47].value = 0;
ext_ctrl[48].id = V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_TYPE;
ext_ctrl[48].value = 3;
#endif
#if defined (MFC5x_VERSION)
ext_ctrl[49].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT; /* MFC5.x Only */
ext_ctrl[49].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
#elif defined (MFC6x_VERSION)
if (pCTX->fmo_enable) {
ext_ctrl[49].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_ENABLE;
ext_ctrl[49].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
ext_ctrl[50].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_MAP_TYPE;
ext_ctrl[50].value = pCTX->fmo_value.slice_map_type;
ext_ctrl[51].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SLICE_NUM;
ext_ctrl[51].value = pCTX->fmo_value.slice_num_grp;
if (pCTX->fmo_value.slice_map_type == 0) {
ext_ctrl[52].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN1;
ext_ctrl[53].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN2;
ext_ctrl[54].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN3;
ext_ctrl[55].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN4;
for (i = 0; i < pCTX->fmo_value.slice_num_grp; i++)
ext_ctrl[52+i].value = pCTX->fmo_value.run_length[i];
for (i = pCTX->fmo_value.slice_num_grp; i < 4; i++);
ext_ctrl[52+i].value = 1;
} else {
ext_ctrl[52].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN1;
ext_ctrl[52].value = 1;
ext_ctrl[53].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN2;
ext_ctrl[53].value = 1;
ext_ctrl[54].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN3;
ext_ctrl[54].value = 1;
ext_ctrl[55].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN4;
ext_ctrl[55].value = 1;
}
if (pCTX->fmo_value.slice_map_type == 4 || pCTX->fmo_value.slice_map_type == 5) {
ext_ctrl[56].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_DIR;
ext_ctrl[56].value = pCTX->fmo_value.sg_dir;
ext_ctrl[57].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_RATE;
ext_ctrl[57].value = pCTX->fmo_value.sg_rate;
} else {
ext_ctrl[56].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_DIR;
ext_ctrl[56].value = 0;
ext_ctrl[57].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_RATE;
ext_ctrl[57].value = 1;
}
} else {
ext_ctrl[49].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_ENABLE;
ext_ctrl[49].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
ext_ctrl[50].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_MAP_TYPE;
ext_ctrl[50].value = 0;
ext_ctrl[51].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SLICE_NUM;
ext_ctrl[51].value = 1;
ext_ctrl[52].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN1;
ext_ctrl[52].value = 1;
ext_ctrl[53].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN2;
ext_ctrl[53].value = 1;
ext_ctrl[54].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN3;
ext_ctrl[54].value = 1;
ext_ctrl[55].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN4;
ext_ctrl[55].value = 1;
ext_ctrl[56].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_DIR;
ext_ctrl[56].value = 0;
ext_ctrl[57].id = V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_RATE;
ext_ctrl[57].value = 1;
}
if (pCTX->aso_enable) {
ext_ctrl[58].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_ENABLE;
ext_ctrl[58].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
ext_ctrl[59].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_0;
ext_ctrl[59].value = pCTX->aso_sl_order[0];
ext_ctrl[60].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_1;
ext_ctrl[60].value = pCTX->aso_sl_order[1];
ext_ctrl[61].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_2;
ext_ctrl[61].value = pCTX->aso_sl_order[2];
ext_ctrl[62].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_3;
ext_ctrl[62].value = pCTX->aso_sl_order[3];
ext_ctrl[63].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_4;
ext_ctrl[63].value = pCTX->aso_sl_order[4];
ext_ctrl[64].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_5;
ext_ctrl[64].value = pCTX->aso_sl_order[5];
ext_ctrl[65].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_6;
ext_ctrl[65].value = pCTX->aso_sl_order[6];
ext_ctrl[66].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_7;
ext_ctrl[66].value = pCTX->aso_sl_order[7];
} else {
ext_ctrl[58].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_ENABLE;
ext_ctrl[58].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
ext_ctrl[59].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_0;
ext_ctrl[59].value = 0;
ext_ctrl[60].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_1;
ext_ctrl[60].value = 0;
ext_ctrl[61].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_2;
ext_ctrl[61].value = 0;
ext_ctrl[62].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_3;
ext_ctrl[62].value = 0;
ext_ctrl[63].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_4;
ext_ctrl[63].value = 0;
ext_ctrl[64].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_5;
ext_ctrl[64].value = 0;
ext_ctrl[65].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_6;
ext_ctrl[65].value = 0;
ext_ctrl[66].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_7;
ext_ctrl[66].value = 0;
}
#endif
break;
default:
@ -730,13 +581,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ext_ctrls.ctrl_class = V4L2_CTRL_CLASS_CODEC;
if (pCTX->codecType == MPEG4_ENC) {
ext_ctrls.count = MPEG4_CTRL_NUM;
ext_ctrls.count = 28;
ext_ctrls.controls = ext_ctrl_mpeg4;
} else if (pCTX->codecType == H264_ENC) {
ext_ctrls.count = H264_CTRL_NUM;
ext_ctrls.count = 48;
ext_ctrls.controls = ext_ctrl;
} else if (pCTX->codecType == H263_ENC) {
ext_ctrls.count = H263_CTRL_NUM;
ext_ctrls.count = 20;
ext_ctrls.controls = ext_ctrl_h263;
}
@ -772,12 +623,11 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
}
#else /* FIXME: */
if (NV12_TILE == pCTX->framemap) {
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT_16X16; /* 4:2:0, 2 Planes, 16x16 Tiles */
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT; /* 4:2:0, 2 Planes, 16x16 Tiles */
} else { /* NV12_LINEAR (default) */
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M; /* 4:2:0, 2 Planes, linear */
}
#endif
ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
if (ret != 0) {
LOGE("[%s] S_FMT failed on MFC output stream",__func__);
@ -995,7 +845,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
} while (1 == poll_state);
pCTX->v4l2_enc.mfc_dst_bufs_bytes_used_len = buf.m.planes[0].bytesused;
pCTX->virStrmBuf = (unsigned int)pCTX->v4l2_enc.mfc_dst_bufs[buf.index];
pCTX->virStrmBuf = pCTX->v4l2_enc.mfc_dst_bufs[buf.index];
/* stream dequeued index */
index = buf.index;
@ -1015,7 +865,6 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
LOGV("[%s] Strm out idx %d",__func__,index);
return MFC_RET_OK;
error_case3:
for (j = 0; j < i; j++)
munmap(pCTX->v4l2_enc.mfc_dst_bufs[j], pCTX->v4l2_enc.mfc_dst_bufs_len);
@ -1058,8 +907,8 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
input_info->CSize = Align(Align(pCTX->width, 128) * Align(pCTX->height >> 1, 32), 8192); /* tiled mode */
} else { /* NV12_LINEAR (default) */
/* 4:2:0, 2 Planes, linear */
input_info->YSize = Align(Align(pCTX->width, 16) * Align(pCTX->height, 16), 2048); /* width = 16B, height = 16B align */
input_info->CSize = Align(Align(pCTX->width, 16) * Align(pCTX->height >> 1, 8), 2048); /* width = 16B, height = 8B align */
input_info->YSize = Align((pCTX->width * pCTX->height), 2048); /* linear mode, 2K align */
input_info->CSize = Align((pCTX->width * (pCTX->height >> 1)), 2048); /* linear mode, 2K align */
}
} else {
for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++)
@ -1356,7 +1205,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
pCTX->v4l2_enc.mfc_src_buf_flags[qbuf.index] = BUF_DEQUEUED;
/* Update context stream buffer address */
pCTX->virStrmBuf = (unsigned int)pCTX->v4l2_enc.mfc_dst_bufs[dequeued_index];
pCTX->virStrmBuf = pCTX->v4l2_enc.mfc_dst_bufs[dequeued_index];
LOGV("[%s] Strm out idx %d",__func__,dequeued_index);
return MFC_RET_OK;
@ -1367,12 +1216,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
_MFCLIB *pCTX;
struct v4l2_control ctrl;
struct mfc_enc_hier_p_qp hier_p_qp;
#ifdef S3D_SUPPORT
SSBSIP_MFC_FRAME_PACKING *frame_packing;
#endif
struct mfc_enc_fmo fmo_param;
int *aso_param;
int ret, i;
int ret;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
@ -1410,13 +1254,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
ctrl.id = V4L2_CID_CODEC_ENCODED_BIT_RATE_CH;
ctrl.value = *((unsigned int*)value);
break;
#ifdef S3D_SUPPORT
case MFC_ENC_SETCONF_SEI_GEN:
ctrl.id = V4L2_CID_CODEC_FRAME_PACK_SEI_GEN;
ctrl.value = *((unsigned int*)value);
pCTX->sei_info.sei_gen_enable = 1;
break;
#endif
case MFC_ENC_SETCONF_ALLOW_FRAME_SKIP:
pCTX->enc_frameskip = *((int *)value);
return MFC_RET_OK;
@ -1434,32 +1272,6 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
pCTX->hier_qp_value.t2_frame_qp = (int)(hier_p_qp.t2_frame_qp);
pCTX->hier_qp_value.t3_frame_qp = (int)(hier_p_qp.t3_frame_qp);
return MFC_RET_OK;
#ifdef S3D_SUPPORT
case MFC_ENC_SETCONF_FRAME_PACKING:
frame_packing = (SSBSIP_MFC_FRAME_PACKING *)value;
pCTX->sei_info.curr_frame_frm0_flag = (int)(frame_packing->current_frame_is_frame0_flag);
pCTX->sei_info.frame_pack_arrgment_type = (int)(frame_packing->arrangement_type);
return MFC_RET_OK;
#endif
case MFC_ENC_SETCONF_FMO:
fmo_param = *((struct mfc_enc_fmo *) value);
pCTX->fmo_enable = 1;
pCTX->fmo_value.slice_map_type = (int)(fmo_param.slice_map_type);
pCTX->fmo_value.slice_num_grp = (int)(fmo_param.slice_num_grp);
pCTX->fmo_value.run_length[0] = (int)(fmo_param.run_length[0]);
pCTX->fmo_value.run_length[1] = (int)(fmo_param.run_length[1]);
pCTX->fmo_value.run_length[2] = (int)(fmo_param.run_length[2]);
pCTX->fmo_value.run_length[3] = (int)(fmo_param.run_length[3]);
pCTX->fmo_value.sg_dir = (int)(fmo_param.sg_dir);
pCTX->fmo_value.sg_rate = (int)(fmo_param.sg_rate);
return MFC_RET_OK;
case MFC_ENC_SETCONF_ASO:
aso_param = (int *) value;
pCTX->aso_enable = 1;
for (i = 0; i < 8; i++)
pCTX->aso_sl_order[i] = (int)aso_param[i];
return MFC_RET_OK;
default:
LOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);

View file

@ -30,8 +30,6 @@
#define MAX_DECODER_INPUT_BUFFER_SIZE (1024 * 3072)
#define MAX_ENCODER_OUTPUT_BUFFER_SIZE (1024 * 3072)
#define MFC6x_VERSION
#define SUPPORT_1080P 1
#if SUPPORT_1080P
@ -61,9 +59,7 @@ typedef enum {
FIMV2_DEC,
FIMV3_DEC,
FIMV4_DEC,
#if defined (MFC6x_VERSION)
VP8_DEC,
#endif
H264_ENC,
MPEG4_ENC,
H263_ENC,
@ -78,15 +74,9 @@ typedef enum {
typedef enum {
NV12_LINEAR = 0,
NV12_TILE,
NV21_LINEAR
NV12_TILE
} SSBSIP_MFC_INSTRM_MODE_TYPE;
typedef enum {
FRAME = 0,
SLICE,
} SSBSIP_MFC_OUTSTRM_MODE_TYPE;
typedef enum {
NO_CACHE = 0,
CACHE = 1
@ -110,12 +100,7 @@ typedef enum {
MFC_DEC_SETCONF_IMMEDIATELY_DISPLAY,
MFC_DEC_SETCONF_DPB_FLUSH,
MFC_DEC_SETCONF_PIXEL_CACHE,
MFC_DEC_GETCONF_WIDTH_HEIGHT,
#ifdef S3D_SUPPORT
/* S3D specific feature */
MFC_DEC_SETCONF_SEI_PARSE,
MFC_DEC_GETCONF_FRAME_PACKING
#endif
MFC_DEC_GETCONF_WIDTH_HEIGHT
} SSBSIP_MFC_DEC_CONF;
typedef enum {
@ -129,14 +114,7 @@ typedef enum {
/* C210 specific feature */
MFC_ENC_SETCONF_VUI_INFO,
MFC_ENC_SETCONF_I_PERIOD,
MFC_ENC_SETCONF_HIER_P,
#ifdef S3D_SUPPORT
/* S3D Specific feature */
MFC_ENC_SETCONF_SEI_GEN,
MFC_ENC_SETCONF_FRAME_PACKING,
#endif
MFC_ENC_SETCONF_FMO,
MFC_ENC_SETCONF_ASO,
MFC_ENC_SETCONF_HIER_P
} SSBSIP_MFC_ENC_CONF;
typedef enum {
@ -258,7 +236,6 @@ typedef struct {
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) */
SSBSIP_MFC_OUTSTRM_MODE_TYPE OutputMode; /* [IN] Output mode: Frame/Slice */
/* H.264 specific parameters */
int ProfileIDC; /* [IN] profile */
@ -302,10 +279,7 @@ typedef struct {
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) */
SSBSIP_MFC_OUTSTRM_MODE_TYPE OutputMode; /* [IN] Output mode: Frame/Slice */
#if defined (MFC6x_VERSION)
int EnableMBRateControl; /* [IN] Enable macroblock-level rate control, MFC6.x Only */
#endif
/* MPEG4 specific parameters */
int ProfileIDC; /* [IN] profile */
@ -338,9 +312,7 @@ typedef struct {
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) */
#if defined (MFC6x_VERSION)
int EnableMBRateControl; /* [IN] Enable macroblock-level rate control, MFC6.x Only */
#endif
/* H.263 specific parameters */
int FrameRate; /* [IN] rate control parameter(frame rate) */
@ -360,25 +332,6 @@ typedef struct {
int crop_right_offset;
} SSBSIP_MFC_CROP_INFORMATION;
#ifdef S3D_SUPPORT
typedef struct {
int available;
unsigned int arrangement_id;
int arrangement_cancel_flag;
unsigned char arrangement_type;
int quincunx_sampling_flag;
unsigned char content_interpretation_type;
int spatial_flipping_flag;
int frame0_flipped_flag;
int field_views_flag;
int current_frame_is_frame0_flag;
unsigned char frame0_grid_pos_x;
unsigned char frame0_grid_pos_y;
unsigned char frame1_grid_pos_x;
unsigned char frame1_grid_pos_y;
} SSBSIP_MFC_FRAME_PACKING;
#endif
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -99,15 +99,6 @@ typedef struct {
int chroma1; /* per frame (or bottom field) */
} SSBSIP_MFC_CRC_DATA;
#ifdef S3D_SUPPORT
struct mfc_frame_pack_sei_info {
int sei_avail;
unsigned int arrgment_id;
int sei_info;
int grid_pos;
};
#endif
struct mfc_strm_ref_buf_arg {
unsigned int strm_ref_y;
unsigned int mv_ref_yc;
@ -457,22 +448,6 @@ struct mfc_enc_hier_p_qp {
int t3_frame_qp;
};
#ifdef S3D_SUPPORT
struct mfc_enc_sei_info {
int sei_gen_enable;
int curr_frame_frm0_flag;
int frame_pack_arrgment_type;
};
#endif
struct mfc_enc_fmo {
unsigned int slice_map_type;
unsigned int slice_num_grp;
unsigned int run_length[4];
unsigned int sg_dir;
unsigned int sg_rate;
};
enum BUF_STATUS {
BUF_ENQUEUED,
BUF_DEQUEUED
@ -566,14 +541,6 @@ typedef struct {
int hier_p_enable;
struct mfc_enc_hier_p_qp hier_qp_value;
#ifdef S3D_SUPPORT
struct mfc_enc_sei_info sei_info;
#endif
int fmo_enable;
struct mfc_enc_fmo fmo_value;
int aso_enable;
int aso_sl_order[8];
/*ION related*/
int ion_fd;

View file

@ -1,3 +1,7 @@
WITH_SEC_OMX := true
ifeq ($(WITH_SEC_OMX), true)
LOCAL_PATH := $(call my-dir)
BOARD_USE_ANB := true
@ -30,3 +34,5 @@ ifeq ($(BOARD_USE_ALP_AUDIO), true)
include $(SEC_OMX_COMPONENT)/audio/dec/Android.mk
include $(SEC_OMX_COMPONENT)/audio/dec/mp3/Android.mk
endif
endif

View file

@ -145,13 +145,8 @@ typedef struct _SEC_OMX_BASECOMPONENT
OMX_ERRORTYPE (*sec_InputBufferReturn)(OMX_COMPONENTTYPE *pOMXComponent);
OMX_ERRORTYPE (*sec_OutputBufferReturn)(OMX_COMPONENTTYPE *pOMXComponent);
OMX_ERRORTYPE (*sec_allocSecureInputBuffer)(OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_U32 nBufferSize,
OMX_INOUT OMX_PTR *pInputBuffer_physicalAddress);
OMX_ERRORTYPE (*sec_freeSecureInputBuffer)(OMX_IN OMX_HANDLETYPE hComponent,
OMX_INOUT OMX_PTR pInputBuffer_physicalAddress);
int (*sec_checkInputFrame)(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame);
} SEC_OMX_BASECOMPONENT;
OMX_ERRORTYPE SEC_OMX_GetParameter(

View file

@ -196,7 +196,6 @@ OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
SEC_OMX_BASEPORT *pSECPort = NULL;
OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL;
OMX_U8 *temp_buffer = NULL;
@ -219,7 +218,6 @@ OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
goto EXIT;
}
pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
pSECPort = &pSECComponent->pSECPort[nPortIndex];
if (nPortIndex >= pSECComponent->portParam.nPorts) {
@ -237,25 +235,15 @@ OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
goto EXIT;
}
if ((pVideoDec->bDRMPlayerMode == OMX_TRUE) && (nPortIndex == INPUT_PORT_INDEX)) {
ret = pSECComponent->sec_allocSecureInputBuffer(hComponent, sizeof(OMX_U8) * nSizeBytes, &temp_buffer);
if (ret != OMX_ErrorNone)
goto EXIT;
} else {
temp_buffer = SEC_OSAL_Malloc(sizeof(OMX_U8) * nSizeBytes);
if (temp_buffer == NULL) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
}
temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
if (temp_bufferHeader == NULL) {
if ((pVideoDec->bDRMPlayerMode == OMX_TRUE) && (nPortIndex == INPUT_PORT_INDEX))
pSECComponent->sec_freeSecureInputBuffer(hComponent, temp_buffer);
else
SEC_OSAL_Free(temp_buffer);
temp_buffer = NULL;
ret = OMX_ErrorInsufficientResources;
goto EXIT;
@ -288,11 +276,7 @@ OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
}
SEC_OSAL_Free(temp_bufferHeader);
if ((pVideoDec->bDRMPlayerMode == OMX_TRUE) && (nPortIndex == INPUT_PORT_INDEX))
pSECComponent->sec_freeSecureInputBuffer(hComponent, temp_buffer);
else
SEC_OSAL_Free(temp_buffer);
ret = OMX_ErrorInsufficientResources;
EXIT:
@ -309,7 +293,6 @@ OMX_ERRORTYPE SEC_OMX_FreeBuffer(
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
SEC_OMX_BASEPORT *pSECPort = NULL;
OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL;
OMX_U8 *temp_buffer = NULL;
@ -332,7 +315,6 @@ OMX_ERRORTYPE SEC_OMX_FreeBuffer(
goto EXIT;
}
pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
pSECPort = &pSECComponent->pSECPort[nPortIndex];
if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
@ -352,9 +334,6 @@ OMX_ERRORTYPE SEC_OMX_FreeBuffer(
if (((pSECPort->bufferStateAllocate[i] | BUFFER_STATE_FREE) != 0) && (pSECPort->bufferHeader[i] != NULL)) {
if (pSECPort->bufferHeader[i]->pBuffer == pBufferHdr->pBuffer) {
if (pSECPort->bufferStateAllocate[i] & BUFFER_STATE_ALLOCATED) {
if ((pVideoDec->bDRMPlayerMode == OMX_TRUE) && (nPortIndex == INPUT_PORT_INDEX))
pSECComponent->sec_freeSecureInputBuffer(hComponent, pSECPort->bufferHeader[i]->pBuffer);
else
SEC_OSAL_Free(pSECPort->bufferHeader[i]->pBuffer);
pSECPort->bufferHeader[i]->pBuffer = NULL;
pBufferHdr->pBuffer = NULL;
@ -704,7 +683,6 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_BOOL ret = OMX_FALSE;
SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
SEC_OMX_DATABUFFER *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
SEC_OMX_DATA *inputData = &pSECComponent->processData[INPUT_PORT_INDEX];
OMX_U32 copySize = 0;
@ -725,10 +703,7 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
} else {
previousFrameEOF = OMX_FALSE;
}
if (pVideoDec->bDRMPlayerMode == OMX_TRUE) {
flagEOF = OMX_TRUE;
checkedSize = checkInputStreamLen;
} else if ((pSECComponent->bUseFlagEOF == OMX_TRUE) &&
if ((pSECComponent->bUseFlagEOF == OMX_TRUE) &&
!(inputUseBuffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) {
flagEOF = OMX_TRUE;
checkedSize = checkInputStreamLen;
@ -748,13 +723,9 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
if (inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS)
pSECComponent->bSaveFlagEOS = OMX_TRUE;
if ((((inputData->allocSize) - (inputData->dataLen)) >= copySize) || (pVideoDec->bDRMPlayerMode == OMX_TRUE)) {
if (pVideoDec->bDRMPlayerMode == OMX_TRUE) {
inputData->dataBuffer = checkInputStream;
} else {
if (((inputData->allocSize) - (inputData->dataLen)) >= copySize) {
if (copySize > 0)
SEC_OSAL_Memcpy(inputData->dataBuffer + inputData->dataLen, checkInputStream, copySize);
}
inputUseBuffer->dataLen -= copySize;
inputUseBuffer->remainDataLen -= copySize;
@ -807,13 +778,11 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
flagEOF = OMX_FALSE;
}
if (inputUseBuffer->remainDataLen == 0) {
if (pVideoDec->bDRMPlayerMode != OMX_TRUE)
if (inputUseBuffer->remainDataLen == 0)
SEC_InputBufferReturn(pOMXComponent);
} else {
else
inputUseBuffer->dataValid = OMX_TRUE;
}
}
if (flagEOF == OMX_TRUE) {
if (pSECComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
@ -964,14 +933,6 @@ OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent)
SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
ret = pSECComponent->sec_mfc_bufferProcess(pOMXComponent, inputData, outputData);
if (pVideoDec->bDRMPlayerMode == OMX_TRUE) {
if ((inputUseBuffer->remainDataLen == 0) &&
(ret != OMX_ErrorInputDataDecodeYet))
SEC_InputBufferReturn(pOMXComponent);
else
inputUseBuffer->dataValid = OMX_TRUE;
}
SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);

View file

@ -84,13 +84,6 @@ typedef struct _SEC_OMX_VIDEODEC_COMPONENT
OMX_BOOL bFirstFrame;
MFC_DEC_INPUT_BUFFER MFCDecInputBuffer[MFC_INPUT_BUFFER_NUM_MAX];
OMX_U32 indexInputBuffer;
/* CSC handle */
OMX_PTR csc_handle;
OMX_U32 csc_set_format;
/* For DRM Play */
OMX_BOOL bDRMPlayerMode;
} SEC_OMX_VIDEODEC_COMPONENT;

View file

@ -4,11 +4,11 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
SEC_OMX_Vp8dec.c \
SEC_OMX_H264dec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.SEC.VP8.Decoder
LOCAL_MODULE := libOMX.SEC.AVC.Decoder
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/omx
LOCAL_CFLAGS :=
@ -24,42 +24,35 @@ ifeq ($(BOARD_USE_V4L2_ION), false)
LOCAL_CFLAGS += -DUSE_CSC_FIMC
endif
endif
endif
ifeq ($(BOARD_USE_CSC_GSCALER), true)
LOCAL_CFLAGS += -DUSE_CSC_GSCALER
ifeq ($(BOARD_USE_V4L2), false)
ifeq ($(BOARD_USE_S3D_SUPPORT), true)
LOCAL_CFLAGS += -DS3D_SUPPORT
endif
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec libsecosal libsecbasecomponent \
libswconverter libsecmfcapi
libseccscapi libsecmfcapi
LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
libSEC_OMX_Resourcemanager libcsc
libSEC_OMX_Resourcemanager
ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),)
LOCAL_SHARED_LIBRARIES += libfimc libhwconverter
endif
ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
LOCAL_SHARED_LIBRARIES += libexynosgscaler
LOCAL_SHARED_LIBRARIES += libhwconverter
endif
#ifeq ($(BOARD_USE_V4L2_ION),true)
#LOCAL_SHARED_LIBRARIES += libion
#endif
ifeq ($(BOARD_USES_MFC_FPS),true)
LOCAL_CFLAGS += -DCONFIG_MFC_FPS
endif
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \
$(SEC_OMX_TOP)/osal \
$(SEC_OMX_TOP)/core \
$(SEC_OMX_COMPONENT)/common \
$(SEC_OMX_COMPONENT)/video/dec \
$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO) \
$(BOARD_HAL_PATH)/include
$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO)
include $(BUILD_SHARED_LIBRARY)

View file

@ -58,6 +58,11 @@ typedef struct _SEC_H264DEC_HANDLE
/* SEC MFC Codec specific */
SEC_MFC_H264DEC_HANDLE hMFCH264Handle;
/* CSC FIMC handle */
#ifdef USE_CSC_FIMC
OMX_PTR hFIMCHandle;
#endif
} SEC_H264DEC_HANDLE;
#ifdef __cplusplus

View file

@ -52,11 +52,6 @@ OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType
SEC_OSAL_Strcpy(secComponents[1]->roles[0], SEC_OMX_COMPONENT_H264_DEC_ROLE);
secComponents[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
/* component 3 - video decoder H.264 for DRM */
SEC_OSAL_Strcpy(secComponents[2]->componentName, SEC_OMX_COMPONENT_H264_DRM_DEC);
SEC_OSAL_Strcpy(secComponents[2]->roles[0], SEC_OMX_COMPONENT_H264_DEC_ROLE);
secComponents[2]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
FunctionOut();

View file

@ -33,13 +33,12 @@
#define OSCL_EXPORT_REF __attribute__((visibility("default")))
#define MAX_COMPONENT_NUM 3
#define MAX_COMPONENT_NUM 2
#define MAX_COMPONENT_ROLE_NUM 1
/* H.264 */
#define SEC_OMX_COMPONENT_H264_DEC "OMX.SEC.AVC.Decoder"
#define SEC_OMX_COMPONENT_H264_FP_DEC "OMX.SEC.FP.AVC.Decoder"
#define SEC_OMX_COMPONENT_H264_DRM_DEC "OMX.SEC.AVC.Decoder.secure"
#define SEC_OMX_COMPONENT_H264_DEC_ROLE "video_decoder.avc"

View file

@ -24,42 +24,29 @@ ifeq ($(BOARD_USE_V4L2_ION), false)
LOCAL_CFLAGS += -DUSE_CSC_FIMC
endif
endif
ifeq ($(BOARD_USE_CSC_GSCALER), true)
LOCAL_CFLAGS += -DUSE_CSC_GSCALER
endif
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec libsecosal libsecbasecomponent \
libswconverter libsecmfcapi
libseccscapi libsecmfcapi
LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
libSEC_OMX_Resourcemanager libcsc
libSEC_OMX_Resourcemanager
ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),)
LOCAL_SHARED_LIBRARIES += libfimc libhwconverter
endif
ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
LOCAL_SHARED_LIBRARIES += libexynosgscaler
LOCAL_SHARED_LIBRARIES += libhwconverter
endif
#ifeq ($(BOARD_USE_V4L2_ION),true)
#LOCAL_SHARED_LIBRARIES += libion
#endif
ifeq ($(BOARD_USES_MFC_FPS),true)
LOCAL_CFLAGS += -DCONFIG_MFC_FPS
endif
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \
$(SEC_OMX_TOP)/osal \
$(SEC_OMX_TOP)/core \
$(SEC_OMX_COMPONENT)/common \
$(SEC_OMX_COMPONENT)/video/dec \
$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO) \
$(BOARD_HAL_PATH)/include
$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO)
include $(BUILD_SHARED_LIBRARY)

View file

@ -38,14 +38,17 @@
#include "library_register.h"
#include "SEC_OMX_Mpeg4dec.h"
#include "SsbSipMfcApi.h"
#include "color_space_convertor.h"
#ifdef USE_ANB
#include "SEC_OSAL_Android.h"
#endif
/* To use CSC_METHOD_PREFER_HW or CSC_METHOD_HW in SEC OMX, gralloc should allocate physical memory using FIMC */
/* To use CSC FIMC in SEC OMX, gralloc should allocate physical memory using FIMC */
/* It means GRALLOC_USAGE_HW_FIMC1 should be set on Native Window usage */
#include "csc.h"
#ifdef USE_CSC_FIMC
#include "csc_fimc.h"
#endif
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_MPEG4_DEC"
@ -923,13 +926,7 @@ OMX_ERRORTYPE SEC_MFC_DecodeThread(OMX_HANDLETYPE hComponent)
SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameStart);
if (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStart(PERF_ID_DEC);
#endif
pMpeg4Dec->hMFCMpeg4Handle.returnCodec = SsbSipMfcDecExe(pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle, pVideoDec->NBDecThread.oneFrameSize);
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStop(PERF_ID_DEC);
#endif
SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameEnd);
}
}
@ -952,11 +949,6 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
OMX_HANDLETYPE hMFCHandle = NULL;
OMX_PTR pStreamBuffer = NULL;
OMX_PTR pStreamPhyBuffer = NULL;
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfInit(PERF_ID_DEC);
SEC_OSAL_PerfInit(PERF_ID_CSC);
#endif
CSC_METHOD csc_method = CSC_METHOD_SW;
FunctionIn();
@ -1031,15 +1023,9 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->getAllDelayBuffer = OMX_FALSE;
#ifdef USE_ANB
#if defined(USE_CSC_FIMC) || defined(USE_CSC_GSCALER)
if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
csc_method = CSC_METHOD_PREFER_HW;
}
#ifdef USE_CSC_FIMC
pMpeg4Dec->hFIMCHandle = csc_fimc_open();
#endif
#endif
pVideoDec->csc_handle = csc_init(&csc_method);
pVideoDec->csc_set_format = OMX_FALSE;
EXIT:
FunctionOut();
@ -1058,11 +1044,6 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
FunctionIn();
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfPrint("[DEC]", PERF_ID_DEC);
SEC_OSAL_PerfPrint("[CSC]", PERF_ID_CSC);
#endif
pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
hMFCHandle = pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle;
@ -1096,10 +1077,12 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle = NULL;
}
if (pVideoDec->csc_handle != NULL) {
csc_deinit(pVideoDec->csc_handle);
pVideoDec->csc_handle = NULL;
#ifdef USE_CSC_FIMC
if (pMpeg4Dec->hFIMCHandle != NULL) {
csc_fimc_close(pMpeg4Dec->hFIMCHandle);
pMpeg4Dec->hFIMCHandle = NULL;
}
#endif
EXIT:
FunctionOut();
@ -1385,20 +1368,13 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SE
/** Fill Output Buffer **/
if (outputDataValid == OMX_TRUE) {
void *pOutputBuf = (void *)pOutputData->dataBuffer;
void *pSrcBuf[3] = {NULL, };
void *pYUVBuf[3] = {NULL, };
unsigned int csc_src_color_format, csc_dst_color_format;
CSC_METHOD csc_method = CSC_METHOD_SW;
unsigned int cacheable = 1;
void *pYUVBuf[3];
int frameSize = bufWidth * bufHeight;
int width = outputInfo.img_width;
int height = outputInfo.img_height;
int imageSize = outputInfo.img_width * outputInfo.img_height;
pSrcBuf[0] = outputInfo.YVirAddr;
pSrcBuf[1] = outputInfo.CVirAddr;
pYUVBuf[0] = (unsigned char *)pOutputBuf;
pYUVBuf[1] = (unsigned char *)pOutputBuf + imageSize;
pYUVBuf[2] = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
@ -1415,16 +1391,13 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SE
if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
(pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
/* if use Post copy address structure */
SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
SEC_OSAL_Memcpy(pOutputBuf, &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
pOutputData->dataLen = (outputInfo.img_width * outputInfo.img_height * 3) / 2;
} else {
SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode");
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStart(PERF_ID_CSC);
#endif
switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12Tiled:
SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
@ -1433,65 +1406,56 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SE
break;
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (pMpeg4Dec->hFIMCHandle != NULL)) {
void *pPhys[3];
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pPhys);
pYUVBuf[0] = outputInfo.YPhyAddr;
pYUVBuf[1] = outputInfo.CPhyAddr;
csc_fimc_convert_nv12t(pMpeg4Dec->hFIMCHandle, pPhys,
pYUVBuf, width, height,
OMX_COLOR_FormatYUV420SemiPlanar);
break;
}
#endif
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
case OMX_COLOR_FormatYUV420Planar:
default:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (pMpeg4Dec->hFIMCHandle != NULL)) {
void *pPhys[3];
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pPhys);
pYUVBuf[0] = outputInfo.YPhyAddr;
pYUVBuf[1] = outputInfo.CPhyAddr;
csc_fimc_convert_nv12t(pMpeg4Dec->hFIMCHandle, pPhys,
pYUVBuf, width, height,
OMX_COLOR_FormatYUV420Planar);
break;
}
csc_get_method(pVideoDec->csc_handle, &csc_method);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
pSrcBuf[0] = outputInfo.YPhyAddr;
pSrcBuf[1] = outputInfo.CPhyAddr;
}
#endif
if (pVideoDec->csc_set_format == OMX_FALSE) {
csc_set_src_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_src_color_format, /* color_format */
cacheable); /* cacheable */
csc_set_dst_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_dst_color_format, /* color_format */
cacheable); /* cacheable */
pVideoDec->csc_set_format = OMX_TRUE;
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_deinterleave_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)pYUVBuf[2],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
}
csc_set_src_buffer(
pVideoDec->csc_handle, /* handle */
pSrcBuf[0], /* y addr */
pSrcBuf[1], /* u addr or uv addr */
pSrcBuf[2], /* v addr or none */
0); /* ion fd */
csc_set_dst_buffer(
pVideoDec->csc_handle, /* handle */
pYUVBuf[0], /* y addr */
pYUVBuf[1], /* u addr or uv addr */
pYUVBuf[2], /* v addr or none */
0); /* ion fd */
csc_convert(pVideoDec->csc_handle);
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStop(PERF_ID_CSC);
#endif
}
#ifdef USE_ANB
if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
@ -1673,20 +1637,13 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_O
(status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
/** Fill Output Buffer **/
void *pOutputBuf = (void *)pOutputData->dataBuffer;
void *pSrcBuf[3] = {NULL, };
void *pYUVBuf[3] = {NULL, };
unsigned int csc_src_color_format, csc_dst_color_format;
CSC_METHOD csc_method = CSC_METHOD_SW;
unsigned int cacheable = 1;
void *pYUVBuf[3];
int frameSize = bufWidth * bufHeight;
int width = outputInfo.img_width;
int height = outputInfo.img_height;
int imageSize = outputInfo.img_width * outputInfo.img_height;
pSrcBuf[0] = outputInfo.YVirAddr;
pSrcBuf[1] = outputInfo.CVirAddr;
pYUVBuf[0] = (unsigned char *)pOutputBuf;
pYUVBuf[1] = (unsigned char *)pOutputBuf + imageSize;
pYUVBuf[2] = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
@ -1703,16 +1660,13 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_O
if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
(pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
/* if use Post copy address structure */
SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
SEC_OSAL_Memcpy(pOutputBuf, &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
pOutputData->dataLen = (outputInfo.img_width * outputInfo.img_height * 3) / 2;
} else {
SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode");
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStart(PERF_ID_CSC);
#endif
switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12Tiled:
SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
@ -1721,65 +1675,56 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_O
break;
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (pMpeg4Dec->hFIMCHandle != NULL)) {
void *pPhys[3];
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pPhys);
pYUVBuf[0] = outputInfo.YPhyAddr;
pYUVBuf[1] = outputInfo.CPhyAddr;
csc_fimc_convert_nv12t(pMpeg4Dec->hFIMCHandle, pPhys,
pYUVBuf, width, height,
OMX_SEC_COLOR_FormatANBYUV420SemiPlanar);
break;
}
#endif
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
case OMX_COLOR_FormatYUV420Planar:
default:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (pMpeg4Dec->hFIMCHandle != NULL)) {
void *pPhys[3];
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pPhys);
pYUVBuf[0] = outputInfo.YPhyAddr;
pYUVBuf[1] = outputInfo.CPhyAddr;
csc_fimc_convert_nv12t(pMpeg4Dec->hFIMCHandle, pPhys,
pYUVBuf, width, height,
OMX_COLOR_FormatYUV420Planar);
break;
}
csc_get_method(pVideoDec->csc_handle, &csc_method);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
pSrcBuf[0] = outputInfo.YPhyAddr;
pSrcBuf[1] = outputInfo.CPhyAddr;
}
#endif
if (pVideoDec->csc_set_format == OMX_FALSE) {
csc_set_src_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_src_color_format, /* color_format */
cacheable); /* cacheable */
csc_set_dst_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_dst_color_format, /* color_format */
cacheable); /* cacheable */
pVideoDec->csc_set_format = OMX_TRUE;
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_deinterleave_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)pYUVBuf[2],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
}
csc_set_src_buffer(
pVideoDec->csc_handle, /* handle */
pSrcBuf[0], /* y addr */
pSrcBuf[1], /* u addr or uv addr */
pSrcBuf[2], /* v addr or none */
0); /* ion fd */
csc_set_dst_buffer(
pVideoDec->csc_handle, /* handle */
pYUVBuf[0], /* y addr */
pYUVBuf[1], /* u addr or uv addr */
pYUVBuf[2], /* v addr or none */
0); /* ion fd */
csc_convert(pVideoDec->csc_handle);
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStop(PERF_ID_CSC);
#endif
}
#ifdef USE_ANB

View file

@ -76,6 +76,11 @@ typedef struct _SEC_MPEG4_HANDLE
/* SEC MFC Codec specific */
SEC_MFC_MPEG4_HANDLE hMFCMpeg4Handle;
/* CSC FIMC handle */
#ifdef USE_CSC_FIMC
OMX_PTR hFIMCHandle;
#endif
} SEC_MPEG4_HANDLE;
#ifdef __cplusplus

View file

@ -24,42 +24,29 @@ ifeq ($(BOARD_USE_V4L2_ION), false)
LOCAL_CFLAGS += -DUSE_CSC_FIMC
endif
endif
ifeq ($(BOARD_USE_CSC_GSCALER), true)
LOCAL_CFLAGS += -DUSE_CSC_GSCALER
endif
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec libsecosal libsecbasecomponent \
libswconverter libsecmfcapi
libseccscapi libsecmfcapi
LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
libSEC_OMX_Resourcemanager libcsc
libSEC_OMX_Resourcemanager
ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),)
LOCAL_SHARED_LIBRARIES += libfimc libhwconverter
endif
ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
LOCAL_SHARED_LIBRARIES += libexynosgscaler
LOCAL_SHARED_LIBRARIES += libhwconverter
endif
#ifeq ($(BOARD_USE_V4L2_ION),true)
#LOCAL_SHARED_LIBRARIES += libion
#endif
ifeq ($(BOARD_USES_MFC_FPS),true)
LOCAL_CFLAGS += -DCONFIG_MFC_FPS
endif
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \
$(SEC_OMX_TOP)/osal \
$(SEC_OMX_TOP)/core \
$(SEC_OMX_COMPONENT)/common \
$(SEC_OMX_COMPONENT)/video/dec \
$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO) \
$(BOARD_HAL_PATH)/include
$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO)
include $(BUILD_SHARED_LIBRARY)

View file

@ -42,14 +42,17 @@
#include "SEC_OMX_Wmvdec.h"
#include "SsbSipMfcApi.h"
#include "SEC_OSAL_Event.h"
#include "color_space_convertor.h"
#ifdef USE_ANB
#include "SEC_OSAL_Android.h"
#endif
/* To use CSC_METHOD_PREFER_HW or CSC_METHOD_HW in SEC OMX, gralloc should allocate physical memory using FIMC */
/* To use CSC FIMC in SEC OMX, gralloc should allocate physical memory using FIMC */
/* It means GRALLOC_USAGE_HW_FIMC1 should be set on Native Window usage */
#include "csc.h"
#ifdef USE_CSC_FIMC
#include "csc_fimc.h"
#endif
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_WMV_DEC"
@ -783,13 +786,7 @@ OMX_ERRORTYPE SEC_MFC_DecodeThread(OMX_HANDLETYPE hComponent)
SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameStart);
if (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStart(PERF_ID_DEC);
#endif
pWmvDec->hMFCWmvHandle.returnCodec = SsbSipMfcDecExe(pWmvDec->hMFCWmvHandle.hMFCHandle, pVideoDec->NBDecThread.oneFrameSize);
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStop(PERF_ID_DEC);
#endif
SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameEnd);
}
}
@ -812,15 +809,9 @@ OMX_ERRORTYPE SEC_MFC_WmvDec_Init(OMX_COMPONENTTYPE *pOMXComponent)
OMX_HANDLETYPE hMFCHandle = NULL;
OMX_PTR pStreamBuffer = NULL;
OMX_PTR pStreamPhyBuffer = NULL;
CSC_METHOD csc_method = CSC_METHOD_SW;
FunctionIn();
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfInit(PERF_ID_DEC);
SEC_OSAL_PerfInit(PERF_ID_CSC);
#endif
pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
pWmvDec->hMFCWmvHandle.bConfiguredMFC = OMX_FALSE;
pSECComponent->bUseFlagEOF = OMX_FALSE;
@ -891,15 +882,9 @@ OMX_ERRORTYPE SEC_MFC_WmvDec_Init(OMX_COMPONENTTYPE *pOMXComponent)
pWmvDec->hMFCWmvHandle.outputIndexTimestamp = 0;
pSECComponent->getAllDelayBuffer = OMX_FALSE;
#ifdef USE_ANB
#if defined(USE_CSC_FIMC) || defined(USE_CSC_GSCALER)
if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
csc_method = CSC_METHOD_PREFER_HW;
}
#ifdef USE_CSC_FIMC
pWmvDec->hFIMCHandle = csc_fimc_open();
#endif
#endif
pVideoDec->csc_handle = csc_init(&csc_method);
pVideoDec->csc_set_format = OMX_FALSE;
EXIT:
FunctionOut();
@ -918,11 +903,6 @@ OMX_ERRORTYPE SEC_MFC_WmvDec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
FunctionIn();
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfPrint("[DEC]", PERF_ID_DEC);
SEC_OSAL_PerfPrint("[CSC]", PERF_ID_CSC);
#endif
pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
hMFCHandle = pWmvDec->hMFCWmvHandle.hMFCHandle;
@ -955,10 +935,12 @@ OMX_ERRORTYPE SEC_MFC_WmvDec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
pWmvDec->hMFCWmvHandle.hMFCHandle = NULL;
}
if (pVideoDec->csc_handle != NULL) {
csc_deinit(pVideoDec->csc_handle);
pVideoDec->csc_handle = NULL;
#ifdef USE_CSC_FIMC
if (pWmvDec->hFIMCHandle != NULL) {
csc_fimc_close(pWmvDec->hFIMCHandle);
pWmvDec->hFIMCHandle = NULL;
}
#endif
EXIT:
FunctionOut();
@ -1284,20 +1266,13 @@ OMX_ERRORTYPE SEC_MFC_Wmv_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_
SEC_OMX_BASEPORT *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
void *pOutputBuf = (void *)pOutputData->dataBuffer;
void *pSrcBuf[3] = {NULL, };
void *pYUVBuf[3] = {NULL, };
unsigned int csc_src_color_format, csc_dst_color_format;
CSC_METHOD csc_method = CSC_METHOD_SW;
unsigned int cacheable = 1;
void *pYUVBuf[3];
int frameSize = bufWidth * bufHeight;
int width = outputInfo.img_width;
int height = outputInfo.img_height;
int imageSize = outputInfo.img_width * outputInfo.img_height;
pSrcBuf[0] = outputInfo.YVirAddr;
pSrcBuf[1] = outputInfo.CVirAddr;
pYUVBuf[0] = (unsigned char *)pOutputBuf;
pYUVBuf[1] = (unsigned char *)pOutputBuf + imageSize;
pYUVBuf[2] = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
@ -1314,16 +1289,13 @@ OMX_ERRORTYPE SEC_MFC_Wmv_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_
if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
(pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
/* if use Post copy address structure */
SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
SEC_OSAL_Memcpy(pOutputBuf, &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
pOutputData->dataLen = (outputInfo.img_width * outputInfo.img_height * 3) / 2;
} else {
SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode");
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStart(PERF_ID_CSC);
#endif
switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12Tiled:
SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
@ -1332,64 +1304,56 @@ OMX_ERRORTYPE SEC_MFC_Wmv_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_
break;
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (pWmvDec->hFIMCHandle != NULL)) {
void *pPhys[3];
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pPhys);
pYUVBuf[0] = outputInfo.YPhyAddr;
pYUVBuf[1] = outputInfo.CPhyAddr;
csc_fimc_convert_nv12t(pWmvDec->hFIMCHandle, pPhys,
pYUVBuf, width, height,
OMX_SEC_COLOR_FormatANBYUV420SemiPlanar);
break;
}
#endif
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
case OMX_COLOR_FormatYUV420Planar:
default:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (pWmvDec->hFIMCHandle != NULL)) {
void *pPhys[3];
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pPhys);
pYUVBuf[0] = outputInfo.YPhyAddr;
pYUVBuf[1] = outputInfo.CPhyAddr;
csc_fimc_convert_nv12t(pWmvDec->hFIMCHandle, pPhys,
pYUVBuf, width, height,
OMX_COLOR_FormatYUV420Planar);
break;
}
csc_get_method(pVideoDec->csc_handle, &csc_method);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
pSrcBuf[0] = outputInfo.YPhyAddr;
pSrcBuf[1] = outputInfo.CPhyAddr;
}
#endif
if (pVideoDec->csc_set_format == OMX_FALSE) {
csc_set_src_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_src_color_format, /* color_format */
cacheable); /* cacheable */
csc_set_dst_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_dst_color_format, /* color_format */
cacheable); /* cacheable */
pVideoDec->csc_set_format = OMX_TRUE;
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_deinterleave_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)pYUVBuf[2],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
}
csc_set_src_buffer(
pVideoDec->csc_handle, /* handle */
pSrcBuf[0], /* y addr */
pSrcBuf[1], /* u addr or uv addr */
pSrcBuf[2], /* v addr or none */
0); /* ion fd */
csc_set_dst_buffer(
pVideoDec->csc_handle,
pYUVBuf[0], /* y addr */
pYUVBuf[1], /* u addr or uv addr */
pYUVBuf[2], /* v addr or none */
0); /* ion fd */
csc_convert(pVideoDec->csc_handle);
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStop(PERF_ID_CSC);
#endif
}
#ifdef USE_ANB
if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
@ -1611,20 +1575,13 @@ OMX_ERRORTYPE SEC_MFC_Wmv_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX
(status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
/** Fill Output Buffer **/
void *pOutputBuf = (void *)pOutputData->dataBuffer;
void *pSrcBuf[3] = {NULL, };
void *pYUVBuf[3] = {NULL, };
unsigned int csc_src_color_format, csc_dst_color_format;
CSC_METHOD csc_method = CSC_METHOD_SW;
unsigned int cacheable = 1;
void *pYUVBuf[3];
int frameSize = bufWidth * bufHeight;
int width = outputInfo.img_width;
int height = outputInfo.img_height;
int imageSize = outputInfo.img_width * outputInfo.img_height;
pSrcBuf[0] = outputInfo.YVirAddr;
pSrcBuf[1] = outputInfo.CVirAddr;
pYUVBuf[0] = (unsigned char *)pOutputBuf;
pYUVBuf[1] = (unsigned char *)pOutputBuf + imageSize;
pYUVBuf[2] = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
@ -1640,16 +1597,13 @@ OMX_ERRORTYPE SEC_MFC_Wmv_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX
#endif
if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
(pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
SEC_OSAL_Memcpy(pOutputBuf, &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
pOutputData->dataLen = (outputInfo.img_width * outputInfo.img_height * 3) / 2;
} else {
SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode");
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStart(PERF_ID_CSC);
#endif
switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12Tiled:
SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
@ -1658,64 +1612,56 @@ OMX_ERRORTYPE SEC_MFC_Wmv_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX
break;
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (pWmvDec->hFIMCHandle != NULL)) {
void *pPhys[3];
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pPhys);
pYUVBuf[0] = outputInfo.YPhyAddr;
pYUVBuf[1] = outputInfo.CPhyAddr;
csc_fimc_convert_nv12t(pWmvDec->hFIMCHandle, pPhys,
pYUVBuf, width, height,
OMX_SEC_COLOR_FormatANBYUV420SemiPlanar);
break;
}
#endif
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
case OMX_COLOR_FormatYUV420Planar:
default:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (pWmvDec->hFIMCHandle != NULL)) {
void *pPhys[3];
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pPhys);
pYUVBuf[0] = outputInfo.YPhyAddr;
pYUVBuf[1] = outputInfo.CPhyAddr;
csc_fimc_convert_nv12t(pWmvDec->hFIMCHandle, pPhys,
pYUVBuf, width, height,
OMX_COLOR_FormatYUV420Planar);
break;
}
csc_get_method(pVideoDec->csc_handle, &csc_method);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
pSrcBuf[0] = outputInfo.YPhyAddr;
pSrcBuf[1] = outputInfo.CPhyAddr;
}
#endif
if (pVideoDec->csc_set_format == OMX_FALSE) {
csc_set_src_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_src_color_format, /* color_format */
cacheable); /* cacheable */
csc_set_dst_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_dst_color_format, /* color_format */
cacheable); /* cacheable */
pVideoDec->csc_set_format = OMX_TRUE;
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_deinterleave_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)pYUVBuf[2],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
}
csc_set_src_buffer(
pVideoDec->csc_handle, /* handle */
pSrcBuf[0], /* y addr */
pSrcBuf[1], /* u addr or uv addr */
pSrcBuf[2], /* v addr or none */
0); /* ion fd */
csc_set_dst_buffer(
pVideoDec->csc_handle,
pYUVBuf[0], /* y addr */
pYUVBuf[1], /* u addr or uv addr */
pYUVBuf[2], /* v addr or none */
0); /* ion fd */
csc_convert(pVideoDec->csc_handle);
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStop(PERF_ID_CSC);
#endif
}
#ifdef USE_ANB

View file

@ -78,6 +78,11 @@ typedef struct _SEC_WMV_HANDLE
/* SEC MFC Codec specific */
SEC_MFC_WMV_HANDLE hMFCWmvHandle;
/* CSC FIMC handle */
#ifdef USE_CSC_FIMC
OMX_PTR hFIMCHandle;
#endif
} SEC_WMV_HANDLE;
#ifdef __cplusplus

View file

@ -0,0 +1,47 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
SEC_OMX_Vp8dec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.SEC.VP8.Decoder
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/omx
LOCAL_CFLAGS :=
ifeq ($(BOARD_NONBLOCK_MODE_PROCESS), true)
LOCAL_CFLAGS += -DNONBLOCK_MODE_PROCESS
endif
ifeq ($(BOARD_USE_ANB), true)
LOCAL_CFLAGS += -DUSE_ANB
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec libsecosal libsecbasecomponent \
libseccscapi libsecmfcapi
LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
libSEC_OMX_Resourcemanager
ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),)
LOCAL_SHARED_LIBRARIES += libhwconverter
endif
#ifeq ($(BOARD_USE_V4L2_ION),true)
#LOCAL_SHARED_LIBRARIES += libion
#endif
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \
$(SEC_OMX_TOP)/osal \
$(SEC_OMX_TOP)/core \
$(SEC_OMX_COMPONENT)/common \
$(SEC_OMX_COMPONENT)/video/dec \
$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO)
include $(BUILD_SHARED_LIBRARY)

View file

@ -38,15 +38,12 @@
#include "library_register.h"
#include "SEC_OMX_Vp8dec.h"
#include "SsbSipMfcApi.h"
#include "color_space_convertor.h"
#ifdef USE_ANB
#include "SEC_OSAL_Android.h"
#endif
/* To use CSC_METHOD_PREFER_HW or CSC_METHOD_HW in SEC OMX, gralloc should allocate physical memory using FIMC */
/* It means GRALLOC_USAGE_HW_FIMC1 should be set on Native Window usage */
#include "csc.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_VP8_DEC"
#define SEC_LOG_OFF
@ -549,13 +546,7 @@ OMX_ERRORTYPE SEC_MFC_DecodeThread(OMX_HANDLETYPE hComponent)
SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameStart);
if (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStart(PERF_ID_DEC);
#endif
pVp8Dec->hMFCVp8Handle.returnCodec = SsbSipMfcDecExe(pVp8Dec->hMFCVp8Handle.hMFCHandle, pVideoDec->NBDecThread.oneFrameSize);
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStop(PERF_ID_DEC);
#endif
SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameEnd);
}
}
@ -578,12 +569,6 @@ OMX_ERRORTYPE SEC_MFC_VP8Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
OMX_PTR hMFCHandle = NULL;
OMX_PTR pStreamBuffer = NULL;
OMX_PTR pStreamPhyBuffer = NULL;
CSC_METHOD csc_method = CSC_METHOD_SW;
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfInit(PERF_ID_DEC);
SEC_OSAL_PerfInit(PERF_ID_CSC);
#endif
pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
pVp8Dec->hMFCVp8Handle.bConfiguredMFC = OMX_FALSE;
@ -656,16 +641,6 @@ OMX_ERRORTYPE SEC_MFC_VP8Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
pSECComponent->getAllDelayBuffer = OMX_FALSE;
#ifdef USE_ANB
#if defined(USE_CSC_FIMC) || defined(USE_CSC_GSCALER)
if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
csc_method = CSC_METHOD_PREFER_HW;
}
#endif
#endif
pVideoDec->csc_handle = csc_init(&csc_method);
pVideoDec->csc_set_format = OMX_FALSE;
EXIT:
FunctionOut();
@ -683,11 +658,6 @@ OMX_ERRORTYPE SEC_MFC_VP8Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
FunctionIn();
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfPrint("[DEC]", PERF_ID_DEC);
SEC_OSAL_PerfPrint("[CSC]", PERF_ID_CSC);
#endif
pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
hMFCHandle = pVp8Dec->hMFCVp8Handle.hMFCHandle;
@ -720,11 +690,6 @@ OMX_ERRORTYPE SEC_MFC_VP8Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
hMFCHandle = pVp8Dec->hMFCVp8Handle.hMFCHandle = NULL;
}
if (pVideoDec->csc_handle != NULL) {
csc_deinit(pVideoDec->csc_handle);
pVideoDec->csc_handle = NULL;
}
EXIT:
FunctionOut();
@ -994,20 +959,13 @@ OMX_ERRORTYPE SEC_MFC_VP8_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_
/** Fill Output Buffer **/
if (outputDataValid == OMX_TRUE) {
void *pOutputBuf = (void *)pOutputData->dataBuffer;
void *pSrcBuf[3] = {NULL, };
void *pYUVBuf[3] = {NULL, };
unsigned int csc_src_color_format, csc_dst_color_format;
CSC_METHOD csc_method = CSC_METHOD_SW;
unsigned int cacheable = 1;
void *pYUVBuf[3];
int frameSize = bufWidth * bufHeight;
int width = outputInfo.img_width;
int height = outputInfo.img_height;
int imageSize = outputInfo.img_width * outputInfo.img_height;
pSrcBuf[0] = outputInfo.YVirAddr;
pSrcBuf[1] = outputInfo.CVirAddr;
pYUVBuf[0] = (unsigned char *)pOutputBuf;
pYUVBuf[1] = (unsigned char *)pOutputBuf + imageSize;
pYUVBuf[2] = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
@ -1024,16 +982,13 @@ OMX_ERRORTYPE SEC_MFC_VP8_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_
if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
(pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
/* if use Post copy address structure */
SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
SEC_OSAL_Memcpy(pOutputBuf, &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
pOutputData->dataLen = (width * height * 3) / 2;
} else {
SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 SP/P Output mode");
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStart(PERF_ID_CSC);
#endif
switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12Tiled:
SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
@ -1042,64 +997,33 @@ OMX_ERRORTYPE SEC_MFC_VP8_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_
break;
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
break;
case OMX_COLOR_FormatYUV420Planar:
default:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_deinterleave_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)pYUVBuf[2],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
}
csc_get_method(pVideoDec->csc_handle, &csc_method);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
pSrcBuf[0] = outputInfo.YPhyAddr;
pSrcBuf[1] = outputInfo.CPhyAddr;
}
#endif
if (pVideoDec->csc_set_format == OMX_FALSE) {
csc_set_src_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_src_color_format, /* color_format */
cacheable); /* cacheable */
csc_set_dst_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_dst_color_format, /* color_format */
cacheable); /* cacheable */
pVideoDec->csc_set_format = OMX_TRUE;
}
csc_set_src_buffer(
pVideoDec->csc_handle, /* handle */
pSrcBuf[0], /* y addr */
pSrcBuf[1], /* u addr or uv addr */
pSrcBuf[2], /* v addr or none */
0); /* ion fd */
csc_set_dst_buffer(
pVideoDec->csc_handle,
pYUVBuf[0], /* y addr */
pYUVBuf[1], /* u addr or uv addr */
pYUVBuf[2], /* v addr or none */
0); /* ion fd */
csc_convert(pVideoDec->csc_handle);
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStop(PERF_ID_CSC);
#endif
}
#ifdef USE_ANB
if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
@ -1263,20 +1187,13 @@ OMX_ERRORTYPE SEC_MFC_VP8_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX
(status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
/** Fill Output Buffer **/
void *pOutputBuf = (void *)pOutputData->dataBuffer;
void *pSrcBuf[3] = {NULL, };
void *pYUVBuf[3] = {NULL, };
unsigned int csc_src_color_format, csc_dst_color_format;
CSC_METHOD csc_method = CSC_METHOD_SW;
unsigned int cacheable = 1;
void *pYUVBuf[3];
int frameSize = bufWidth * bufHeight;
int width = outputInfo.img_width;
int height = outputInfo.img_height;
int imageSize = outputInfo.img_width * outputInfo.img_height;
pSrcBuf[0] = outputInfo.YVirAddr;
pSrcBuf[1] = outputInfo.CVirAddr;
pYUVBuf[0] = (unsigned char *)pOutputBuf;
pYUVBuf[1] = (unsigned char *)pOutputBuf + imageSize;
pYUVBuf[2] = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
@ -1293,16 +1210,13 @@ OMX_ERRORTYPE SEC_MFC_VP8_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX
if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
(pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
/* if use Post copy address structure */
SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
SEC_OSAL_Memcpy(pOutputBuf, &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
pOutputData->dataLen = (width * height * 3) / 2;
} else {
SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 SP/P Output mode");
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStart(PERF_ID_CSC);
#endif
switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12Tiled:
SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
@ -1311,64 +1225,32 @@ OMX_ERRORTYPE SEC_MFC_VP8_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX
break;
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
case OMX_COLOR_FormatYUV420Planar:
default:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
csc_tiled_to_linear_y_neon(
(unsigned char *)pYUVBuf[0],
(unsigned char *)outputInfo.YVirAddr,
width,
height);
csc_tiled_to_linear_uv_deinterleave_neon(
(unsigned char *)pYUVBuf[1],
(unsigned char *)pYUVBuf[2],
(unsigned char *)outputInfo.CVirAddr,
width,
height / 2);
break;
}
csc_get_method(pVideoDec->csc_handle, &csc_method);
#ifdef USE_CSC_FIMC
if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
pSrcBuf[0] = outputInfo.YPhyAddr;
pSrcBuf[1] = outputInfo.CPhyAddr;
}
#endif
if (pVideoDec->csc_set_format == OMX_FALSE) {
csc_set_src_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_src_color_format, /* color_format */
cacheable); /* cacheable */
csc_set_dst_format(
pVideoDec->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_dst_color_format, /* color_format */
cacheable); /* cacheable */
pVideoDec->csc_set_format = OMX_TRUE;
}
csc_set_src_buffer(
pVideoDec->csc_handle, /* handle */
pSrcBuf[0], /* y addr */
pSrcBuf[1], /* u addr or uv addr */
pSrcBuf[2], /* v addr or none */
0); /* ion fd */
csc_set_dst_buffer(
pVideoDec->csc_handle,
pYUVBuf[0], /* y addr */
pYUVBuf[1], /* u addr or uv addr */
pYUVBuf[2], /* v addr or none */
0); /* ion fd */
csc_convert(pVideoDec->csc_handle);
#ifdef CONFIG_MFC_FPS
SEC_OSAL_PerfStop(PERF_ID_CSC);
#endif
}
#ifdef USE_ANB

View file

@ -24,14 +24,4 @@ ifeq ($(BOARD_USE_STOREMETADATA), true)
LOCAL_CFLAGS += -DUSE_STOREMETADATA
endif
ifeq ($(BOARD_USE_V4L2), true)
ifeq ($(TARGET_SOC), exynos5250)
LOCAL_CFLAGS += -DUSE_SLICE_OUTPUT_MODE
endif
else
LOCAL_CFLAGS += -DUSE_SLICE_OUTPUT_MODE
endif
LOCAL_SHARED_LIBRARIES := libcsc
include $(BUILD_STATIC_LIBRARY)

View file

@ -36,7 +36,7 @@
#include "SEC_OSAL_Mutex.h"
#include "SEC_OSAL_Semaphore.h"
#include "SEC_OSAL_ETC.h"
#include "csc.h"
#include "color_space_convertor.h"
#ifdef USE_STOREMETADATA
#include "SEC_OSAL_Android.h"
@ -708,9 +708,6 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
case OMX_COLOR_FormatYUV420Planar:
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12Tiled:
case OMX_SEC_COLOR_FormatNV21Linear:
oneFrameSize = (width * height * 3) / 2;
break;
case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
@ -758,22 +755,13 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
if ((pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV12TPhysicalAddress) &&
(pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV12LPhysicalAddress) &&
(pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV12LVirtualAddress) &&
(pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV21LPhysicalAddress)) {
(pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV12LVirtualAddress)) {
if (flagEOF == OMX_TRUE) {
OMX_U32 width, height;
unsigned int csc_src_color_format, csc_dst_color_format;
unsigned int cacheable = 1;
unsigned char *pSrcBuf[3] = {NULL, };
unsigned char *pDstBuf[3] = {NULL, };
OMX_PTR ppBuf[3];
width = pSECPort->portDefinition.format.video.nFrameWidth;
height = pSECPort->portDefinition.format.video.nFrameHeight;
pDstBuf[0] = (unsigned char *)pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr;
pDstBuf[1] = (unsigned char *)pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr;
SEC_OSAL_Log(SEC_LOG_TRACE, "pVideoEnc->MFCEncInputBuffer[%d].YVirAddr : 0x%x", pVideoEnc->indexInputBuffer, pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr);
SEC_OSAL_Log(SEC_LOG_TRACE, "pVideoEnc->MFCEncInputBuffer[%d].CVirAddr : 0x%x", pVideoEnc->indexInputBuffer, pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr);
@ -781,21 +769,28 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
SEC_OSAL_Log(SEC_LOG_TRACE, "width:%d, height:%d, Csize:%d", width, height, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height / 2)));
if (pSECPort->bStoreMetaData == OMX_FALSE) {
pSrcBuf[0] = checkInputStream;
pSrcBuf[1] = checkInputStream + (width * height);
pSrcBuf[2] = checkInputStream + (((width * height) * 5) / 4);
switch (pSECPort->portDefinition.format.video.eColorFormat) {
case OMX_COLOR_FormatYUV420Planar:
/* YUV420Planar case it needed changed interleave UV plane (MFC spec.)*/
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
SEC_OSAL_Memcpy(pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr,
checkInputStream, (width * height));
csc_interleave_memcpy_neon(pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr,
checkInputStream + (width * height),
checkInputStream + (((width * height) * 5) / 4),
width * height >> 2);
break;
case OMX_COLOR_FormatYUV420SemiPlanar:
SEC_OSAL_Memcpy(pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr,
checkInputStream, (width * height));
SEC_OSAL_Memcpy(pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr,
checkInputStream + (width * height), (width * height / 2));
break;
case OMX_SEC_COLOR_FormatNV12Tiled:
case OMX_SEC_COLOR_FormatNV21Linear:
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
SEC_OSAL_Memcpy(pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr,
checkInputStream, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)));
SEC_OSAL_Memcpy(pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr,
checkInputStream + ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)),
ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height / 2)));
break;
default:
break;
@ -804,57 +799,19 @@ OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
#ifdef USE_METADATABUFFERTYPE
else {
if (pSECPort->portDefinition.format.video.eColorFormat == OMX_COLOR_FormatAndroidOpaque) {
OMX_PTR ppBuf[3];
OMX_PTR pOutBuffer;
csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_Format32bitARGB8888);
csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
SEC_OSAL_GetInfoFromMetaData(inputData, ppBuf);
SEC_OSAL_LockANBHandle((OMX_U32)ppBuf[0], width, height, OMX_COLOR_FormatAndroidOpaque, &pOutBuffer);
pSrcBuf[0] = (unsigned char *)pOutBuffer;
pSrcBuf[1] = NULL;
pSrcBuf[2] = NULL;
}
}
#endif
csc_set_src_format(
pVideoEnc->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_src_color_format, /* color_format */
cacheable); /* cacheable */
csc_set_dst_format(
pVideoEnc->csc_handle, /* handle */
width, /* width */
height, /* height */
0, /* crop_left */
0, /* crop_right */
width, /* crop_width */
height, /* crop_height */
csc_dst_color_format, /* color_format */
cacheable); /* cacheable */
csc_set_src_buffer(
pVideoEnc->csc_handle, /* handle */
pSrcBuf[0], /* y addr */
pSrcBuf[1], /* u addr or uv addr */
pSrcBuf[2], /* v addr or none */
0); /* ion fd */
csc_set_dst_buffer(
pVideoEnc->csc_handle, /* handle */
pDstBuf[0], /* y addr */
pDstBuf[1], /* u addr or uv addr */
pDstBuf[2], /* v addr or none */
0); /* ion fd */
csc_convert(pVideoEnc->csc_handle);
csc_ARGB8888_to_YUV420SP(pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr,
pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr,
pOutBuffer, width, height);
#ifdef USE_METADATABUFFERTYPE
if (pSECPort->bStoreMetaData == OMX_TRUE) {
SEC_OSAL_UnlockANBHandle((OMX_U32)ppBuf[0]);
}
}
#endif
}
}
@ -1189,20 +1146,9 @@ OMX_ERRORTYPE SEC_OMX_VideoEncodeGetParameter(
portFormat->xFramerate = portDefinition->format.video.xFramerate;
break;
case supportFormat_6:
portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
portFormat->eColorFormat = OMX_SEC_COLOR_FormatNV21LPhysicalAddress;
portFormat->xFramerate = portDefinition->format.video.xFramerate;
break;
case supportFormat_7:
portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
portFormat->eColorFormat = OMX_SEC_COLOR_FormatNV21Linear;
portFormat->xFramerate = portDefinition->format.video.xFramerate;
break;
case supportFormat_8:
portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
portFormat->eColorFormat = OMX_COLOR_FormatAndroidOpaque;
portFormat->xFramerate = portDefinition->format.video.xFramerate;
break;
}
} else if (portIndex == OUTPUT_PORT_INDEX) {
supportFormatNum = OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1;

View file

@ -47,7 +47,7 @@
#define MFC_INPUT_BUFFER_NUM_MAX 2
#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 9
#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 7
#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 1
#ifdef USE_STOREMETADATA
@ -95,9 +95,6 @@ typedef struct _SEC_OMX_VIDEOENC_COMPONENT
OMX_BOOL bFirstFrame;
MFC_ENC_INPUT_BUFFER MFCEncInputBuffer[MFC_INPUT_BUFFER_NUM_MAX];
OMX_U32 indexInputBuffer;
/* CSC handle */
OMX_PTR csc_handle;
} SEC_OMX_VIDEOENC_COMPONENT;
#ifdef __cplusplus

View file

@ -24,9 +24,9 @@ endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libSEC_OMX_Venc libsecosal libsecbasecomponent \
libswconverter libsecmfcapi
libseccscapi libsecmfcapi
LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
libSEC_OMX_Resourcemanager libcsc
libSEC_OMX_Resourcemanager
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \

View file

@ -39,7 +39,7 @@
#include "library_register.h"
#include "SEC_OMX_H264enc.h"
#include "SsbSipMfcApi.h"
#include "csc.h"
#include "color_space_convertor.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_H264_ENC"
@ -161,9 +161,6 @@ void H264PrintParams(SSBSIP_MFC_ENC_H264_PARAM *h264Arg)
SEC_OSAL_Log(SEC_LOG_TRACE, "NumberRefForPframes : %d\n", h264Arg->NumberRefForPframes);
SEC_OSAL_Log(SEC_LOG_TRACE, "SliceMode : %d\n", h264Arg->SliceMode);
SEC_OSAL_Log(SEC_LOG_TRACE, "SliceArgument : %d\n", h264Arg->SliceArgument);
#ifdef USE_SLICE_OUTPUT_MODE
SEC_OSAL_Log(SEC_LOG_TRACE, "OutputMode : %d\n", h264Arg->OutputMode);
#endif
SEC_OSAL_Log(SEC_LOG_TRACE, "NumberBFrames : %d\n", h264Arg->NumberBFrames);
SEC_OSAL_Log(SEC_LOG_TRACE, "LoopFilterDisable : %d\n", h264Arg->LoopFilterDisable);
SEC_OSAL_Log(SEC_LOG_TRACE, "LoopFilterAlphaC0Offset : %d\n", h264Arg->LoopFilterAlphaC0Offset);
@ -208,9 +205,6 @@ void Set_H264Enc_Param(SSBSIP_MFC_ENC_H264_PARAM *pH264Arg, SEC_OMX_BASECOMPONEN
pH264Arg->SourceHeight = pSECOutputPort->portDefinition.format.video.nFrameHeight;
pH264Arg->IDRPeriod = pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].nPFrames + 1;
pH264Arg->SliceMode = 0;
#ifdef USE_SLICE_OUTPUT_MODE
pH264Arg->OutputMode = FRAME;
#endif
pH264Arg->RandomIntraMBRefresh = 0;
pH264Arg->Bitrate = pSECOutputPort->portDefinition.format.video.nBitrate;
pH264Arg->QSCodeMax = 51;
@ -230,9 +224,9 @@ void Set_H264Enc_Param(SSBSIP_MFC_ENC_H264_PARAM *pH264Arg, SEC_OMX_BASECOMPONEN
pH264Arg->LoopFilterDisable = 1; // 1: Loop Filter Disable, 0: Filter Enable
pH264Arg->LoopFilterAlphaC0Offset = 0;
pH264Arg->LoopFilterBetaOffset = 0;
pH264Arg->SymbolMode = 1; // 0: CAVLC, 1: CABAC
pH264Arg->SymbolMode = 0; // 0: CAVLC, 1: CABAC
pH264Arg->PictureInterlace = 0;
pH264Arg->Transform8x8Mode = 1; // 0: 4x4, 1: allow 8x8
pH264Arg->Transform8x8Mode = 0; // 0: 4x4, 1: allow 8x8
pH264Arg->DarkDisable = 1;
pH264Arg->SmoothDisable = 1;
pH264Arg->StaticDisable = 1;
@ -277,12 +271,6 @@ void Set_H264Enc_Param(SSBSIP_MFC_ENC_H264_PARAM *pH264Arg, SEC_OMX_BASECOMPONEN
break;
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12Tiled:
pH264Arg->FrameMap = NV12_TILE;
break;
case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV21Linear:
pH264Arg->FrameMap = NV21_LINEAR;
break;
default:
pH264Arg->FrameMap = NV12_TILE;
break;
@ -873,7 +861,6 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
SEC_H264ENC_HANDLE *pH264Enc = NULL;
OMX_PTR hMFCHandle = NULL;
OMX_S32 returnCodec = 0;
CSC_METHOD csc_method = CSC_METHOD_SW;
FunctionIn();
@ -887,7 +874,6 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
hMFCHandle = (OMX_PTR)SsbSipMfcEncOpen();
break;
default: {
@ -963,8 +949,6 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pH264Enc->hMFCH264Handle.indexTimestamp = 0;
pVideoEnc->csc_handle = csc_init(&csc_method);
EXIT:
FunctionOut();
@ -1008,11 +992,6 @@ OMX_ERRORTYPE SEC_MFC_H264Enc_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
hMFCHandle = pH264Enc->hMFCH264Handle.hMFCHandle = NULL;
}
if (pVideoEnc->csc_handle != NULL) {
csc_deinit(pVideoEnc->csc_handle);
pVideoEnc->csc_handle = NULL;
}
EXIT:
FunctionOut();
@ -1091,8 +1070,7 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC
} else {
switch (pSECPort->portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV21LPhysicalAddress: {
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress: {
#ifndef USE_METADATABUFFERTYPE
/* USE_FIMC_FRAME_BUFFER */
SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY));
@ -1287,8 +1265,7 @@ OMX_ERRORTYPE SEC_MFC_H264_Encode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OM
pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
switch (pSECPort->portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV21LPhysicalAddress: {
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress: {
#ifndef USE_METADATABUFFERTYPE
/* USE_FIMC_FRAME_BUFFER */
SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY));
@ -1537,8 +1514,8 @@ OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, O
for(i = 0; i < ALL_PORT_NUM; i++) {
INIT_SET_SIZE_VERSION(&pH264Enc->AVCComponent[i], OMX_VIDEO_PARAM_AVCTYPE);
pH264Enc->AVCComponent[i].nPortIndex = i;
pH264Enc->AVCComponent[i].eProfile = OMX_VIDEO_AVCProfileHigh;
pH264Enc->AVCComponent[i].eLevel = OMX_VIDEO_AVCLevel4;
pH264Enc->AVCComponent[i].eProfile = OMX_VIDEO_AVCProfileBaseline;
pH264Enc->AVCComponent[i].eLevel = OMX_VIDEO_AVCLevel31;
pH264Enc->AVCComponent[i].nPFrames = 20;
}

View file

@ -24,9 +24,9 @@ endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libSEC_OMX_Venc libsecosal libsecbasecomponent \
libswconverter libsecmfcapi
libseccscapi libsecmfcapi
LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
libSEC_OMX_Resourcemanager libcsc
libSEC_OMX_Resourcemanager
LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
$(SEC_OMX_INC)/sec \

View file

@ -40,7 +40,7 @@
#include "library_register.h"
#include "SEC_OMX_Mpeg4enc.h"
#include "SsbSipMfcApi.h"
#include "csc.h"
#include "color_space_convertor.h"
#undef SEC_LOG_TAG
#define SEC_LOG_TAG "SEC_MPEG4_ENC"
@ -135,9 +135,6 @@ void Mpeg4PrintParams(SSBSIP_MFC_ENC_MPEG4_PARAM *pMpeg4Param)
SEC_OSAL_Log(SEC_LOG_TRACE, "SourceHeight : %d\n", pMpeg4Param->SourceHeight);
SEC_OSAL_Log(SEC_LOG_TRACE, "IDRPeriod : %d\n", pMpeg4Param->IDRPeriod);
SEC_OSAL_Log(SEC_LOG_TRACE, "SliceMode : %d\n", pMpeg4Param->SliceMode);
#ifdef USE_SLICE_OUTPUT_MODE
SEC_OSAL_Log(SEC_LOG_TRACE, "OutputMode : %d\n", pMpeg4Param->OutputMode);
#endif
SEC_OSAL_Log(SEC_LOG_TRACE, "RandomIntraMBRefresh : %d\n", pMpeg4Param->RandomIntraMBRefresh);
SEC_OSAL_Log(SEC_LOG_TRACE, "EnableFRMRateControl : %d\n", pMpeg4Param->EnableFRMRateControl);
SEC_OSAL_Log(SEC_LOG_TRACE, "Bitrate : %d\n", pMpeg4Param->Bitrate);
@ -204,9 +201,6 @@ void Set_Mpeg4Enc_Param(SSBSIP_MFC_ENC_MPEG4_PARAM *pMpeg4Param, SEC_OMX_BASECOM
pMpeg4Param->SourceHeight = pSECOutputPort->portDefinition.format.video.nFrameHeight;
pMpeg4Param->IDRPeriod = pMpeg4Enc->mpeg4Component[OUTPUT_PORT_INDEX].nPFrames + 1;
pMpeg4Param->SliceMode = 0;
#ifdef USE_SLICE_OUTPUT_MODE
pMpeg4Param->OutputMode = FRAME;
#endif
pMpeg4Param->RandomIntraMBRefresh = 0;
pMpeg4Param->Bitrate = pSECOutputPort->portDefinition.format.video.nBitrate;
pMpeg4Param->QSCodeMax = 30;
@ -260,12 +254,6 @@ void Set_Mpeg4Enc_Param(SSBSIP_MFC_ENC_MPEG4_PARAM *pMpeg4Param, SEC_OMX_BASECOM
break;
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12Tiled:
pMpeg4Param->FrameMap = NV12_TILE;
break;
case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV21Linear:
pMpeg4Param->FrameMap = NV21_LINEAR;
break;
default:
pMpeg4Param->FrameMap = NV12_TILE;
break;
@ -376,12 +364,6 @@ void Set_H263Enc_Param(SSBSIP_MFC_ENC_H263_PARAM *pH263Param, SEC_OMX_BASECOMPON
break;
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12Tiled:
pH263Param->FrameMap = NV12_TILE;
break;
case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV21Linear:
pH263Param->FrameMap = NV21_LINEAR;
break;
default:
pH263Param->FrameMap = NV12_TILE;
break;
@ -1048,7 +1030,6 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
SEC_MPEG4ENC_HANDLE *pMpeg4Enc = NULL;
OMX_HANDLETYPE hMFCHandle = NULL;
OMX_S32 returnCodec = 0;
CSC_METHOD csc_method = CSC_METHOD_SW;
FunctionIn();
@ -1062,7 +1043,6 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
hMFCHandle = (OMX_PTR)SsbSipMfcEncOpen();
break;
default: {
@ -1143,8 +1123,6 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp = 0;
pVideoEnc->csc_handle = csc_init(&csc_method);
EXIT:
FunctionOut();
@ -1188,11 +1166,6 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
hMFCHandle = pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle = NULL;
}
if (pVideoEnc->csc_handle != NULL) {
csc_deinit(pVideoEnc->csc_handle);
pVideoEnc->csc_handle = NULL;
}
EXIT:
FunctionOut();
@ -1259,8 +1232,7 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SE
} else {
switch (pSECPort->portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV21LPhysicalAddress: {
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress: {
#ifndef USE_METADATABUFFERTYPE
/* USE_FIMC_FRAME_BUFFER */
SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY));
@ -1445,8 +1417,7 @@ OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_O
pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
switch (pSECPort->portDefinition.format.video.eColorFormat) {
case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
case OMX_SEC_COLOR_FormatNV21LPhysicalAddress: {
case OMX_SEC_COLOR_FormatNV12LPhysicalAddress: {
#ifndef USE_METADATABUFFERTYPE
/* USE_FIMC_FRAME_BUFFER */
SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY));

Some files were not shown because too many files have changed in this diff Show more