mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 01:02:39 +08:00
[mpp]: add need_split flag to MppDec. When set this flag parser will do frame split internally. Default is disabled
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@922 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -77,8 +77,8 @@ typedef enum {
|
||||
MPP_DEC_SET_EXT_BUF_GROUP, /* IMPORTANT: set external buffer group to mpp decoder */
|
||||
MPP_DEC_USE_PRESENT_TIME_ORDER,
|
||||
MPP_DEC_SET_VC1_EXTRA_DATA,
|
||||
MPP_DEC_SET_VP6_ID,
|
||||
MPP_DEC_USE_FAST_MODE,
|
||||
MPP_DEC_SET_PARSER_SPLIT_MODE, /* Need to setup before init */
|
||||
MPP_DEC_SET_PARSER_FAST_MODE, /* Need to setup before init */
|
||||
MPP_DEC_GET_STREAM_COUNT,
|
||||
|
||||
MPP_ENC_CMD_BASE = 0x50000,
|
||||
|
@@ -33,14 +33,23 @@ struct MppDec_t {
|
||||
MppBufSlots packet_slots;
|
||||
HalTaskGroup tasks;
|
||||
|
||||
// status flag
|
||||
RK_U32 reset_flag;
|
||||
|
||||
// work mode flag
|
||||
RK_U32 parser_need_split;
|
||||
RK_U32 parser_fast_mode;
|
||||
|
||||
// dec parser thread runtime resource context
|
||||
MppPacket mpp_pkt_in;
|
||||
RK_U32 fast_mode;
|
||||
void *mpp;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
MppCodingType coding;
|
||||
RK_U32 fast_mode;
|
||||
RK_U32 need_split;
|
||||
} MppDecCfg;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -55,7 +64,7 @@ void *mpp_dec_hal_thread(void *data);
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MPP_RET mpp_dec_init(MppDec *dec, MppCodingType coding);
|
||||
MPP_RET mpp_dec_init(MppDec *dec, MppDecCfg *cfg);
|
||||
MPP_RET mpp_dec_deinit(MppDec *dec);
|
||||
|
||||
MPP_RET mpp_dec_reset(MppDec *dec);
|
||||
|
@@ -35,8 +35,8 @@ typedef struct DecParserInitCfg_t {
|
||||
MppBufSlots packet_slots;
|
||||
|
||||
// output
|
||||
RK_S32 task_count;
|
||||
RK_S32 need_split;
|
||||
RK_U32 task_count;
|
||||
RK_U32 need_split;
|
||||
IOInterruptCB notify_cb;
|
||||
} ParserCfg;
|
||||
|
||||
|
@@ -150,7 +150,7 @@ static RK_U32 reset_dec_task(Mpp *mpp, DecTask *task)
|
||||
MppBufSlots packet_slots = dec->packet_slots;
|
||||
HalDecTask *task_dec = &task->info.dec;
|
||||
|
||||
if (!dec->fast_mode) {
|
||||
if (!dec->parser_fast_mode) {
|
||||
if (!task->status.prev_task_rdy) {
|
||||
HalTaskHnd task_prev = NULL;
|
||||
hal_task_get_hnd(tasks, TASK_PROC_DONE, &task_prev);
|
||||
@@ -386,7 +386,7 @@ static MPP_RET try_proc_dec_task(Mpp *mpp, DecTask *task)
|
||||
task->status.dec_pkt_copy_rdy = 1;
|
||||
}
|
||||
|
||||
if (!dec->fast_mode) {
|
||||
if (!dec->parser_fast_mode) {
|
||||
// wait previous task done
|
||||
if (!task->status.prev_task_rdy) {
|
||||
HalTaskHnd task_prev = NULL;
|
||||
@@ -680,8 +680,7 @@ void *mpp_dec_hal_thread(void *data)
|
||||
// TODO: may have risk here
|
||||
hal_task_hnd_set_status(task, TASK_PROC_DONE);
|
||||
task = NULL;
|
||||
if (dec->fast_mode) {
|
||||
|
||||
if (dec->parser_fast_mode) {
|
||||
hal_task_get_hnd(tasks, TASK_PROC_DONE, &task);
|
||||
if (task) {
|
||||
hal_task_hnd_set_status(task, TASK_IDLE);
|
||||
@@ -706,24 +705,25 @@ void *mpp_dec_hal_thread(void *data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MPP_RET mpp_dec_init(MppDec *dec, MppCodingType coding)
|
||||
MPP_RET mpp_dec_init(MppDec *dec, MppDecCfg *cfg)
|
||||
{
|
||||
MPP_RET ret;
|
||||
MppCodingType coding;
|
||||
MppBufSlots frame_slots = NULL;
|
||||
MppBufSlots packet_slots = NULL;
|
||||
Parser parser = NULL;
|
||||
MppHal hal = NULL;
|
||||
MppDec *p = dec;
|
||||
RK_S32 task_count = 2;
|
||||
RK_S32 hal_task_count = 0;
|
||||
IOInterruptCB cb = {NULL, NULL};
|
||||
if (dec->fast_mode) {
|
||||
task_count = 3;
|
||||
}
|
||||
if (NULL == p) {
|
||||
mpp_err_f("failed to malloc context\n");
|
||||
|
||||
if (NULL == dec || NULL == cfg) {
|
||||
mpp_err_f("invalid input dec %p cfg %p\n", dec, cfg);
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
coding = cfg->coding;
|
||||
hal_task_count = (cfg->fast_mode) ? (3) : (2);
|
||||
|
||||
do {
|
||||
ret = mpp_buf_slot_init(&frame_slots);
|
||||
if (ret) {
|
||||
@@ -737,15 +737,15 @@ MPP_RET mpp_dec_init(MppDec *dec, MppCodingType coding)
|
||||
break;
|
||||
}
|
||||
|
||||
mpp_buf_slot_setup(packet_slots, task_count);
|
||||
mpp_buf_slot_setup(packet_slots, hal_task_count);
|
||||
cb.callBack = mpp_dec_notify;
|
||||
cb.opaque = dec;
|
||||
ParserCfg parser_cfg = {
|
||||
coding,
|
||||
frame_slots,
|
||||
packet_slots,
|
||||
task_count,
|
||||
0,
|
||||
hal_task_count,
|
||||
cfg->need_split,
|
||||
cb,
|
||||
};
|
||||
|
||||
@@ -766,7 +766,7 @@ MPP_RET mpp_dec_init(MppDec *dec, MppCodingType coding)
|
||||
packet_slots,
|
||||
NULL,
|
||||
parser_cfg.task_count,
|
||||
dec->fast_mode,
|
||||
cfg->fast_mode,
|
||||
cb,
|
||||
};
|
||||
|
||||
@@ -776,16 +776,19 @@ MPP_RET mpp_dec_init(MppDec *dec, MppCodingType coding)
|
||||
break;
|
||||
}
|
||||
|
||||
p->coding = coding;
|
||||
p->parser = parser;
|
||||
p->hal = hal;
|
||||
p->tasks = hal_cfg.tasks;
|
||||
p->frame_slots = frame_slots;
|
||||
p->packet_slots = packet_slots;
|
||||
dec->coding = coding;
|
||||
dec->parser = parser;
|
||||
dec->hal = hal;
|
||||
dec->tasks = hal_cfg.tasks;
|
||||
dec->frame_slots = frame_slots;
|
||||
dec->packet_slots = packet_slots;
|
||||
|
||||
dec->parser_need_split = cfg->need_split;
|
||||
dec->parser_fast_mode = cfg->fast_mode;
|
||||
return MPP_OK;
|
||||
} while (0);
|
||||
|
||||
mpp_dec_deinit(p);
|
||||
mpp_dec_deinit(dec);
|
||||
return MPP_NOK;
|
||||
}
|
||||
|
||||
|
@@ -266,7 +266,7 @@ rk_list::~rk_list()
|
||||
#define COUNT_ADD 100
|
||||
#define COUNT_DEL 99
|
||||
|
||||
volatile int err = 0;
|
||||
static volatile int err = 0;
|
||||
|
||||
static int rk_list_fifo_test(rk_list *list_0)
|
||||
{
|
||||
|
@@ -368,7 +368,7 @@ RK_S32 VpuApi::control(VpuCodecContext *ctx, VPU_API_CMD cmd, void *param)
|
||||
break;
|
||||
}
|
||||
case VPU_API_USE_FAST_MODE: {
|
||||
mpicmd = MPP_DEC_USE_FAST_MODE;
|
||||
mpicmd = MPP_DEC_SET_PARSER_FAST_MODE;
|
||||
break;
|
||||
}
|
||||
case VPU_API_DEC_GET_STREAM_COUNT: {
|
||||
|
22
mpp/mpp.cpp
22
mpp/mpp.cpp
@@ -56,7 +56,8 @@ Mpp::Mpp()
|
||||
mOutputBlock(0),
|
||||
mMultiFrame(0),
|
||||
mStatus(0),
|
||||
mFastMode(0)
|
||||
mParserFastMode(0),
|
||||
mParserNeedSplit(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -77,11 +78,13 @@ MPP_RET Mpp::init(MppCtxType type, MppCodingType coding)
|
||||
mFrames = new mpp_list((node_destructor)mpp_frame_deinit);
|
||||
mTasks = new mpp_list((node_destructor)NULL);
|
||||
|
||||
if (MPP_VIDEO_CodingHEVC == coding) {
|
||||
mDec->fast_mode = mFastMode;
|
||||
}
|
||||
MppDecCfg cfg = {
|
||||
coding,
|
||||
mParserFastMode,
|
||||
mParserNeedSplit,
|
||||
};
|
||||
mDec->mpp = this;
|
||||
mpp_dec_init(mDec, coding);
|
||||
mpp_dec_init(mDec, &cfg);
|
||||
|
||||
mThreadCodec = new MppThread(mpp_dec_parser_thread, this, "mpp_dec_parser");
|
||||
mThreadHal = new MppThread(mpp_dec_hal_thread, this, "mpp_dec_hal");
|
||||
@@ -286,9 +289,14 @@ MPP_RET Mpp::control(MpiCmd cmd, MppParam param)
|
||||
mpp_dec_control(mDec, cmd, param);
|
||||
break;
|
||||
}
|
||||
case MPP_DEC_USE_FAST_MODE: {
|
||||
case MPP_DEC_SET_PARSER_SPLIT_MODE: {
|
||||
RK_U32 mode = *((RK_U32 *)param);
|
||||
mFastMode = mode;
|
||||
mParserNeedSplit = mode;
|
||||
break;
|
||||
}
|
||||
case MPP_DEC_SET_PARSER_FAST_MODE: {
|
||||
RK_U32 mode = *((RK_U32 *)param);
|
||||
mParserFastMode = mode;
|
||||
break;
|
||||
}
|
||||
case MPP_DEC_GET_STREAM_COUNT: {
|
||||
|
Reference in New Issue
Block a user