mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-16 14:11:10 +08:00
[h264d] remove log H264D_DBG_DPB_FREE && H264D_DBG_DPB_DISPLAY; add used_for_reference in check_dpb_continuous;
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@785 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -565,7 +565,6 @@ MPP_RET h264d_flush(void *decoder)
|
||||
p_Dec->p_Inp->task_eos = 1;
|
||||
mpp_buf_slot_set_prop(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_EOS, &p_Dec->p_Inp->task_eos);
|
||||
__RETURN:
|
||||
H264D_DBG(H264D_DBG_DPB_DISPLAY, "[DPB_display] flush end, task_eos=%d, last_slot_idx=%d", p_Dec->p_Inp->task_eos, p_Dec->last_frame_slot_idx);
|
||||
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
||||
return ret = MPP_OK;
|
||||
__FAILED:
|
||||
|
@@ -639,23 +639,9 @@ static void free_dpb_mark(H264_DecCtx_t *p_Dec, H264_StorePic_t *p, H264_DpbMark
|
||||
} else if (structure == BOTTOM_FIELD) {
|
||||
p_mark->bot_used = (p_mark->bot_used > 0) ? (p_mark->bot_used - 1) : 0;
|
||||
}
|
||||
H264D_DBG(H264D_DBG_DPB_FREE, "[free_dbp_mark] top_used=%d, bot_used=%d, out_flag=%d, is_output=%d, slot_idx=%d \n",
|
||||
p_mark->top_used, p_mark->bot_used, p_mark->out_flag, p->is_output, p_mark->slot_idx);
|
||||
if (p_mark->top_used == 0 && p_mark->bot_used == 0
|
||||
&& p_mark->out_flag == 0 && (p_mark->slot_idx >= 0)) {
|
||||
mpp_buf_slot_clr_flag(p_Dec->frame_slots, p_mark->slot_idx, SLOT_CODEC_USE);
|
||||
{
|
||||
MppFrame frame = NULL;
|
||||
mpp_buf_slot_get_prop(p_Dec->frame_slots, p_mark->slot_idx, SLOT_FRAME_PTR, &frame);
|
||||
if (frame) {
|
||||
MppBuffer mbuffer = NULL;
|
||||
RK_U64 pts = frame ? mpp_frame_get_pts(frame) : 0;
|
||||
RK_U32 poc = frame ? mpp_frame_get_poc(frame) : 0;
|
||||
mpp_buf_slot_get_prop(p_Dec->frame_slots, p_mark->slot_idx, SLOT_BUFFER, &mbuffer);
|
||||
H264D_DBG(H264D_DBG_DPB_FREE, "[free_dbp_mark] g_frame_no=%d, structure=%d, mark_idx=%d, slot_idx=%d(%p), poc=%d, pts=%lld, %p \n",
|
||||
p_Dec->p_Vid->g_framecnt, structure, p_mark->mark_idx, p_mark->slot_idx, mbuffer, poc, pts, frame);
|
||||
}
|
||||
}
|
||||
reset_dpb_mark(p_mark);
|
||||
}
|
||||
}
|
||||
@@ -677,9 +663,6 @@ static MPP_RET remove_frame_from_dpb(H264_DpbBuf_t *p_Dpb, RK_S32 pos)
|
||||
INP_CHECK(ret, !p_Dec);
|
||||
runlog = p_Dec->logctx.parr[RUN_PARSE];
|
||||
|
||||
H264D_DBG(H264D_DBG_DPB_FREE, "[FREE_MALLOC] is_used=%d, used_size=%d,frame(%p), top(%p), bot(%p)",
|
||||
fs->is_used, p_Dpb->used_size, fs->frame, fs->top_field, fs->bottom_field);
|
||||
|
||||
switch (fs->is_used) {
|
||||
case 3:
|
||||
if (fs->frame) free_storable_picture(p_Dec, fs->frame);
|
||||
@@ -859,9 +842,6 @@ static void write_picture(H264_StorePic_t *p, H264dVideoCtx_t *p_Vid)
|
||||
H264dErrCtx_t *p_err = &p_Vid->p_Dec->errctx;
|
||||
|
||||
p_mark = p->mem_mark;
|
||||
H264D_DBG(H264D_DBG_DPB_FREE, "[write_picture] mem_type=%d, struct=%d, poc=%d, top_used=%d, bot_used=%d, slot_idx=%d, mark_idx=%d, out_flag=%d, is_output=%d",
|
||||
p->mem_malloc_type, p->structure, p->poc, p_mark->top_used, p_mark->bot_used, p_mark->slot_idx, p_mark->mark_idx, p_mark->out_flag, p->is_output);
|
||||
|
||||
if ((p->mem_malloc_type == Mem_Malloc
|
||||
|| p->mem_malloc_type == Mem_TopOnly
|
||||
|| p->mem_malloc_type == Mem_BotOnly)
|
||||
@@ -880,13 +860,19 @@ static void write_picture(H264_StorePic_t *p, H264dVideoCtx_t *p_Vid)
|
||||
|
||||
//!< discard unpaired
|
||||
if (p->mem_malloc_type == Mem_TopOnly || p->mem_malloc_type == Mem_BotOnly) {
|
||||
mpp_frame_set_errinfo(mframe, VPU_FRAME_ERR_UNKNOW);
|
||||
H264D_DBG(H264D_DBG_DPB_FREE, "[write_picture] discard, malloc_type unpaired, type=%d", p->mem_malloc_type);
|
||||
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);
|
||||
}
|
||||
}
|
||||
//!< discard less than first i frame poc
|
||||
if ((p_err->i_slice_no < 2) && (p->poc < p_err->first_iframe_poc)) {
|
||||
mpp_frame_set_errinfo(mframe, VPU_FRAME_ERR_UNKNOW);
|
||||
H264D_DBG(H264D_DBG_DPB_FREE, "[write_picture] discard, cur_poc=%d, first_iframe_poc=%d", p->poc, p_err->first_iframe_poc);
|
||||
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_Vid->p_Dec->frame_slots, p_mark->slot_idx, SLOT_QUEUE_USE);
|
||||
if (p_Vid->p_Dec->mvc_valid && !p_Vid->p_Inp->mvc_disable) {
|
||||
@@ -896,17 +882,7 @@ static void write_picture(H264_StorePic_t *p, H264dVideoCtx_t *p_Vid)
|
||||
p_Vid->p_Dec->last_frame_slot_idx = p_mark->slot_idx;
|
||||
p_mark->out_flag = 0;
|
||||
}
|
||||
if (rkv_h264d_parse_debug & H264D_DBG_DPB_DISPLAY)
|
||||
{
|
||||
MppBuffer mbuffer = NULL;
|
||||
mpp_buf_slot_get_prop(p_Vid->p_Dec->frame_slots, p_mark->slot_idx, SLOT_BUFFER, &mbuffer);
|
||||
H264D_DBG(H264D_DBG_DPB_DISPLAY, "[DPB_dispaly] layer_id=%d, pic_num=%d, poc=%d, slice_type=%d(idr=%d), slot_idx=%d(%p), pts=%lld, g_framecnt=%d \n",
|
||||
p->layer_id, p->pic_num, p->poc, p->slice_type, p->idr_flag, p_mark->slot_idx, mbuffer, mpp_frame_get_pts(mframe), p_Vid->g_framecnt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static MPP_RET write_unpaired_field(H264dVideoCtx_t *p_Vid, H264_FrameStore_t *fs)
|
||||
@@ -1598,7 +1574,6 @@ __FAILED:
|
||||
void free_storable_picture(H264_DecCtx_t *p_Dec, H264_StorePic_t *p)
|
||||
{
|
||||
if (p) {
|
||||
H264D_DBG(H264D_DBG_DPB_FREE, "[free_dbp_mark] type=%d, p->is_output=%d", p->mem_malloc_type, p->is_output);
|
||||
if (p->mem_malloc_type == Mem_Malloc
|
||||
|| p->mem_malloc_type == Mem_Clone) {
|
||||
free_dpb_mark(p_Dec, p, p->mem_mark, p->structure);
|
||||
|
@@ -480,15 +480,19 @@ __FAILED:
|
||||
static MPP_RET check_dpb_discontinuous(H264_StorePic_t *p_last, H264_StorePic_t *dec_pic, H264_SLICE_t *currSlice)
|
||||
{
|
||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||
|
||||
if (p_last && dec_pic && (dec_pic->slice_type != I_SLICE)) {
|
||||
RK_U32 error_flag = 0;
|
||||
RK_S32 wrap_frame_num = 0;
|
||||
if (p_last->used_for_reference) {
|
||||
wrap_frame_num = (p_last->frame_num + 1) % currSlice->p_Vid->max_frame_num;
|
||||
} else {
|
||||
wrap_frame_num = p_last->frame_num;
|
||||
}
|
||||
error_flag = (wrap_frame_num != dec_pic->frame_num) ? 1 : 0;
|
||||
currSlice->p_Dec->errctx.cur_err_flag |= error_flag ? VPU_FRAME_ERR_UNKNOW : 0;
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -1702,11 +1706,12 @@ static MPP_RET prepare_init_ref_info(H264_SLICE_t *currSlice)
|
||||
{
|
||||
void *refpic = NULL;
|
||||
RK_U32 i = 0, j = 0, k = 0;
|
||||
RK_S32 poc = 0, TOP_POC = 0, BOT_POC = 0;
|
||||
RK_S32 layer_id = 0, voidx = 0, is_used = 0, near_dpb_idx = 0;
|
||||
RK_S32 poc = 0, TOP_POC = 0, BOT_POC = 0;
|
||||
RK_S32 min_poc = 0, max_poc = 0;
|
||||
RK_S32 layer_id = 0, voidx = 0, is_used = 0, near_dpb_idx = 0;
|
||||
H264_DecCtx_t *p_Dec = currSlice->p_Dec;
|
||||
|
||||
memset(p_Dec->refpic_info_p, 0, MAX_REF_SIZE * sizeof(H264_RefPicInfo_t));
|
||||
memset(p_Dec->refpic_info_p, 0, MAX_REF_SIZE * sizeof(H264_RefPicInfo_t));
|
||||
memset(p_Dec->refpic_info_b[0], 0, MAX_REF_SIZE * sizeof(H264_RefPicInfo_t));
|
||||
memset(p_Dec->refpic_info_b[1], 0, MAX_REF_SIZE * sizeof(H264_RefPicInfo_t));
|
||||
|
||||
@@ -1757,6 +1762,7 @@ static MPP_RET prepare_init_ref_info(H264_SLICE_t *currSlice)
|
||||
} else {
|
||||
ASSERT(near_dpb_idx >= 0);
|
||||
p_Dec->refpic_info_p[j].dpb_idx = near_dpb_idx;
|
||||
p_Dec->errctx.cur_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
}
|
||||
if (currSlice->listP[0][j]->structure == BOTTOM_FIELD) {
|
||||
p_Dec->refpic_info_p[j].bottom_flag = 1;
|
||||
@@ -1772,9 +1778,8 @@ static MPP_RET prepare_init_ref_info(H264_SLICE_t *currSlice)
|
||||
}
|
||||
//!<------ set listB -------
|
||||
for (k = 0; k < 2; k++) {
|
||||
RK_S32 min_poc = 0xFFFF;
|
||||
RK_S32 max_poc = -0xFFFF;
|
||||
RK_S32 cur_poc = p_Dec->p_Vid->dec_pic->poc;
|
||||
min_poc = 0xFFFF;
|
||||
max_poc = -0xFFFF;
|
||||
near_dpb_idx = 0;
|
||||
for (j = 0; j < 32; j++) {
|
||||
poc = 0;
|
||||
@@ -1821,6 +1826,7 @@ static MPP_RET prepare_init_ref_info(H264_SLICE_t *currSlice)
|
||||
} else {
|
||||
ASSERT(near_dpb_idx >= 0);
|
||||
p_Dec->refpic_info_b[k][j].dpb_idx = near_dpb_idx;
|
||||
p_Dec->errctx.cur_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
}
|
||||
if (currSlice->listB[k][j]->structure == BOTTOM_FIELD) {
|
||||
p_Dec->refpic_info_b[k][j].bottom_flag = 1;
|
||||
@@ -1834,20 +1840,25 @@ static MPP_RET prepare_init_ref_info(H264_SLICE_t *currSlice)
|
||||
p_Dec->refpic_info_b[k][j].bottom_flag = 0;
|
||||
}
|
||||
}
|
||||
H264D_DBG(H264D_DBG_DPB_REF_ERR, "[DPB_LIST_B] min_poc=%d, max_poc=%d, dec_poc=%d", min_poc, max_poc, cur_poc);
|
||||
|
||||
}
|
||||
//!< check dpb list poc
|
||||
{
|
||||
RK_S32 cur_poc = p_Dec->p_Vid->dec_pic->poc;
|
||||
if ((currSlice->slice_type % 5) != I_SLICE
|
||||
&& (currSlice->slice_type % 5) != SI_SLICE) {
|
||||
if (cur_poc < min_poc) {
|
||||
p_Dec->errctx.cur_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
H264D_DBG(H264D_DBG_DPB_REF_ERR, "[DPB_REF_ERR] min_poc=%d, dec_poc=%d", min_poc, cur_poc);
|
||||
}
|
||||
}
|
||||
if (currSlice->slice_type % 5 == B_SLICE) {
|
||||
if (cur_poc > max_poc) {
|
||||
p_Dec->errctx.cur_err_flag |= VPU_FRAME_ERR_UNKNOW;
|
||||
H264D_DBG(H264D_DBG_DPB_REF_ERR, "[DPB_REF_ERR] max_poc=%d, dec_poc=%d", max_poc, cur_poc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
__RETURN:
|
||||
return MPP_OK;
|
||||
}
|
||||
@@ -1985,7 +1996,6 @@ MPP_RET init_picture(H264_SLICE_t *currSlice)
|
||||
if ((p_err->i_slice_no < 2)
|
||||
&& (!currSlice->layer_id) && (I_SLICE == currSlice->slice_type)) {
|
||||
p_err->first_iframe_poc = p_Vid->dec_pic->poc; //!< recoder first i frame poc
|
||||
H264D_DBG(H264D_DBG_DPB_FREE, "[first_iframe_poc] i_slice_no=%d, first_iframe_poc=%d", p_err->i_slice_no, p_err->first_iframe_poc);
|
||||
}
|
||||
//!< idr_memory_management MVC_layer, idr_flag==1
|
||||
if (currSlice->layer_id && !currSlice->svc_extension_flag && !currSlice->mvcExt.non_idr_flag) {
|
||||
|
@@ -451,7 +451,7 @@ __FAILED:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define MAX_TS_FILE_SIZE (100*1024*1024)
|
||||
#define MAX_ES_FILE_SIZE (100*1024*1024)
|
||||
static RK_U32 global_file_fid = 0;
|
||||
static RK_U64 global_flie_size = 0;
|
||||
/*!
|
||||
@@ -490,7 +490,7 @@ MPP_RET fwrite_stream_to_file(H264dInputCtx_t *p_Inp, RK_U8 *pdata, RK_U32 len)
|
||||
fflush(p_Inp->fp);
|
||||
}
|
||||
global_flie_size += len;
|
||||
if (global_flie_size > MAX_TS_FILE_SIZE) {
|
||||
if (global_flie_size > MAX_ES_FILE_SIZE) {
|
||||
FCLOSE(p_Inp->fp);
|
||||
global_file_fid = 1 - global_file_fid;
|
||||
global_flie_size = 0;
|
||||
@@ -958,7 +958,12 @@ MPP_RET parse_loop(H264_DecCtx_t *p_Dec)
|
||||
case SliceSTATE_GetSliceData:
|
||||
FUN_CHECK(ret = fill_slice_syntax(&p_Dec->p_Cur->slice, p_Dec->dxva_ctx));
|
||||
p_Dec->p_Vid->iNumOfSlicesDecoded++;
|
||||
p_Dec->next_state = SliceSTATE_ResetSlice;
|
||||
//if (p_Dec->is_parser_end) {
|
||||
// p_Dec->next_state = SliceSTATE_RegisterOneFrame;
|
||||
//} else
|
||||
{
|
||||
p_Dec->next_state = SliceSTATE_ResetSlice;
|
||||
}
|
||||
H264D_DBG(H264D_DBG_LOOP_STATE, "SliceSTATE_GetSliceData");
|
||||
break;
|
||||
case SliceSTATE_RegisterOneFrame:
|
||||
|
@@ -38,8 +38,7 @@
|
||||
|
||||
#define H264D_DBG_DPB_INFO (0x00000100) //!< size,
|
||||
#define H264D_DBG_DPB_MALLIC (0x00000200) //!< malloc
|
||||
#define H264D_DBG_DPB_FREE (0x00000400) //!< free
|
||||
#define H264D_DBG_DPB_DISPLAY (0x00000800) //!< display
|
||||
|
||||
|
||||
#define H264D_DBG_DPB_REF_ERR (0x00001000)
|
||||
#define H264D_DBG_SLOT_FLUSH (0x00002000) //!< dpb buffer slot remain
|
||||
|
Reference in New Issue
Block a user