mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-09 02:50:06 +08:00
[h264d] add cur_err_flag; dpb_err_flag => had_err;
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@752 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -698,7 +698,7 @@ MPP_RET h264d_parse(void *decoder, HalDecTask *in_task)
|
||||
|
||||
in_task->valid = 0; // prepare end flag
|
||||
p_Dec->in_task = in_task;
|
||||
|
||||
p_err->cur_err_flag = 0;
|
||||
p_err->used_ref_flag = 0;
|
||||
p_Dec->is_parser_end = 0;
|
||||
FUN_CHECK(ret = parse_loop(p_Dec));
|
||||
@@ -717,9 +717,9 @@ MPP_RET h264d_parse(void *decoder, HalDecTask *in_task)
|
||||
in_task->valid = 1; // register valid flag
|
||||
in_task->syntax.number = p_Dec->dxva_ctx->syn.num;
|
||||
in_task->syntax.data = (void *)p_Dec->dxva_ctx->syn.buf;
|
||||
in_task->flags.dpb_error = p_err->dpb_err_flag;
|
||||
in_task->flags.used_for_ref = p_err->used_ref_flag;
|
||||
|
||||
in_task->flags.used_for_ref = p_err->used_ref_flag;
|
||||
p_err->dpb_err_flag |= p_err->used_ref_flag ? p_err->cur_err_flag : 0;
|
||||
in_task->flags.had_error = (p_err->dpb_err_flag | p_err->cur_err_flag) ? 1 : 0;
|
||||
}
|
||||
__RETURN:
|
||||
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
||||
@@ -751,7 +751,7 @@ __FAILED:
|
||||
MPP_FREE(dec_pic);
|
||||
p_Dec->p_Vid->dec_pic = NULL;
|
||||
}
|
||||
p_err->dpb_err_flag = p_err->used_ref_flag ? 1 : 0;
|
||||
p_err->dpb_err_flag |= p_err->used_ref_flag ? 1 : 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -778,8 +778,8 @@ MPP_RET h264d_callback(void *decoder, void *errinfo)
|
||||
MppFrame mframe = NULL;
|
||||
|
||||
RK_U32 out_slot_idx = p_regs[78];
|
||||
RK_U32 dpb_err_flag = p_regs[79];
|
||||
RK_U32 ref_flag = p_regs[80];
|
||||
RK_U32 had_err_flag = p_regs[79];
|
||||
RK_U32 used_ref_flag = p_regs[80];
|
||||
RK_U32 dec_error_sta = p_regs[1] & 0x00004000;
|
||||
RK_U32 dec_rdy_sta = p_regs[1] & 0x00001000;
|
||||
RK_U32 buf_empty_sta = p_regs[1] & 0x00010000;
|
||||
@@ -789,16 +789,15 @@ MPP_RET h264d_callback(void *decoder, void *errinfo)
|
||||
mpp_buf_slot_get_prop(p_Dec->frame_slots, out_slot_idx, SLOT_FRAME_PTR, &mframe);
|
||||
if (mframe) {
|
||||
if (dec_error_sta || (!dec_rdy_sta) || buf_empty_sta
|
||||
|| dpb_err_flag || strmd_error_status || strmd_error_detect_flag) {
|
||||
if (ref_flag) {
|
||||
|| had_err_flag || strmd_error_status || strmd_error_detect_flag) {
|
||||
if (used_ref_flag) {
|
||||
mpp_frame_set_errinfo(mframe, VPU_FRAME_ERR_UNKNOW);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mpp_frame_set_discard(mframe, VPU_FRAME_ERR_UNKNOW);
|
||||
}
|
||||
}
|
||||
H264D_DBG(H264D_DBG_CALLBACK, "[CALLBACK] g_no=%d, s_idx=%d, sw[01]=%08x, sw[45]=%08x, sw[76]=%08x, dpberr=%d, ref=%d, errinfo=%d",
|
||||
p_Dec->p_Vid->g_framecnt, out_slot_idx, p_regs[1], p_regs[45], p_regs[76], dpb_err_flag, ref_flag, mpp_frame_get_errinfo(mframe));
|
||||
H264D_DBG(H264D_DBG_CALLBACK, "[CALLBACK] g_no=%d, s_idx=%d, sw[01]=%08x, sw[45]=%08x, sw[76]=%08x, dpberr=%d, ref=%d, errinfo=%d, discard=%d \n",
|
||||
p_Dec->p_Vid->g_framecnt, out_slot_idx, p_regs[1], p_regs[45], p_regs[76], had_err_flag, used_ref_flag, mpp_frame_get_errinfo(mframe), mpp_frame_get_discard(mframe));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1044,8 +1044,10 @@ typedef enum slice_state_type {
|
||||
|
||||
typedef struct h264_err_ctx_t {
|
||||
RK_U32 un_spt_flag;
|
||||
RK_U32 dpb_err_flag;
|
||||
RK_U32 cur_err_flag; //!< current decoded picture error
|
||||
RK_U32 used_ref_flag;
|
||||
RK_U32 dpb_err_flag; //!< dpb storage had error
|
||||
|
||||
RK_U32 i_slice_no;
|
||||
RK_S32 first_iframe_poc;
|
||||
} H264dErrCtx_t;
|
||||
|
@@ -481,31 +481,13 @@ static MPP_RET check_dpb_discontinuous(H264_StorePic_t *p_last, H264_StorePic_t
|
||||
{
|
||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||
|
||||
if (p_last && dec_pic) {
|
||||
RK_S32 num_ref_frames = currSlice->active_sps->max_num_ref_frames;
|
||||
|
||||
H264D_DBG(H264D_DBG_DISCONTINUOUS, "[discontinuous] last_slice=%d, cur_slice=%d, last_fnum=%d, cur_fnum=%d, last_poc=%d, cur_poc=%d, num_refs=%d",
|
||||
p_last->slice_type, dec_pic->slice_type, p_last->frame_num, dec_pic->frame_num, p_last->poc, dec_pic->poc, num_ref_frames);
|
||||
|
||||
if (dec_pic->slice_type != I_SLICE) {
|
||||
if (!(p_last->frame_num == dec_pic->frame_num
|
||||
|| ((p_last->frame_num + 1) % currSlice->p_Vid->max_frame_num) == dec_pic->frame_num))
|
||||
{
|
||||
mpp_log_f("[check frame_num] dec_pic->slice_type=%d, p_last->frame_num=%d,dec_pic->frame_num=%d, slot_idx=%d",
|
||||
dec_pic->slice_type, p_last->frame_num, dec_pic->frame_num, dec_pic->mem_mark->slot_idx);
|
||||
if (dec_pic->mem_mark
|
||||
&& (dec_pic->mem_mark->slot_idx >= 0)) {
|
||||
MppFrame mframe = NULL;
|
||||
mpp_buf_slot_get_prop(currSlice->p_Dec->frame_slots, dec_pic->mem_mark->slot_idx, SLOT_FRAME_PTR, &mframe);
|
||||
if (mframe) {
|
||||
if (currSlice->p_Dec->errctx.used_ref_flag) {
|
||||
mpp_frame_set_errinfo(mframe, VPU_FRAME_ERR_UNKNOW);
|
||||
} else {
|
||||
mpp_frame_set_discard(mframe, VPU_FRAME_ERR_UNKNOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p_last && dec_pic && (dec_pic->slice_type != I_SLICE)) {
|
||||
H264D_DBG(H264D_DBG_DISCONTINUOUS, "[discontinuous] last_slice=%d, cur_slice=%d, last_fnum=%d, cur_fnum=%d, last_poc=%d, cur_poc=%d",
|
||||
p_last->slice_type, dec_pic->slice_type, p_last->frame_num, dec_pic->frame_num, p_last->poc, dec_pic->poc);
|
||||
if (!(p_last->frame_num == dec_pic->frame_num
|
||||
|| ((p_last->frame_num + 1) % currSlice->p_Vid->max_frame_num) == dec_pic->frame_num))
|
||||
{
|
||||
currSlice->p_Dec->errctx.cur_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
}
|
||||
}
|
||||
return ret = MPP_OK;
|
||||
@@ -1394,24 +1376,24 @@ static void check_refer_picture_lists(H264_SLICE_t *currSlice)
|
||||
&& (currSlice->slice_type % 5) != SI_SLICE) {
|
||||
if (currSlice->ref_pic_list_reordering_flag[LIST_0]) {
|
||||
if (check_ref_pic_list(currSlice, 0)) {
|
||||
p_Dec->errctx.dpb_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
p_Dec->errctx.cur_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
}
|
||||
} else {
|
||||
p_Dec->errctx.dpb_err_flag |= check_ref_dbp_err(p_Dec, p_Dec->refpic_info_b[0]);
|
||||
p_Dec->errctx.cur_err_flag |= check_ref_dbp_err(p_Dec, p_Dec->refpic_info_b[0]);
|
||||
}
|
||||
}
|
||||
if (currSlice->slice_type % 5 == B_SLICE) {
|
||||
if (currSlice->ref_pic_list_reordering_flag[LIST_1]) {
|
||||
if (check_ref_pic_list(currSlice, 1)) {
|
||||
p_Dec->errctx.dpb_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
p_Dec->errctx.cur_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
}
|
||||
} else {
|
||||
p_Dec->errctx.dpb_err_flag |= check_ref_dbp_err(p_Dec, p_Dec->refpic_info_b[1]);
|
||||
p_Dec->errctx.cur_err_flag |= check_ref_dbp_err(p_Dec, p_Dec->refpic_info_b[1]);
|
||||
}
|
||||
//!< B_SLICE only has one refer
|
||||
if ((currSlice->active_sps->vui_seq_parameters.num_reorder_frames > 1)
|
||||
&& (currSlice->p_Dpb->ref_frames_in_buffer < 2)) {
|
||||
p_Dec->errctx.dpb_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
p_Dec->errctx.cur_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
H264D_DBG(H264D_DBG_DPB_REF_ERR, "[DPB_REF_ERR] error, B frame only has one refer");
|
||||
}
|
||||
}
|
||||
@@ -1856,12 +1838,12 @@ static MPP_RET prepare_init_ref_info(H264_SLICE_t *currSlice)
|
||||
if ((currSlice->slice_type % 5) != I_SLICE
|
||||
&& (currSlice->slice_type % 5) != SI_SLICE) {
|
||||
if (cur_poc < min_poc) {
|
||||
p_Dec->errctx.dpb_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
p_Dec->errctx.cur_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
}
|
||||
}
|
||||
if (currSlice->slice_type % 5 == B_SLICE) {
|
||||
if (cur_poc > max_poc) {
|
||||
p_Dec->errctx.dpb_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
p_Dec->errctx.cur_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -909,6 +909,7 @@ MPP_RET parse_loop(H264_DecCtx_t *p_Dec)
|
||||
//!< ==== loop ====
|
||||
p_Dec->next_state = SliceSTATE_ResetSlice;
|
||||
p_curdata = p_Dec->p_Cur->strm.head_buf;
|
||||
|
||||
while (while_loop_flag) {
|
||||
switch (p_Dec->next_state) {
|
||||
case SliceSTATE_ResetSlice:
|
||||
@@ -980,10 +981,6 @@ __RETURN:
|
||||
return ret = MPP_OK;
|
||||
__FAILED:
|
||||
p_Dec->nalu_ret = NALU_NULL;
|
||||
//p_Dec->is_first_frame = 1;
|
||||
//p_Dec->is_new_frame = 0;
|
||||
//p_Dec->is_parser_end = 0;
|
||||
p_Dec->next_state = SliceSTATE_ResetSlice;
|
||||
p_Dec->dxva_ctx->slice_count = 0;
|
||||
p_Dec->dxva_ctx->strm_offset = 0;
|
||||
p_Dec->p_Vid->iNumOfSlicesDecoded = 0;
|
||||
|
@@ -85,7 +85,7 @@ typedef union HalDecTaskFlag_t {
|
||||
struct {
|
||||
RK_U32 eos : 1;
|
||||
RK_U32 info_change : 1;
|
||||
RK_U32 dpb_error : 1;
|
||||
RK_U32 had_error : 1;
|
||||
RK_U32 used_for_ref : 1;
|
||||
};
|
||||
} HalDecTaskFlag;
|
||||
|
@@ -321,7 +321,7 @@ MPP_RET rkv_h264d_gen_regs(void *hal, HalTaskInfo *task)
|
||||
|
||||
INP_CHECK(ret, NULL == p_hal);
|
||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||
if (task->dec.flags.dpb_error) {
|
||||
if (task->dec.flags.had_error) {
|
||||
goto __RETURN;
|
||||
}
|
||||
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);
|
||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||
if (task->dec.flags.dpb_error) {
|
||||
if (task->dec.flags.had_error) {
|
||||
goto __RETURN;
|
||||
}
|
||||
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]);
|
||||
|
||||
p_regs = (H264dRkvRegs_t *)p_hal->regs;
|
||||
if (task->dec.flags.dpb_error) {
|
||||
if (task->dec.flags.had_error) {
|
||||
goto __SKIP_HARD;
|
||||
}
|
||||
#ifdef ANDROID
|
||||
@@ -450,8 +450,8 @@ MPP_RET rkv_h264d_wait(void *hal, HalTaskInfo *task)
|
||||
}
|
||||
__SKIP_HARD:
|
||||
p_regs->slot_idx = task->dec.output;
|
||||
p_regs->dpb_err_flag = task->dec.flags.dpb_error;
|
||||
p_regs->used_for_ref_flag = task->dec.flags.used_for_ref;
|
||||
p_regs->had_err_flag = task->dec.flags.had_error;
|
||||
p_regs->used_for_ref = task->dec.flags.used_for_ref;
|
||||
if (p_hal->init_cb.callBack) {
|
||||
p_hal->init_cb.callBack(p_hal->init_cb.opaque, p_hal->regs);
|
||||
}
|
||||
|
@@ -211,8 +211,8 @@ typedef struct h264d_rkv_regs_t {
|
||||
RK_U32 reserve : 2;
|
||||
} swreg77_h264_error_e;
|
||||
RK_U32 slot_idx;
|
||||
RK_U32 dpb_err_flag;
|
||||
RK_U32 used_for_ref_flag;
|
||||
RK_U32 had_err_flag;
|
||||
RK_U32 used_for_ref;
|
||||
RK_U32 compare_len;
|
||||
RK_U32 reverse[100];
|
||||
} H264dRkvRegs_t;
|
||||
|
Reference in New Issue
Block a user