mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-09 11:00:53 +08:00
[hal_task] insert dpb_err_flag && used_for_ref_flag into valuable flags; when parse error, then dpb_err_flag is enable, and when next I slice or reorder right to disable.
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@693 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -612,7 +612,7 @@ MPP_RET h264d_prepare(void *decoder, MppPacket pkt, HalDecTask *task)
|
|||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
p_Inp = p_Dec->p_Inp;
|
p_Inp = p_Dec->p_Inp;
|
||||||
if (p_Inp->has_get_eos) {
|
if (p_Inp->has_get_eos || p_Dec->errctx.un_spt_flag) {
|
||||||
mpp_packet_set_length(pkt, 0);
|
mpp_packet_set_length(pkt, 0);
|
||||||
goto __RETURN;
|
goto __RETURN;
|
||||||
}
|
}
|
||||||
@@ -691,18 +691,17 @@ __FAILED:
|
|||||||
MPP_RET h264d_parse(void *decoder, HalDecTask *in_task)
|
MPP_RET h264d_parse(void *decoder, HalDecTask *in_task)
|
||||||
{
|
{
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
H264dErrCtx_t *p_err = NULL;
|
||||||
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
||||||
|
|
||||||
INP_CHECK(ret, !decoder && !in_task);
|
INP_CHECK(ret, !decoder && !in_task);
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
p_err = &p_Dec->errctx;
|
||||||
|
|
||||||
in_task->valid = 0; // prepare end flag
|
in_task->valid = 0; // prepare end flag
|
||||||
p_Dec->in_task = in_task;
|
p_Dec->in_task = in_task;
|
||||||
|
|
||||||
p_Dec->errctx.parse_err_flag = 0;
|
p_err->used_ref_flag = 0;
|
||||||
p_Dec->errctx.dpb_err_flag = 0;
|
|
||||||
p_Dec->errctx.used_for_ref_flag = 0;
|
|
||||||
p_Dec->is_parser_end = 0;
|
p_Dec->is_parser_end = 0;
|
||||||
FUN_CHECK(ret = parse_loop(p_Dec));
|
FUN_CHECK(ret = parse_loop(p_Dec));
|
||||||
|
|
||||||
@@ -720,8 +719,8 @@ MPP_RET h264d_parse(void *decoder, HalDecTask *in_task)
|
|||||||
in_task->valid = 1; // register valid flag
|
in_task->valid = 1; // register valid flag
|
||||||
in_task->syntax.number = p_Dec->dxva_ctx->syn.num;
|
in_task->syntax.number = p_Dec->dxva_ctx->syn.num;
|
||||||
in_task->syntax.data = (void *)p_Dec->dxva_ctx->syn.buf;
|
in_task->syntax.data = (void *)p_Dec->dxva_ctx->syn.buf;
|
||||||
in_task->dpb_err_flag = p_Dec->errctx.dpb_err_flag;
|
in_task->flags.dpb_error = p_err->dpb_err_flag;
|
||||||
in_task->used_for_ref_flag = p_Dec->errctx.used_for_ref_flag;
|
in_task->flags.used_for_ref = p_err->used_ref_flag;
|
||||||
}
|
}
|
||||||
__RETURN:
|
__RETURN:
|
||||||
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
@@ -738,7 +737,11 @@ __FAILED:
|
|||||||
MppFrame mframe = NULL;
|
MppFrame mframe = NULL;
|
||||||
mpp_buf_slot_get_prop(p_Dec->frame_slots, dec_pic->mem_mark->slot_idx, SLOT_FRAME_PTR, &mframe);
|
mpp_buf_slot_get_prop(p_Dec->frame_slots, dec_pic->mem_mark->slot_idx, SLOT_FRAME_PTR, &mframe);
|
||||||
if (mframe) {
|
if (mframe) {
|
||||||
mpp_frame_set_errinfo(mframe, VPU_FRAME_ERR_UNKNOW);
|
if (p_err->used_ref_flag) {
|
||||||
|
mpp_frame_set_errinfo(mframe, VPU_FRAME_ERR_UNKNOW);
|
||||||
|
} else {
|
||||||
|
mpp_frame_set_discard(mframe, VPU_FRAME_ERR_UNKNOW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mpp_buf_slot_set_flag(p_Dec->frame_slots, dec_pic->mem_mark->slot_idx, SLOT_QUEUE_USE);
|
mpp_buf_slot_set_flag(p_Dec->frame_slots, dec_pic->mem_mark->slot_idx, SLOT_QUEUE_USE);
|
||||||
mpp_buf_slot_enqueue(p_Dec->frame_slots, dec_pic->mem_mark->slot_idx, QUEUE_DISPLAY);
|
mpp_buf_slot_enqueue(p_Dec->frame_slots, dec_pic->mem_mark->slot_idx, QUEUE_DISPLAY);
|
||||||
@@ -749,6 +752,7 @@ __FAILED:
|
|||||||
MPP_FREE(dec_pic);
|
MPP_FREE(dec_pic);
|
||||||
p_Dec->p_Vid->dec_pic = NULL;
|
p_Dec->p_Vid->dec_pic = NULL;
|
||||||
}
|
}
|
||||||
|
p_err->dpb_err_flag = p_err->used_ref_flag ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -1034,9 +1034,9 @@ typedef enum slice_state_type {
|
|||||||
} SLICE_STATUS;
|
} SLICE_STATUS;
|
||||||
|
|
||||||
typedef struct h264_err_ctx_t {
|
typedef struct h264_err_ctx_t {
|
||||||
RK_U32 parse_err_flag;
|
RK_U32 un_spt_flag;
|
||||||
RK_U32 dpb_err_flag;
|
RK_U32 dpb_err_flag;
|
||||||
RK_U32 used_for_ref_flag;
|
RK_U32 used_ref_flag;
|
||||||
RK_U32 i_slice_no;
|
RK_U32 i_slice_no;
|
||||||
RK_S32 first_iframe_poc;
|
RK_S32 first_iframe_poc;
|
||||||
} H264dErrCtx_t;
|
} H264dErrCtx_t;
|
||||||
|
@@ -1442,14 +1442,27 @@ static RK_U32 check_ref_dbp_err(H264_DecCtx_t *p_Dec, H264_RefPicInfo_t *pref)
|
|||||||
for (i = 0; i < MAX_REF_SIZE; i++) {
|
for (i = 0; i < MAX_REF_SIZE; i++) {
|
||||||
if (pref[i].valid) {
|
if (pref[i].valid) {
|
||||||
MppFrame mframe = NULL;
|
MppFrame mframe = NULL;
|
||||||
RK_U32 slot_idx = p_Dec->dpb_info[pref->dpb_idx].slot_index;
|
RK_U32 slot_idx = p_Dec->dpb_info[pref[i].dpb_idx].slot_index;
|
||||||
mpp_buf_slot_get_prop(p_Dec->frame_slots, slot_idx, SLOT_FRAME_PTR, &mframe);
|
mpp_buf_slot_get_prop(p_Dec->frame_slots, slot_idx, SLOT_FRAME_PTR, &mframe);
|
||||||
if(mframe) {
|
if (mframe) {
|
||||||
dpb_error_flag |= mpp_frame_get_errinfo(mframe);
|
dpb_error_flag |= mpp_frame_get_errinfo(mframe);
|
||||||
H264D_DBG(H264D_DBG_DPB_REF_ERR, "[DPB_REF_ERR] slot_idx=%d, dpb_err[%d]=%d", slot_idx, i, mpp_frame_get_errinfo(mframe));
|
H264D_DBG(H264D_DBG_DPB_REF_ERR, "[DPB_REF_ERR] slot_idx=%d, dpb_err[%d]=%d", slot_idx, i, mpp_frame_get_errinfo(mframe));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//for (i = 0; i < MAX_DPB_SIZE; i++) {
|
||||||
|
// RK_S32 slot_idx = p_Dec->in_task->refer[i];
|
||||||
|
// if (slot_idx >= 0) {
|
||||||
|
// MppFrame mframe = NULL;
|
||||||
|
// mpp_buf_slot_get_prop(p_Dec->frame_slots, slot_idx, SLOT_FRAME_PTR, &mframe);
|
||||||
|
// if (mframe) {
|
||||||
|
// dpb_error_flag |= mpp_frame_get_errinfo(mframe);
|
||||||
|
// H264D_DBG(H264D_DBG_DPB_REF_ERR, "[DPB_REF_ERR] slot_idx=%d, dpb_err[%d]=%d", slot_idx, i, mpp_frame_get_errinfo(mframe));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
return dpb_error_flag;
|
return dpb_error_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1458,7 +1471,6 @@ static void check_refer_picture_lists(H264_SLICE_t *currSlice)
|
|||||||
H264_DecCtx_t *p_Dec = currSlice->p_Dec;
|
H264_DecCtx_t *p_Dec = currSlice->p_Dec;
|
||||||
|
|
||||||
if (I_SLICE == currSlice->slice_type) {
|
if (I_SLICE == currSlice->slice_type) {
|
||||||
p_Dec->errctx.dpb_err_flag = 0;
|
|
||||||
goto __RETURN;
|
goto __RETURN;
|
||||||
}
|
}
|
||||||
#if 1
|
#if 1
|
||||||
@@ -1466,14 +1478,20 @@ static void check_refer_picture_lists(H264_SLICE_t *currSlice)
|
|||||||
if ((currSlice->slice_type % 5) != I_SLICE
|
if ((currSlice->slice_type % 5) != I_SLICE
|
||||||
&& (currSlice->slice_type % 5) != SI_SLICE) {
|
&& (currSlice->slice_type % 5) != SI_SLICE) {
|
||||||
if (currSlice->ref_pic_list_reordering_flag[LIST_0]) {
|
if (currSlice->ref_pic_list_reordering_flag[LIST_0]) {
|
||||||
p_Dec->errctx.dpb_err_flag |= check_ref_pic_list(currSlice, 0);
|
if (check_ref_pic_list(currSlice, 0)) {
|
||||||
|
p_Dec->errctx.dpb_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||||
|
} else {
|
||||||
|
p_Dec->errctx.dpb_err_flag = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
p_Dec->errctx.dpb_err_flag |= check_ref_dbp_err(p_Dec, p_Dec->refpic_info_b[0]);
|
p_Dec->errctx.dpb_err_flag |= check_ref_dbp_err(p_Dec, p_Dec->refpic_info_b[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currSlice->slice_type % 5 == B_SLICE) {
|
if (currSlice->slice_type % 5 == B_SLICE) {
|
||||||
if (currSlice->ref_pic_list_reordering_flag[LIST_1]) {
|
if (currSlice->ref_pic_list_reordering_flag[LIST_1]) {
|
||||||
p_Dec->errctx.dpb_err_flag |= check_ref_pic_list(currSlice, 1);
|
if (check_ref_pic_list(currSlice, 1)) {
|
||||||
|
p_Dec->errctx.dpb_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
p_Dec->errctx.dpb_err_flag |= check_ref_dbp_err(p_Dec, p_Dec->refpic_info_b[1]);
|
p_Dec->errctx.dpb_err_flag |= check_ref_dbp_err(p_Dec, p_Dec->refpic_info_b[1]);
|
||||||
}
|
}
|
||||||
@@ -2065,11 +2083,9 @@ MPP_RET init_picture(H264_SLICE_t *currSlice)
|
|||||||
p_err->i_slice_no += ((!currSlice->layer_id) && (I_SLICE == currSlice->slice_type)) ? 1 : 0;
|
p_err->i_slice_no += ((!currSlice->layer_id) && (I_SLICE == currSlice->slice_type)) ? 1 : 0;
|
||||||
if (!p_err->i_slice_no) {
|
if (!p_err->i_slice_no) {
|
||||||
H264D_WARNNING("[Discard] Discard slice before I Slice.");
|
H264D_WARNNING("[Discard] Discard slice before I Slice.");
|
||||||
p_Dec->errctx.parse_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
|
||||||
ret = MPP_NOK;
|
ret = MPP_NOK;
|
||||||
goto __FAILED;
|
goto __FAILED;
|
||||||
}
|
}
|
||||||
p_Dec->errctx.used_for_ref_flag = currSlice->nal_reference_idc ? 1 : 0;
|
|
||||||
|
|
||||||
FUN_CHECK(ret = alloc_decpic(currSlice));
|
FUN_CHECK(ret = alloc_decpic(currSlice));
|
||||||
|
|
||||||
|
@@ -966,6 +966,7 @@ MPP_RET parse_loop(H264_DecCtx_t *p_Dec)
|
|||||||
break;
|
break;
|
||||||
case SliceSTATE_RegisterOneFrame:
|
case SliceSTATE_RegisterOneFrame:
|
||||||
if (!p_Dec->is_parser_end){
|
if (!p_Dec->is_parser_end){
|
||||||
|
ret = MPP_NOK;
|
||||||
goto __FAILED;
|
goto __FAILED;
|
||||||
}
|
}
|
||||||
commit_buffer(p_Dec->dxva_ctx);
|
commit_buffer(p_Dec->dxva_ctx);
|
||||||
@@ -991,7 +992,6 @@ __FAILED:
|
|||||||
p_Dec->dxva_ctx->strm_offset = 0;
|
p_Dec->dxva_ctx->strm_offset = 0;
|
||||||
p_Dec->p_Vid->iNumOfSlicesDecoded = 0;
|
p_Dec->p_Vid->iNumOfSlicesDecoded = 0;
|
||||||
p_Dec->p_Vid->exit_picture_flag = 0;
|
p_Dec->p_Vid->exit_picture_flag = 0;
|
||||||
p_Dec->errctx.parse_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -74,7 +74,7 @@ static MPP_RET interpret_user_data_unregistered_info(RK_U8 *payload, RK_S32 size
|
|||||||
sei_msg->user_data_DivX_flag = strstr(_strupr((char *)&payload[16]), "DIVX") ? 1 : 0;
|
sei_msg->user_data_DivX_flag = strstr(_strupr((char *)&payload[16]), "DIVX") ? 1 : 0;
|
||||||
if (sei_msg->user_data_DivX_flag) {
|
if (sei_msg->user_data_DivX_flag) {
|
||||||
H264D_ERR("DivX is not supported. \n");
|
H264D_ERR("DivX is not supported. \n");
|
||||||
sei_msg->p_Dec->errctx.parse_err_flag |= VPU_FRAME_ERR_UNSUPPORT;
|
sei_msg->p_Dec->errctx.un_spt_flag = 1;
|
||||||
ret = MPP_NOK;
|
ret = MPP_NOK;
|
||||||
goto __FAILED;
|
goto __FAILED;
|
||||||
}
|
}
|
||||||
|
@@ -322,7 +322,14 @@ static void init_slice_parmeters(H264_SLICE_t *currSlice)
|
|||||||
//--- init slice syntax
|
//--- init slice syntax
|
||||||
currSlice->idr_flag = ((cur_nalu->nalu_type == NALU_TYPE_IDR)
|
currSlice->idr_flag = ((cur_nalu->nalu_type == NALU_TYPE_IDR)
|
||||||
|| (currSlice->mvcExt.valid && !currSlice->mvcExt.non_idr_flag));
|
|| (currSlice->mvcExt.valid && !currSlice->mvcExt.non_idr_flag));
|
||||||
currSlice->nal_reference_idc = cur_nalu->nal_reference_idc;
|
currSlice->nal_reference_idc = cur_nalu->nal_reference_idc;
|
||||||
|
//!< set ref flag and dpb error flag
|
||||||
|
{
|
||||||
|
p_Vid->p_Dec->errctx.used_ref_flag = currSlice->nal_reference_idc ? 1 : 0;
|
||||||
|
if (currSlice->slice_type == I_SLICE) {
|
||||||
|
p_Vid->p_Dec->errctx.dpb_err_flag = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ((!currSlice->svc_extension_flag) || currSlice->mvcExt.iPrefixNALU) { // MVC or have prefixNALU
|
if ((!currSlice->svc_extension_flag) || currSlice->mvcExt.iPrefixNALU) { // MVC or have prefixNALU
|
||||||
currSlice->view_id = currSlice->mvcExt.view_id;
|
currSlice->view_id = currSlice->mvcExt.view_id;
|
||||||
currSlice->inter_view_flag = currSlice->mvcExt.inter_view_flag;
|
currSlice->inter_view_flag = currSlice->mvcExt.inter_view_flag;
|
||||||
|
@@ -83,8 +83,10 @@ typedef struct MppSyntax_t {
|
|||||||
typedef union HalDecTaskFlag_t {
|
typedef union HalDecTaskFlag_t {
|
||||||
RK_U32 val;
|
RK_U32 val;
|
||||||
struct {
|
struct {
|
||||||
RK_U32 eos : 1;
|
RK_U32 eos : 1;
|
||||||
RK_U32 info_change : 1;
|
RK_U32 info_change : 1;
|
||||||
|
RK_U32 dpb_error : 1;
|
||||||
|
RK_U32 used_for_ref : 1;
|
||||||
};
|
};
|
||||||
} HalDecTaskFlag;
|
} HalDecTaskFlag;
|
||||||
|
|
||||||
@@ -96,8 +98,6 @@ typedef struct HalDecTask_t {
|
|||||||
// previous task hardware working status
|
// previous task hardware working status
|
||||||
// when hardware error happen status is not zero
|
// when hardware error happen status is not zero
|
||||||
RK_U32 prev_status;
|
RK_U32 prev_status;
|
||||||
RK_U32 dpb_err_flag;
|
|
||||||
RK_U32 used_for_ref_flag;
|
|
||||||
// current tesk protocol syntax information
|
// current tesk protocol syntax information
|
||||||
MppSyntax syntax;
|
MppSyntax syntax;
|
||||||
|
|
||||||
|
@@ -321,7 +321,7 @@ MPP_RET rkv_h264d_gen_regs(void *hal, HalTaskInfo *task)
|
|||||||
|
|
||||||
INP_CHECK(ret, NULL == p_hal);
|
INP_CHECK(ret, NULL == p_hal);
|
||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
if (task->dec.dpb_err_flag) {
|
if (task->dec.flags.dpb_error) {
|
||||||
goto __RETURN;
|
goto __RETURN;
|
||||||
}
|
}
|
||||||
rkv_prepare_spspps_packet(hal, &pkts->spspps);
|
rkv_prepare_spspps_packet(hal, &pkts->spspps);
|
||||||
@@ -369,7 +369,7 @@ MPP_RET rkv_h264d_start(void *hal, HalTaskInfo *task)
|
|||||||
|
|
||||||
INP_CHECK(ret, NULL == p_hal);
|
INP_CHECK(ret, NULL == p_hal);
|
||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
if (task->dec.dpb_err_flag) {
|
if (task->dec.flags.dpb_error) {
|
||||||
goto __RETURN;
|
goto __RETURN;
|
||||||
}
|
}
|
||||||
p_regs = (RK_U32 *)p_hal->regs;
|
p_regs = (RK_U32 *)p_hal->regs;
|
||||||
@@ -420,7 +420,7 @@ MPP_RET rkv_h264d_wait(void *hal, HalTaskInfo *task)
|
|||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
|
|
||||||
p_regs = (H264dRkvRegs_t *)p_hal->regs;
|
p_regs = (H264dRkvRegs_t *)p_hal->regs;
|
||||||
if (task->dec.dpb_err_flag) {
|
if (task->dec.flags.dpb_error) {
|
||||||
goto __SKIP_HARD;
|
goto __SKIP_HARD;
|
||||||
}
|
}
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
@@ -450,8 +450,8 @@ MPP_RET rkv_h264d_wait(void *hal, HalTaskInfo *task)
|
|||||||
}
|
}
|
||||||
__SKIP_HARD:
|
__SKIP_HARD:
|
||||||
p_regs->slot_idx = task->dec.output;
|
p_regs->slot_idx = task->dec.output;
|
||||||
p_regs->dpb_err_flag = task->dec.dpb_err_flag;
|
p_regs->dpb_err_flag = task->dec.flags.dpb_error;
|
||||||
p_regs->used_for_ref_flag = task->dec.used_for_ref_flag;
|
p_regs->used_for_ref_flag = task->dec.flags.used_for_ref;
|
||||||
if (p_hal->init_cb.callBack) {
|
if (p_hal->init_cb.callBack) {
|
||||||
p_hal->init_cb.callBack(p_hal->init_cb.opaque, p_hal->regs);
|
p_hal->init_cb.callBack(p_hal->init_cb.opaque, p_hal->regs);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user