Skip to content

Commit

Permalink
[mpp_enc]: Fix h265e async issue
Browse files Browse the repository at this point in the history
1. Disable frame parallel on h265e_vepu580.
2. Output KEY_INPUT_FRAME on normal path.

Change-Id: Ic25628b4d44b23cd425740ea7cc72693997bca40
Signed-off-by: Herman Chen <[email protected]>
  • Loading branch information
HermanChen committed Mar 2, 2022
1 parent 2e25db1 commit 578cb5d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions mpp/codec/mpp_enc_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1980,6 +1980,9 @@ static MPP_RET try_proc_normal_task(MppEncImpl *enc, EncTask *task)
mpp_meta_set_s32(meta, KEY_OUTPUT_INTRA, frm->is_intra);
if (rc_task->info.quality_real)
mpp_meta_set_s32(meta, KEY_ENC_AVERAGE_QP, rc_task->info.quality_real);

if (mpp->mEncAyncIo)
mpp_meta_set_frame(meta, KEY_INPUT_FRAME, enc->frame);
}

/*
Expand Down
22 changes: 19 additions & 3 deletions mpp/mpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ static void *list_wraper_frame(void *arg)
return NULL;
}

static MPP_RET check_frm_task_cnt_cap(MppCodingType coding)
{
if (coding != MPP_VIDEO_CodingAVC ||
!strstr(mpp_get_soc_name(), "rk3588")) {
mpp_log("Only rk3588 h264 encoder can use frame parallel\n");
return MPP_NOK;
}

return MPP_OK;
}

Mpp::Mpp(MppCtx ctx = NULL)
: mPktIn(NULL),
mPktOut(NULL),
Expand Down Expand Up @@ -197,6 +208,12 @@ MPP_RET Mpp::init(MppCtxType type, MppCodingType coding)
mMppInPort = mpp_task_queue_get_port(mInputTaskQueue, MPP_PORT_OUTPUT);
mMppOutPort = mpp_task_queue_get_port(mOutputTaskQueue, MPP_PORT_INPUT);

if (mInputTimeout == MPP_POLL_NON_BLOCK) {
mEncAyncIo = 1;
if (check_frm_task_cnt_cap(coding))
mInputTimeout = MPP_POLL_BLOCK;
}

MppEncInitCfg cfg = {
coding,
(mInputTimeout) ? (1) : (2),
Expand All @@ -208,7 +225,6 @@ MPP_RET Mpp::init(MppCtxType type, MppCodingType coding)
break;

if (mInputTimeout == MPP_POLL_NON_BLOCK) {
mEncAyncIo = 1;
ret = mpp_enc_start_async(mEnc);
} else {
ret = mpp_enc_start_v2(mEnc);
Expand Down Expand Up @@ -506,7 +522,7 @@ MPP_RET Mpp::put_frame(MppFrame frame)
if (!mInitDone)
return MPP_ERR_INIT;

if (mEncAyncIo)
if (mInputTimeout == MPP_POLL_NON_BLOCK)
return put_frame_async(frame);

MPP_RET ret = MPP_NOK;
Expand Down Expand Up @@ -610,7 +626,7 @@ MPP_RET Mpp::get_packet(MppPacket *packet)
if (!mInitDone)
return MPP_ERR_INIT;

if (mEncAyncIo)
if (mInputTimeout == MPP_POLL_NON_BLOCK)
return get_packet_async(packet);

MPP_RET ret = MPP_OK;
Expand Down

0 comments on commit 578cb5d

Please sign in to comment.