mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 09:06:50 +08:00
[astyle]: format coding style
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@539 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -207,8 +207,8 @@ typedef enum VPU_API_ERR {
|
|||||||
} VPU_API_ERR;
|
} VPU_API_ERR;
|
||||||
|
|
||||||
typedef enum VPU_FRAME_ERR {
|
typedef enum VPU_FRAME_ERR {
|
||||||
VPU_FRAME_ERR_UNKNOW = 0x0001,
|
VPU_FRAME_ERR_UNKNOW = 0x0001,
|
||||||
VPU_FRAME_ERR_UNSUPPORT = 0x0002,
|
VPU_FRAME_ERR_UNSUPPORT = 0x0002,
|
||||||
|
|
||||||
} VPU_FRAME_ERR;
|
} VPU_FRAME_ERR;
|
||||||
|
|
||||||
|
@@ -250,9 +250,9 @@ static MPP_RET init_vid_ctx(H264dVideoCtx_t *p_Vid)
|
|||||||
p_Vid->p_Dpb_layer[i]->layer_id = i;
|
p_Vid->p_Dpb_layer[i]->layer_id = i;
|
||||||
p_Vid->p_Dpb_layer[i]->p_Vid = p_Vid;
|
p_Vid->p_Dpb_layer[i]->p_Vid = p_Vid;
|
||||||
p_Vid->p_Dpb_layer[i]->init_done = 0;
|
p_Vid->p_Dpb_layer[i]->init_done = 0;
|
||||||
memset(&p_Vid->outlist[i], 0, sizeof(p_Vid->outlist[i]));
|
memset(&p_Vid->outlist[i], 0, sizeof(p_Vid->outlist[i]));
|
||||||
p_Vid->outlist[i].max_size = MAX_MARK_SIZE;
|
p_Vid->outlist[i].max_size = MAX_MARK_SIZE;
|
||||||
p_Vid->last_outputpoc[i] = -1;
|
p_Vid->last_outputpoc[i] = -1;
|
||||||
}
|
}
|
||||||
//!< init video pars
|
//!< init video pars
|
||||||
for (i = 0; i < MAXSPS; i++) {
|
for (i = 0; i < MAXSPS; i++) {
|
||||||
@@ -274,7 +274,7 @@ static MPP_RET init_vid_ctx(H264dVideoCtx_t *p_Vid)
|
|||||||
p_Vid->subspsSet[i].num_views_minus1 = -1;
|
p_Vid->subspsSet[i].num_views_minus1 = -1;
|
||||||
p_Vid->subspsSet[i].num_level_values_signalled_minus1 = -1;
|
p_Vid->subspsSet[i].num_level_values_signalled_minus1 = -1;
|
||||||
}
|
}
|
||||||
p_Vid->has_get_i_frame_flag = 0;
|
p_Vid->has_get_i_frame_flag = 0;
|
||||||
FunctionOut(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Vid->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
@@ -306,7 +306,7 @@ static MPP_RET init_dxva_ctx(H264dDxvaCtx_t *p_dxva)
|
|||||||
|
|
||||||
INP_CHECK(ret, !p_dxva);
|
INP_CHECK(ret, !p_dxva);
|
||||||
FunctionIn(p_dxva->p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_dxva->p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
p_dxva->slice_count = 0;
|
p_dxva->slice_count = 0;
|
||||||
p_dxva->max_slice_size = MAX_SLICE_SIZE;
|
p_dxva->max_slice_size = MAX_SLICE_SIZE;
|
||||||
p_dxva->max_strm_size = FRAME_BUF_MAX_SIZE;
|
p_dxva->max_strm_size = FRAME_BUF_MAX_SIZE;
|
||||||
p_dxva->slice_long = mpp_calloc(DXVA_Slice_H264_Long, p_dxva->max_slice_size);
|
p_dxva->slice_long = mpp_calloc(DXVA_Slice_H264_Long, p_dxva->max_slice_size);
|
||||||
@@ -352,17 +352,17 @@ static MPP_RET init_dec_ctx(H264_DecCtx_t *p_Dec)
|
|||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
p_Dec->mem = mpp_calloc(H264_DecMem_t, 1);
|
p_Dec->mem = mpp_calloc(H264_DecMem_t, 1);
|
||||||
MEM_CHECK(ret, p_Dec->mem);
|
MEM_CHECK(ret, p_Dec->mem);
|
||||||
p_Dec->dpb_mark = p_Dec->mem->dpb_mark; //!< for write out, MAX_DPB_SIZE
|
p_Dec->dpb_mark = p_Dec->mem->dpb_mark; //!< for write out, MAX_DPB_SIZE
|
||||||
p_Dec->dpb_info = p_Dec->mem->dpb_info; //!< 16
|
p_Dec->dpb_info = p_Dec->mem->dpb_info; //!< 16
|
||||||
p_Dec->dpb_old[0] = p_Dec->mem->dpb_old[0];
|
p_Dec->dpb_old[0] = p_Dec->mem->dpb_old[0];
|
||||||
p_Dec->dpb_old[1] = p_Dec->mem->dpb_old[1];
|
p_Dec->dpb_old[1] = p_Dec->mem->dpb_old[1];
|
||||||
p_Dec->refpic_info_p = p_Dec->mem->refpic_info_p; //!< 32
|
p_Dec->refpic_info_p = p_Dec->mem->refpic_info_p; //!< 32
|
||||||
p_Dec->refpic_info_b[0] = p_Dec->mem->refpic_info_b[0]; //!< [2][32]
|
p_Dec->refpic_info_b[0] = p_Dec->mem->refpic_info_b[0]; //!< [2][32]
|
||||||
p_Dec->refpic_info_b[1] = p_Dec->mem->refpic_info_b[1]; //!< [2][32]
|
p_Dec->refpic_info_b[1] = p_Dec->mem->refpic_info_b[1]; //!< [2][32]
|
||||||
//!< init dxva memory
|
//!< init dxva memory
|
||||||
p_Dec->mem->dxva_ctx.p_Dec = p_Dec;
|
p_Dec->mem->dxva_ctx.p_Dec = p_Dec;
|
||||||
FUN_CHECK(ret = init_dxva_ctx(&p_Dec->mem->dxva_ctx));
|
FUN_CHECK(ret = init_dxva_ctx(&p_Dec->mem->dxva_ctx));
|
||||||
p_Dec->dxva_ctx = &p_Dec->mem->dxva_ctx;
|
p_Dec->dxva_ctx = &p_Dec->mem->dxva_ctx;
|
||||||
//!< init Dpb_memory Mark, for fpga check
|
//!< init Dpb_memory Mark, for fpga check
|
||||||
for (i = 0; i < MAX_MARK_SIZE; i++) {
|
for (i = 0; i < MAX_MARK_SIZE; i++) {
|
||||||
p_Dec->dpb_mark[i].top_used = 0;
|
p_Dec->dpb_mark[i].top_used = 0;
|
||||||
@@ -372,18 +372,18 @@ static MPP_RET init_dec_ctx(H264_DecCtx_t *p_Dec)
|
|||||||
p_Dec->dpb_mark[i].pic = NULL;
|
p_Dec->dpb_mark[i].pic = NULL;
|
||||||
mpp_frame_init(&p_Dec->dpb_mark[i].frame);
|
mpp_frame_init(&p_Dec->dpb_mark[i].frame);
|
||||||
}
|
}
|
||||||
mpp_buf_slot_setup(p_Dec->frame_slots, MAX_MARK_SIZE);
|
mpp_buf_slot_setup(p_Dec->frame_slots, MAX_MARK_SIZE);
|
||||||
//!< malloc mpp packet
|
//!< malloc mpp packet
|
||||||
mpp_packet_init(&p_Dec->task_pkt, p_Dec->dxva_ctx->bitstream, p_Dec->dxva_ctx->max_strm_size);
|
mpp_packet_init(&p_Dec->task_pkt, p_Dec->dxva_ctx->bitstream, p_Dec->dxva_ctx->max_strm_size);
|
||||||
MEM_CHECK(ret, p_Dec->task_pkt);
|
MEM_CHECK(ret, p_Dec->task_pkt);
|
||||||
//!< memset error context
|
//!< memset error context
|
||||||
memset(&p_Dec->err_ctx, 0, sizeof(H264dErrCtx_t));
|
memset(&p_Dec->err_ctx, 0, sizeof(H264dErrCtx_t));
|
||||||
//!< set Dec support decoder method
|
//!< set Dec support decoder method
|
||||||
p_Dec->spt_decode_mtds = MPP_DEC_BY_FRAME;
|
p_Dec->spt_decode_mtds = MPP_DEC_BY_FRAME;
|
||||||
p_Dec->next_state = SliceSTATE_ResetSlice;
|
p_Dec->next_state = SliceSTATE_ResetSlice;
|
||||||
p_Dec->nalu_ret = NALU_NULL;
|
p_Dec->nalu_ret = NALU_NULL;
|
||||||
p_Dec->is_first_frame = 1;
|
p_Dec->is_first_frame = 1;
|
||||||
p_Dec->last_frame_slot_idx = -1;
|
p_Dec->last_frame_slot_idx = -1;
|
||||||
|
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
@@ -396,20 +396,20 @@ __FAILED:
|
|||||||
#if 0
|
#if 0
|
||||||
static void get_pkt_timestamp(H264dCurStream_t *p_strm, H264dInputCtx_t *p_Inp, MppPacket pkt)
|
static void get_pkt_timestamp(H264dCurStream_t *p_strm, H264dInputCtx_t *p_Inp, MppPacket pkt)
|
||||||
{
|
{
|
||||||
H264dTimeStamp_t *p_last = NULL, *p_curr = NULL;
|
H264dTimeStamp_t *p_last = NULL, *p_curr = NULL;
|
||||||
|
|
||||||
if (!p_Inp->in_length){
|
if (!p_Inp->in_length) {
|
||||||
p_last = &p_strm->pkt_ts[p_strm->pkt_ts_idx];
|
p_last = &p_strm->pkt_ts[p_strm->pkt_ts_idx];
|
||||||
p_strm->pkt_ts_idx = (p_strm->pkt_ts_idx + 1) % MAX_PTS_NUM ;
|
p_strm->pkt_ts_idx = (p_strm->pkt_ts_idx + 1) % MAX_PTS_NUM ;
|
||||||
p_curr = &p_strm->pkt_ts[p_strm->pkt_ts_idx];
|
p_curr = &p_strm->pkt_ts[p_strm->pkt_ts_idx];
|
||||||
|
|
||||||
p_curr->begin_off = p_last->end_off;
|
p_curr->begin_off = p_last->end_off;
|
||||||
p_curr->end_off = p_curr->begin_off + mpp_packet_get_length(pkt);
|
p_curr->end_off = p_curr->begin_off + mpp_packet_get_length(pkt);
|
||||||
p_curr->pts = mpp_packet_get_pts(pkt);
|
p_curr->pts = mpp_packet_get_pts(pkt);
|
||||||
p_curr->dts = mpp_packet_get_dts(pkt);
|
p_curr->dts = mpp_packet_get_dts(pkt);
|
||||||
|
|
||||||
//mpp_log("[init_pts] prepare_pts=%lld, g_framecnt=%d \n",p_curr->pts, p_Inp->p_Vid->g_framecnt);
|
//mpp_log("[init_pts] prepare_pts=%lld, g_framecnt=%d \n",p_curr->pts, p_Inp->p_Vid->g_framecnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -474,7 +474,7 @@ MPP_RET h264d_deinit(void *decoder)
|
|||||||
|
|
||||||
INP_CHECK(ret, !decoder);
|
INP_CHECK(ret, !decoder);
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
h264d_flush(decoder);
|
h264d_flush(decoder);
|
||||||
free_input_ctx(p_Dec->p_Inp);
|
free_input_ctx(p_Dec->p_Inp);
|
||||||
MPP_FREE(p_Dec->p_Inp);
|
MPP_FREE(p_Dec->p_Inp);
|
||||||
free_cur_ctx(p_Dec->p_Cur);
|
free_cur_ctx(p_Dec->p_Cur);
|
||||||
@@ -499,7 +499,7 @@ MPP_RET h264d_reset(void *decoder)
|
|||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
||||||
H264dCurStream_t *p_strm = NULL;
|
H264dCurStream_t *p_strm = NULL;
|
||||||
|
|
||||||
INP_CHECK(ret, !decoder);
|
INP_CHECK(ret, !decoder);
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
@@ -508,24 +508,24 @@ MPP_RET h264d_reset(void *decoder)
|
|||||||
//!< reset input parameter
|
//!< reset input parameter
|
||||||
p_Dec->p_Inp->in_buf = NULL;
|
p_Dec->p_Inp->in_buf = NULL;
|
||||||
p_Dec->p_Inp->pkt_eos = 0;
|
p_Dec->p_Inp->pkt_eos = 0;
|
||||||
p_Dec->p_Inp->task_eos = 0;
|
p_Dec->p_Inp->task_eos = 0;
|
||||||
p_Dec->p_Inp->in_pts = 0;
|
p_Dec->p_Inp->in_pts = 0;
|
||||||
p_Dec->p_Inp->in_dts = 0;
|
p_Dec->p_Inp->in_dts = 0;
|
||||||
p_Dec->p_Inp->out_buf = NULL;
|
p_Dec->p_Inp->out_buf = NULL;
|
||||||
p_Dec->p_Inp->out_length = 0;
|
p_Dec->p_Inp->out_length = 0;
|
||||||
p_Dec->p_Inp->has_get_eos = 0;
|
p_Dec->p_Inp->has_get_eos = 0;
|
||||||
//!< reset video parameter
|
//!< reset video parameter
|
||||||
p_Dec->p_Vid->g_framecnt = 0;
|
p_Dec->p_Vid->g_framecnt = 0;
|
||||||
p_Dec->p_Vid->last_outputpoc[0] = -1;
|
p_Dec->p_Vid->last_outputpoc[0] = -1;
|
||||||
p_Dec->p_Vid->last_outputpoc[1] = -1;
|
p_Dec->p_Vid->last_outputpoc[1] = -1;
|
||||||
p_Dec->p_Vid->has_get_i_frame_flag = 0;
|
p_Dec->p_Vid->has_get_i_frame_flag = 0;
|
||||||
//!< reset current time stamp
|
//!< reset current time stamp
|
||||||
p_Dec->p_Cur->last_dts = 0;
|
p_Dec->p_Cur->last_dts = 0;
|
||||||
p_Dec->p_Cur->last_pts = 0;
|
p_Dec->p_Cur->last_pts = 0;
|
||||||
p_Dec->p_Cur->curr_dts = 0;
|
p_Dec->p_Cur->curr_dts = 0;
|
||||||
p_Dec->p_Cur->curr_pts = 0;
|
p_Dec->p_Cur->curr_pts = 0;
|
||||||
//!< reset current stream
|
//!< reset current stream
|
||||||
p_strm = &p_Dec->p_Cur->strm;
|
p_strm = &p_Dec->p_Cur->strm;
|
||||||
p_strm->prefixdata[0] = 0xff;
|
p_strm->prefixdata[0] = 0xff;
|
||||||
p_strm->prefixdata[1] = 0xff;
|
p_strm->prefixdata[1] = 0xff;
|
||||||
p_strm->prefixdata[2] = 0xff;
|
p_strm->prefixdata[2] = 0xff;
|
||||||
@@ -534,10 +534,10 @@ MPP_RET h264d_reset(void *decoder)
|
|||||||
p_strm->head_offset = 0;
|
p_strm->head_offset = 0;
|
||||||
p_strm->startcode_found = 0;
|
p_strm->startcode_found = 0;
|
||||||
p_strm->endcode_found = 0;
|
p_strm->endcode_found = 0;
|
||||||
p_strm->pkt_ts_idx = 0;
|
p_strm->pkt_ts_idx = 0;
|
||||||
p_strm->pkt_used_bytes = 0;
|
p_strm->pkt_used_bytes = 0;
|
||||||
p_strm->startcode_found = p_Dec->p_Inp->is_nalff;
|
p_strm->startcode_found = p_Dec->p_Inp->is_nalff;
|
||||||
memset(p_strm->pkt_ts, 0, MAX_PTS_NUM*sizeof(H264dTimeStamp_t));
|
memset(p_strm->pkt_ts, 0, MAX_PTS_NUM * sizeof(H264dTimeStamp_t));
|
||||||
//!< reset decoder parameter
|
//!< reset decoder parameter
|
||||||
p_Dec->next_state = SliceSTATE_ResetSlice;
|
p_Dec->next_state = SliceSTATE_ResetSlice;
|
||||||
p_Dec->nalu_ret = NALU_NULL;
|
p_Dec->nalu_ret = NALU_NULL;
|
||||||
@@ -547,15 +547,15 @@ MPP_RET h264d_reset(void *decoder)
|
|||||||
p_Dec->dxva_ctx->strm_offset = 0;
|
p_Dec->dxva_ctx->strm_offset = 0;
|
||||||
p_Dec->dxva_ctx->slice_count = 0;
|
p_Dec->dxva_ctx->slice_count = 0;
|
||||||
|
|
||||||
memset(p_Dec->dpb_old[0], 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
memset(p_Dec->dpb_old[0], 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
||||||
memset(p_Dec->dpb_old[1], 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
memset(p_Dec->dpb_old[1], 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
||||||
|
|
||||||
//!< reset dpb
|
//!< reset dpb
|
||||||
FUN_CHECK(ret = flush_dpb(p_Dec->p_Vid->p_Dpb_layer[0], 1));
|
FUN_CHECK(ret = flush_dpb(p_Dec->p_Vid->p_Dpb_layer[0], 1));
|
||||||
FUN_CHECK(ret = init_dpb(p_Dec->p_Vid, p_Dec->p_Vid->p_Dpb_layer[0], 1));
|
FUN_CHECK(ret = init_dpb(p_Dec->p_Vid, p_Dec->p_Vid->p_Dpb_layer[0], 1));
|
||||||
if (p_Dec->mvc_valid)
|
if (p_Dec->mvc_valid) {
|
||||||
{ // layer_id == 1
|
// layer_id == 1
|
||||||
FUN_CHECK(ret = flush_dpb(p_Dec->p_Vid->p_Dpb_layer[1], 1));
|
FUN_CHECK(ret = flush_dpb(p_Dec->p_Vid->p_Dpb_layer[1], 1));
|
||||||
FUN_CHECK(ret = init_dpb(p_Dec->p_Vid, p_Dec->p_Vid->p_Dpb_layer[1], 2));
|
FUN_CHECK(ret = init_dpb(p_Dec->p_Vid, p_Dec->p_Vid->p_Dpb_layer[1], 2));
|
||||||
}
|
}
|
||||||
for (i = 0; i < MAX_MARK_SIZE; i++) {
|
for (i = 0; i < MAX_MARK_SIZE; i++) {
|
||||||
@@ -564,7 +564,7 @@ MPP_RET h264d_reset(void *decoder)
|
|||||||
p_Dec->dpb_mark[i].slot_idx = -1;
|
p_Dec->dpb_mark[i].slot_idx = -1;
|
||||||
p_Dec->dpb_mark[i].pic = NULL;
|
p_Dec->dpb_mark[i].pic = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
__RETURN:
|
__RETURN:
|
||||||
@@ -583,26 +583,26 @@ MPP_RET h264d_flush(void *decoder)
|
|||||||
{
|
{
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
||||||
//MppFrame m_frame;
|
//MppFrame m_frame;
|
||||||
INP_CHECK(ret, !decoder);
|
INP_CHECK(ret, !decoder);
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
FUN_CHECK(ret = flush_dpb(p_Dec->p_Vid->p_Dpb_layer[0], 1));
|
FUN_CHECK(ret = flush_dpb(p_Dec->p_Vid->p_Dpb_layer[0], 1));
|
||||||
FUN_CHECK(ret = init_dpb(p_Dec->p_Vid, p_Dec->p_Vid->p_Dpb_layer[0], 1));
|
FUN_CHECK(ret = init_dpb(p_Dec->p_Vid, p_Dec->p_Vid->p_Dpb_layer[0], 1));
|
||||||
//free_dpb(p_Dec->p_Vid->p_Dpb_layer[0]);
|
//free_dpb(p_Dec->p_Vid->p_Dpb_layer[0]);
|
||||||
if (p_Dec->mvc_valid)
|
if (p_Dec->mvc_valid) {
|
||||||
{ // layer_id == 1
|
// layer_id == 1
|
||||||
|
|
||||||
FUN_CHECK(ret = flush_dpb(p_Dec->p_Vid->p_Dpb_layer[1], 2));
|
FUN_CHECK(ret = flush_dpb(p_Dec->p_Vid->p_Dpb_layer[1], 2));
|
||||||
FUN_CHECK(ret = init_dpb(p_Dec->p_Vid, p_Dec->p_Vid->p_Dpb_layer[1], 2));
|
FUN_CHECK(ret = init_dpb(p_Dec->p_Vid, p_Dec->p_Vid->p_Dpb_layer[1], 2));
|
||||||
//free_dpb(p_Dec->p_Vid->p_Dpb_layer[1]);
|
//free_dpb(p_Dec->p_Vid->p_Dpb_layer[1]);
|
||||||
flush_muti_view_output(p_Dec->frame_slots, p_Dec->p_Vid->outlist, p_Dec->p_Vid);
|
flush_muti_view_output(p_Dec->frame_slots, p_Dec->p_Vid->outlist, p_Dec->p_Vid);
|
||||||
}
|
}
|
||||||
H264D_LOG("[FLUSH] -------- flush over.------, task_eos=%d, last_slot_idx=%d", p_Dec->p_Inp->task_eos, p_Dec->last_frame_slot_idx);
|
H264D_LOG("[FLUSH] -------- flush over.------, task_eos=%d, last_slot_idx=%d", p_Dec->p_Inp->task_eos, p_Dec->last_frame_slot_idx);
|
||||||
|
|
||||||
//mpp_buf_slot_get_prop(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_FRAME_PTR, &m_frame);
|
//mpp_buf_slot_get_prop(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_FRAME_PTR, &m_frame);
|
||||||
mpp_buf_slot_set_prop(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_EOS, &p_Dec->p_Inp->task_eos);
|
mpp_buf_slot_set_prop(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_EOS, &p_Dec->p_Inp->task_eos);
|
||||||
FPRINT(g_debug_file0, "[FLUSH] -------- flush over.------\n");
|
FPRINT(g_debug_file0, "[FLUSH] -------- flush over.------\n");
|
||||||
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
@@ -647,83 +647,83 @@ MPP_RET h264d_prepare(void *decoder, MppPacket pkt, HalDecTask *task)
|
|||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
//LogTrace(logctx, "Prepare In:len=%d, valid=%d ", mpp_packet_get_length(pkt), task->valid);
|
//LogTrace(logctx, "Prepare In:len=%d, valid=%d ", mpp_packet_get_length(pkt), task->valid);
|
||||||
|
|
||||||
if (p_Dec->p_Inp->has_get_eos || p_Dec->err_ctx.err_flag) {
|
if (p_Dec->p_Inp->has_get_eos || p_Dec->err_ctx.err_flag) {
|
||||||
((MppPacketImpl *)pkt)->length = 0;
|
((MppPacketImpl *)pkt)->length = 0;
|
||||||
goto __RETURN;
|
goto __RETURN;
|
||||||
}
|
}
|
||||||
p_Dec->p_Inp->in_pkt = pkt;
|
p_Dec->p_Inp->in_pkt = pkt;
|
||||||
p_Dec->p_Inp->in_pts = mpp_packet_get_pts(pkt);
|
p_Dec->p_Inp->in_pts = mpp_packet_get_pts(pkt);
|
||||||
p_Dec->p_Inp->in_dts = mpp_packet_get_dts(pkt);
|
p_Dec->p_Inp->in_dts = mpp_packet_get_dts(pkt);
|
||||||
//get_pkt_timestamp(&p_Dec->p_Cur->strm, p_Dec->p_Inp, pkt);
|
//get_pkt_timestamp(&p_Dec->p_Cur->strm, p_Dec->p_Inp, pkt);
|
||||||
|
|
||||||
if (mpp_packet_get_eos(pkt)) {
|
if (mpp_packet_get_eos(pkt)) {
|
||||||
p_Dec->p_Inp->in_buf = NULL;
|
p_Dec->p_Inp->in_buf = NULL;
|
||||||
p_Dec->p_Inp->in_length = 0;
|
p_Dec->p_Inp->in_length = 0;
|
||||||
p_Dec->p_Inp->pkt_eos = 1;
|
p_Dec->p_Inp->pkt_eos = 1;
|
||||||
p_Dec->p_Inp->has_get_eos = 1;
|
p_Dec->p_Inp->has_get_eos = 1;
|
||||||
} else {
|
} else {
|
||||||
p_Dec->p_Inp->in_buf = (RK_U8 *)mpp_packet_get_pos(pkt);
|
p_Dec->p_Inp->in_buf = (RK_U8 *)mpp_packet_get_pos(pkt);
|
||||||
p_Dec->p_Inp->in_length = mpp_packet_get_length(pkt);
|
p_Dec->p_Inp->in_length = mpp_packet_get_length(pkt);
|
||||||
p_Dec->p_Inp->pkt_eos = 0;
|
p_Dec->p_Inp->pkt_eos = 0;
|
||||||
|
|
||||||
FPRINT(g_debug_file1, "[nal_ff_data] %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
FPRINT(g_debug_file1, "[nal_ff_data] %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||||
p_Dec->p_Inp->in_buf[0],
|
p_Dec->p_Inp->in_buf[0],
|
||||||
p_Dec->p_Inp->in_buf[1],
|
p_Dec->p_Inp->in_buf[1],
|
||||||
p_Dec->p_Inp->in_buf[2],
|
p_Dec->p_Inp->in_buf[2],
|
||||||
p_Dec->p_Inp->in_buf[3],
|
p_Dec->p_Inp->in_buf[3],
|
||||||
p_Dec->p_Inp->in_buf[4],
|
p_Dec->p_Inp->in_buf[4],
|
||||||
p_Dec->p_Inp->in_buf[5],
|
p_Dec->p_Inp->in_buf[5],
|
||||||
p_Dec->p_Inp->in_buf[6],
|
p_Dec->p_Inp->in_buf[6],
|
||||||
p_Dec->p_Inp->in_buf[7],
|
p_Dec->p_Inp->in_buf[7],
|
||||||
p_Dec->p_Inp->in_buf[8]);
|
p_Dec->p_Inp->in_buf[8]);
|
||||||
}
|
}
|
||||||
//mpp_log("mpp_packet_get_flag(pkt)=%d\n", mpp_packet_get_flag(pkt));
|
//mpp_log("mpp_packet_get_flag(pkt)=%d\n", mpp_packet_get_flag(pkt));
|
||||||
|
|
||||||
if (mpp_packet_get_flag(pkt)& MPP_PACKET_FLAG_EXTRA_DATA) {
|
if (mpp_packet_get_flag(pkt)& MPP_PACKET_FLAG_EXTRA_DATA) {
|
||||||
RK_U8 *pdata = p_Dec->p_Inp->in_buf;
|
RK_U8 *pdata = p_Dec->p_Inp->in_buf;
|
||||||
p_Dec->p_Inp->is_nalff = (p_Dec->p_Inp->in_length > 3)&& (pdata[0] && pdata[1]);
|
p_Dec->p_Inp->is_nalff = (p_Dec->p_Inp->in_length > 3) && (pdata[0] && pdata[1]);
|
||||||
|
|
||||||
if (p_Dec->p_Inp->is_nalff) {
|
|
||||||
(ret = parse_prepare_extra_header(p_Dec->p_Inp, p_Dec->p_Cur));
|
|
||||||
goto __RETURN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//mpp_log("p_Dec->p_Inp->is_nalff=%d, len=%d \n", p_Dec->p_Inp->is_nalff, p_Dec->p_Inp->in_length);
|
|
||||||
|
|
||||||
//mpp_err("[timePkt_in] pts=%lld, dts=%lld", p_Dec->p_Inp->pts, p_Dec->p_Inp->dts);
|
if (p_Dec->p_Inp->is_nalff) {
|
||||||
|
(ret = parse_prepare_extra_header(p_Dec->p_Inp, p_Dec->p_Cur));
|
||||||
|
goto __RETURN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//mpp_log("p_Dec->p_Inp->is_nalff=%d, len=%d \n", p_Dec->p_Inp->is_nalff, p_Dec->p_Inp->in_length);
|
||||||
|
|
||||||
|
//mpp_err("[timePkt_in] pts=%lld, dts=%lld", p_Dec->p_Inp->pts, p_Dec->p_Inp->dts);
|
||||||
|
|
||||||
//LogTrace(logctx, "[Prepare_In] in_length=%d, eos=%d, g_framecnt=%d", mpp_packet_get_length(pkt), mpp_packet_get_eos(pkt), p_Dec->p_Vid->g_framecnt);
|
//LogTrace(logctx, "[Prepare_In] in_length=%d, eos=%d, g_framecnt=%d", mpp_packet_get_length(pkt), mpp_packet_get_eos(pkt), p_Dec->p_Vid->g_framecnt);
|
||||||
//FPRINT(g_debug_file0, "[Prepare_In] in_length=%d, eos=%d, g_framecnt=%d \n", mpp_packet_get_length(pkt), mpp_packet_get_eos(pkt), p_Dec->p_Vid->g_framecnt);
|
//FPRINT(g_debug_file0, "[Prepare_In] in_length=%d, eos=%d, g_framecnt=%d \n", mpp_packet_get_length(pkt), mpp_packet_get_eos(pkt), p_Dec->p_Vid->g_framecnt);
|
||||||
|
|
||||||
H264D_LOG("[ pkt_in timeUs ] p_Inp_is_nalff=%d, preprare input_pts=%lld, pkt_eos=%d, len=%d, g_framecnt=%d \n",
|
|
||||||
p_Dec->p_Inp->is_nalff, p_Dec->p_Inp->in_pts, p_Dec->p_Inp->pkt_eos, p_Dec->p_Inp->in_length, p_Dec->p_Vid->g_framecnt);
|
|
||||||
|
|
||||||
if (p_Dec->p_Inp->is_nalff) {
|
H264D_LOG("[ pkt_in timeUs ] p_Inp_is_nalff=%d, preprare input_pts=%lld, pkt_eos=%d, len=%d, g_framecnt=%d \n",
|
||||||
(ret = parse_prepare_extra_data(p_Dec->p_Inp, p_Dec->p_Cur));
|
p_Dec->p_Inp->is_nalff, p_Dec->p_Inp->in_pts, p_Dec->p_Inp->pkt_eos, p_Dec->p_Inp->in_length, p_Dec->p_Vid->g_framecnt);
|
||||||
task->valid = p_Dec->p_Inp->task_valid; //!< prepare valid flag
|
|
||||||
} else {
|
|
||||||
do{
|
|
||||||
(ret = parse_prepare_fast(p_Dec->p_Inp, p_Dec->p_Cur));
|
|
||||||
task->valid = p_Dec->p_Inp->task_valid; //!< prepare valid flag
|
|
||||||
//LogTrace(logctx, "[Prepare_Ing] length=%d, valid=%d,strm_off=%d, g_framecnt=%d", mpp_packet_get_length(pkt), task->valid, p_Dec->dxva_ctx->strm_offset, p_Dec->p_Vid->g_framecnt);
|
|
||||||
//FPRINT(g_debug_file0, "[Prepare_Ing] length=%d, valid=%d,strm_off=%d, g_framecnt=%d \n", mpp_packet_get_length(pkt), task->valid, p_Dec->dxva_ctx->strm_offset, p_Dec->p_Vid->g_framecnt);
|
|
||||||
|
|
||||||
}while(mpp_packet_get_length(pkt) && !task->valid);
|
if (p_Dec->p_Inp->is_nalff) {
|
||||||
}
|
(ret = parse_prepare_extra_data(p_Dec->p_Inp, p_Dec->p_Cur));
|
||||||
|
task->valid = p_Dec->p_Inp->task_valid; //!< prepare valid flag
|
||||||
|
} else {
|
||||||
|
do {
|
||||||
|
(ret = parse_prepare_fast(p_Dec->p_Inp, p_Dec->p_Cur));
|
||||||
|
task->valid = p_Dec->p_Inp->task_valid; //!< prepare valid flag
|
||||||
|
//LogTrace(logctx, "[Prepare_Ing] length=%d, valid=%d,strm_off=%d, g_framecnt=%d", mpp_packet_get_length(pkt), task->valid, p_Dec->dxva_ctx->strm_offset, p_Dec->p_Vid->g_framecnt);
|
||||||
|
//FPRINT(g_debug_file0, "[Prepare_Ing] length=%d, valid=%d,strm_off=%d, g_framecnt=%d \n", mpp_packet_get_length(pkt), task->valid, p_Dec->dxva_ctx->strm_offset, p_Dec->p_Vid->g_framecnt);
|
||||||
|
|
||||||
|
} while (mpp_packet_get_length(pkt) && !task->valid);
|
||||||
|
}
|
||||||
|
|
||||||
//LogTrace(logctx, "Prepare Out: len=%d, valid=%d ", mpp_packet_get_length(pkt), task->valid);
|
//LogTrace(logctx, "Prepare Out: len=%d, valid=%d ", mpp_packet_get_length(pkt), task->valid);
|
||||||
//mpp_log("Prepare Out: len=%d, valid=%d ", mpp_packet_get_length(pkt), task->valid);
|
//mpp_log("Prepare Out: len=%d, valid=%d ", mpp_packet_get_length(pkt), task->valid);
|
||||||
task->flags.eos = p_Dec->p_Inp->pkt_eos;
|
task->flags.eos = p_Dec->p_Inp->pkt_eos;
|
||||||
if (task->valid) {
|
if (task->valid) {
|
||||||
memset(p_Dec->dxva_ctx->bitstream + p_Dec->dxva_ctx->strm_offset, 0,
|
memset(p_Dec->dxva_ctx->bitstream + p_Dec->dxva_ctx->strm_offset, 0,
|
||||||
MPP_ALIGN(p_Dec->dxva_ctx->strm_offset, 16) - p_Dec->dxva_ctx->strm_offset);
|
MPP_ALIGN(p_Dec->dxva_ctx->strm_offset, 16) - p_Dec->dxva_ctx->strm_offset);
|
||||||
mpp_packet_set_data(p_Dec->task_pkt, p_Dec->dxva_ctx->bitstream);
|
mpp_packet_set_data(p_Dec->task_pkt, p_Dec->dxva_ctx->bitstream);
|
||||||
mpp_packet_set_length(p_Dec->task_pkt, MPP_ALIGN(p_Dec->dxva_ctx->strm_offset, 16));
|
mpp_packet_set_length(p_Dec->task_pkt, MPP_ALIGN(p_Dec->dxva_ctx->strm_offset, 16));
|
||||||
mpp_packet_set_size(p_Dec->task_pkt, p_Dec->dxva_ctx->max_strm_size);
|
mpp_packet_set_size(p_Dec->task_pkt, p_Dec->dxva_ctx->max_strm_size);
|
||||||
//LogTrace(logctx, "[Prepare_Out] ptr=%08x, stream_len=%d, max_size=%d", p_Dec->dxva_ctx->bitstream, p_Dec->dxva_ctx->strm_offset, p_Dec->dxva_ctx->max_strm_size);
|
//LogTrace(logctx, "[Prepare_Out] ptr=%08x, stream_len=%d, max_size=%d", p_Dec->dxva_ctx->bitstream, p_Dec->dxva_ctx->strm_offset, p_Dec->dxva_ctx->max_strm_size);
|
||||||
//mpp_log("[Prepare_Out] g_framecnt=%d, stream_len=%d \n", p_Dec->p_Vid->g_framecnt, p_Dec->dxva_ctx->strm_offset);
|
//mpp_log("[Prepare_Out] g_framecnt=%d, stream_len=%d \n", p_Dec->p_Vid->g_framecnt, p_Dec->dxva_ctx->strm_offset);
|
||||||
task->input_packet = p_Dec->task_pkt;
|
task->input_packet = p_Dec->task_pkt;
|
||||||
//task->flags.eos = p_Dec->p_Inp->pkt_eos;
|
//task->flags.eos = p_Dec->p_Inp->pkt_eos;
|
||||||
} else {
|
} else {
|
||||||
task->input_packet = NULL;
|
task->input_packet = NULL;
|
||||||
}
|
}
|
||||||
@@ -753,19 +753,19 @@ MPP_RET h264d_parse(void *decoder, HalDecTask *in_task)
|
|||||||
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;
|
||||||
|
|
||||||
FUN_CHECK(ret = parse_loop(p_Dec));
|
FUN_CHECK(ret = parse_loop(p_Dec));
|
||||||
|
|
||||||
if (p_Dec->is_parser_end) {
|
if (p_Dec->is_parser_end) {
|
||||||
p_Dec->is_parser_end = 0;
|
p_Dec->is_parser_end = 0;
|
||||||
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;
|
||||||
FUN_CHECK(ret = update_dpb(p_Dec));
|
FUN_CHECK(ret = update_dpb(p_Dec));
|
||||||
|
|
||||||
if (in_task->flags.eos) {
|
if (in_task->flags.eos) {
|
||||||
h264d_flush(decoder);
|
h264d_flush(decoder);
|
||||||
}
|
}
|
||||||
p_Dec->p_Vid->g_framecnt++;
|
p_Dec->p_Vid->g_framecnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
__RETURN:
|
__RETURN:
|
||||||
@@ -784,38 +784,38 @@ __FAILED:
|
|||||||
|
|
||||||
MPP_RET h264d_callback(void *decoder, void *err_info)
|
MPP_RET h264d_callback(void *decoder, void *err_info)
|
||||||
{
|
{
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
MppFrame m_frame;
|
MppFrame m_frame;
|
||||||
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
|
||||||
H264dErrCtx_t *ctx = (H264dErrCtx_t *)err_info;
|
H264dErrCtx_t *ctx = (H264dErrCtx_t *)err_info;
|
||||||
|
|
||||||
INP_CHECK(ret, !decoder && !err_info);
|
INP_CHECK(ret, !decoder && !err_info);
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
|
|
||||||
ctx->err_flag |= VPU_FRAME_ERR_UNSUPPORT;
|
ctx->err_flag |= VPU_FRAME_ERR_UNSUPPORT;
|
||||||
|
|
||||||
if(ctx->err_flag & VPU_FRAME_ERR_UNSUPPORT) {
|
if (ctx->err_flag & VPU_FRAME_ERR_UNSUPPORT) {
|
||||||
h264d_reset(decoder);
|
h264d_reset(decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_Dec->last_frame_slot_idx < 0) {
|
if (p_Dec->last_frame_slot_idx < 0) {
|
||||||
mpp_frame_init(&m_frame);
|
mpp_frame_init(&m_frame);
|
||||||
mpp_slots_get_prop(p_Dec->frame_slots, SLOTS_FRAME_INFO, m_frame);
|
mpp_slots_get_prop(p_Dec->frame_slots, SLOTS_FRAME_INFO, m_frame);
|
||||||
mpp_buf_slot_get_unused(p_Dec->frame_slots, &p_Dec->last_frame_slot_idx);
|
mpp_buf_slot_get_unused(p_Dec->frame_slots, &p_Dec->last_frame_slot_idx);
|
||||||
mpp_buf_slot_set_prop(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_FRAME, m_frame);
|
mpp_buf_slot_set_prop(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_FRAME, m_frame);
|
||||||
mpp_buf_slot_set_flag(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_QUEUE_USE);
|
mpp_buf_slot_set_flag(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_QUEUE_USE);
|
||||||
mpp_buf_slot_enqueue(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, QUEUE_DISPLAY);
|
mpp_buf_slot_enqueue(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, QUEUE_DISPLAY);
|
||||||
mpp_buf_slot_clr_flag(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_HAL_OUTPUT);
|
mpp_buf_slot_clr_flag(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_HAL_OUTPUT);
|
||||||
mpp_buf_slot_clr_flag(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_CODEC_USE);
|
mpp_buf_slot_clr_flag(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_CODEC_USE);
|
||||||
mpp_frame_deinit(&m_frame);
|
mpp_frame_deinit(&m_frame);
|
||||||
}
|
}
|
||||||
mpp_buf_slot_get_prop(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_FRAME_PTR, &m_frame);
|
mpp_buf_slot_get_prop(p_Dec->frame_slots, p_Dec->last_frame_slot_idx, SLOT_FRAME_PTR, &m_frame);
|
||||||
if (m_frame) {
|
if (m_frame) {
|
||||||
mpp_frame_set_errinfo(m_frame, ctx->err_flag);
|
mpp_frame_set_errinfo(m_frame, ctx->err_flag);
|
||||||
}
|
}
|
||||||
__RETURN:
|
__RETURN:
|
||||||
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
|
@@ -120,18 +120,18 @@ static RK_S32 getDpbSize(H264dVideoCtx_t *p_Vid, H264_SPS_t *active_sps)
|
|||||||
} else {
|
} else {
|
||||||
size = MPP_MIN(size, 16);
|
size = MPP_MIN(size, 16);
|
||||||
}
|
}
|
||||||
if (active_sps->vui_parameters_present_flag && active_sps->vui_seq_parameters.bitstream_restriction_flag) {
|
if (active_sps->vui_parameters_present_flag && active_sps->vui_seq_parameters.bitstream_restriction_flag) {
|
||||||
RK_S32 size_vui = 0;
|
RK_S32 size_vui = 0;
|
||||||
//if ((RK_S32)active_sps->vui_seq_parameters.max_dec_frame_buffering > size) {
|
//if ((RK_S32)active_sps->vui_seq_parameters.max_dec_frame_buffering > size) {
|
||||||
//H264D_LOG("max_dec_frame_buffering larger than MaxDpbSize");
|
//H264D_LOG("max_dec_frame_buffering larger than MaxDpbSize");
|
||||||
//}
|
//}
|
||||||
size_vui = MPP_MAX (1, active_sps->vui_seq_parameters.max_dec_frame_buffering);
|
size_vui = MPP_MAX (1, active_sps->vui_seq_parameters.max_dec_frame_buffering);
|
||||||
|
|
||||||
//if(size_vui < size) {
|
//if(size_vui < size) {
|
||||||
//H264D_LOG("Warning: max_dec_frame_buffering(%d) is less than DPB size(%d) calculated from Profile/Level.\n", size_vui, size);
|
//H264D_LOG("Warning: max_dec_frame_buffering(%d) is less than DPB size(%d) calculated from Profile/Level.\n", size_vui, size);
|
||||||
//}
|
//}
|
||||||
size = size_vui;
|
size = size_vui;
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ static void unmark_for_reference(H264_DecCtx_t *p_Dec, H264_FrameStore_t* fs)
|
|||||||
//mpp_buf_slot_clr_flag(p_Dec->frame_slots, cur_pic->mem_mark->slot_idx, SLOT_CODEC_USE);
|
//mpp_buf_slot_clr_flag(p_Dec->frame_slots, cur_pic->mem_mark->slot_idx, SLOT_CODEC_USE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)p_Dec;
|
(void)p_Dec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RK_U32 is_short_term_reference(H264_FrameStore_t* fs)
|
static RK_U32 is_short_term_reference(H264_FrameStore_t* fs)
|
||||||
@@ -632,9 +632,9 @@ static RK_U32 is_used_for_reference(H264_FrameStore_t* fs)
|
|||||||
|
|
||||||
static void free_dpb_mark(H264_DecCtx_t *p_Dec, H264_DpbMark_t *p, RK_S32 structure)
|
static void free_dpb_mark(H264_DecCtx_t *p_Dec, H264_DpbMark_t *p, RK_S32 structure)
|
||||||
{
|
{
|
||||||
MppFrame frame;
|
MppFrame frame;
|
||||||
RK_U64 pts;
|
RK_U64 pts;
|
||||||
RK_U32 poc;
|
RK_U32 poc;
|
||||||
|
|
||||||
if (structure == FRAME) {
|
if (structure == FRAME) {
|
||||||
p->top_used = (p->top_used > 0) ? (p->top_used - 1) : 0;
|
p->top_used = (p->top_used > 0) ? (p->top_used - 1) : 0;
|
||||||
@@ -644,26 +644,26 @@ static void free_dpb_mark(H264_DecCtx_t *p_Dec, H264_DpbMark_t *p, RK_S32 struct
|
|||||||
} else if (structure == BOTTOM_FIELD) {
|
} else if (structure == BOTTOM_FIELD) {
|
||||||
p->bot_used = (p->bot_used > 0) ? (p->bot_used - 1) : 0;
|
p->bot_used = (p->bot_used > 0) ? (p->bot_used - 1) : 0;
|
||||||
}
|
}
|
||||||
if (p->top_used == 0 && p->bot_used == 0
|
if (p->top_used == 0 && p->bot_used == 0
|
||||||
&& p->out_flag == 0 && (p->slot_idx >= 0)) {
|
&& p->out_flag == 0 && (p->slot_idx >= 0)) {
|
||||||
//if (p_Dec->p_Vid->g_framecnt == 692) {
|
//if (p_Dec->p_Vid->g_framecnt == 692) {
|
||||||
// p = p;
|
// p = p;
|
||||||
//}
|
//}
|
||||||
mpp_buf_slot_clr_flag(p_Dec->frame_slots, p->slot_idx, SLOT_CODEC_USE);
|
mpp_buf_slot_clr_flag(p_Dec->frame_slots, p->slot_idx, SLOT_CODEC_USE);
|
||||||
|
|
||||||
//mpp_buf_slot_clr_flag(p_Dec->frame_slots, p->slot_idx, SLOT_HAL_INPUT);
|
//mpp_buf_slot_clr_flag(p_Dec->frame_slots, p->slot_idx, SLOT_HAL_INPUT);
|
||||||
//mpp_buf_slot_clr_flag(p_Dec->frame_slots, p->slot_idx, SLOT_HAL_OUTPUT);
|
//mpp_buf_slot_clr_flag(p_Dec->frame_slots, p->slot_idx, SLOT_HAL_OUTPUT);
|
||||||
//mpp_buf_slot_clr_flag(p_Dec->frame_slots, p->slot_idx, SLOT_QUEUE_USE);
|
//mpp_buf_slot_clr_flag(p_Dec->frame_slots, p->slot_idx, SLOT_QUEUE_USE);
|
||||||
mpp_buf_slot_get_prop(p_Dec->frame_slots, p->slot_idx, SLOT_FRAME_PTR, &frame);
|
mpp_buf_slot_get_prop(p_Dec->frame_slots, p->slot_idx, SLOT_FRAME_PTR, &frame);
|
||||||
pts = frame ? mpp_frame_get_pts(frame) : 0;
|
pts = frame ? mpp_frame_get_pts(frame) : 0;
|
||||||
poc = frame ? mpp_frame_get_poc(frame) : 0;
|
poc = frame ? mpp_frame_get_poc(frame) : 0;
|
||||||
H264D_LOG("[FREE] g_frame_no=%d, structure=%d, mark_idx=%d, slot_idx=%d, poc=%d, pts=%lld, %p \n",
|
H264D_LOG("[FREE] g_frame_no=%d, structure=%d, mark_idx=%d, slot_idx=%d, poc=%d, pts=%lld, %p \n",
|
||||||
p_Dec->p_Vid->g_framecnt, structure, p->mark_idx, p->slot_idx, poc, pts, frame);
|
p_Dec->p_Vid->g_framecnt, structure, p->mark_idx, p->slot_idx, poc, pts, frame);
|
||||||
//mpp_print_slot_flag_info(g_debug_file1, p_Dec->frame_slots, p->slot_idx);
|
//mpp_print_slot_flag_info(g_debug_file1, p_Dec->frame_slots, p->slot_idx);
|
||||||
|
|
||||||
|
(void)pts;
|
||||||
|
(void)poc;
|
||||||
|
|
||||||
(void)pts;
|
|
||||||
(void)poc;
|
|
||||||
|
|
||||||
p->slot_idx = -1;
|
p->slot_idx = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -841,145 +841,142 @@ __FAILED:
|
|||||||
|
|
||||||
static void muti_view_output(MppBufSlots frame_slots, H264_DpbMark_t *p_mark, H264dVideoCtx_t *p_Vid)
|
static void muti_view_output(MppBufSlots frame_slots, H264_DpbMark_t *p_mark, H264dVideoCtx_t *p_Vid)
|
||||||
{
|
{
|
||||||
//!< add slot
|
//!< add slot
|
||||||
{
|
{
|
||||||
MppFrame frame;
|
MppFrame frame;
|
||||||
RK_S32 layer_id = -1;
|
RK_S32 layer_id = -1;
|
||||||
H264dOutList_t *p_cur = NULL;
|
H264dOutList_t *p_cur = NULL;
|
||||||
|
|
||||||
mpp_buf_slot_get_prop(frame_slots, p_mark->slot_idx, SLOT_FRAME_PTR, &frame);
|
mpp_buf_slot_get_prop(frame_slots, p_mark->slot_idx, SLOT_FRAME_PTR, &frame);
|
||||||
layer_id = mpp_frame_get_viewid(frame);
|
layer_id = mpp_frame_get_viewid(frame);
|
||||||
H264D_LOG("[Write_picture] frame_%d_pts=%lld \n", layer_id, mpp_frame_get_pts(frame));
|
H264D_LOG("[Write_picture] frame_%d_pts=%lld \n", layer_id, mpp_frame_get_pts(frame));
|
||||||
p_cur = &p_Vid->outlist[layer_id];
|
p_cur = &p_Vid->outlist[layer_id];
|
||||||
p_cur->list[p_cur->end] = p_mark;
|
p_cur->list[p_cur->end] = p_mark;
|
||||||
p_cur->end = (p_cur->end + 1) % p_cur->max_size;
|
p_cur->end = (p_cur->end + 1) % p_cur->max_size;
|
||||||
}
|
}
|
||||||
//!< enqueue
|
//!< enqueue
|
||||||
{
|
{
|
||||||
RK_S64 pts = 0;
|
RK_S64 pts = 0;
|
||||||
MppFrame frame0;
|
MppFrame frame0;
|
||||||
MppFrame frame1;
|
MppFrame frame1;
|
||||||
H264_DpbMark_t *p_mark0 = NULL;
|
H264_DpbMark_t *p_mark0 = NULL;
|
||||||
H264_DpbMark_t *p_mark1 = NULL;
|
H264_DpbMark_t *p_mark1 = NULL;
|
||||||
H264dOutList_t *p_out[MAX_NUM_DPB_LAYERS] = { NULL };
|
H264dOutList_t *p_out[MAX_NUM_DPB_LAYERS] = { NULL };
|
||||||
|
|
||||||
p_out[0] = &p_Vid->outlist[0];
|
p_out[0] = &p_Vid->outlist[0];
|
||||||
p_out[1] = &p_Vid->outlist[1];
|
p_out[1] = &p_Vid->outlist[1];
|
||||||
|
|
||||||
p_mark0 = p_out[0]->list[p_out[0]->begin];
|
p_mark0 = p_out[0]->list[p_out[0]->begin];
|
||||||
p_mark1 = p_out[1]->list[p_out[1]->begin];
|
p_mark1 = p_out[1]->list[p_out[1]->begin];
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
while (p_mark0 && p_mark1) {
|
while (p_mark0 && p_mark1) {
|
||||||
mpp_buf_slot_get_prop(frame_slots, p_mark0->slot_idx, SLOT_FRAME_PTR, &frame0);
|
mpp_buf_slot_get_prop(frame_slots, p_mark0->slot_idx, SLOT_FRAME_PTR, &frame0);
|
||||||
mpp_buf_slot_get_prop(frame_slots, p_mark1->slot_idx, SLOT_FRAME_PTR, &frame1);
|
mpp_buf_slot_get_prop(frame_slots, p_mark1->slot_idx, SLOT_FRAME_PTR, &frame1);
|
||||||
|
|
||||||
if (mpp_frame_get_poc(frame0) == mpp_frame_get_poc(frame1)) {
|
if (mpp_frame_get_poc(frame0) == mpp_frame_get_poc(frame1)) {
|
||||||
H264D_LOG("[Write_picture] mark0_poc == mark1_poc \n");
|
H264D_LOG("[Write_picture] mark0_poc == mark1_poc \n");
|
||||||
|
|
||||||
pts = MPP_MIN(mpp_frame_get_pts(frame0), mpp_frame_get_pts(frame1));
|
pts = MPP_MIN(mpp_frame_get_pts(frame0), mpp_frame_get_pts(frame1));
|
||||||
mpp_frame_set_pts(frame0, pts);
|
mpp_frame_set_pts(frame0, pts);
|
||||||
mpp_frame_set_pts(frame1, pts);
|
mpp_frame_set_pts(frame1, pts);
|
||||||
mpp_buf_slot_enqueue(frame_slots, p_mark0->slot_idx, QUEUE_DISPLAY);
|
mpp_buf_slot_enqueue(frame_slots, p_mark0->slot_idx, QUEUE_DISPLAY);
|
||||||
mpp_buf_slot_enqueue(frame_slots, p_mark1->slot_idx, QUEUE_DISPLAY);
|
mpp_buf_slot_enqueue(frame_slots, p_mark1->slot_idx, QUEUE_DISPLAY);
|
||||||
|
|
||||||
H264D_LOG("[Write_picture] begin0=%d, end0=%d, begin1=%d, end1=%d, frame0_pts=%lld,%p,%p,frame1_pts=%lld,%p,%p \n",
|
H264D_LOG("[Write_picture] begin0=%d, end0=%d, begin1=%d, end1=%d, frame0_pts=%lld,%p,%p,frame1_pts=%lld,%p,%p \n",
|
||||||
p_out[0]->begin, p_out[0]->end, p_out[1]->begin, p_out[1]->end, mpp_frame_get_pts(frame0), frame0, p_mark0->frame, mpp_frame_get_pts(frame1), frame1, p_mark1->frame);
|
p_out[0]->begin, p_out[0]->end, p_out[1]->begin, p_out[1]->end, mpp_frame_get_pts(frame0), frame0, p_mark0->frame, mpp_frame_get_pts(frame1), frame1, p_mark1->frame);
|
||||||
|
|
||||||
p_mark0->out_flag = 0;
|
p_mark0->out_flag = 0;
|
||||||
p_mark1->out_flag = 0;
|
p_mark1->out_flag = 0;
|
||||||
p_Vid->p_Dec->last_frame_slot_idx = p_mark1->slot_idx;
|
p_Vid->p_Dec->last_frame_slot_idx = p_mark1->slot_idx;
|
||||||
|
|
||||||
free_dpb_mark(p_Vid->p_Dec, p_mark0, FRAME);
|
free_dpb_mark(p_Vid->p_Dec, p_mark0, FRAME);
|
||||||
free_dpb_mark(p_Vid->p_Dec, p_mark1, FRAME);
|
free_dpb_mark(p_Vid->p_Dec, p_mark1, FRAME);
|
||||||
p_out[0]->list[p_out[0]->begin] = NULL;
|
p_out[0]->list[p_out[0]->begin] = NULL;
|
||||||
p_out[1]->list[p_out[1]->begin] = NULL;
|
p_out[1]->list[p_out[1]->begin] = NULL;
|
||||||
p_out[0]->begin = (p_out[0]->begin + 1) % p_out[0]->max_size;
|
p_out[0]->begin = (p_out[0]->begin + 1) % p_out[0]->max_size;
|
||||||
p_out[1]->begin = (p_out[1]->begin + 1) % p_out[1]->max_size;
|
p_out[1]->begin = (p_out[1]->begin + 1) % p_out[1]->max_size;
|
||||||
}
|
} else if (mpp_frame_get_poc(frame0) > mpp_frame_get_poc(frame1)) {
|
||||||
else if (mpp_frame_get_poc(frame0) > mpp_frame_get_poc(frame1)) {
|
H264D_LOG("[Write_picture] p_mark0->poc > p_mark1->poc \n");
|
||||||
H264D_LOG("[Write_picture] p_mark0->poc > p_mark1->poc \n");
|
mpp_buf_slot_enqueue(frame_slots, p_mark1->slot_idx, QUEUE_DISPLAY);
|
||||||
mpp_buf_slot_enqueue(frame_slots, p_mark1->slot_idx, QUEUE_DISPLAY);
|
p_mark1->out_flag = 0;
|
||||||
p_mark1->out_flag = 0;
|
free_dpb_mark(p_Vid->p_Dec, p_mark1, FRAME);
|
||||||
free_dpb_mark(p_Vid->p_Dec, p_mark1, FRAME);
|
p_out[1]->list[p_out[1]->begin] = NULL;
|
||||||
p_out[1]->list[p_out[1]->begin] = NULL;
|
p_out[1]->begin = (p_out[1]->begin + 1) % p_out[1]->max_size;
|
||||||
p_out[1]->begin = (p_out[1]->begin + 1) % p_out[1]->max_size;
|
mpp_frame_set_discard(frame1, 1);
|
||||||
mpp_frame_set_discard(frame1, 1);
|
} else { //!< mpp_frame_get_poc(frame0) < mpp_frame_get_poc(frame1)
|
||||||
}
|
H264D_LOG("[Write_picture] p_mark0->poc < p_mark1->poc \n");
|
||||||
else { //!< mpp_frame_get_poc(frame0) < mpp_frame_get_poc(frame1)
|
mpp_buf_slot_enqueue(frame_slots, p_mark0->slot_idx, QUEUE_DISPLAY);
|
||||||
H264D_LOG("[Write_picture] p_mark0->poc < p_mark1->poc \n");
|
p_mark0->out_flag = 0;
|
||||||
mpp_buf_slot_enqueue(frame_slots, p_mark0->slot_idx, QUEUE_DISPLAY);
|
free_dpb_mark(p_Vid->p_Dec, p_mark0, FRAME);
|
||||||
p_mark0->out_flag = 0;
|
p_out[0]->list[p_out[0]->begin] = NULL;
|
||||||
free_dpb_mark(p_Vid->p_Dec, p_mark0, FRAME);
|
p_out[0]->begin = (p_out[0]->begin + 1) % p_out[0]->max_size;
|
||||||
p_out[0]->list[p_out[0]->begin] = NULL;
|
mpp_frame_set_discard(frame0, 1);
|
||||||
p_out[0]->begin = (p_out[0]->begin + 1) % p_out[0]->max_size;
|
}
|
||||||
mpp_frame_set_discard(frame0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
p_mark0 = p_out[0]->list[p_out[0]->begin];
|
p_mark0 = p_out[0]->list[p_out[0]->begin];
|
||||||
p_mark1 = p_out[1]->list[p_out[1]->begin];
|
p_mark1 = p_out[1]->list[p_out[1]->begin];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
mpp_buf_slot_enqueue(frame_slots, p_mark->slot_idx, QUEUE_DISPLAY);
|
mpp_buf_slot_enqueue(frame_slots, p_mark->slot_idx, QUEUE_DISPLAY);
|
||||||
p_Vid->p_Dec->last_frame_slot_idx = p_mark->slot_idx;
|
p_Vid->p_Dec->last_frame_slot_idx = p_mark->slot_idx;
|
||||||
p_mark->out_flag = 0;
|
p_mark->out_flag = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void write_picture(H264_StorePic_t *p, H264dVideoCtx_t *p_Vid)
|
static void write_picture(H264_StorePic_t *p, H264dVideoCtx_t *p_Vid)
|
||||||
{
|
{
|
||||||
MppFrame frame;
|
MppFrame frame;
|
||||||
H264_DpbMark_t *p_mark = NULL;
|
H264_DpbMark_t *p_mark = NULL;
|
||||||
|
|
||||||
p_mark = p->mem_mark;
|
p_mark = p->mem_mark;
|
||||||
if (p->mem_malloc_type == Mem_Malloc && p->structure == FRAME && p_mark->out_flag) {
|
if (p->mem_malloc_type == Mem_Malloc && p->structure == FRAME && p_mark->out_flag) {
|
||||||
|
|
||||||
mpp_buf_slot_get_prop(p_Vid->p_Dec->frame_slots, p_mark->slot_idx, SLOT_FRAME_PTR, &frame);
|
|
||||||
|
|
||||||
mpp_frame_set_poc(frame, p->poc);
|
mpp_buf_slot_get_prop(p_Vid->p_Dec->frame_slots, p_mark->slot_idx, SLOT_FRAME_PTR, &frame);
|
||||||
p_mark->poc = p->poc;
|
|
||||||
p_mark->pts = mpp_frame_get_pts(frame);
|
|
||||||
|
|
||||||
mpp_frame_set_viewid(frame, p->layer_id);
|
mpp_frame_set_poc(frame, p->poc);
|
||||||
//if (p->layer_id == 1) {
|
p_mark->poc = p->poc;
|
||||||
// mpp_frame_set_discard(frame, 1);
|
p_mark->pts = mpp_frame_get_pts(frame);
|
||||||
//}
|
|
||||||
//else {
|
|
||||||
// mpp_frame_set_discard(frame, 1);
|
|
||||||
//}
|
|
||||||
|
|
||||||
p_Vid->has_get_i_frame_flag = (p_Vid->has_get_i_frame_flag || (p->slice_type == I_SLICE)) ? 1 : 0;
|
mpp_frame_set_viewid(frame, p->layer_id);
|
||||||
if (!p_Vid->has_get_i_frame_flag) {
|
//if (p->layer_id == 1) {
|
||||||
mpp_frame_set_discard(frame, 1);
|
// mpp_frame_set_discard(frame, 1);
|
||||||
}
|
//}
|
||||||
if (p->poc
|
//else {
|
||||||
&& (p_Vid->last_outputpoc[p->layer_id] >= 0)
|
// mpp_frame_set_discard(frame, 1);
|
||||||
&& (p->poc < p_Vid->last_outputpoc[p->layer_id])) {
|
//}
|
||||||
mpp_frame_set_discard(frame, 1);
|
|
||||||
}
|
|
||||||
H264D_LOG("[dispaly] layer_id=%d, pic_num=%d, poc=%d, last_poc=%d, slice_type=%d(isdir=%d), pts=%lld, g_framecnt=%d \n", p->layer_id,
|
|
||||||
p->pic_num, p->poc, p_Vid->last_outputpoc[p->layer_id], p->slice_type, p->idr_flag, mpp_frame_get_pts(frame), p_Vid->g_framecnt);
|
|
||||||
p_Vid->last_outputpoc[p->layer_id] = p->poc;
|
|
||||||
|
|
||||||
mpp_buf_slot_set_flag(p_Vid->p_Dec->frame_slots, p_mark->slot_idx, SLOT_QUEUE_USE);
|
p_Vid->has_get_i_frame_flag = (p_Vid->has_get_i_frame_flag || (p->slice_type == I_SLICE)) ? 1 : 0;
|
||||||
|
if (!p_Vid->has_get_i_frame_flag) {
|
||||||
|
mpp_frame_set_discard(frame, 1);
|
||||||
|
}
|
||||||
|
if (p->poc
|
||||||
|
&& (p_Vid->last_outputpoc[p->layer_id] >= 0)
|
||||||
|
&& (p->poc < p_Vid->last_outputpoc[p->layer_id])) {
|
||||||
|
mpp_frame_set_discard(frame, 1);
|
||||||
|
}
|
||||||
|
H264D_LOG("[dispaly] layer_id=%d, pic_num=%d, poc=%d, last_poc=%d, slice_type=%d(isdir=%d), pts=%lld, g_framecnt=%d \n", p->layer_id,
|
||||||
|
p->pic_num, p->poc, p_Vid->last_outputpoc[p->layer_id], p->slice_type, p->idr_flag, mpp_frame_get_pts(frame), p_Vid->g_framecnt);
|
||||||
|
p_Vid->last_outputpoc[p->layer_id] = p->poc;
|
||||||
|
|
||||||
|
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) {
|
|
||||||
muti_view_output(p_Vid->p_Dec->frame_slots, p_mark, p_Vid);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
mpp_buf_slot_enqueue(p_Vid->p_Dec->frame_slots, p_mark->slot_idx, QUEUE_DISPLAY);
|
|
||||||
p_Vid->p_Dec->last_frame_slot_idx = p_mark->slot_idx;
|
|
||||||
p_mark->out_flag = 0;
|
|
||||||
}
|
|
||||||
// FPRINT(g_debug_file0, "[WRITE_PICTURE] lay_id=%d, g_frame_no=%d, mark_idx=%d, slot_idx=%d, pts=%lld \n",
|
|
||||||
//p->layer_id, p_Vid->g_framecnt, p_mark->mark_idx, p_mark->slot_idx, mpp_frame_get_pts(frame));
|
|
||||||
|
|
||||||
//H264D_LOG("[WRITE_PICTURE] lay_id=%d, g_frame_no=%d, mark_idx=%d, slot_idx=%d, pts=%lld \n",
|
|
||||||
// p->layer_id, p_Vid->g_framecnt, p_mark->mark_idx, p_mark->slot_idx, mpp_frame_get_pts(frame));
|
if (p_Vid->p_Dec->mvc_valid) {
|
||||||
|
muti_view_output(p_Vid->p_Dec->frame_slots, p_mark, p_Vid);
|
||||||
|
} else {
|
||||||
|
mpp_buf_slot_enqueue(p_Vid->p_Dec->frame_slots, p_mark->slot_idx, QUEUE_DISPLAY);
|
||||||
|
p_Vid->p_Dec->last_frame_slot_idx = p_mark->slot_idx;
|
||||||
|
p_mark->out_flag = 0;
|
||||||
|
}
|
||||||
|
// FPRINT(g_debug_file0, "[WRITE_PICTURE] lay_id=%d, g_frame_no=%d, mark_idx=%d, slot_idx=%d, pts=%lld \n",
|
||||||
|
//p->layer_id, p_Vid->g_framecnt, p_mark->mark_idx, p_mark->slot_idx, mpp_frame_get_pts(frame));
|
||||||
|
|
||||||
|
//H264D_LOG("[WRITE_PICTURE] lay_id=%d, g_frame_no=%d, mark_idx=%d, slot_idx=%d, pts=%lld \n",
|
||||||
|
// p->layer_id, p_Vid->g_framecnt, p_mark->mark_idx, p_mark->slot_idx, mpp_frame_get_pts(frame));
|
||||||
|
|
||||||
//LogInfo(p_Vid->p_Dec->logctx.parr[RUN_PARSE], "[WRITE_PICTURE] g_frame_cnt=%d", p_Vid->g_framecnt);
|
//LogInfo(p_Vid->p_Dec->logctx.parr[RUN_PARSE], "[WRITE_PICTURE] g_frame_cnt=%d", p_Vid->g_framecnt);
|
||||||
}
|
}
|
||||||
@@ -1383,7 +1380,7 @@ static MPP_RET store_picture_in_dpb(H264_DpbBuf_t *p_Dpb, H264_StorePic_t *p)
|
|||||||
p_Dpb->used_size++;
|
p_Dpb->used_size++;
|
||||||
update_ref_list(p_Dpb);
|
update_ref_list(p_Dpb);
|
||||||
update_ltref_list(p_Dpb);
|
update_ltref_list(p_Dpb);
|
||||||
H264D_LOG("SLOT_CODEC_USE slot_idx=%d \n", p->mem_mark->slot_idx);
|
H264D_LOG("SLOT_CODEC_USE slot_idx=%d \n", p->mem_mark->slot_idx);
|
||||||
mpp_buf_slot_set_flag(p_Vid->p_Dec->frame_slots, p->mem_mark->slot_idx, SLOT_CODEC_USE);
|
mpp_buf_slot_set_flag(p_Vid->p_Dec->frame_slots, p->mem_mark->slot_idx, SLOT_CODEC_USE);
|
||||||
|
|
||||||
__RETURN:
|
__RETURN:
|
||||||
@@ -1402,27 +1399,27 @@ __FAILED:
|
|||||||
//extern "C"
|
//extern "C"
|
||||||
void flush_muti_view_output(MppBufSlots frame_slots, H264dOutList_t *p_list, H264dVideoCtx_t *p_Vid)
|
void flush_muti_view_output(MppBufSlots frame_slots, H264dOutList_t *p_list, H264dVideoCtx_t *p_Vid)
|
||||||
{
|
{
|
||||||
RK_U32 i= 0;
|
RK_U32 i = 0;
|
||||||
MppFrame frame;
|
MppFrame frame;
|
||||||
H264_DpbMark_t *p_mark = NULL;
|
H264_DpbMark_t *p_mark = NULL;
|
||||||
H264dOutList_t *p_out = NULL;
|
H264dOutList_t *p_out = NULL;
|
||||||
|
|
||||||
//!< flush unpaired
|
//!< flush unpaired
|
||||||
for (i = 0; i < MAX_NUM_DPB_LAYERS; i++) {
|
for (i = 0; i < MAX_NUM_DPB_LAYERS; i++) {
|
||||||
p_out = &p_list[i];
|
p_out = &p_list[i];
|
||||||
p_mark = p_out->list[p_out->begin];
|
p_mark = p_out->list[p_out->begin];
|
||||||
while (p_mark) {
|
while (p_mark) {
|
||||||
H264D_LOG("[Write_picture] ---- Flush discard --- mpp_frame_get_pts(frame0) \n");
|
H264D_LOG("[Write_picture] ---- Flush discard --- mpp_frame_get_pts(frame0) \n");
|
||||||
mpp_buf_slot_get_prop(frame_slots, p_mark->slot_idx, SLOT_FRAME_PTR, &frame);
|
mpp_buf_slot_get_prop(frame_slots, p_mark->slot_idx, SLOT_FRAME_PTR, &frame);
|
||||||
mpp_buf_slot_enqueue(frame_slots, p_mark->slot_idx, QUEUE_DISPLAY);
|
mpp_buf_slot_enqueue(frame_slots, p_mark->slot_idx, QUEUE_DISPLAY);
|
||||||
p_mark->out_flag = 0;
|
p_mark->out_flag = 0;
|
||||||
free_dpb_mark(p_Vid->p_Dec, p_mark, FRAME);
|
free_dpb_mark(p_Vid->p_Dec, p_mark, FRAME);
|
||||||
p_out->list[p_out->begin] = NULL;
|
p_out->list[p_out->begin] = NULL;
|
||||||
p_out->begin = (p_out->begin + 1) % p_out->max_size;
|
p_out->begin = (p_out->begin + 1) % p_out->max_size;
|
||||||
p_mark = p_out->list[p_out->begin];
|
p_mark = p_out->list[p_out->begin];
|
||||||
mpp_frame_set_discard(frame, 1);
|
mpp_frame_set_discard(frame, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -1758,21 +1755,21 @@ MPP_RET init_dpb(H264dVideoCtx_t *p_Vid, H264_DpbBuf_t *p_Dpb, RK_S32 type) //
|
|||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
H264_SPS_t *active_sps = p_Vid->active_sps;
|
H264_SPS_t *active_sps = p_Vid->active_sps;
|
||||||
|
|
||||||
if(!active_sps){
|
if (!active_sps) {
|
||||||
ret = MPP_NOK;
|
ret = MPP_NOK;
|
||||||
goto __FAILED;
|
goto __FAILED;
|
||||||
}
|
}
|
||||||
p_Dpb->p_Vid = p_Vid;
|
p_Dpb->p_Vid = p_Vid;
|
||||||
if (p_Dpb->init_done) {
|
if (p_Dpb->init_done) {
|
||||||
free_dpb(p_Dpb);
|
free_dpb(p_Dpb);
|
||||||
}
|
}
|
||||||
p_Dpb->size = getDpbSize(p_Vid, active_sps) + (type == 2 ? 0 : 1);
|
p_Dpb->size = getDpbSize(p_Vid, active_sps) + (type == 2 ? 0 : 1);
|
||||||
p_Dpb->num_ref_frames = active_sps->max_num_ref_frames;
|
p_Dpb->num_ref_frames = active_sps->max_num_ref_frames;
|
||||||
//if (active_sps->max_dec_frame_buffering < active_sps->max_num_ref_frames) {
|
//if (active_sps->max_dec_frame_buffering < active_sps->max_num_ref_frames) {
|
||||||
//H264D_LOG("DPB size at specified level is smaller than reference frames");
|
//H264D_LOG("DPB size at specified level is smaller than reference frames");
|
||||||
//LogError(runlog, "DPB size at specified level is smaller than reference frames");
|
//LogError(runlog, "DPB size at specified level is smaller than reference frames");
|
||||||
//goto __FAILED;
|
//goto __FAILED;
|
||||||
//}
|
//}
|
||||||
p_Dpb->used_size = 0;
|
p_Dpb->used_size = 0;
|
||||||
p_Dpb->last_picture = NULL;
|
p_Dpb->last_picture = NULL;
|
||||||
p_Dpb->ref_frames_in_buffer = 0;
|
p_Dpb->ref_frames_in_buffer = 0;
|
||||||
@@ -1862,7 +1859,7 @@ MPP_RET flush_dpb(H264_DpbBuf_t *p_Dpb, RK_S32 type)
|
|||||||
FUN_CHECK(ret = output_one_frame_from_dpb(p_Dpb));
|
FUN_CHECK(ret = output_one_frame_from_dpb(p_Dpb));
|
||||||
}
|
}
|
||||||
p_Dpb->last_output_poc = INT_MIN;
|
p_Dpb->last_output_poc = INT_MIN;
|
||||||
(void)type;
|
(void)type;
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
__FAILED:
|
__FAILED:
|
||||||
@@ -1909,104 +1906,104 @@ __FAILED:
|
|||||||
|
|
||||||
static void reset_dpb_info(H264_DpbInfo_t *p)
|
static void reset_dpb_info(H264_DpbInfo_t *p)
|
||||||
{
|
{
|
||||||
p->picbuf = NULL;
|
p->picbuf = NULL;
|
||||||
p->TOP_POC = 0;
|
p->TOP_POC = 0;
|
||||||
p->BOT_POC = 0;
|
p->BOT_POC = 0;
|
||||||
p->field_flag = 0;
|
p->field_flag = 0;
|
||||||
p->slot_index = -1;
|
p->slot_index = -1;
|
||||||
p->colmv_is_used = 0;
|
p->colmv_is_used = 0;
|
||||||
p->frame_num = 0;
|
p->frame_num = 0;
|
||||||
p->is_long_term = 0;
|
p->is_long_term = 0;
|
||||||
p->long_term_pic_num = 0;
|
p->long_term_pic_num = 0;
|
||||||
p->voidx = 0;
|
p->voidx = 0;
|
||||||
p->view_id = 0;
|
p->view_id = 0;
|
||||||
p->is_used = 0;
|
p->is_used = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static MPP_RET adjust_input(H264_SLICE_t *currSlice)
|
static MPP_RET adjust_input(H264_SLICE_t *currSlice)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0, j = 0;
|
RK_U32 i = 0, j = 0;
|
||||||
RK_U32 find_flag = 0;
|
RK_U32 find_flag = 0;
|
||||||
|
|
||||||
H264_DecCtx_t *p_Dec = currSlice->p_Dec;
|
H264_DecCtx_t *p_Dec = currSlice->p_Dec;
|
||||||
H264_DpbInfo_t *new_dpb = p_Dec->dpb_info;
|
H264_DpbInfo_t *new_dpb = p_Dec->dpb_info;
|
||||||
H264_DpbInfo_t *old_dpb = p_Dec->dpb_old[currSlice->layer_id];
|
H264_DpbInfo_t *old_dpb = p_Dec->dpb_old[currSlice->layer_id];
|
||||||
|
|
||||||
|
|
||||||
//for (i = 0; i < MAX_DPB_SIZE; i++) {
|
//for (i = 0; i < MAX_DPB_SIZE; i++) {
|
||||||
// if (new_dpb[i].picbuf) {
|
// if (new_dpb[i].picbuf) {
|
||||||
// FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", i, new_dpb[i].frame_num, new_dpb[i].frame_num);
|
// FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", i, new_dpb[i].frame_num, new_dpb[i].frame_num);
|
||||||
// FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", new_dpb[i].slot_index, new_dpb[i].is_long_term,
|
// FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", new_dpb[i].slot_index, new_dpb[i].is_long_term,
|
||||||
// new_dpb[i].TOP_POC);
|
// new_dpb[i].TOP_POC);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
//FPRINT(g_debug_file0, "--------- [new DPB] -------- \n");
|
//FPRINT(g_debug_file0, "--------- [new DPB] -------- \n");
|
||||||
//for (i = 0; i < MAX_DPB_SIZE; i++) {
|
//for (i = 0; i < MAX_DPB_SIZE; i++) {
|
||||||
// if (old_dpb[i].picbuf) {
|
// if (old_dpb[i].picbuf) {
|
||||||
// FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", i, old_dpb[i].frame_num, old_dpb[i].frame_num);
|
// FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", i, old_dpb[i].frame_num, old_dpb[i].frame_num);
|
||||||
// FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", old_dpb[i].slot_index, old_dpb[i].is_long_term,
|
// FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", old_dpb[i].slot_index, old_dpb[i].is_long_term,
|
||||||
// old_dpb[i].TOP_POC);
|
// old_dpb[i].TOP_POC);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
//FPRINT(g_debug_file0, "--------- [Old DPB] -------- \n");
|
//FPRINT(g_debug_file0, "--------- [Old DPB] -------- \n");
|
||||||
|
|
||||||
//!< delete old dpb
|
//!< delete old dpb
|
||||||
for (i = 0; i < MAX_DPB_SIZE; i++) {
|
for (i = 0; i < MAX_DPB_SIZE; i++) {
|
||||||
find_flag = 0;
|
find_flag = 0;
|
||||||
if (old_dpb[i].picbuf) {
|
if (old_dpb[i].picbuf) {
|
||||||
for (j = 0; j < MAX_DPB_SIZE; j++) {
|
for (j = 0; j < MAX_DPB_SIZE; j++) {
|
||||||
if(new_dpb[j].picbuf) {
|
if (new_dpb[j].picbuf) {
|
||||||
find_flag = (old_dpb[i].frame_num == new_dpb[j].frame_num) ? 1 : 0;
|
find_flag = (old_dpb[i].frame_num == new_dpb[j].frame_num) ? 1 : 0;
|
||||||
find_flag = (old_dpb[i].slot_index == new_dpb[j].slot_index) ? find_flag : 0;
|
find_flag = (old_dpb[i].slot_index == new_dpb[j].slot_index) ? find_flag : 0;
|
||||||
if (new_dpb[j].is_used & 0x1) {
|
if (new_dpb[j].is_used & 0x1) {
|
||||||
find_flag = (old_dpb[i].TOP_POC == new_dpb[j].TOP_POC) ? find_flag : 0;
|
find_flag = (old_dpb[i].TOP_POC == new_dpb[j].TOP_POC) ? find_flag : 0;
|
||||||
}
|
}
|
||||||
if (new_dpb[j].is_used & 0x2) {
|
if (new_dpb[j].is_used & 0x2) {
|
||||||
find_flag = (old_dpb[i].BOT_POC == new_dpb[j].BOT_POC) ? find_flag : 0;
|
find_flag = (old_dpb[i].BOT_POC == new_dpb[j].BOT_POC) ? find_flag : 0;
|
||||||
}
|
}
|
||||||
if (find_flag) { //!< found
|
if (find_flag) { //!< found
|
||||||
new_dpb[j].have_same = 1;
|
new_dpb[j].have_same = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//!< not found
|
//!< not found
|
||||||
if (find_flag == 0) {
|
if (find_flag == 0) {
|
||||||
reset_dpb_info(&old_dpb[i]);
|
reset_dpb_info(&old_dpb[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//!< add new dpb
|
//!< add new dpb
|
||||||
for (j = 0; j < MAX_DPB_SIZE; j++) {
|
for (j = 0; j < MAX_DPB_SIZE; j++) {
|
||||||
if ((new_dpb[j].picbuf == 0) || new_dpb[j].have_same) {
|
if ((new_dpb[j].picbuf == 0) || new_dpb[j].have_same) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (i = 0; i < MAX_DPB_SIZE; i++) {
|
for (i = 0; i < MAX_DPB_SIZE; i++) {
|
||||||
if (old_dpb[i].picbuf == 0) {
|
if (old_dpb[i].picbuf == 0) {
|
||||||
old_dpb[i] = new_dpb[j];
|
old_dpb[i] = new_dpb[j];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//memcpy(new_dpb, old_dpb, MAX_DPB_SIZE*sizeof(H264_DpbInfo_t));
|
//memcpy(new_dpb, old_dpb, MAX_DPB_SIZE*sizeof(H264_DpbInfo_t));
|
||||||
memset(new_dpb, 0, MAX_DPB_SIZE*sizeof(H264_DpbInfo_t));
|
memset(new_dpb, 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
||||||
for (i = 0, j = 0; i < MAX_DPB_SIZE; i++) {
|
for (i = 0, j = 0; i < MAX_DPB_SIZE; i++) {
|
||||||
if (old_dpb[i].picbuf) {
|
if (old_dpb[i].picbuf) {
|
||||||
new_dpb[j] = old_dpb[i];
|
new_dpb[j] = old_dpb[i];
|
||||||
//FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", j, old_dpb[j].frame_num, old_dpb[j].frame_num);
|
//FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", j, old_dpb[j].frame_num, old_dpb[j].frame_num);
|
||||||
//FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", old_dpb[j].slot_index, old_dpb[j].is_long_term,
|
//FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", old_dpb[j].slot_index, old_dpb[j].is_long_term,
|
||||||
// old_dpb[i].TOP_POC);
|
// old_dpb[i].TOP_POC);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (; j < 16; j++) {
|
for (; j < 16; j++) {
|
||||||
reset_dpb_info(&new_dpb[j]);
|
reset_dpb_info(&new_dpb[j]);
|
||||||
}
|
}
|
||||||
memcpy(old_dpb, new_dpb, MAX_DPB_SIZE*sizeof(H264_DpbInfo_t));
|
memcpy(old_dpb, new_dpb, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
||||||
|
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2025,10 +2022,10 @@ MPP_RET prepare_init_dpb_info(H264_SLICE_t *currSlice)
|
|||||||
H264_DecCtx_t *p_Dec = currSlice->p_Dec;
|
H264_DecCtx_t *p_Dec = currSlice->p_Dec;
|
||||||
|
|
||||||
memset(p_Dec->dpb_info, 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
memset(p_Dec->dpb_info, 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
||||||
memset(&p_Dec->in_task->refer, -1, sizeof(p_Dec->in_task->refer));
|
memset(&p_Dec->in_task->refer, -1, sizeof(p_Dec->in_task->refer));
|
||||||
if (currSlice->idr_flag && (currSlice->layer_id == 0)) { // idr_flag==1 && layer_id==0
|
if (currSlice->idr_flag && (currSlice->layer_id == 0)) { // idr_flag==1 && layer_id==0
|
||||||
memset(p_Dec->dpb_old[0], 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
memset(p_Dec->dpb_old[0], 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
||||||
memset(p_Dec->dpb_old[1], 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
memset(p_Dec->dpb_old[1], 0, MAX_DPB_SIZE * sizeof(H264_DpbInfo_t));
|
||||||
goto __RETURN;
|
goto __RETURN;
|
||||||
}
|
}
|
||||||
//!<---- reference
|
//!<---- reference
|
||||||
@@ -2126,118 +2123,118 @@ MPP_RET prepare_init_dpb_info(H264_SLICE_t *currSlice)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
//!< inter-layer reference (for multi-layered codecs)
|
//!< inter-layer reference (for multi-layered codecs)
|
||||||
for (j = 0; j < p_Dpb->used_size_il; i++, j++) {
|
for (j = 0; j < p_Dpb->used_size_il; i++, j++) {
|
||||||
if (currSlice->structure == FRAME && p_Dpb->fs_ilref[j]->is_used == 3) {
|
if (currSlice->structure == FRAME && p_Dpb->fs_ilref[j]->is_used == 3) {
|
||||||
if (p_Dpb->fs_ilref[j]->inter_view_flag[0] == 0 && p_Dpb->fs_ilref[j]->inter_view_flag[1] == 0)
|
if (p_Dpb->fs_ilref[j]->inter_view_flag[0] == 0 && p_Dpb->fs_ilref[j]->inter_view_flag[1] == 0)
|
||||||
break;
|
break;
|
||||||
p_Dec->dpb_info[i].picbuf = p_Dpb->fs_ilref[j]->frame;
|
p_Dec->dpb_info[i].picbuf = p_Dpb->fs_ilref[j]->frame;
|
||||||
|
|
||||||
if (p_Dpb->fs_ilref[j]->frame->is_mmco_5) {
|
if (p_Dpb->fs_ilref[j]->frame->is_mmco_5) {
|
||||||
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->frame->top_poc_mmco5;
|
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->frame->top_poc_mmco5;
|
||||||
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->frame->bot_poc_mmco5;
|
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->frame->bot_poc_mmco5;
|
||||||
} else {
|
} else {
|
||||||
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->frame->top_poc;
|
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->frame->top_poc;
|
||||||
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->frame->bottom_poc;
|
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->frame->bottom_poc;
|
||||||
}
|
}
|
||||||
p_Dec->dpb_info[i].field_flag = p_Dpb->fs_ilref[j]->frame->iCodingType == FIELD_CODING;
|
p_Dec->dpb_info[i].field_flag = p_Dpb->fs_ilref[j]->frame->iCodingType == FIELD_CODING;
|
||||||
p_Dec->dpb_info[i].slot_index = p_Dpb->fs_ilref[j]->frame->mem_mark->slot_idx;
|
p_Dec->dpb_info[i].slot_index = p_Dpb->fs_ilref[j]->frame->mem_mark->slot_idx;
|
||||||
p_Dec->dpb_info[i].colmv_is_used = (p_Dpb->fs_ilref[j]->frame->colmv_no_used_flag ? 0 : 1);
|
p_Dec->dpb_info[i].colmv_is_used = (p_Dpb->fs_ilref[j]->frame->colmv_no_used_flag ? 0 : 1);
|
||||||
} else if (currSlice->structure != FRAME && p_Dpb->fs_ilref[j]->is_used) {
|
} else if (currSlice->structure != FRAME && p_Dpb->fs_ilref[j]->is_used) {
|
||||||
if (p_Dpb->fs_ilref[j]->is_used == 0x3) {
|
if (p_Dpb->fs_ilref[j]->is_used == 0x3) {
|
||||||
if (p_Dpb->fs_ilref[j]->inter_view_flag[currSlice->structure == BOTTOM_FIELD] == 0)
|
if (p_Dpb->fs_ilref[j]->inter_view_flag[currSlice->structure == BOTTOM_FIELD] == 0)
|
||||||
break;
|
break;
|
||||||
p_Dec->dpb_info[i].picbuf = p_Dpb->fs_ilref[j]->top_field;
|
p_Dec->dpb_info[i].picbuf = p_Dpb->fs_ilref[j]->top_field;
|
||||||
|
|
||||||
if (p_Dpb->fs_ilref[j]->top_field->is_mmco_5) {
|
if (p_Dpb->fs_ilref[j]->top_field->is_mmco_5) {
|
||||||
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->top_field->top_poc_mmco5;
|
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->top_field->top_poc_mmco5;
|
||||||
} else {
|
} else {
|
||||||
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->top_field->top_poc;
|
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->top_field->top_poc;
|
||||||
}
|
}
|
||||||
if (p_Dpb->fs_ilref[j]->bottom_field->is_mmco_5) {
|
if (p_Dpb->fs_ilref[j]->bottom_field->is_mmco_5) {
|
||||||
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->bottom_field->bot_poc_mmco5;
|
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->bottom_field->bot_poc_mmco5;
|
||||||
} else {
|
} else {
|
||||||
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->bottom_field->bottom_poc;
|
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->bottom_field->bottom_poc;
|
||||||
}
|
}
|
||||||
p_Dec->dpb_info[i].field_flag = p_Dpb->fs_ilref[j]->frame->iCodingType == FIELD_CODING;
|
p_Dec->dpb_info[i].field_flag = p_Dpb->fs_ilref[j]->frame->iCodingType == FIELD_CODING;
|
||||||
p_Dec->dpb_info[i].slot_index = p_Dpb->fs_ilref[j]->frame->mem_mark->slot_idx;
|
p_Dec->dpb_info[i].slot_index = p_Dpb->fs_ilref[j]->frame->mem_mark->slot_idx;
|
||||||
p_Dec->dpb_info[i].colmv_is_used = (p_Dpb->fs_ilref[j]->frame->colmv_no_used_flag ? 0 : 1);
|
p_Dec->dpb_info[i].colmv_is_used = (p_Dpb->fs_ilref[j]->frame->colmv_no_used_flag ? 0 : 1);
|
||||||
}
|
}
|
||||||
if (p_Dpb->fs_ilref[j]->is_used & 0x1) {
|
if (p_Dpb->fs_ilref[j]->is_used & 0x1) {
|
||||||
if (p_Dpb->fs_ilref[j]->inter_view_flag[0] == 0)
|
if (p_Dpb->fs_ilref[j]->inter_view_flag[0] == 0)
|
||||||
break;
|
break;
|
||||||
p_Dec->dpb_info[i].picbuf = p_Dpb->fs_ilref[j]->top_field;
|
p_Dec->dpb_info[i].picbuf = p_Dpb->fs_ilref[j]->top_field;
|
||||||
|
|
||||||
if (p_Dpb->fs_ilref[j]->top_field->is_mmco_5) {
|
if (p_Dpb->fs_ilref[j]->top_field->is_mmco_5) {
|
||||||
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->top_field->top_poc_mmco5;
|
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->top_field->top_poc_mmco5;
|
||||||
} else {
|
} else {
|
||||||
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->top_field->top_poc;
|
p_Dec->dpb_info[i].TOP_POC = p_Dpb->fs_ilref[j]->top_field->top_poc;
|
||||||
}
|
}
|
||||||
p_Dec->dpb_info[i].BOT_POC = 0;
|
p_Dec->dpb_info[i].BOT_POC = 0;
|
||||||
p_Dec->dpb_info[i].field_flag = 1;
|
p_Dec->dpb_info[i].field_flag = 1;
|
||||||
p_Dec->dpb_info[i].slot_index = p_Dpb->fs_ilref[j]->top_field->mem_mark->slot_idx;
|
p_Dec->dpb_info[i].slot_index = p_Dpb->fs_ilref[j]->top_field->mem_mark->slot_idx;
|
||||||
p_Dec->dpb_info[i].colmv_is_used = (p_Dpb->fs_ilref[j]->top_field->colmv_no_used_flag ? 0 : 1);
|
p_Dec->dpb_info[i].colmv_is_used = (p_Dpb->fs_ilref[j]->top_field->colmv_no_used_flag ? 0 : 1);
|
||||||
} else { // if(p_Dpb->fs_ref[j]->is_used & 0x2)
|
} else { // if(p_Dpb->fs_ref[j]->is_used & 0x2)
|
||||||
if (p_Dpb->fs_ilref[j]->inter_view_flag[1] == 0)
|
if (p_Dpb->fs_ilref[j]->inter_view_flag[1] == 0)
|
||||||
break;
|
break;
|
||||||
p_Dec->dpb_info[i].picbuf = p_Dpb->fs_ilref[j]->bottom_field;
|
p_Dec->dpb_info[i].picbuf = p_Dpb->fs_ilref[j]->bottom_field;
|
||||||
|
|
||||||
p_Dec->dpb_info[i].TOP_POC = 0;
|
p_Dec->dpb_info[i].TOP_POC = 0;
|
||||||
if (p_Dpb->fs_ilref[j]->bottom_field->is_mmco_5) {
|
if (p_Dpb->fs_ilref[j]->bottom_field->is_mmco_5) {
|
||||||
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->bottom_field->bot_poc_mmco5;
|
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->bottom_field->bot_poc_mmco5;
|
||||||
} else {
|
} else {
|
||||||
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->bottom_field->bottom_poc;
|
p_Dec->dpb_info[i].BOT_POC = p_Dpb->fs_ilref[j]->bottom_field->bottom_poc;
|
||||||
}
|
}
|
||||||
p_Dec->dpb_info[i].field_flag = 1;
|
p_Dec->dpb_info[i].field_flag = 1;
|
||||||
p_Dec->dpb_info[i].slot_index = p_Dpb->fs_ilref[j]->bottom_field->mem_mark->slot_idx;
|
p_Dec->dpb_info[i].slot_index = p_Dpb->fs_ilref[j]->bottom_field->mem_mark->slot_idx;
|
||||||
p_Dec->dpb_info[i].colmv_is_used = (p_Dpb->fs_ilref[j]->bottom_field->colmv_no_used_flag ? 0 : 1);
|
p_Dec->dpb_info[i].colmv_is_used = (p_Dpb->fs_ilref[j]->bottom_field->colmv_no_used_flag ? 0 : 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p_Dec->dpb_info[i].frame_num = p_Dpb->fs_ilref[j]->frame_num;
|
p_Dec->dpb_info[i].frame_num = p_Dpb->fs_ilref[j]->frame_num;
|
||||||
p_Dec->dpb_info[i].is_long_term = 0;//p_Dpb->fs_ilref[j]->is_long_term;
|
p_Dec->dpb_info[i].is_long_term = 0;//p_Dpb->fs_ilref[j]->is_long_term;
|
||||||
p_Dec->dpb_info[i].is_ilt_flag = 1;
|
p_Dec->dpb_info[i].is_ilt_flag = 1;
|
||||||
p_Dec->dpb_info[i].long_term_pic_num = 0;
|
p_Dec->dpb_info[i].long_term_pic_num = 0;
|
||||||
p_Dec->dpb_info[i].long_term_frame_idx = 0;
|
p_Dec->dpb_info[i].long_term_frame_idx = 0;
|
||||||
p_Dec->dpb_info[i].voidx = p_Dpb->fs_ilref[j]->layer_id;
|
p_Dec->dpb_info[i].voidx = p_Dpb->fs_ilref[j]->layer_id;
|
||||||
p_Dec->dpb_info[i].view_id = p_Dpb->fs_ilref[j]->view_id;
|
p_Dec->dpb_info[i].view_id = p_Dpb->fs_ilref[j]->view_id;
|
||||||
p_Dec->dpb_info[i].is_used = p_Dpb->fs_ilref[j]->is_used;
|
p_Dec->dpb_info[i].is_used = p_Dpb->fs_ilref[j]->is_used;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//for(j = 0; j < i; j++) {
|
//for(j = 0; j < i; j++) {
|
||||||
// FPRINT(g_debug_file1, "i=%2d, picnum=%d, framenum=%2d, ", j, p_Dec->dpb_info[j].frame_num, p_Dec->dpb_info[j].frame_num);
|
// FPRINT(g_debug_file1, "i=%2d, picnum=%d, framenum=%2d, ", j, p_Dec->dpb_info[j].frame_num, p_Dec->dpb_info[j].frame_num);
|
||||||
// FPRINT(g_debug_file1, " dbp_idx=%d, longterm=%d, poc=%d \n", p_Dec->dpb_info[j].slot_index, p_Dec->dpb_info[j].is_long_term,
|
// FPRINT(g_debug_file1, " dbp_idx=%d, longterm=%d, poc=%d \n", p_Dec->dpb_info[j].slot_index, p_Dec->dpb_info[j].is_long_term,
|
||||||
// p_Dec->dpb_info[j].TOP_POC);
|
// p_Dec->dpb_info[j].TOP_POC);
|
||||||
//}
|
//}
|
||||||
//FPRINT(g_debug_file1, "--------- [FLUSH_CNT] flush framecnt=%d -------- \n", p_Dec->p_Vid->g_framecnt);
|
//FPRINT(g_debug_file1, "--------- [FLUSH_CNT] flush framecnt=%d -------- \n", p_Dec->p_Vid->g_framecnt);
|
||||||
|
|
||||||
//if (p_Dec->p_Vid->g_framecnt == 255) {
|
//if (p_Dec->p_Vid->g_framecnt == 255) {
|
||||||
// i = i;
|
// i = i;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//!< reset left parameters
|
//!< reset left parameters
|
||||||
for (; i < 16; i++) {
|
for (; i < 16; i++) {
|
||||||
reset_dpb_info(&p_Dec->dpb_info[i]);
|
reset_dpb_info(&p_Dec->dpb_info[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FPRINT(g_debug_file0, "---g_framecnt=%d\n", p_Dec->p_Vid->g_framecnt);
|
//FPRINT(g_debug_file0, "---g_framecnt=%d\n", p_Dec->p_Vid->g_framecnt);
|
||||||
//for (i = 0; i< 16; i++)
|
//for (i = 0; i< 16; i++)
|
||||||
//{
|
//{
|
||||||
// FPRINT(g_debug_file0, "i=%d, top_poc=%d, bot_poc=%d, frame_num=%d, is_lt=%d, voidx=%d\n", i, p_Dec->dpb_info[i].TOP_POC,
|
// FPRINT(g_debug_file0, "i=%d, top_poc=%d, bot_poc=%d, frame_num=%d, is_lt=%d, voidx=%d\n", i, p_Dec->dpb_info[i].TOP_POC,
|
||||||
// p_Dec->dpb_info[i].BOT_POC, p_Dec->dpb_info[i].frame_num, p_Dec->dpb_info[i].is_ilt_flag, p_Dec->dpb_info[i].voidx);
|
// p_Dec->dpb_info[i].BOT_POC, p_Dec->dpb_info[i].frame_num, p_Dec->dpb_info[i].is_ilt_flag, p_Dec->dpb_info[i].voidx);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//adjust_input(currSlice);
|
//adjust_input(currSlice);
|
||||||
|
|
||||||
for (i = 0; i < MAX_DPB_SIZE; i++) {
|
for (i = 0; i < MAX_DPB_SIZE; i++) {
|
||||||
if ((NULL != p_Dec->dpb_info[i].picbuf) && (p_Dec->dpb_info[i].slot_index >= 0)) {
|
if ((NULL != p_Dec->dpb_info[i].picbuf) && (p_Dec->dpb_info[i].slot_index >= 0)) {
|
||||||
p_Dec->in_task->refer[i] = p_Dec->dpb_info[i].slot_index;
|
p_Dec->in_task->refer[i] = p_Dec->dpb_info[i].slot_index;
|
||||||
mpp_buf_slot_set_flag(p_Dec->frame_slots, p_Dec->dpb_info[i].slot_index, SLOT_HAL_INPUT);
|
mpp_buf_slot_set_flag(p_Dec->frame_slots, p_Dec->dpb_info[i].slot_index, SLOT_HAL_INPUT);
|
||||||
mpp_buf_slot_set_flag(p_Dec->frame_slots, p_Dec->dpb_info[i].slot_index, SLOT_CODEC_USE);
|
mpp_buf_slot_set_flag(p_Dec->frame_slots, p_Dec->dpb_info[i].slot_index, SLOT_CODEC_USE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void update_ref_list(H264_DpbBuf_t *p_Dpb);
|
void update_ref_list(H264_DpbBuf_t *p_Dpb);
|
||||||
void update_ltref_list(H264_DpbBuf_t *p_Dpb);
|
void update_ltref_list(H264_DpbBuf_t *p_Dpb);
|
||||||
void free_storable_picture(H264_DecCtx_t *p_Dec, H264_StorePic_t *p);
|
void free_storable_picture(H264_DecCtx_t *p_Dec, H264_StorePic_t *p);
|
||||||
|
@@ -39,12 +39,12 @@
|
|||||||
#define MAX_MARK_SIZE 35 //!< for malloc buffer mark, can be changed
|
#define MAX_MARK_SIZE 35 //!< for malloc buffer mark, can be changed
|
||||||
|
|
||||||
|
|
||||||
#define NALU_BUF_MAX_SIZE 5*1024*1024
|
#define NALU_BUF_MAX_SIZE 5*1024*1024
|
||||||
#define NALU_BUF_ADD_SIZE 512
|
#define NALU_BUF_ADD_SIZE 512
|
||||||
#define HEAD_BUF_MAX_SIZE 5*1024*1024
|
#define HEAD_BUF_MAX_SIZE 5*1024*1024
|
||||||
#define HEAD_BUF_ADD_SIZE 1024
|
#define HEAD_BUF_ADD_SIZE 1024
|
||||||
#define SODB_BUF_MAX_SIZE 10*1024*1024
|
#define SODB_BUF_MAX_SIZE 10*1024*1024
|
||||||
#define SODB_BUF_ADD_SIZE 1024
|
#define SODB_BUF_ADD_SIZE 1024
|
||||||
|
|
||||||
|
|
||||||
//!< AVC Profile IDC definitions
|
//!< AVC Profile IDC definitions
|
||||||
@@ -197,12 +197,12 @@ typedef enum {
|
|||||||
typedef struct h264_dpb_mark_t {
|
typedef struct h264_dpb_mark_t {
|
||||||
RK_U8 top_used;
|
RK_U8 top_used;
|
||||||
RK_U8 bot_used;
|
RK_U8 bot_used;
|
||||||
RK_U8 out_flag;
|
RK_U8 out_flag;
|
||||||
RK_U8 mark_idx;
|
RK_U8 mark_idx;
|
||||||
MppFrame frame;
|
MppFrame frame;
|
||||||
RK_S32 slot_idx;
|
RK_S32 slot_idx;
|
||||||
RK_S32 poc;
|
RK_S32 poc;
|
||||||
RK_S64 pts;
|
RK_S64 pts;
|
||||||
struct h264_store_pic_t *pic;
|
struct h264_store_pic_t *pic;
|
||||||
} H264_DpbMark_t;
|
} H264_DpbMark_t;
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ typedef struct h264_dpb_info_t {
|
|||||||
RK_U32 bot_valid;
|
RK_U32 bot_valid;
|
||||||
struct h264_store_pic_t *picbuf;
|
struct h264_store_pic_t *picbuf;
|
||||||
|
|
||||||
RK_U32 have_same;
|
RK_U32 have_same;
|
||||||
} H264_DpbInfo_t;
|
} H264_DpbInfo_t;
|
||||||
|
|
||||||
//!< refence picture information
|
//!< refence picture information
|
||||||
@@ -688,7 +688,7 @@ typedef struct h264_sei_t {
|
|||||||
//-- for adding
|
//-- for adding
|
||||||
} scalable_nesting;
|
} scalable_nesting;
|
||||||
|
|
||||||
RK_U32 user_data_DivX_flag;
|
RK_U32 user_data_DivX_flag;
|
||||||
// Placeholder; in future more supported types will contribute to more
|
// Placeholder; in future more supported types will contribute to more
|
||||||
//---- follow is used in other parts
|
//---- follow is used in other parts
|
||||||
RK_S32 mvc_scalable_nesting_flag;
|
RK_S32 mvc_scalable_nesting_flag;
|
||||||
@@ -823,7 +823,7 @@ typedef struct h264d_dxva_ctx_t {
|
|||||||
} H264dDxvaCtx_t;
|
} H264dDxvaCtx_t;
|
||||||
|
|
||||||
//!< input parameter
|
//!< input parameter
|
||||||
typedef struct h264d_input_ctx_t {
|
typedef struct h264d_input_ctx_t {
|
||||||
struct h264_dec_ctx_t *p_Dec;
|
struct h264_dec_ctx_t *p_Dec;
|
||||||
struct h264d_cur_ctx_t *p_Cur; //!< current parameters, use in read nalu
|
struct h264d_cur_ctx_t *p_Cur; //!< current parameters, use in read nalu
|
||||||
struct h264d_video_ctx_t *p_Vid; //!< parameters for video decoder
|
struct h264d_video_ctx_t *p_Vid; //!< parameters for video decoder
|
||||||
@@ -832,36 +832,36 @@ typedef struct h264d_input_ctx_t {
|
|||||||
//!< input data
|
//!< input data
|
||||||
RK_U8 *in_buf;
|
RK_U8 *in_buf;
|
||||||
size_t in_length;
|
size_t in_length;
|
||||||
RK_U32 pkt_eos;
|
RK_U32 pkt_eos;
|
||||||
|
|
||||||
MppPacket in_pkt;
|
MppPacket in_pkt;
|
||||||
|
|
||||||
RK_S64 in_pts;
|
RK_S64 in_pts;
|
||||||
RK_S64 in_dts;
|
RK_S64 in_dts;
|
||||||
RK_U8 has_get_eos;
|
RK_U8 has_get_eos;
|
||||||
//!< output data
|
//!< output data
|
||||||
RK_U8 *out_buf;
|
RK_U8 *out_buf;
|
||||||
RK_U32 out_length;
|
RK_U32 out_length;
|
||||||
RK_U8 task_valid;
|
RK_U8 task_valid;
|
||||||
RK_U32 task_eos;
|
RK_U32 task_eos;
|
||||||
|
|
||||||
//!< have extradata
|
//!< have extradata
|
||||||
RK_U8 is_nalff;
|
RK_U8 is_nalff;
|
||||||
RK_U8 profile;
|
RK_U8 profile;
|
||||||
RK_U8 level;
|
RK_U8 level;
|
||||||
RK_U32 nal_size;
|
RK_U32 nal_size;
|
||||||
RK_S32 sps_num;
|
RK_S32 sps_num;
|
||||||
RK_S32 pps_num;
|
RK_S32 pps_num;
|
||||||
} H264dInputCtx_t;
|
} H264dInputCtx_t;
|
||||||
|
|
||||||
//!< TimeStamp context
|
//!< TimeStamp context
|
||||||
#define MAX_PTS_NUM 5
|
#define MAX_PTS_NUM 5
|
||||||
typedef struct h264d_timestamp_t{
|
typedef struct h264d_timestamp_t {
|
||||||
RK_U64 begin_off;
|
RK_U64 begin_off;
|
||||||
RK_U64 end_off;
|
RK_U64 end_off;
|
||||||
RK_S64 pts;
|
RK_S64 pts;
|
||||||
RK_S64 dts;
|
RK_S64 dts;
|
||||||
}H264dTimeStamp_t;
|
} H264dTimeStamp_t;
|
||||||
|
|
||||||
//!< current stream
|
//!< current stream
|
||||||
typedef struct h264d_curstrm_t {
|
typedef struct h264d_curstrm_t {
|
||||||
@@ -881,12 +881,12 @@ typedef struct h264d_curstrm_t {
|
|||||||
RK_U8 prefixdata[START_PREFIX_3BYTE];
|
RK_U8 prefixdata[START_PREFIX_3BYTE];
|
||||||
RK_U8 startcode_found;
|
RK_U8 startcode_found;
|
||||||
RK_U8 endcode_found;
|
RK_U8 endcode_found;
|
||||||
//!< time stamp
|
//!< time stamp
|
||||||
//RK_S32 has_fetch_ts;
|
//RK_S32 has_fetch_ts;
|
||||||
RK_U8 pkt_ts_idx;
|
RK_U8 pkt_ts_idx;
|
||||||
RK_U64 pkt_used_bytes; //!< byte offset from starting packet start
|
RK_U64 pkt_used_bytes; //!< byte offset from starting packet start
|
||||||
|
|
||||||
H264dTimeStamp_t pkt_ts[MAX_PTS_NUM];
|
H264dTimeStamp_t pkt_ts[MAX_PTS_NUM];
|
||||||
} H264dCurStream_t;
|
} H264dCurStream_t;
|
||||||
|
|
||||||
//!< current parameters
|
//!< current parameters
|
||||||
@@ -906,18 +906,18 @@ typedef struct h264d_cur_ctx_t {
|
|||||||
struct h264_dec_ctx_t *p_Dec;
|
struct h264_dec_ctx_t *p_Dec;
|
||||||
struct h264d_video_ctx_t *p_Vid; //!< parameters for video decoder
|
struct h264d_video_ctx_t *p_Vid; //!< parameters for video decoder
|
||||||
|
|
||||||
RK_S64 last_pts;
|
RK_S64 last_pts;
|
||||||
RK_S64 last_dts;
|
RK_S64 last_dts;
|
||||||
RK_S64 curr_pts;
|
RK_S64 curr_pts;
|
||||||
RK_S64 curr_dts;
|
RK_S64 curr_dts;
|
||||||
} H264dCurCtx_t;
|
} H264dCurCtx_t;
|
||||||
|
|
||||||
typedef struct h264d_outlist_t {
|
typedef struct h264d_outlist_t {
|
||||||
RK_U32 begin;
|
RK_U32 begin;
|
||||||
RK_U32 end;
|
RK_U32 end;
|
||||||
RK_U32 max_size;
|
RK_U32 max_size;
|
||||||
H264_DpbMark_t *list[MAX_MARK_SIZE];
|
H264_DpbMark_t *list[MAX_MARK_SIZE];
|
||||||
}H264dOutList_t;
|
} H264dOutList_t;
|
||||||
|
|
||||||
//!< parameters for video decoder
|
//!< parameters for video decoder
|
||||||
typedef struct h264d_video_ctx_t {
|
typedef struct h264d_video_ctx_t {
|
||||||
@@ -956,8 +956,8 @@ typedef struct h264d_video_ctx_t {
|
|||||||
RK_U32 PicWidthInMbs;
|
RK_U32 PicWidthInMbs;
|
||||||
RK_U32 FrameHeightInMbs;
|
RK_U32 FrameHeightInMbs;
|
||||||
RK_S32 yuv_format;
|
RK_S32 yuv_format;
|
||||||
RK_U32 bit_depth_chroma;
|
RK_U32 bit_depth_chroma;
|
||||||
RK_U32 bit_depth_luma;
|
RK_U32 bit_depth_luma;
|
||||||
RK_S32 width;
|
RK_S32 width;
|
||||||
RK_S32 height;
|
RK_S32 height;
|
||||||
RK_U32 width_after_crop;
|
RK_U32 width_after_crop;
|
||||||
@@ -988,17 +988,17 @@ typedef struct h264d_video_ctx_t {
|
|||||||
RK_S32 active_mvc_sps_flag;
|
RK_S32 active_mvc_sps_flag;
|
||||||
|
|
||||||
RK_U32 g_framecnt;
|
RK_U32 g_framecnt;
|
||||||
RK_U32 dpb_size[MAX_NUM_DPB_LAYERS];
|
RK_U32 dpb_size[MAX_NUM_DPB_LAYERS];
|
||||||
struct h264d_outlist_t outlist[MAX_NUM_DPB_LAYERS];
|
struct h264d_outlist_t outlist[MAX_NUM_DPB_LAYERS];
|
||||||
RK_S32 last_outputpoc[MAX_NUM_DPB_LAYERS];
|
RK_S32 last_outputpoc[MAX_NUM_DPB_LAYERS];
|
||||||
RK_U32 has_get_i_frame_flag;
|
RK_U32 has_get_i_frame_flag;
|
||||||
} H264dVideoCtx_t;
|
} H264dVideoCtx_t;
|
||||||
|
|
||||||
typedef struct h264d_mem_t {
|
typedef struct h264d_mem_t {
|
||||||
struct h264_dpb_mark_t dpb_mark[MAX_MARK_SIZE]; //!< for fpga register check, dpb mark
|
struct h264_dpb_mark_t dpb_mark[MAX_MARK_SIZE]; //!< for fpga register check, dpb mark
|
||||||
struct h264_dpb_info_t dpb_info[MAX_DPB_SIZE]; //!< 16
|
struct h264_dpb_info_t dpb_info[MAX_DPB_SIZE]; //!< 16
|
||||||
struct h264_dpb_info_t dpb_old[2][MAX_DPB_SIZE];
|
struct h264_dpb_info_t dpb_old[2][MAX_DPB_SIZE];
|
||||||
struct h264_refpic_info_t refpic_info_p[MAX_REF_SIZE]; //!< 32
|
struct h264_refpic_info_t refpic_info_p[MAX_REF_SIZE]; //!< 32
|
||||||
struct h264_refpic_info_t refpic_info_b[2][MAX_REF_SIZE]; //!< [2][32]
|
struct h264_refpic_info_t refpic_info_b[2][MAX_REF_SIZE]; //!< [2][32]
|
||||||
struct h264d_dxva_ctx_t dxva_ctx;
|
struct h264d_dxva_ctx_t dxva_ctx;
|
||||||
} H264_DecMem_t;
|
} H264_DecMem_t;
|
||||||
@@ -1048,10 +1048,10 @@ typedef enum slice_state_type {
|
|||||||
|
|
||||||
//!< decoder video parameter
|
//!< decoder video parameter
|
||||||
typedef struct h264_err_ctx_t {
|
typedef struct h264_err_ctx_t {
|
||||||
RK_U32 err_flag;
|
RK_U32 err_flag;
|
||||||
void *data;
|
void *data;
|
||||||
RK_U32 length;
|
RK_U32 length;
|
||||||
}H264dErrCtx_t;
|
} H264dErrCtx_t;
|
||||||
|
|
||||||
|
|
||||||
//!< decoder video parameter
|
//!< decoder video parameter
|
||||||
@@ -1059,7 +1059,7 @@ typedef struct h264_dec_ctx_t {
|
|||||||
struct h264d_mem_t *mem;
|
struct h264d_mem_t *mem;
|
||||||
struct h264_dpb_mark_t *dpb_mark; //!< for write out, MAX_DPB_SIZE
|
struct h264_dpb_mark_t *dpb_mark; //!< for write out, MAX_DPB_SIZE
|
||||||
struct h264_dpb_info_t *dpb_info; //!< 16
|
struct h264_dpb_info_t *dpb_info; //!< 16
|
||||||
struct h264_dpb_info_t *dpb_old[2]; //!< 16
|
struct h264_dpb_info_t *dpb_old[2]; //!< 16
|
||||||
struct h264_refpic_info_t *refpic_info_p; //!< 32
|
struct h264_refpic_info_t *refpic_info_p; //!< 32
|
||||||
struct h264_refpic_info_t *refpic_info_b[2]; //!< [2][32]
|
struct h264_refpic_info_t *refpic_info_b[2]; //!< [2][32]
|
||||||
struct h264d_dxva_ctx_t *dxva_ctx;
|
struct h264d_dxva_ctx_t *dxva_ctx;
|
||||||
@@ -1073,7 +1073,7 @@ typedef struct h264_dec_ctx_t {
|
|||||||
RK_U8 is_first_frame;
|
RK_U8 is_first_frame;
|
||||||
RK_U8 is_new_frame;
|
RK_U8 is_new_frame;
|
||||||
RK_U8 is_parser_end;
|
RK_U8 is_parser_end;
|
||||||
RK_U8 mvc_valid;
|
RK_U8 mvc_valid;
|
||||||
struct h264d_logctx_t logctx; //!< debug log file
|
struct h264d_logctx_t logctx; //!< debug log file
|
||||||
struct log_ctx_t logctxbuf[LOG_MAX];
|
struct log_ctx_t logctxbuf[LOG_MAX];
|
||||||
|
|
||||||
@@ -1087,7 +1087,7 @@ typedef struct h264_dec_ctx_t {
|
|||||||
RK_U32 task_eos;
|
RK_U32 task_eos;
|
||||||
HalDecTask *in_task;
|
HalDecTask *in_task;
|
||||||
RK_S32 last_frame_slot_idx;
|
RK_S32 last_frame_slot_idx;
|
||||||
struct h264_err_ctx_t err_ctx;
|
struct h264_err_ctx_t err_ctx;
|
||||||
} H264_DecCtx_t;
|
} H264_DecCtx_t;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -380,9 +380,9 @@ __FAILED:
|
|||||||
|
|
||||||
static void dpb_mark_malloc(H264dVideoCtx_t *p_Vid, RK_S32 structure, RK_U8 combine_flag, RK_S32 layer_id)
|
static void dpb_mark_malloc(H264dVideoCtx_t *p_Vid, RK_S32 structure, RK_U8 combine_flag, RK_S32 layer_id)
|
||||||
{
|
{
|
||||||
RK_U8 idx = 1;
|
RK_U8 idx = 1;
|
||||||
H264_DpbMark_t *cur_mark = NULL;
|
H264_DpbMark_t *cur_mark = NULL;
|
||||||
RK_U32 hor_stride = 0, ver_stride = 0;
|
RK_U32 hor_stride = 0, ver_stride = 0;
|
||||||
H264_DecCtx_t *p_Dec = p_Vid->p_Dec;
|
H264_DecCtx_t *p_Dec = p_Vid->p_Dec;
|
||||||
H264_DpbMark_t *p_mark = p_Vid->p_Dec->dpb_mark;
|
H264_DpbMark_t *p_mark = p_Vid->p_Dec->dpb_mark;
|
||||||
|
|
||||||
@@ -395,50 +395,49 @@ static void dpb_mark_malloc(H264dVideoCtx_t *p_Vid, RK_S32 structure, RK_U8 comb
|
|||||||
mpp_buf_slot_get_unused(p_Vid->p_Dec->frame_slots, &p_mark[idx].slot_idx);
|
mpp_buf_slot_get_unused(p_Vid->p_Dec->frame_slots, &p_mark[idx].slot_idx);
|
||||||
cur_mark = &p_mark[idx];
|
cur_mark = &p_mark[idx];
|
||||||
|
|
||||||
cur_mark->out_flag = 1;
|
cur_mark->out_flag = 1;
|
||||||
if(p_Vid->g_framecnt == 255)
|
if (p_Vid->g_framecnt == 255) {
|
||||||
{
|
idx = idx;
|
||||||
idx = idx;
|
}
|
||||||
}
|
//LogInfo(p_Vid->p_Dec->logctx.parr[RUN_PARSE], "[MALLOC] g_frame_no=%d, mark_idx=%d, slot_idx=%d \n", p_Vid->g_framecnt, cur_mark->mark_idx, cur_mark->slot_idx);
|
||||||
//LogInfo(p_Vid->p_Dec->logctx.parr[RUN_PARSE], "[MALLOC] g_frame_no=%d, mark_idx=%d, slot_idx=%d \n", p_Vid->g_framecnt, cur_mark->mark_idx, cur_mark->slot_idx);
|
|
||||||
//mpp_print_slot_flag_info(g_debug_file1, p_Dec->frame_slots, cur_mark->slot_idx);
|
//mpp_print_slot_flag_info(g_debug_file1, p_Dec->frame_slots, cur_mark->slot_idx);
|
||||||
H264D_LOG("[extra_data][Malloc] lay_id=%d, g_framecnt=%d, mark_idx=%d, slot_idx=%d, pts=%lld \n", layer_id,
|
H264D_LOG("[extra_data][Malloc] lay_id=%d, g_framecnt=%d, mark_idx=%d, slot_idx=%d, pts=%lld \n", layer_id,
|
||||||
p_Vid->g_framecnt, cur_mark->mark_idx, cur_mark->slot_idx, p_Vid->p_Inp->in_pts);
|
p_Vid->g_framecnt, cur_mark->mark_idx, cur_mark->slot_idx, p_Vid->p_Inp->in_pts);
|
||||||
|
|
||||||
//FPRINT(g_debug_file1, "[MALLOC] g_frame_no=%d, mark_idx=%d, slot_idx=%d \n", p_Vid->g_framecnt, cur_mark->mark_idx, cur_mark->slot_idx);
|
//FPRINT(g_debug_file1, "[MALLOC] g_frame_no=%d, mark_idx=%d, slot_idx=%d \n", p_Vid->g_framecnt, cur_mark->mark_idx, cur_mark->slot_idx);
|
||||||
|
|
||||||
|
|
||||||
if((YUV420 == p_Vid->yuv_format) && (8 == p_Vid->bit_depth_luma)) {
|
if ((YUV420 == p_Vid->yuv_format) && (8 == p_Vid->bit_depth_luma)) {
|
||||||
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV420SP);
|
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV420SP);
|
||||||
} else if ((YUV420 == p_Vid->yuv_format) && (10 == p_Vid->bit_depth_luma)) {
|
} else if ((YUV420 == p_Vid->yuv_format) && (10 == p_Vid->bit_depth_luma)) {
|
||||||
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV420SP_10BIT);
|
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV420SP_10BIT);
|
||||||
H264D_LOG(" alloc_picture ----- MPP_FMT_YUV420SP_10BIT ------ \n");
|
H264D_LOG(" alloc_picture ----- MPP_FMT_YUV420SP_10BIT ------ \n");
|
||||||
} else if ((YUV422 == p_Vid->yuv_format) && (8 == p_Vid->bit_depth_luma)) {
|
} else if ((YUV422 == p_Vid->yuv_format) && (8 == p_Vid->bit_depth_luma)) {
|
||||||
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV422SP);
|
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV422SP);
|
||||||
} else if ((YUV422 == p_Vid->yuv_format) && (10 == p_Vid->bit_depth_luma)) {
|
} else if ((YUV422 == p_Vid->yuv_format) && (10 == p_Vid->bit_depth_luma)) {
|
||||||
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV422SP_10BIT);
|
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV422SP_10BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
hor_stride = ((p_Vid->width * p_Vid->bit_depth_luma + 127) & (~127))/8;
|
hor_stride = ((p_Vid->width * p_Vid->bit_depth_luma + 127) & (~127)) / 8;
|
||||||
ver_stride = p_Vid->height;
|
ver_stride = p_Vid->height;
|
||||||
hor_stride = MPP_ALIGN(hor_stride, 256) | 256;
|
hor_stride = MPP_ALIGN(hor_stride, 256) | 256;
|
||||||
ver_stride = MPP_ALIGN(ver_stride, 16);
|
ver_stride = MPP_ALIGN(ver_stride, 16);
|
||||||
|
|
||||||
mpp_frame_set_hor_stride(cur_mark->frame, hor_stride); // before crop
|
mpp_frame_set_hor_stride(cur_mark->frame, hor_stride); // before crop
|
||||||
mpp_frame_set_ver_stride(cur_mark->frame, ver_stride);
|
mpp_frame_set_ver_stride(cur_mark->frame, ver_stride);
|
||||||
|
|
||||||
mpp_frame_set_width(cur_mark->frame, p_Vid->width_after_crop); // after crop
|
mpp_frame_set_width(cur_mark->frame, p_Vid->width_after_crop); // after crop
|
||||||
mpp_frame_set_height(cur_mark->frame, p_Vid->height_after_crop);
|
mpp_frame_set_height(cur_mark->frame, p_Vid->height_after_crop);
|
||||||
H264D_LOG("hor_stride=%d, ver_stride=%d, width=%d, height=%d, crop_width=%d, crop_height =%d \n", hor_stride,
|
H264D_LOG("hor_stride=%d, ver_stride=%d, width=%d, height=%d, crop_width=%d, crop_height =%d \n", hor_stride,
|
||||||
ver_stride, p_Vid->width, p_Vid->height, p_Vid->width_after_crop, p_Vid->height_after_crop);
|
ver_stride, p_Vid->width, p_Vid->height, p_Vid->width_after_crop, p_Vid->height_after_crop);
|
||||||
|
|
||||||
mpp_frame_set_pts(cur_mark->frame, p_Vid->p_Cur->last_pts);
|
mpp_frame_set_pts(cur_mark->frame, p_Vid->p_Cur->last_pts);
|
||||||
mpp_frame_set_dts(cur_mark->frame, p_Vid->p_Cur->last_dts);
|
mpp_frame_set_dts(cur_mark->frame, p_Vid->p_Cur->last_dts);
|
||||||
//mpp_log("[ timeUs ] alloc_pts=%lld, input_pts=%lld \n", p_Vid->p_Cur->last_pts, p_Vid->p_Inp->in_pts);
|
//mpp_log("[ timeUs ] alloc_pts=%lld, input_pts=%lld \n", p_Vid->p_Cur->last_pts, p_Vid->p_Inp->in_pts);
|
||||||
|
|
||||||
mpp_buf_slot_set_prop(p_Dec->frame_slots, cur_mark->slot_idx, SLOT_FRAME, cur_mark->frame);
|
mpp_buf_slot_set_prop(p_Dec->frame_slots, cur_mark->slot_idx, SLOT_FRAME, cur_mark->frame);
|
||||||
FPRINT(g_debug_file0, "[Malloc] g_framecnt=%d, mark_idx=%d, slot_idx=%d, lay_id=%d, pts=%lld \n",
|
FPRINT(g_debug_file0, "[Malloc] g_framecnt=%d, mark_idx=%d, slot_idx=%d, lay_id=%d, pts=%lld \n",
|
||||||
p_Vid->g_framecnt, cur_mark->mark_idx, cur_mark->slot_idx, layer_id, p_Vid->p_Inp->in_pts);
|
p_Vid->g_framecnt, cur_mark->mark_idx, cur_mark->slot_idx, layer_id, p_Vid->p_Inp->in_pts);
|
||||||
|
|
||||||
p_Vid->active_dpb_mark[layer_id] = cur_mark;
|
p_Vid->active_dpb_mark[layer_id] = cur_mark;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -31,11 +31,11 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
char *_strupr(char *str)
|
char *_strupr(char *str)
|
||||||
{
|
{
|
||||||
char *orign=str;
|
char *orign = str;
|
||||||
for (; *str != '\0'; str++) {
|
for (; *str != '\0'; str++) {
|
||||||
*str = toupper(*str);
|
*str = toupper(*str);
|
||||||
}
|
}
|
||||||
return orign;
|
return orign;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -66,38 +66,38 @@ static void interpret_user_data_registered_itu_t_t35_info()
|
|||||||
|
|
||||||
static MPP_RET interpret_user_data_unregistered_info(RK_U8 *payload, RK_S32 size, H264_SEI_t *sei_msg)
|
static MPP_RET interpret_user_data_unregistered_info(RK_U8 *payload, RK_S32 size, H264_SEI_t *sei_msg)
|
||||||
{
|
{
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
H264D_LOG("size=%d",size);
|
H264D_LOG("size=%d", size);
|
||||||
ASSERT(size >= 16);
|
ASSERT(size >= 16);
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
RK_U32 offset = 0;
|
RK_U32 offset = 0;
|
||||||
RK_U8 payload_byte;
|
RK_U8 payload_byte;
|
||||||
mpp_log("User data unregistered SEI message\n");
|
mpp_log("User data unregistered SEI message\n");
|
||||||
mpp_log("uuid_iso_11578 = 0x");
|
mpp_log("uuid_iso_11578 = 0x");
|
||||||
for (offset = 0; offset < 16; offset++) {
|
for (offset = 0; offset < 16; offset++) {
|
||||||
mpp_log("%02x",payload[offset]);
|
mpp_log("%02x", payload[offset]);
|
||||||
}
|
}
|
||||||
while (offset < size) {
|
while (offset < size) {
|
||||||
payload_byte = payload[offset];
|
payload_byte = payload[offset];
|
||||||
offset++;
|
offset++;
|
||||||
mpp_log("Unreg data payload_byte = %02x\n", payload_byte);
|
mpp_log("Unreg data payload_byte = %02x\n", payload_byte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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->err_ctx.err_flag |= VPU_FRAME_ERR_UNSUPPORT;
|
sei_msg->p_Dec->err_ctx.err_flag |= VPU_FRAME_ERR_UNSUPPORT;
|
||||||
ret = MPP_NOK;
|
ret = MPP_NOK;
|
||||||
goto __FAILED;
|
goto __FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
__FAILED:
|
__FAILED:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void interpret_pan_scan_rect_info()
|
static void interpret_pan_scan_rect_info()
|
||||||
@@ -232,8 +232,8 @@ static MPP_RET interpret_buffering_period_info(RK_U8 *payload, RK_S32 size, BitR
|
|||||||
p_bitctx = &tmp_strmdata;
|
p_bitctx = &tmp_strmdata;
|
||||||
mpp_set_bitread_ctx(p_bitctx, payload, size);
|
mpp_set_bitread_ctx(p_bitctx, payload, size);
|
||||||
READ_UE(p_bitctx, &sei_msg->seq_parameter_set_id, "seq_parameter_set_id");
|
READ_UE(p_bitctx, &sei_msg->seq_parameter_set_id, "seq_parameter_set_id");
|
||||||
//mpp_log("sei_msg->seq_parameter_set_id=%d \n", sei_msg->seq_parameter_set_id);
|
//mpp_log("sei_msg->seq_parameter_set_id=%d \n", sei_msg->seq_parameter_set_id);
|
||||||
CHECK_RANGE(p_bitctx, sei_msg->seq_parameter_set_id, 0, 32);
|
CHECK_RANGE(p_bitctx, sei_msg->seq_parameter_set_id, 0, 32);
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
__BITREAD_ERR:
|
__BITREAD_ERR:
|
||||||
ret = p_bitctx->ret;
|
ret = p_bitctx->ret;
|
||||||
@@ -258,27 +258,27 @@ static void interpret_reserved_info(RK_U8 *payload, RK_S32 size, BitReadCtx_t *p
|
|||||||
static MPP_RET parserSEI(H264_SLICE_t *cur_slice, BitReadCtx_t *p_bitctx, H264_SEI_t *sei_msg, RK_U8 *msg)
|
static MPP_RET parserSEI(H264_SLICE_t *cur_slice, BitReadCtx_t *p_bitctx, H264_SEI_t *sei_msg, RK_U8 *msg)
|
||||||
{
|
{
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
H264dVideoCtx_t *p_Vid = cur_slice->p_Vid;
|
H264dVideoCtx_t *p_Vid = cur_slice->p_Vid;
|
||||||
|
|
||||||
H264D_LOG("[SEI_TYPE] type=%d \n", sei_msg->type);
|
H264D_LOG("[SEI_TYPE] type=%d \n", sei_msg->type);
|
||||||
switch (sei_msg->type) {
|
switch (sei_msg->type) {
|
||||||
case SEI_BUFFERING_PERIOD:
|
case SEI_BUFFERING_PERIOD:
|
||||||
FUN_CHECK(ret = interpret_buffering_period_info(msg, sei_msg->payload_size, p_bitctx, sei_msg));
|
FUN_CHECK(ret = interpret_buffering_period_info(msg, sei_msg->payload_size, p_bitctx, sei_msg));
|
||||||
{
|
{
|
||||||
H264_SPS_t *sps = NULL;
|
H264_SPS_t *sps = NULL;
|
||||||
H264_subSPS_t *subset_sps = NULL;
|
H264_subSPS_t *subset_sps = NULL;
|
||||||
if (sei_msg->mvc_scalable_nesting_flag) {
|
if (sei_msg->mvc_scalable_nesting_flag) {
|
||||||
p_Vid->active_mvc_sps_flag = 1;
|
p_Vid->active_mvc_sps_flag = 1;
|
||||||
sps = NULL;
|
sps = NULL;
|
||||||
subset_sps = &p_Vid->subspsSet[sei_msg->seq_parameter_set_id];
|
subset_sps = &p_Vid->subspsSet[sei_msg->seq_parameter_set_id];
|
||||||
} else {
|
} else {
|
||||||
p_Vid->active_mvc_sps_flag = 0;
|
p_Vid->active_mvc_sps_flag = 0;
|
||||||
sps = &p_Vid->spsSet[sei_msg->seq_parameter_set_id];
|
sps = &p_Vid->spsSet[sei_msg->seq_parameter_set_id];
|
||||||
subset_sps = NULL;
|
subset_sps = NULL;
|
||||||
}
|
}
|
||||||
p_Vid->exit_picture_flag = 1;
|
p_Vid->exit_picture_flag = 1;
|
||||||
FUN_CHECK(ret = activate_sps(p_Vid, sps, subset_sps));
|
FUN_CHECK(ret = activate_sps(p_Vid, sps, subset_sps));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SEI_PIC_TIMING:
|
case SEI_PIC_TIMING:
|
||||||
interpret_picture_timing_info();
|
interpret_picture_timing_info();
|
||||||
@@ -353,7 +353,7 @@ static MPP_RET parserSEI(H264_SLICE_t *cur_slice, BitReadCtx_t *p_bitctx, H264_S
|
|||||||
break;
|
break;
|
||||||
case SEI_MVC_SCALABLE_NESTING:
|
case SEI_MVC_SCALABLE_NESTING:
|
||||||
FUN_CHECK(ret = interpret_mvc_scalable_nesting_info(msg, sei_msg->payload_size, p_bitctx));
|
FUN_CHECK(ret = interpret_mvc_scalable_nesting_info(msg, sei_msg->payload_size, p_bitctx));
|
||||||
sei_msg->mvc_scalable_nesting_flag = 1;
|
sei_msg->mvc_scalable_nesting_flag = 1;
|
||||||
break;
|
break;
|
||||||
case SEI_VIEW_SCALABILITY_INFO:
|
case SEI_VIEW_SCALABILITY_INFO:
|
||||||
interpret_mvc_scalability_info();
|
interpret_mvc_scalability_info();
|
||||||
@@ -385,7 +385,7 @@ MPP_RET process_sei(H264_SLICE_t *currSlice)
|
|||||||
FunctionIn(currSlice->logctx->parr[RUN_PARSE]);
|
FunctionIn(currSlice->logctx->parr[RUN_PARSE]);
|
||||||
memset(sei_msg, 0, sizeof(*sei_msg));
|
memset(sei_msg, 0, sizeof(*sei_msg));
|
||||||
sei_msg->mvc_scalable_nesting_flag = 0; //init to false
|
sei_msg->mvc_scalable_nesting_flag = 0; //init to false
|
||||||
sei_msg->p_Dec = currSlice->p_Dec;
|
sei_msg->p_Dec = currSlice->p_Dec;
|
||||||
do {
|
do {
|
||||||
sei_msg->type = 0;
|
sei_msg->type = 0;
|
||||||
READ_BITS(p_bitctx, 8, &tmp_byte, "tmp_byte");
|
READ_BITS(p_bitctx, 8, &tmp_byte, "tmp_byte");
|
||||||
|
@@ -398,7 +398,7 @@ static MPP_RET set_slice_user_parmeters(H264_SLICE_t *currSlice)
|
|||||||
currSlice->active_sps = p_Vid->active_sps;
|
currSlice->active_sps = p_Vid->active_sps;
|
||||||
currSlice->active_pps = p_Vid->active_pps;
|
currSlice->active_pps = p_Vid->active_pps;
|
||||||
|
|
||||||
p_Vid->type = currSlice->slice_type;
|
p_Vid->type = currSlice->slice_type;
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
__FAILED:
|
__FAILED:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
|
@@ -179,11 +179,11 @@ static MPP_RET parser_sps(BitReadCtx_t *p_bitctx, H264_SPS_t *cur_sps, H264_DecC
|
|||||||
|| cur_sps->profile_idc == 128 || cur_sps->profile_idc == 138) {
|
|| cur_sps->profile_idc == 128 || cur_sps->profile_idc == 138) {
|
||||||
READ_UE(p_bitctx, &cur_sps->chroma_format_idc, "chroma_format_idc");
|
READ_UE(p_bitctx, &cur_sps->chroma_format_idc, "chroma_format_idc");
|
||||||
ASSERT(cur_sps->chroma_format_idc < 4);
|
ASSERT(cur_sps->chroma_format_idc < 4);
|
||||||
//if (cur_sps->chroma_format_idc >= 3) {
|
//if (cur_sps->chroma_format_idc >= 3) {
|
||||||
// H264D_ERR("ERROR: Not support chroma_format_idc=%d.", cur_sps->chroma_format_idc);
|
// H264D_ERR("ERROR: Not support chroma_format_idc=%d.", cur_sps->chroma_format_idc);
|
||||||
// p_Dec->err_ctx.err_flag |= VPU_FRAME_ERR_UNSUPPORT;
|
// p_Dec->err_ctx.err_flag |= VPU_FRAME_ERR_UNSUPPORT;
|
||||||
// goto __FAILED;
|
// goto __FAILED;
|
||||||
//}
|
//}
|
||||||
//if (cur_sps->chroma_format_idc == 3) {
|
//if (cur_sps->chroma_format_idc == 3) {
|
||||||
// READ_ONEBIT(p_bitctx, &cur_sps->separate_colour_plane_flag, "separate_colour_plane_flag");
|
// READ_ONEBIT(p_bitctx, &cur_sps->separate_colour_plane_flag, "separate_colour_plane_flag");
|
||||||
// LogError(p_bitctx->ctx, "Not support YUV444 format current.");
|
// LogError(p_bitctx->ctx, "Not support YUV444 format current.");
|
||||||
@@ -361,9 +361,9 @@ static void update_video_pars(H264dVideoCtx_t *p_Vid, H264_SPS_t *sps)
|
|||||||
|
|
||||||
p_Vid->width = p_Vid->PicWidthInMbs * 16;
|
p_Vid->width = p_Vid->PicWidthInMbs * 16;
|
||||||
p_Vid->height = p_Vid->FrameHeightInMbs * 16;
|
p_Vid->height = p_Vid->FrameHeightInMbs * 16;
|
||||||
p_Vid->bit_depth_luma = sps->bit_depth_luma_minus8 + 8;
|
p_Vid->bit_depth_luma = sps->bit_depth_luma_minus8 + 8;
|
||||||
p_Vid->bit_depth_chroma = sps->bit_depth_chroma_minus8 + 8;
|
p_Vid->bit_depth_chroma = sps->bit_depth_chroma_minus8 + 8;
|
||||||
|
|
||||||
if (p_Vid->yuv_format == YUV420) {
|
if (p_Vid->yuv_format == YUV420) {
|
||||||
p_Vid->width_cr = (p_Vid->width >> 1);
|
p_Vid->width_cr = (p_Vid->width >> 1);
|
||||||
p_Vid->height_cr = (p_Vid->height >> 1);
|
p_Vid->height_cr = (p_Vid->height >> 1);
|
||||||
@@ -545,10 +545,10 @@ MPP_RET activate_sps(H264dVideoCtx_t *p_Vid, H264_SPS_t *sps, H264_subSPS_t *sub
|
|||||||
if (video_pars_changed(p_Vid, p_Vid->active_sps, 1)) {
|
if (video_pars_changed(p_Vid, p_Vid->active_sps, 1)) {
|
||||||
FUN_CHECK(ret = flush_dpb(p_Vid->p_Dpb_layer[1], 2));
|
FUN_CHECK(ret = flush_dpb(p_Vid->p_Dpb_layer[1], 2));
|
||||||
FUN_CHECK(ret = init_dpb(p_Vid, p_Vid->p_Dpb_layer[1], 2));
|
FUN_CHECK(ret = init_dpb(p_Vid, p_Vid->p_Dpb_layer[1], 2));
|
||||||
update_last_video_pars(p_Vid, p_Vid->active_sps, 1);
|
update_last_video_pars(p_Vid, p_Vid->active_sps, 1);
|
||||||
//!< init frame slots, store frame buffer size
|
//!< init frame slots, store frame buffer size
|
||||||
p_Vid->dpb_size[1] = p_Vid->p_Dpb_layer[1]->size;
|
p_Vid->dpb_size[1] = p_Vid->p_Dpb_layer[1]->size;
|
||||||
//mpp_buf_slot_setup(p_Vid->p_Dec->frame_slots, p_Vid->dpb_size[0] + p_Vid->dpb_size[1] + 3);
|
//mpp_buf_slot_setup(p_Vid->p_Dec->frame_slots, p_Vid->dpb_size[0] + p_Vid->dpb_size[1] + 3);
|
||||||
}
|
}
|
||||||
} else { //!< layer_id == 0
|
} else { //!< layer_id == 0
|
||||||
p_Vid->active_sps = sps;
|
p_Vid->active_sps = sps;
|
||||||
@@ -560,10 +560,10 @@ MPP_RET activate_sps(H264dVideoCtx_t *p_Vid, H264_SPS_t *sps, H264_subSPS_t *sub
|
|||||||
FUN_CHECK(ret = flush_dpb(p_Vid->p_Dpb_layer[0], 1));
|
FUN_CHECK(ret = flush_dpb(p_Vid->p_Dpb_layer[0], 1));
|
||||||
}
|
}
|
||||||
FUN_CHECK(ret = init_dpb(p_Vid, p_Vid->p_Dpb_layer[0], 1));
|
FUN_CHECK(ret = init_dpb(p_Vid, p_Vid->p_Dpb_layer[0], 1));
|
||||||
update_last_video_pars(p_Vid, p_Vid->active_sps, 0);
|
update_last_video_pars(p_Vid, p_Vid->active_sps, 0);
|
||||||
//!< init frame slots, store frame buffer size
|
//!< init frame slots, store frame buffer size
|
||||||
p_Vid->dpb_size[0] = p_Vid->p_Dpb_layer[0]->size;
|
p_Vid->dpb_size[0] = p_Vid->p_Dpb_layer[0]->size;
|
||||||
//mpp_buf_slot_setup(p_Vid->p_Dec->frame_slots, p_Vid->dpb_size[0] + 3);
|
//mpp_buf_slot_setup(p_Vid->p_Dec->frame_slots, p_Vid->dpb_size[0] + 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update_video_pars(p_Vid, p_Vid->active_sps);
|
update_video_pars(p_Vid, p_Vid->active_sps);
|
||||||
|
@@ -716,11 +716,11 @@ static RK_S32 hls_slice_header(HEVCContext *s)
|
|||||||
if (s->nal_unit_type >= 16 && s->nal_unit_type <= 23)
|
if (s->nal_unit_type >= 16 && s->nal_unit_type <= 23)
|
||||||
READ_ONEBIT(gb, &sh->no_output_of_prior_pics_flag);
|
READ_ONEBIT(gb, &sh->no_output_of_prior_pics_flag);
|
||||||
|
|
||||||
if(IS_IRAP(s) && s->miss_ref_flag && sh->first_slice_in_pic_flag){
|
if (IS_IRAP(s) && s->miss_ref_flag && sh->first_slice_in_pic_flag) {
|
||||||
// mpp_err("s->nal_unit_type = %d s->poc %d",s->nal_unit_type,s->poc);
|
// mpp_err("s->nal_unit_type = %d s->poc %d",s->nal_unit_type,s->poc);
|
||||||
s->max_ra = INT_MAX;
|
s->max_ra = INT_MAX;
|
||||||
s->miss_ref_flag = 0;
|
s->miss_ref_flag = 0;
|
||||||
}
|
}
|
||||||
READ_UE(gb, &pps_id);
|
READ_UE(gb, &pps_id);
|
||||||
|
|
||||||
if (pps_id >= MAX_PPS_COUNT || !s->pps_list[pps_id]) {
|
if (pps_id >= MAX_PPS_COUNT || !s->pps_list[pps_id]) {
|
||||||
@@ -1134,13 +1134,13 @@ static RK_S32 hevc_frame_start(HEVCContext *s)
|
|||||||
|
|
||||||
s->miss_ref_flag = 0;
|
s->miss_ref_flag = 0;
|
||||||
ret = mpp_hevc_frame_rps(s);
|
ret = mpp_hevc_frame_rps(s);
|
||||||
if(s->miss_ref_flag && !IS_IRAP(s)){
|
if (s->miss_ref_flag && !IS_IRAP(s)) {
|
||||||
mpp_frame_set_errinfo(s->frame,VPU_FRAME_ERR_UNKNOW);
|
mpp_frame_set_errinfo(s->frame, VPU_FRAME_ERR_UNKNOW);
|
||||||
s->ref->error_flag = 1;
|
s->ref->error_flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mpp_buf_slot_set_prop(s->slots, s->ref->slot_index, SLOT_FRAME, s->ref->frame);
|
mpp_buf_slot_set_prop(s->slots, s->ref->slot_index, SLOT_FRAME, s->ref->frame);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
mpp_err("Error constructing the frame RPS.\n");
|
mpp_err("Error constructing the frame RPS.\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -1485,18 +1485,18 @@ static RK_S32 split_nal_units(HEVCContext *s, RK_U8 *buf, RK_U32 length)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (buf[0] != 0 || buf[1] != 0 || buf[2] != 1) {
|
if (buf[0] != 0 || buf[1] != 0 || buf[2] != 1) {
|
||||||
RK_U32 state = (RK_U32)-1;
|
RK_U32 state = (RK_U32) - 1;
|
||||||
int has_nal = 0;
|
int has_nal = 0;
|
||||||
for (i = 0; i < (RK_S32)length; i++) {
|
for (i = 0; i < (RK_S32)length; i++) {
|
||||||
state = (state << 8) | buf[i];
|
state = (state << 8) | buf[i];
|
||||||
if (((state >> 8) & 0xFFFFFF) == START_CODE){
|
if (((state >> 8) & 0xFFFFFF) == START_CODE) {
|
||||||
has_nal = 1;
|
has_nal = 1;
|
||||||
i = i -3;
|
i = i - 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(has_nal){
|
if (has_nal) {
|
||||||
length -= i;
|
length -= i;
|
||||||
buf += i;
|
buf += i;
|
||||||
continue;
|
continue;
|
||||||
@@ -1671,7 +1671,7 @@ MPP_RET h265d_prepare(void *ctx, MppPacket pkt, HalDecTask *task)
|
|||||||
void *pos = NULL;
|
void *pos = NULL;
|
||||||
RK_S32 length = 0;
|
RK_S32 length = 0;
|
||||||
|
|
||||||
//task->valid = 0;
|
//task->valid = 0;
|
||||||
s->eos = mpp_packet_get_eos(pkt);
|
s->eos = mpp_packet_get_eos(pkt);
|
||||||
if (sc != NULL) {
|
if (sc != NULL) {
|
||||||
sc->eos = s->eos;
|
sc->eos = s->eos;
|
||||||
@@ -1712,17 +1712,17 @@ MPP_RET h265d_prepare(void *ctx, MppPacket pkt, HalDecTask *task)
|
|||||||
} else {
|
} else {
|
||||||
return MPP_FAIL_SPLIT_FRAME;
|
return MPP_FAIL_SPLIT_FRAME;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
pos = buf + length;
|
pos = buf + length;
|
||||||
s->pts = pts;
|
s->pts = pts;
|
||||||
mpp_packet_set_pos(pkt, pos);
|
mpp_packet_set_pos(pkt, pos);
|
||||||
if(s->eos){
|
if (s->eos) {
|
||||||
task->valid = 0;
|
task->valid = 0;
|
||||||
task->flags.eos = 1;
|
task->flags.eos = 1;
|
||||||
|
|
||||||
h265d_flush(ctx);
|
h265d_flush(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef dump
|
#ifdef dump
|
||||||
if (s->nb_frame < 10 && fp != NULL) {
|
if (s->nb_frame < 10 && fp != NULL) {
|
||||||
@@ -1974,11 +1974,11 @@ MPP_RET h265d_flush(void *ctx)
|
|||||||
ret = mpp_hevc_output_frame(ctx, 1);
|
ret = mpp_hevc_output_frame(ctx, 1);
|
||||||
} while (ret);
|
} while (ret);
|
||||||
frame = &s->DPB[s->output_frame_idx];
|
frame = &s->DPB[s->output_frame_idx];
|
||||||
if(frame->slot_index < 0xff){
|
if (frame->slot_index < 0xff) {
|
||||||
mpp_buf_slot_set_prop(s->slots, frame->slot_index, SLOT_EOS, &eos);
|
mpp_buf_slot_set_prop(s->slots, frame->slot_index, SLOT_EOS, &eos);
|
||||||
}else{
|
} else {
|
||||||
if(s->notify_cb.callBack != NULL){
|
if (s->notify_cb.callBack != NULL) {
|
||||||
s->notify_cb.callBack(s->notify_cb.opaque,NULL);
|
s->notify_cb.callBack(s->notify_cb.opaque, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2008,22 +2008,22 @@ MPP_RET h265d_control(void *ctx, RK_S32 cmd, void *param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET h265d_callback(void *ctx, void *err_info)
|
MPP_RET h265d_callback(void *ctx, void *err_info)
|
||||||
{
|
{
|
||||||
H265dContext_t *h265dctx = (H265dContext_t *)ctx;
|
H265dContext_t *h265dctx = (H265dContext_t *)ctx;
|
||||||
HEVCContext *s = (HEVCContext *)h265dctx->priv_data;
|
HEVCContext *s = (HEVCContext *)h265dctx->priv_data;
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
s->max_ra = INT_MAX;
|
s->max_ra = INT_MAX;
|
||||||
// s->miss_ref_flag = 1;
|
// s->miss_ref_flag = 1;
|
||||||
mpp_buf_slot_get_prop(s->slots, s->ref->slot_index,SLOT_FRAME,&s->ref->frame);
|
mpp_buf_slot_get_prop(s->slots, s->ref->slot_index, SLOT_FRAME, &s->ref->frame);
|
||||||
mpp_frame_set_errinfo(s->ref->frame,VPU_FRAME_ERR_UNKNOW);
|
mpp_frame_set_errinfo(s->ref->frame, VPU_FRAME_ERR_UNKNOW);
|
||||||
mpp_buf_slot_set_prop(s->slots, s->ref->slot_index, SLOT_FRAME, s->ref->frame);
|
mpp_buf_slot_set_prop(s->slots, s->ref->slot_index, SLOT_FRAME, s->ref->frame);
|
||||||
for (i = 0; i < MPP_ARRAY_ELEMS(s->DPB); i++) {
|
for (i = 0; i < MPP_ARRAY_ELEMS(s->DPB); i++) {
|
||||||
if(s->DPB[i].slot_index == s->ref->slot_index){
|
if (s->DPB[i].slot_index == s->ref->slot_index) {
|
||||||
s->DPB[i].error_flag = 1;
|
s->DPB[i].error_flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
(void) err_info;
|
(void) err_info;
|
||||||
|
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
@@ -696,8 +696,8 @@ typedef struct HEVCContext {
|
|||||||
void *hal_pic_private;
|
void *hal_pic_private;
|
||||||
|
|
||||||
RK_S64 pts;
|
RK_S64 pts;
|
||||||
RK_U8 has_get_eos;
|
RK_U8 has_get_eos;
|
||||||
RK_U8 miss_ref_flag;
|
RK_U8 miss_ref_flag;
|
||||||
IOInterruptCB notify_cb;
|
IOInterruptCB notify_cb;
|
||||||
} HEVCContext;
|
} HEVCContext;
|
||||||
|
|
||||||
|
@@ -172,8 +172,7 @@ static void fill_picture_parameters(const HEVCContext *h,
|
|||||||
}
|
}
|
||||||
// mpp_err("fill RefPicList from the DPB");
|
// mpp_err("fill RefPicList from the DPB");
|
||||||
// fill RefPicList from the DPB
|
// fill RefPicList from the DPB
|
||||||
for (i = 0, j = 0; i < MPP_ARRAY_ELEMS(pp->RefPicList); i++)
|
for (i = 0, j = 0; i < MPP_ARRAY_ELEMS(pp->RefPicList); i++) {
|
||||||
{
|
|
||||||
const HEVCFrame *frame = NULL;
|
const HEVCFrame *frame = NULL;
|
||||||
while (!frame && j < MPP_ARRAY_ELEMS(h->DPB)) {
|
while (!frame && j < MPP_ARRAY_ELEMS(h->DPB)) {
|
||||||
if (&h->DPB[j] != current_picture &&
|
if (&h->DPB[j] != current_picture &&
|
||||||
|
@@ -96,7 +96,7 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
|
|||||||
mpp_frame_set_hor_stride(frame->frame, (s->h265dctx->coded_width * s->h265dctx->nBitDepth) >> 3);
|
mpp_frame_set_hor_stride(frame->frame, (s->h265dctx->coded_width * s->h265dctx->nBitDepth) >> 3);
|
||||||
mpp_frame_set_ver_stride(frame->frame, s->h265dctx->coded_height);
|
mpp_frame_set_ver_stride(frame->frame, s->h265dctx->coded_height);
|
||||||
mpp_frame_set_fmt(frame->frame, s->h265dctx->pix_fmt);
|
mpp_frame_set_fmt(frame->frame, s->h265dctx->pix_fmt);
|
||||||
mpp_frame_set_errinfo(frame->frame,0);
|
mpp_frame_set_errinfo(frame->frame, 0);
|
||||||
|
|
||||||
h265d_dbg(H265D_DBG_GLOBAL, "w_stride %d h_stride %d\n", s->h265dctx->coded_width, s->h265dctx->coded_height);
|
h265d_dbg(H265D_DBG_GLOBAL, "w_stride %d h_stride %d\n", s->h265dctx->coded_width, s->h265dctx->coded_height);
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ static int add_candidate_ref(HEVCContext *s, RefPicList *list,
|
|||||||
mpp_buf_slot_set_flag(s->slots, ref->slot_index, SLOT_CODEC_USE);
|
mpp_buf_slot_set_flag(s->slots, ref->slot_index, SLOT_CODEC_USE);
|
||||||
}
|
}
|
||||||
mark_ref(ref, ref_flag);
|
mark_ref(ref, ref_flag);
|
||||||
if(ref->error_flag){
|
if (ref->error_flag) {
|
||||||
s->miss_ref_flag = 1;
|
s->miss_ref_flag = 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -194,7 +194,7 @@ struct MppBufSlotsImpl_t {
|
|||||||
// buffer parameter, default alignement is 16
|
// buffer parameter, default alignement is 16
|
||||||
AlignFunc hal_hor_align; // default NULL
|
AlignFunc hal_hor_align; // default NULL
|
||||||
AlignFunc hal_ver_align; // default NULL
|
AlignFunc hal_ver_align; // default NULL
|
||||||
AlignFunc hal_len_align; // default NULL
|
AlignFunc hal_len_align; // default NULL
|
||||||
size_t buf_size;
|
size_t buf_size;
|
||||||
RK_S32 buf_count;
|
RK_S32 buf_count;
|
||||||
// buffer size equal to (h_stride * v_stride) * numerator / denominator
|
// buffer size equal to (h_stride * v_stride) * numerator / denominator
|
||||||
@@ -239,7 +239,7 @@ static void generate_info_set(MppBufSlotsImpl *impl, MppFrame frame)
|
|||||||
RK_U32 size = hal_hor_stride * hal_ver_stride;
|
RK_U32 size = hal_hor_stride * hal_ver_stride;
|
||||||
size *= impl->numerator;
|
size *= impl->numerator;
|
||||||
size /= impl->denominator;
|
size /= impl->denominator;
|
||||||
size = impl->hal_len_align ? impl->hal_len_align(hal_hor_stride * hal_ver_stride) : size;
|
size = impl->hal_len_align ? impl->hal_len_align(hal_hor_stride * hal_ver_stride) : size;
|
||||||
|
|
||||||
mpp_frame_set_width(impl->info_set, width);
|
mpp_frame_set_width(impl->info_set, width);
|
||||||
mpp_frame_set_height(impl->info_set, height);
|
mpp_frame_set_height(impl->info_set, height);
|
||||||
@@ -514,7 +514,7 @@ MPP_RET mpp_buf_slot_init(MppBufSlots *slots)
|
|||||||
// slots information default setup
|
// slots information default setup
|
||||||
impl->hal_hor_align = default_align_16;
|
impl->hal_hor_align = default_align_16;
|
||||||
impl->hal_ver_align = default_align_16;
|
impl->hal_ver_align = default_align_16;
|
||||||
impl->hal_len_align = NULL;
|
impl->hal_len_align = NULL;
|
||||||
impl->numerator = 10;
|
impl->numerator = 10;
|
||||||
impl->denominator = 5;
|
impl->denominator = 5;
|
||||||
|
|
||||||
@@ -789,7 +789,7 @@ MPP_RET mpp_buf_slot_set_prop(MppBufSlots slots, RK_S32 index, SlotPropType type
|
|||||||
mpp_log("new width %4d height %4d stride hor %4d ver %4d\n",
|
mpp_log("new width %4d height %4d stride hor %4d ver %4d\n",
|
||||||
dst->width, dst->height, dst->hor_stride, dst->ver_stride);
|
dst->width, dst->height, dst->hor_stride, dst->ver_stride);
|
||||||
#endif
|
#endif
|
||||||
// info change found here
|
// info change found here
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case SLOT_BUFFER: {
|
case SLOT_BUFFER: {
|
||||||
@@ -830,7 +830,7 @@ MPP_RET mpp_buf_slot_get_prop(MppBufSlots slots, RK_S32 index, SlotPropType type
|
|||||||
} break;
|
} break;
|
||||||
case SLOT_FRAME: {
|
case SLOT_FRAME: {
|
||||||
MppFrame *frame = (MppFrame *)val;
|
MppFrame *frame = (MppFrame *)val;
|
||||||
//*frame = (slot->status.has_frame) ? (slot->frame) : (NULL);
|
//*frame = (slot->status.has_frame) ? (slot->frame) : (NULL);
|
||||||
|
|
||||||
mpp_assert(slot->status.has_frame);
|
mpp_assert(slot->status.has_frame);
|
||||||
if (slot->status.has_frame) {
|
if (slot->status.has_frame) {
|
||||||
@@ -840,9 +840,9 @@ MPP_RET mpp_buf_slot_get_prop(MppBufSlots slots, RK_S32 index, SlotPropType type
|
|||||||
} else
|
} else
|
||||||
*frame = NULL;
|
*frame = NULL;
|
||||||
} break;
|
} break;
|
||||||
case SLOT_FRAME_PTR: {
|
case SLOT_FRAME_PTR: {
|
||||||
MppFrame *frame = (MppFrame *)val;
|
MppFrame *frame = (MppFrame *)val;
|
||||||
*frame = (slot->status.has_frame) ? (slot->frame) : (NULL);
|
*frame = (slot->status.has_frame) ? (slot->frame) : (NULL);
|
||||||
} break;
|
} break;
|
||||||
case SLOT_BUFFER: {
|
case SLOT_BUFFER: {
|
||||||
MppBuffer *buffer = (MppBuffer *)val;
|
MppBuffer *buffer = (MppBuffer *)val;
|
||||||
@@ -874,9 +874,9 @@ MPP_RET mpp_slots_set_prop(MppBufSlots slots, SlotsPropType type, void *val)
|
|||||||
case SLOTS_VER_ALIGN: {
|
case SLOTS_VER_ALIGN: {
|
||||||
impl->hal_ver_align = (AlignFunc)val;
|
impl->hal_ver_align = (AlignFunc)val;
|
||||||
} break;
|
} break;
|
||||||
case SLOTS_LEN_ALIGN: {
|
case SLOTS_LEN_ALIGN: {
|
||||||
impl->hal_len_align = (AlignFunc)val;
|
impl->hal_len_align = (AlignFunc)val;
|
||||||
} break;
|
} break;
|
||||||
case SLOTS_COUNT: {
|
case SLOTS_COUNT: {
|
||||||
impl->buf_count = value;
|
impl->buf_count = value;
|
||||||
} break;
|
} break;
|
||||||
|
@@ -287,7 +287,7 @@ static MPP_RET try_proc_dec_task(Mpp *mpp, DecTask *task)
|
|||||||
*/
|
*/
|
||||||
if (!task->status.curr_task_rdy) {
|
if (!task->status.curr_task_rdy) {
|
||||||
parser_prepare(dec->parser, dec->mpp_pkt_in, task_dec);
|
parser_prepare(dec->parser, dec->mpp_pkt_in, task_dec);
|
||||||
if (0 == mpp_packet_get_length(dec->mpp_pkt_in)) {
|
if (0 == mpp_packet_get_length(dec->mpp_pkt_in)) {
|
||||||
mpp_packet_deinit(&dec->mpp_pkt_in);
|
mpp_packet_deinit(&dec->mpp_pkt_in);
|
||||||
dec->mpp_pkt_in = NULL;
|
dec->mpp_pkt_in = NULL;
|
||||||
}
|
}
|
||||||
@@ -555,8 +555,8 @@ void *mpp_dec_parser_thread(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
parser->lock();
|
parser->lock();
|
||||||
if(MPP_THREAD_RUNNING == parser->get_status()){
|
if (MPP_THREAD_RUNNING == parser->get_status()) {
|
||||||
if (check_task_wait(dec, &task))
|
if (check_task_wait(dec, &task))
|
||||||
parser->wait();
|
parser->wait();
|
||||||
}
|
}
|
||||||
parser->unlock();
|
parser->unlock();
|
||||||
@@ -606,7 +606,7 @@ void *mpp_dec_hal_thread(void *data)
|
|||||||
* hal thread wait for dxva interface intput firt
|
* hal thread wait for dxva interface intput firt
|
||||||
*/
|
*/
|
||||||
hal->lock();
|
hal->lock();
|
||||||
if(MPP_THREAD_RUNNING == hal->get_status()){
|
if (MPP_THREAD_RUNNING == hal->get_status()) {
|
||||||
if (hal_task_get_hnd(tasks, TASK_PROCESSING, &task))
|
if (hal_task_get_hnd(tasks, TASK_PROCESSING, &task))
|
||||||
hal->wait();
|
hal->wait();
|
||||||
}
|
}
|
||||||
|
@@ -160,38 +160,38 @@ typedef struct h264d_logctx_t {
|
|||||||
|
|
||||||
//!< vaule check
|
//!< vaule check
|
||||||
#define VAL_CHECK(ret, val, ...)\
|
#define VAL_CHECK(ret, val, ...)\
|
||||||
do{ if(!(val)){\
|
do{ if(!(val)){\
|
||||||
ret = MPP_ERR_VALUE;\
|
ret = MPP_ERR_VALUE;\
|
||||||
mpp_log("Function:%s:%d, ERROR: value error.\n", __FUNCTION__, __LINE__);\
|
mpp_log("Function:%s:%d, ERROR: value error.\n", __FUNCTION__, __LINE__);\
|
||||||
goto __FAILED;\
|
goto __FAILED;\
|
||||||
} } while (0)
|
} } while (0)
|
||||||
//!< memory malloc check
|
//!< memory malloc check
|
||||||
#define MEM_CHECK(ret, val, ...)\
|
#define MEM_CHECK(ret, val, ...)\
|
||||||
do{ if(!(val)) {\
|
do{ if(!(val)) {\
|
||||||
ret = MPP_ERR_MALLOC;\
|
ret = MPP_ERR_MALLOC;\
|
||||||
mpp_log("Function:%s:%d, ERROR: malloc buffer.\n", __FUNCTION__, __LINE__);\
|
mpp_log("Function:%s:%d, ERROR: malloc buffer.\n", __FUNCTION__, __LINE__);\
|
||||||
mpp_assert(0); goto __FAILED;\
|
mpp_assert(0); goto __FAILED;\
|
||||||
} } while (0)
|
} } while (0)
|
||||||
//!< file check
|
//!< file check
|
||||||
#define FLE_CHECK(ret, val, ...)\
|
#define FLE_CHECK(ret, val, ...)\
|
||||||
do{ if(!(val)) {\
|
do{ if(!(val)) {\
|
||||||
ret = MPP_ERR_OPEN_FILE;\
|
ret = MPP_ERR_OPEN_FILE;\
|
||||||
mpp_log("Function:%s:%d, ERROR: open file.\n", __FUNCTION__, __LINE__);\
|
mpp_log("Function:%s:%d, ERROR: open file.\n", __FUNCTION__, __LINE__);\
|
||||||
ASSERT(0); goto __FAILED;\
|
ASSERT(0); goto __FAILED;\
|
||||||
} } while (0)
|
} } while (0)
|
||||||
|
|
||||||
//!< input check
|
//!< input check
|
||||||
#define INP_CHECK(ret, val, ...)\
|
#define INP_CHECK(ret, val, ...)\
|
||||||
do{ if((val)) {\
|
do{ if((val)) {\
|
||||||
ret = MPP_ERR_INIT;\
|
ret = MPP_ERR_INIT;\
|
||||||
mpp_log("Function:%s:%d, WARNNING: input empty.\n", __FUNCTION__, __LINE__);\
|
mpp_log("Function:%s:%d, WARNNING: input empty.\n", __FUNCTION__, __LINE__);\
|
||||||
goto __RETURN;\
|
goto __RETURN;\
|
||||||
} } while (0)
|
} } while (0)
|
||||||
//!< function return check
|
//!< function return check
|
||||||
#define FUN_CHECK(val)\
|
#define FUN_CHECK(val)\
|
||||||
do{ if((val) < 0) {\
|
do{ if((val) < 0) {\
|
||||||
goto __FAILED;\
|
goto __FAILED;\
|
||||||
} } while (0)
|
} } while (0)
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
#define FPRINT(fp, ...) //{ { mpp_log(__VA_ARGS__); } if (fp) { fprintf(fp, ##__VA_ARGS__); fflush(fp);} }
|
#define FPRINT(fp, ...) //{ { mpp_log(__VA_ARGS__); } if (fp) { fprintf(fp, ##__VA_ARGS__); fflush(fp);} }
|
||||||
|
@@ -178,7 +178,7 @@ static void explain_input_buffer(void *hal, HalDecTask *task)
|
|||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
RK_S32 VPUClientGetIOMMUStatus()
|
RK_S32 VPUClientGetIOMMUStatus()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*!
|
/*!
|
||||||
@@ -190,8 +190,8 @@ RK_S32 VPUClientGetIOMMUStatus()
|
|||||||
//extern "C"
|
//extern "C"
|
||||||
MPP_RET hal_h264d_init(void *hal, MppHalCfg *cfg)
|
MPP_RET hal_h264d_init(void *hal, MppHalCfg *cfg)
|
||||||
{
|
{
|
||||||
MppHalApi *p_api = NULL;
|
MppHalApi *p_api = NULL;
|
||||||
VPU_CLIENT_TYPE vpu_client;
|
VPU_CLIENT_TYPE vpu_client;
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ MPP_RET hal_h264d_init(void *hal, MppHalCfg *cfg)
|
|||||||
p_api->reset = rkv_h264d_reset;
|
p_api->reset = rkv_h264d_reset;
|
||||||
p_api->flush = rkv_h264d_flush;
|
p_api->flush = rkv_h264d_flush;
|
||||||
p_api->control = rkv_h264d_control;
|
p_api->control = rkv_h264d_control;
|
||||||
vpu_client = VPU_DEC_RKV;
|
vpu_client = VPU_DEC_RKV;
|
||||||
break;
|
break;
|
||||||
case HAL_VDPU:
|
case HAL_VDPU:
|
||||||
p_api->init = vdpu_h264d_init;
|
p_api->init = vdpu_h264d_init;
|
||||||
@@ -225,7 +225,7 @@ MPP_RET hal_h264d_init(void *hal, MppHalCfg *cfg)
|
|||||||
p_api->reset = vdpu_h264d_reset;
|
p_api->reset = vdpu_h264d_reset;
|
||||||
p_api->flush = vdpu_h264d_flush;
|
p_api->flush = vdpu_h264d_flush;
|
||||||
p_api->control = vdpu_h264d_control;
|
p_api->control = vdpu_h264d_control;
|
||||||
vpu_client = VPU_DEC;
|
vpu_client = VPU_DEC;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ MPP_RET hal_h264d_init(void *hal, MppHalCfg *cfg)
|
|||||||
|
|
||||||
//!< run init funtion
|
//!< run init funtion
|
||||||
FUN_CHECK(ret = p_api->init(hal, cfg));
|
FUN_CHECK(ret = p_api->init(hal, cfg));
|
||||||
(void *)vpu_client;
|
(void *)vpu_client;
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
__FAILED:
|
__FAILED:
|
||||||
|
@@ -55,7 +55,7 @@ const enum {
|
|||||||
|
|
||||||
static void rkv_write_sps_to_fifo(H264dHalCtx_t *p_hal, FifoCtx_t *pkt)
|
static void rkv_write_sps_to_fifo(H264dHalCtx_t *p_hal, FifoCtx_t *pkt)
|
||||||
{
|
{
|
||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
|
|
||||||
fifo_write_bits(pkt, -1, 4, "seq_parameter_set_id"); //!< not used in hard
|
fifo_write_bits(pkt, -1, 4, "seq_parameter_set_id"); //!< not used in hard
|
||||||
fifo_write_bits(pkt, -1, 8, "profile_idc"); //!< not used in hard
|
fifo_write_bits(pkt, -1, 8, "profile_idc"); //!< not used in hard
|
||||||
@@ -104,14 +104,14 @@ static void rkv_write_sps_to_fifo(H264dHalCtx_t *p_hal, FifoCtx_t *pkt)
|
|||||||
fifo_write_bits(pkt, 0, 10, "non_anchor_ref_l1");
|
fifo_write_bits(pkt, 0, 10, "non_anchor_ref_l1");
|
||||||
}
|
}
|
||||||
fifo_align_bits(pkt, 32);
|
fifo_align_bits(pkt, 32);
|
||||||
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rkv_write_pps_to_fifo(H264dHalCtx_t *p_hal, FifoCtx_t *pkt)
|
static void rkv_write_pps_to_fifo(H264dHalCtx_t *p_hal, FifoCtx_t *pkt)
|
||||||
{
|
{
|
||||||
RK_U32 Scaleing_list_address = 0;
|
RK_U32 Scaleing_list_address = 0;
|
||||||
RK_U32 offset = RKV_CABAC_TAB_SIZE + RKV_SPSPPS_SIZE + RKV_RPS_SIZE;
|
RK_U32 offset = RKV_CABAC_TAB_SIZE + RKV_SPSPPS_SIZE + RKV_RPS_SIZE;
|
||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
fifo_write_bits(pkt, -1, 8, "pps_pic_parameter_set_id");
|
fifo_write_bits(pkt, -1, 8, "pps_pic_parameter_set_id");
|
||||||
fifo_write_bits(pkt, -1, 5, "pps_seq_parameter_set_id");
|
fifo_write_bits(pkt, -1, 5, "pps_seq_parameter_set_id");
|
||||||
fifo_write_bits(pkt, p_hal->pp->entropy_coding_mode_flag, 1, "entropy_coding_mode_flag");
|
fifo_write_bits(pkt, p_hal->pp->entropy_coding_mode_flag, 1, "entropy_coding_mode_flag");
|
||||||
@@ -130,20 +130,20 @@ static void rkv_write_pps_to_fifo(H264dHalCtx_t *p_hal, FifoCtx_t *pkt)
|
|||||||
fifo_write_bits(pkt, p_hal->pp->second_chroma_qp_index_offset, 5, "second_chroma_qp_index_offset");
|
fifo_write_bits(pkt, p_hal->pp->second_chroma_qp_index_offset, 5, "second_chroma_qp_index_offset");
|
||||||
fifo_write_bits(pkt, p_hal->pp->scaleing_list_enable_flag, 1, "scaleing_list_enable_flag");
|
fifo_write_bits(pkt, p_hal->pp->scaleing_list_enable_flag, 1, "scaleing_list_enable_flag");
|
||||||
|
|
||||||
Scaleing_list_address = mpp_buffer_get_fd(p_hal->cabac_buf);
|
Scaleing_list_address = mpp_buffer_get_fd(p_hal->cabac_buf);
|
||||||
//mpp_log("fd=%08x, offset=%d", Scaleing_list_address, offset);
|
//mpp_log("fd=%08x, offset=%d", Scaleing_list_address, offset);
|
||||||
if (VPUClientGetIOMMUStatus() > 0) {
|
if (VPUClientGetIOMMUStatus() > 0) {
|
||||||
Scaleing_list_address |= offset << 10;
|
Scaleing_list_address |= offset << 10;
|
||||||
} else {
|
} else {
|
||||||
Scaleing_list_address += offset;
|
Scaleing_list_address += offset;
|
||||||
}
|
}
|
||||||
//mpp_log("Scaleing_list_address=%08x \n", Scaleing_list_address);
|
//mpp_log("Scaleing_list_address=%08x \n", Scaleing_list_address);
|
||||||
#if FPGA_TEST
|
#if FPGA_TEST
|
||||||
fifo_write_bits(pkt, 0, 32, "Scaleing_list_address");
|
fifo_write_bits(pkt, 0, 32, "Scaleing_list_address");
|
||||||
#else
|
#else
|
||||||
fifo_write_bits(pkt, Scaleing_list_address, 32, "Scaleing_list_address");
|
fifo_write_bits(pkt, Scaleing_list_address, 32, "Scaleing_list_address");
|
||||||
#endif
|
#endif
|
||||||
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ MPP_RET rkv_alloc_fifo_packet(H264dLogCtx_t *logctx, H264dRkvPkt_t *pkts)
|
|||||||
RK_U32 sclst_size = RKV_SCALING_LIST_SIZE + 64;
|
RK_U32 sclst_size = RKV_SCALING_LIST_SIZE + 64;
|
||||||
RK_U32 regs_size = sizeof(H264dRkvRegs_t);
|
RK_U32 regs_size = sizeof(H264dRkvRegs_t);
|
||||||
|
|
||||||
FunctionIn(logctx->parr[RUN_HAL]);
|
FunctionIn(logctx->parr[RUN_HAL]);
|
||||||
//!< initial packages header and malloc buffer
|
//!< initial packages header and malloc buffer
|
||||||
FUN_CHECK(ret = fifo_packet_alloc(&pkts->spspps, H264dPPS_HEADER, pps_size));
|
FUN_CHECK(ret = fifo_packet_alloc(&pkts->spspps, H264dPPS_HEADER, pps_size));
|
||||||
FUN_CHECK(ret = fifo_packet_alloc(&pkts->rps, H264dRPS_HEADER, rps_size));
|
FUN_CHECK(ret = fifo_packet_alloc(&pkts->rps, H264dRPS_HEADER, rps_size));
|
||||||
@@ -222,7 +222,7 @@ MPP_RET rkv_alloc_fifo_packet(H264dLogCtx_t *logctx, H264dRkvPkt_t *pkts)
|
|||||||
pkts->scanlist.fp_data = NULL;
|
pkts->scanlist.fp_data = NULL;
|
||||||
pkts->reg.fp_data = NULL;
|
pkts->reg.fp_data = NULL;
|
||||||
}
|
}
|
||||||
FunctionOut(logctx->parr[RUN_HAL]);
|
FunctionOut(logctx->parr[RUN_HAL]);
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
__FAILED:
|
__FAILED:
|
||||||
rkv_free_fifo_packet(pkts);
|
rkv_free_fifo_packet(pkts);
|
||||||
@@ -243,7 +243,7 @@ void rkv_prepare_spspps_packet(void *hal, FifoCtx_t *pkt)
|
|||||||
RK_S32 is_long_term = 0, voidx = 0;
|
RK_S32 is_long_term = 0, voidx = 0;
|
||||||
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
||||||
|
|
||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
fifo_packet_reset(pkt);
|
fifo_packet_reset(pkt);
|
||||||
LogInfo(pkt->logctx, "------------------ Frame SPS_PPS begin ------------------------");
|
LogInfo(pkt->logctx, "------------------ Frame SPS_PPS begin ------------------------");
|
||||||
rkv_write_sps_to_fifo(p_hal, pkt);
|
rkv_write_sps_to_fifo(p_hal, pkt);
|
||||||
@@ -259,7 +259,7 @@ void rkv_prepare_spspps_packet(void *hal, FifoCtx_t *pkt)
|
|||||||
}
|
}
|
||||||
fifo_align_bits(pkt, 64);
|
fifo_align_bits(pkt, 64);
|
||||||
fifo_fwrite_data(pkt); //!< "PPSH" header 32 bit
|
fifo_fwrite_data(pkt); //!< "PPSH" header 32 bit
|
||||||
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
@@ -277,7 +277,7 @@ void rkv_prepare_framerps_packet(void *hal, FifoCtx_t *pkt)
|
|||||||
RK_U16 frame_num_wrap = 0;
|
RK_U16 frame_num_wrap = 0;
|
||||||
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
||||||
DXVA_PicParams_H264_MVC *pp = p_hal->pp;
|
DXVA_PicParams_H264_MVC *pp = p_hal->pp;
|
||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
fifo_packet_reset(pkt);
|
fifo_packet_reset(pkt);
|
||||||
LogInfo(pkt->logctx, "------------------ Frame RPS begin ------------------------");
|
LogInfo(pkt->logctx, "------------------ Frame RPS begin ------------------------");
|
||||||
max_frame_num = 1 << (pp->log2_max_frame_num_minus4 + 4);
|
max_frame_num = 1 << (pp->log2_max_frame_num_minus4 + 4);
|
||||||
@@ -324,7 +324,7 @@ void rkv_prepare_framerps_packet(void *hal, FifoCtx_t *pkt)
|
|||||||
fifo_align_bits(pkt, 128);
|
fifo_align_bits(pkt, 128);
|
||||||
fifo_flush_bits(pkt);
|
fifo_flush_bits(pkt);
|
||||||
fifo_fwrite_data(pkt); //!< "RPSH" header 32 bit
|
fifo_fwrite_data(pkt); //!< "RPSH" header 32 bit
|
||||||
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
@@ -337,7 +337,7 @@ void rkv_prepare_scanlist_packet(void *hal, FifoCtx_t *pkt)
|
|||||||
{
|
{
|
||||||
RK_S32 i = 0;
|
RK_S32 i = 0;
|
||||||
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
if (p_hal->pp->scaleing_list_enable_flag) {
|
if (p_hal->pp->scaleing_list_enable_flag) {
|
||||||
fifo_packet_reset(pkt);
|
fifo_packet_reset(pkt);
|
||||||
LogInfo(pkt->logctx, "------------------ Scanlist begin ------------------------");
|
LogInfo(pkt->logctx, "------------------ Scanlist begin ------------------------");
|
||||||
@@ -349,7 +349,7 @@ void rkv_prepare_scanlist_packet(void *hal, FifoCtx_t *pkt)
|
|||||||
}
|
}
|
||||||
fifo_fwrite_data(pkt); //!< "SCLS" header 32 bit
|
fifo_fwrite_data(pkt); //!< "SCLS" header 32 bit
|
||||||
}
|
}
|
||||||
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -361,59 +361,59 @@ void rkv_prepare_scanlist_packet(void *hal, FifoCtx_t *pkt)
|
|||||||
//extern "C"
|
//extern "C"
|
||||||
void rkv_generate_regs(void *hal, HalTaskInfo *task, FifoCtx_t *pkt)
|
void rkv_generate_regs(void *hal, HalTaskInfo *task, FifoCtx_t *pkt)
|
||||||
{
|
{
|
||||||
RK_S32 i = 0;
|
RK_S32 i = 0;
|
||||||
MppBuffer frame_buf = NULL;
|
MppBuffer frame_buf = NULL;
|
||||||
MppBuffer bitstream_buf = NULL;
|
MppBuffer bitstream_buf = NULL;
|
||||||
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
||||||
DXVA_PicParams_H264_MVC *pp = p_hal->pp;
|
DXVA_PicParams_H264_MVC *pp = p_hal->pp;
|
||||||
H264dRkvRegs_t *p_regs = (H264dRkvRegs_t *)p_hal->regs;
|
H264dRkvRegs_t *p_regs = (H264dRkvRegs_t *)p_hal->regs;
|
||||||
|
|
||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
|
|
||||||
memset(p_regs, 0, sizeof(H264dRkvRegs_t));
|
memset(p_regs, 0, sizeof(H264dRkvRegs_t));
|
||||||
p_regs->swreg2_sysctrl.sw_dec_mode = 1; //!< h264
|
p_regs->swreg2_sysctrl.sw_dec_mode = 1; //!< h264
|
||||||
|
|
||||||
if (p_regs->swreg2_sysctrl.sw_rlc_mode == 1) {
|
if (p_regs->swreg2_sysctrl.sw_rlc_mode == 1) {
|
||||||
p_regs->swreg5_stream_rlc_len.sw_stream_len = 0;
|
p_regs->swreg5_stream_rlc_len.sw_stream_len = 0;
|
||||||
} else {
|
} else {
|
||||||
p_regs->swreg5_stream_rlc_len.sw_stream_len = (RK_U32)mpp_packet_get_length(task->dec.input_packet);
|
p_regs->swreg5_stream_rlc_len.sw_stream_len = (RK_U32)mpp_packet_get_length(task->dec.input_packet);
|
||||||
}
|
}
|
||||||
//!< caculate the yuv_frame_size
|
//!< caculate the yuv_frame_size
|
||||||
{
|
{
|
||||||
MppFrame cur_frame = NULL;
|
MppFrame cur_frame = NULL;
|
||||||
RK_U32 hor_virstride = 0;
|
RK_U32 hor_virstride = 0;
|
||||||
RK_U32 ver_virstride = 0;
|
RK_U32 ver_virstride = 0;
|
||||||
RK_U32 y_virstride = 0;
|
RK_U32 y_virstride = 0;
|
||||||
RK_U32 yuv_virstride = 0;
|
RK_U32 yuv_virstride = 0;
|
||||||
|
|
||||||
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->CurrPic.Index7Bits, SLOT_FRAME_PTR, &cur_frame);
|
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->CurrPic.Index7Bits, SLOT_FRAME_PTR, &cur_frame);
|
||||||
hor_virstride = mpp_frame_get_hor_stride(cur_frame);
|
hor_virstride = mpp_frame_get_hor_stride(cur_frame);
|
||||||
ver_virstride = mpp_frame_get_ver_stride(cur_frame);
|
ver_virstride = mpp_frame_get_ver_stride(cur_frame);
|
||||||
y_virstride = hor_virstride * ver_virstride;
|
y_virstride = hor_virstride * ver_virstride;
|
||||||
|
|
||||||
|
if (pp->chroma_format_idc == 0) { //!< Y400
|
||||||
|
yuv_virstride = y_virstride;
|
||||||
|
} else if (pp->chroma_format_idc == 1) { //!< Y420
|
||||||
|
yuv_virstride += y_virstride + y_virstride / 2;
|
||||||
|
} else if (pp->chroma_format_idc == 2) { //!< Y422
|
||||||
|
yuv_virstride += 2 * y_virstride;
|
||||||
|
}
|
||||||
|
p_regs->swreg3_picpar.sw_y_hor_virstride = hor_virstride / 16;
|
||||||
|
p_regs->swreg3_picpar.sw_uv_hor_virstride = hor_virstride / 16;
|
||||||
|
p_regs->swreg8_y_virstride.sw_y_virstride = y_virstride / 16;
|
||||||
|
p_regs->swreg9_yuv_virstride.sw_yuv_virstride = yuv_virstride / 16;
|
||||||
|
//mpp_log("$$$$$$$$ hor_stride=%d, y_stride=%d, yuv_stride=%d \n", p_regs->swreg3_picpar.sw_y_hor_virstride,
|
||||||
|
// p_regs->swreg8_y_virstride.sw_y_virstride, p_regs->swreg9_yuv_virstride.sw_yuv_virstride);
|
||||||
|
}
|
||||||
|
//!< caculate mv_size
|
||||||
|
{
|
||||||
|
RK_U32 mb_width = 0, mb_height = 0, mv_size = 0;
|
||||||
|
mb_width = pp->wFrameWidthInMbsMinus1 + 1;
|
||||||
|
mb_height = (2 - pp->frame_mbs_only_flag) * (pp->wFrameHeightInMbsMinus1 + 1);
|
||||||
|
mv_size = mb_width * mb_height * 8; // 64bit per 4x4
|
||||||
|
p_regs->compare_len = (p_regs->swreg9_yuv_virstride.sw_yuv_virstride + mv_size) * 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (pp->chroma_format_idc == 0) { //!< Y400
|
|
||||||
yuv_virstride = y_virstride;
|
|
||||||
} else if (pp->chroma_format_idc == 1) { //!< Y420
|
|
||||||
yuv_virstride += y_virstride + y_virstride / 2;
|
|
||||||
} else if (pp->chroma_format_idc == 2) { //!< Y422
|
|
||||||
yuv_virstride += 2 * y_virstride;
|
|
||||||
}
|
|
||||||
p_regs->swreg3_picpar.sw_y_hor_virstride = hor_virstride/16;
|
|
||||||
p_regs->swreg3_picpar.sw_uv_hor_virstride = hor_virstride/16;
|
|
||||||
p_regs->swreg8_y_virstride.sw_y_virstride = y_virstride/16;
|
|
||||||
p_regs->swreg9_yuv_virstride.sw_yuv_virstride = yuv_virstride/16;
|
|
||||||
//mpp_log("$$$$$$$$ hor_stride=%d, y_stride=%d, yuv_stride=%d \n", p_regs->swreg3_picpar.sw_y_hor_virstride,
|
|
||||||
// p_regs->swreg8_y_virstride.sw_y_virstride, p_regs->swreg9_yuv_virstride.sw_yuv_virstride);
|
|
||||||
}
|
|
||||||
//!< caculate mv_size
|
|
||||||
{
|
|
||||||
RK_U32 mb_width = 0, mb_height = 0, mv_size = 0;
|
|
||||||
mb_width = pp->wFrameWidthInMbsMinus1 + 1;
|
|
||||||
mb_height = (2 - pp->frame_mbs_only_flag) * (pp->wFrameHeightInMbsMinus1 + 1);
|
|
||||||
mv_size = mb_width * mb_height * 8; // 64bit per 4x4
|
|
||||||
p_regs->compare_len = (p_regs->swreg9_yuv_virstride.sw_yuv_virstride + mv_size) * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_regs->swreg2_sysctrl.sw_h264_rps_mode) { // rps_mode == 1
|
if (p_regs->swreg2_sysctrl.sw_h264_rps_mode) { // rps_mode == 1
|
||||||
p_regs->swreg43_rps_base.sw_rps_base += 0x8;
|
p_regs->swreg43_rps_base.sw_rps_base += 0x8;
|
||||||
}
|
}
|
||||||
@@ -425,10 +425,10 @@ void rkv_generate_regs(void *hal, HalTaskInfo *task, FifoCtx_t *pkt)
|
|||||||
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->CurrPic.Index7Bits, SLOT_BUFFER, &frame_buf); //!< current out phy addr
|
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->CurrPic.Index7Bits, SLOT_BUFFER, &frame_buf); //!< current out phy addr
|
||||||
|
|
||||||
#if FPGA_TEST
|
#if FPGA_TEST
|
||||||
p_regs->swreg7_decout_base.sw_decout_base = pp->CurrPic.Index7Bits + 1;
|
p_regs->swreg7_decout_base.sw_decout_base = pp->CurrPic.Index7Bits + 1;
|
||||||
#else
|
#else
|
||||||
p_regs->swreg7_decout_base.sw_decout_base = mpp_buffer_get_fd(frame_buf);
|
p_regs->swreg7_decout_base.sw_decout_base = mpp_buffer_get_fd(frame_buf);
|
||||||
//mpp_log_f("line=%d, decout_fd=%d over \n", __LINE__, mpp_buffer_get_fd(frame_buf));
|
//mpp_log_f("line=%d, decout_fd=%d over \n", __LINE__, mpp_buffer_get_fd(frame_buf));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//!< set reference
|
//!< set reference
|
||||||
@@ -445,10 +445,10 @@ void rkv_generate_regs(void *hal, HalTaskInfo *task, FifoCtx_t *pkt)
|
|||||||
} else {
|
} else {
|
||||||
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->RefFrameList[i].Index7Bits, SLOT_BUFFER, &frame_buf); //!< reference phy addr
|
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->RefFrameList[i].Index7Bits, SLOT_BUFFER, &frame_buf); //!< reference phy addr
|
||||||
}
|
}
|
||||||
//mpp_log_f("line=%d, ref[%d]=%d over \n", __LINE__, i, mpp_buffer_get_fd(frame_buf));
|
//mpp_log_f("line=%d, ref[%d]=%d over \n", __LINE__, i, mpp_buffer_get_fd(frame_buf));
|
||||||
#if FPGA_TEST
|
#if FPGA_TEST
|
||||||
p_regs->swreg10_24_refer0_14_base[i].sw_refer_base = pp->RefFrameList[i].Index7Bits + 1;
|
p_regs->swreg10_24_refer0_14_base[i].sw_refer_base = pp->RefFrameList[i].Index7Bits + 1;
|
||||||
#else
|
#else
|
||||||
p_regs->swreg10_24_refer0_14_base[i].sw_refer_base = mpp_buffer_get_fd(frame_buf);
|
p_regs->swreg10_24_refer0_14_base[i].sw_refer_base = mpp_buffer_get_fd(frame_buf);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -463,31 +463,31 @@ void rkv_generate_regs(void *hal, HalTaskInfo *task, FifoCtx_t *pkt)
|
|||||||
} else {
|
} else {
|
||||||
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->RefFrameList[15].Index7Bits, SLOT_BUFFER, &frame_buf); //!< reference phy addr
|
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->RefFrameList[15].Index7Bits, SLOT_BUFFER, &frame_buf); //!< reference phy addr
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FPGA_TEST
|
#if FPGA_TEST
|
||||||
p_regs->swreg48_refer15_base.sw_refer_base = pp->RefFrameList[15].Index7Bits + 1;
|
p_regs->swreg48_refer15_base.sw_refer_base = pp->RefFrameList[15].Index7Bits + 1;
|
||||||
p_regs->swreg4_strm_rlc_base.sw_strm_rlc_base = 0;
|
p_regs->swreg4_strm_rlc_base.sw_strm_rlc_base = 0;
|
||||||
p_regs->swreg6_cabactbl_prob_base.sw_cabactbl_base = 0;
|
p_regs->swreg6_cabactbl_prob_base.sw_cabactbl_base = 0;
|
||||||
#else
|
#else
|
||||||
p_regs->swreg48_refer15_base.sw_refer_base = mpp_buffer_get_fd(frame_buf);
|
p_regs->swreg48_refer15_base.sw_refer_base = mpp_buffer_get_fd(frame_buf);
|
||||||
//mpp_log_f("line=%d, ref[%d]=%d over \n", __LINE__, 15, mpp_buffer_get_fd(frame_buf));
|
//mpp_log_f("line=%d, ref[%d]=%d over \n", __LINE__, 15, mpp_buffer_get_fd(frame_buf));
|
||||||
p_regs->swreg6_cabactbl_prob_base.sw_cabactbl_base = mpp_buffer_get_fd(p_hal->cabac_buf);
|
p_regs->swreg6_cabactbl_prob_base.sw_cabactbl_base = mpp_buffer_get_fd(p_hal->cabac_buf);
|
||||||
//mpp_log_f("line=%d, cabac_table_fd=%d over \n", __LINE__, mpp_buffer_get_fd(p_hal->cabac_buf));
|
//mpp_log_f("line=%d, cabac_table_fd=%d over \n", __LINE__, mpp_buffer_get_fd(p_hal->cabac_buf));
|
||||||
mpp_buf_slot_get_prop(p_hal->packet_slots, task->dec.input, SLOT_BUFFER, &bitstream_buf);
|
mpp_buf_slot_get_prop(p_hal->packet_slots, task->dec.input, SLOT_BUFFER, &bitstream_buf);
|
||||||
p_regs->swreg4_strm_rlc_base.sw_strm_rlc_base = mpp_buffer_get_fd(bitstream_buf);
|
p_regs->swreg4_strm_rlc_base.sw_strm_rlc_base = mpp_buffer_get_fd(bitstream_buf);
|
||||||
//mpp_log_f("line=%d, rlc_base_fd=%d over \n", __LINE__,mpp_buffer_get_fd(bitstream_buf));
|
//mpp_log_f("line=%d, rlc_base_fd=%d over \n", __LINE__,mpp_buffer_get_fd(bitstream_buf));
|
||||||
p_regs->swreg41_rlcwrite_base.sw_rlcwrite_base = p_regs->swreg4_strm_rlc_base.sw_strm_rlc_base;
|
p_regs->swreg41_rlcwrite_base.sw_rlcwrite_base = p_regs->swreg4_strm_rlc_base.sw_strm_rlc_base;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//{
|
|
||||||
// RK_U32 *ptr = (RK_U32*)p_hal->regs;
|
//{
|
||||||
// for (i = 0; i < 80; i++)
|
// RK_U32 *ptr = (RK_U32*)p_hal->regs;
|
||||||
// {
|
// for (i = 0; i < 80; i++)
|
||||||
// FPRINT(g_debug_file1, "register[%3d] = %08x\n", i, ptr[i]);
|
// {
|
||||||
// }
|
// FPRINT(g_debug_file1, "register[%3d] = %08x\n", i, ptr[i]);
|
||||||
// FPRINT(g_debug_file1, "-----frame=%d----------\n", p_hal->iDecodedNum);
|
// }
|
||||||
//}
|
// FPRINT(g_debug_file1, "-----frame=%d----------\n", p_hal->iDecodedNum);
|
||||||
|
//}
|
||||||
|
|
||||||
fifo_packet_reset(pkt);
|
fifo_packet_reset(pkt);
|
||||||
fifo_write_bytes(pkt, (void *)p_hal->regs, 80 * sizeof(RK_U32));
|
fifo_write_bytes(pkt, (void *)p_hal->regs, 80 * sizeof(RK_U32));
|
||||||
@@ -495,7 +495,7 @@ void rkv_generate_regs(void *hal, HalTaskInfo *task, FifoCtx_t *pkt)
|
|||||||
fifo_flush_bits(pkt);
|
fifo_flush_bits(pkt);
|
||||||
fifo_fwrite_data(pkt); //!< "REGH" header 32 bit
|
fifo_fwrite_data(pkt); //!< "REGH" header 32 bit
|
||||||
|
|
||||||
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@@ -204,7 +204,7 @@ static RK_U32 rkv_hor_align(RK_U32 val)
|
|||||||
|
|
||||||
static RK_U32 rkv_len_align(RK_U32 val)
|
static RK_U32 rkv_len_align(RK_U32 val)
|
||||||
{
|
{
|
||||||
return (2 * MPP_ALIGN(val, 16));
|
return (2 * MPP_ALIGN(val, 16));
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
@@ -221,7 +221,7 @@ MPP_RET rkv_h264d_init(void *hal, MppHalCfg *cfg)
|
|||||||
|
|
||||||
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]);
|
||||||
p_hal->iDecodedNum = 0;
|
p_hal->iDecodedNum = 0;
|
||||||
MEM_CHECK(ret, p_hal->pkts = mpp_calloc_size(void, sizeof(H264dRkvPkt_t)));
|
MEM_CHECK(ret, p_hal->pkts = mpp_calloc_size(void, sizeof(H264dRkvPkt_t)));
|
||||||
//!< malloc cabac+scanlis + packets + poc_buf
|
//!< malloc cabac+scanlis + packets + poc_buf
|
||||||
cabac_size = RKV_CABAC_TAB_SIZE + RKV_SPSPPS_SIZE + RKV_RPS_SIZE + RKV_SCALING_LIST_SIZE + RKV_ERROR_INFO_SIZE;
|
cabac_size = RKV_CABAC_TAB_SIZE + RKV_SPSPPS_SIZE + RKV_RPS_SIZE + RKV_SCALING_LIST_SIZE + RKV_ERROR_INFO_SIZE;
|
||||||
@@ -233,7 +233,7 @@ MPP_RET rkv_h264d_init(void *hal, MppHalCfg *cfg)
|
|||||||
|
|
||||||
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_HOR_ALIGN, rkv_hor_align);
|
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_HOR_ALIGN, rkv_hor_align);
|
||||||
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_VER_ALIGN, rkv_ver_align);
|
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_VER_ALIGN, rkv_ver_align);
|
||||||
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_LEN_ALIGN, rkv_len_align);
|
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_LEN_ALIGN, rkv_len_align);
|
||||||
|
|
||||||
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
||||||
(void)cfg;
|
(void)cfg;
|
||||||
@@ -280,39 +280,39 @@ __FAILED:
|
|||||||
//extern "C"
|
//extern "C"
|
||||||
MPP_RET rkv_h264d_gen_regs(void *hal, HalTaskInfo *task)
|
MPP_RET rkv_h264d_gen_regs(void *hal, HalTaskInfo *task)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
RK_U32 hw_base = 0;
|
RK_U32 hw_base = 0;
|
||||||
RK_U32 strm_offset = 0;
|
RK_U32 strm_offset = 0;
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
||||||
H264dRkvPkt_t *pkts = (H264dRkvPkt_t *)p_hal->pkts;
|
H264dRkvPkt_t *pkts = (H264dRkvPkt_t *)p_hal->pkts;
|
||||||
H264dRkvRegs_t *p_regs = (H264dRkvRegs_t *)p_hal->regs;
|
H264dRkvRegs_t *p_regs = (H264dRkvRegs_t *)p_hal->regs;
|
||||||
|
|
||||||
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]);
|
||||||
|
|
||||||
rkv_prepare_spspps_packet(hal, &pkts->spspps);
|
rkv_prepare_spspps_packet(hal, &pkts->spspps);
|
||||||
rkv_prepare_framerps_packet(hal, &pkts->rps);
|
rkv_prepare_framerps_packet(hal, &pkts->rps);
|
||||||
rkv_prepare_scanlist_packet(hal, &pkts->scanlist);
|
rkv_prepare_scanlist_packet(hal, &pkts->scanlist);
|
||||||
rkv_generate_regs(p_hal, task, &pkts->reg);
|
rkv_generate_regs(p_hal, task, &pkts->reg);
|
||||||
|
|
||||||
hw_base = mpp_buffer_get_fd(p_hal->cabac_buf);
|
hw_base = mpp_buffer_get_fd(p_hal->cabac_buf);
|
||||||
//!< copy datas
|
//!< copy datas
|
||||||
strm_offset = RKV_CABAC_TAB_SIZE;
|
strm_offset = RKV_CABAC_TAB_SIZE;
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
mpp_buffer_write(p_hal->cabac_buf, (strm_offset + 32 * i), (void *)pkts->spspps.pbuf, RKV_SPSPPS_SIZE);
|
mpp_buffer_write(p_hal->cabac_buf, (strm_offset + 32 * i), (void *)pkts->spspps.pbuf, RKV_SPSPPS_SIZE);
|
||||||
}
|
}
|
||||||
p_regs->swreg42_pps_base.sw_pps_base = hw_base + (strm_offset<<10);
|
p_regs->swreg42_pps_base.sw_pps_base = hw_base + (strm_offset << 10);
|
||||||
strm_offset += RKV_SPSPPS_SIZE;
|
strm_offset += RKV_SPSPPS_SIZE;
|
||||||
|
|
||||||
mpp_buffer_write(p_hal->cabac_buf, strm_offset, (void *)pkts->rps.pbuf, RKV_RPS_SIZE);
|
mpp_buffer_write(p_hal->cabac_buf, strm_offset, (void *)pkts->rps.pbuf, RKV_RPS_SIZE);
|
||||||
p_regs->swreg43_rps_base.sw_rps_base = hw_base + (strm_offset<<10);
|
p_regs->swreg43_rps_base.sw_rps_base = hw_base + (strm_offset << 10);
|
||||||
|
|
||||||
strm_offset += RKV_RPS_SIZE;
|
strm_offset += RKV_RPS_SIZE;
|
||||||
mpp_buffer_write(p_hal->cabac_buf, strm_offset, (void *)pkts->scanlist.pbuf, RKV_SCALING_LIST_SIZE);
|
mpp_buffer_write(p_hal->cabac_buf, strm_offset, (void *)pkts->scanlist.pbuf, RKV_SCALING_LIST_SIZE);
|
||||||
|
|
||||||
strm_offset += RKV_SCALING_LIST_SIZE;
|
strm_offset += RKV_SCALING_LIST_SIZE;
|
||||||
p_regs->swreg75_h264_errorinfo_base.sw_errorinfo_base = hw_base + (strm_offset<<10);
|
p_regs->swreg75_h264_errorinfo_base.sw_errorinfo_base = hw_base + (strm_offset << 10);
|
||||||
|
|
||||||
|
|
||||||
((HalDecTask*)&task->dec)->valid = 0;
|
((HalDecTask*)&task->dec)->valid = 0;
|
||||||
@@ -330,32 +330,32 @@ __RETURN:
|
|||||||
//extern "C"
|
//extern "C"
|
||||||
MPP_RET rkv_h264d_start(void *hal, HalTaskInfo *task)
|
MPP_RET rkv_h264d_start(void *hal, HalTaskInfo *task)
|
||||||
{
|
{
|
||||||
//RK_U32 i = 0;
|
//RK_U32 i = 0;
|
||||||
RK_U32 *p_regs = NULL;
|
RK_U32 *p_regs = NULL;
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
||||||
|
|
||||||
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]);
|
||||||
|
|
||||||
p_regs = (RK_U32 *)p_hal->regs;
|
p_regs = (RK_U32 *)p_hal->regs;
|
||||||
|
|
||||||
//FUN_CHECK(ret = hal_set_regdrv(p_drv, VDPU_QTABLE_BASE, mpp_buffer_get_fd(p_hal->cabac_buf))); //!< cabacInit.phy_addr
|
//FUN_CHECK(ret = hal_set_regdrv(p_drv, VDPU_QTABLE_BASE, mpp_buffer_get_fd(p_hal->cabac_buf))); //!< cabacInit.phy_addr
|
||||||
//FUN_CHECK(ret = vdpu_h264d_print_regs(p_hal, p_drv));
|
//FUN_CHECK(ret = vdpu_h264d_print_regs(p_hal, p_drv));
|
||||||
|
|
||||||
p_regs[64] = 0;
|
p_regs[64] = 0;
|
||||||
p_regs[65] = 0;
|
p_regs[65] = 0;
|
||||||
p_regs[66] = 0;
|
p_regs[66] = 0;
|
||||||
p_regs[67] = 0x000000ff; // disable fpga reset
|
p_regs[67] = 0x000000ff; // disable fpga reset
|
||||||
p_regs[44] = 0; // 0xffff_ffff, debug enable
|
p_regs[44] = 0; // 0xffff_ffff, debug enable
|
||||||
p_regs[77] = 0; // 0xffff_dfff, debug enable
|
p_regs[77] = 0; // 0xffff_dfff, debug enable
|
||||||
p_regs[1] = 0x00000021; // run hardware
|
p_regs[1] = 0x00000021; // run hardware
|
||||||
|
|
||||||
//mpp_log("------- register input ------ \n");
|
//mpp_log("------- register input ------ \n");
|
||||||
//for(i=0; i<78; i++)
|
//for(i=0; i<78; i++)
|
||||||
//{
|
//{
|
||||||
// mpp_log("reg[%d]=%08x \n", i, p_regs[i]);
|
// mpp_log("reg[%d]=%08x \n", i, p_regs[i]);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
if (VPUClientSendReg(p_hal->vpu_socket, (RK_U32 *)p_regs, DEC_RKV_REGISTERS)) {
|
if (VPUClientSendReg(p_hal->vpu_socket, (RK_U32 *)p_regs, DEC_RKV_REGISTERS)) {
|
||||||
@@ -388,31 +388,31 @@ MPP_RET rkv_h264d_wait(void *hal, HalTaskInfo *task)
|
|||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
RK_S32 wait_ret = -1;
|
RK_S32 wait_ret = -1;
|
||||||
RK_S32 ret_len = 0, cur_deat = 0;
|
RK_S32 ret_len = 0, cur_deat = 0;
|
||||||
VPU_CMD_TYPE ret_cmd = VPU_CMD_BUTT;
|
VPU_CMD_TYPE ret_cmd = VPU_CMD_BUTT;
|
||||||
static struct timeval tv1, tv2;
|
static struct timeval tv1, tv2;
|
||||||
gettimeofday(&tv1, NULL);
|
gettimeofday(&tv1, NULL);
|
||||||
wait_ret = VPUClientWaitResult(p_hal->vpu_socket, (RK_U32 *)p_hal->regs, DEC_RKV_REGISTERS, &ret_cmd, &ret_len);
|
wait_ret = VPUClientWaitResult(p_hal->vpu_socket, (RK_U32 *)p_hal->regs, DEC_RKV_REGISTERS, &ret_cmd, &ret_len);
|
||||||
gettimeofday(&tv2, NULL);
|
gettimeofday(&tv2, NULL);
|
||||||
cur_deat = (tv2.tv_sec - tv1.tv_sec) * 1000 + (tv2.tv_usec - tv1.tv_usec) / 1000;
|
cur_deat = (tv2.tv_sec - tv1.tv_sec) * 1000 + (tv2.tv_usec - tv1.tv_usec) / 1000;
|
||||||
p_hal->total_time += cur_deat;
|
p_hal->total_time += cur_deat;
|
||||||
|
|
||||||
//mpp_log("H264 RKV FlushRegs success, dec_no=%lld, time=%d ms, av_time=%lld ms. \n",
|
//mpp_log("H264 RKV FlushRegs success, dec_no=%lld, time=%d ms, av_time=%lld ms. \n",
|
||||||
// p_hal->iDecodedNum, cur_deat, p_hal->total_time/(p_hal->iDecodedNum + 1));
|
// p_hal->iDecodedNum, cur_deat, p_hal->total_time/(p_hal->iDecodedNum + 1));
|
||||||
|
|
||||||
p_hal->iDecodedNum++;
|
p_hal->iDecodedNum++;
|
||||||
(void)wait_ret;
|
(void)wait_ret;
|
||||||
#endif
|
#endif
|
||||||
//mpp_log("------- register output ------ \n");
|
//mpp_log("------- register output ------ \n");
|
||||||
//RK_U32 i = 0;
|
//RK_U32 i = 0;
|
||||||
//RK_U32 *ptr = NULL;
|
//RK_U32 *ptr = NULL;
|
||||||
//ptr = (RK_U32 *)p_hal->regs;
|
//ptr = (RK_U32 *)p_hal->regs;
|
||||||
//for(i=0; i<78; i++)
|
//for(i=0; i<78; i++)
|
||||||
//{
|
//{
|
||||||
// mpp_log("reg[%d]=%08x \n", i, ptr[i]);
|
// mpp_log("reg[%d]=%08x \n", i, ptr[i]);
|
||||||
//}
|
//}
|
||||||
p_regs = (H264dRkvRegs_t *)p_hal->regs;
|
p_regs = (H264dRkvRegs_t *)p_hal->regs;
|
||||||
memset(&p_regs->swreg1_int, 0, sizeof(RK_U32));
|
memset(&p_regs->swreg1_int, 0, sizeof(RK_U32));
|
||||||
|
|
||||||
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
||||||
|
@@ -107,12 +107,12 @@ typedef struct h264d_rkv_regs_t {
|
|||||||
RK_U32 sw_yuv_virstride : 21;
|
RK_U32 sw_yuv_virstride : 21;
|
||||||
} swreg9_yuv_virstride;
|
} swreg9_yuv_virstride;
|
||||||
struct {
|
struct {
|
||||||
RK_U32 sw_refer_base : 10;
|
RK_U32 sw_refer_base : 10;
|
||||||
RK_U32 sw_ref_field : 1;
|
RK_U32 sw_ref_field : 1;
|
||||||
RK_U32 sw_ref_topfield_used : 1;
|
RK_U32 sw_ref_topfield_used : 1;
|
||||||
RK_U32 sw_ref_botfield_used : 1;
|
RK_U32 sw_ref_botfield_used : 1;
|
||||||
RK_U32 sw_ref_colmv_use_flag : 1;
|
RK_U32 sw_ref_colmv_use_flag : 1;
|
||||||
|
|
||||||
} swreg10_24_refer0_14_base[15];
|
} swreg10_24_refer0_14_base[15];
|
||||||
RK_U32 swreg25_39_refer0_14_poc[15];
|
RK_U32 swreg25_39_refer0_14_poc[15];
|
||||||
struct {
|
struct {
|
||||||
@@ -148,12 +148,12 @@ typedef struct h264d_rkv_regs_t {
|
|||||||
RK_U32 sw_saowr_yoffset : 10;
|
RK_U32 sw_saowr_yoffset : 10;
|
||||||
} swreg47_sao_ctu_position;
|
} swreg47_sao_ctu_position;
|
||||||
struct {
|
struct {
|
||||||
RK_U32 sw_refer_base : 10;
|
RK_U32 sw_refer_base : 10;
|
||||||
RK_U32 sw_ref_field : 1;
|
RK_U32 sw_ref_field : 1;
|
||||||
RK_U32 sw_ref_topfield_used : 1;
|
RK_U32 sw_ref_topfield_used : 1;
|
||||||
RK_U32 sw_ref_botfield_used : 1;
|
RK_U32 sw_ref_botfield_used : 1;
|
||||||
RK_U32 sw_ref_colmv_use_flag : 1;
|
RK_U32 sw_ref_colmv_use_flag : 1;
|
||||||
|
|
||||||
} swreg48_refer15_base;
|
} swreg48_refer15_base;
|
||||||
RK_U32 swreg49_63_refer15_29_poc[15];
|
RK_U32 swreg49_63_refer15_29_poc[15];
|
||||||
struct {
|
struct {
|
||||||
@@ -199,7 +199,7 @@ typedef struct h264d_rkv_regs_t {
|
|||||||
struct {
|
struct {
|
||||||
//RK_U32 reserve : 4;
|
//RK_U32 reserve : 4;
|
||||||
//RK_U32 sw_errorinfo_base : 28;
|
//RK_U32 sw_errorinfo_base : 28;
|
||||||
RK_U32 sw_errorinfo_base : 32;
|
RK_U32 sw_errorinfo_base : 32;
|
||||||
} swreg75_h264_errorinfo_base;
|
} swreg75_h264_errorinfo_base;
|
||||||
struct {
|
struct {
|
||||||
RK_U32 sw_slicedec_num : 14;
|
RK_U32 sw_slicedec_num : 14;
|
||||||
@@ -212,7 +212,7 @@ typedef struct h264d_rkv_regs_t {
|
|||||||
RK_U32 reserve : 2;
|
RK_U32 reserve : 2;
|
||||||
} swreg77_h264_error_e;
|
} swreg77_h264_error_e;
|
||||||
RK_U32 compare_len;
|
RK_U32 compare_len;
|
||||||
RK_U32 reverse[100];
|
RK_U32 reverse[100];
|
||||||
} H264dRkvRegs_t;
|
} H264dRkvRegs_t;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -237,7 +237,7 @@ const HalRegDrv_t g_vdpu_drv[VDPU_MAX_SIZE + 1] = {
|
|||||||
{ VDPU_DEC_OUT_DIS , 3 , 1, 15, "sw03_dec_out_dis " },
|
{ VDPU_DEC_OUT_DIS , 3 , 1, 15, "sw03_dec_out_dis " },
|
||||||
{ VDPU_FILTERING_DIS , 3 , 1, 14, "sw03_filtering_dis " },
|
{ VDPU_FILTERING_DIS , 3 , 1, 14, "sw03_filtering_dis " },
|
||||||
{ VDPU_PIC_FIXED_QUANT , 3 , 1, 13, "sw03_pic_fixed_quant " },
|
{ VDPU_PIC_FIXED_QUANT , 3 , 1, 13, "sw03_pic_fixed_quant " },
|
||||||
{ VDPU_MVC_E , 3 , 1, 13, "sw03_mvc_e " },
|
{ VDPU_MVC_E , 3 , 1, 13, "sw03_mvc_e " },
|
||||||
{ VDPU_WRITE_MVS_E , 3 , 1, 12, "sw03_write_mvs_e " },
|
{ VDPU_WRITE_MVS_E , 3 , 1, 12, "sw03_write_mvs_e " },
|
||||||
{ VDPU_REFTOPFIRST_E , 3 , 1, 11, "sw03_reftopfirst_e " },
|
{ VDPU_REFTOPFIRST_E , 3 , 1, 11, "sw03_reftopfirst_e " },
|
||||||
{ VDPU_SEQ_MBAFF_E , 3 , 1, 10, "sw03_seq_mbaff_e " },
|
{ VDPU_SEQ_MBAFF_E , 3 , 1, 10, "sw03_seq_mbaff_e " },
|
||||||
@@ -1062,10 +1062,10 @@ MPP_RET vdpu_set_vlc_regs(void *hal, HalRegDrvCtx_t *p_drv)
|
|||||||
FUN_CHECK(ret = hal_set_regdrv(p_drv, VDPU_REFER_VALID_E, validFlags << 16));
|
FUN_CHECK(ret = hal_set_regdrv(p_drv, VDPU_REFER_VALID_E, validFlags << 16));
|
||||||
|
|
||||||
|
|
||||||
//FPRINT(g_debug_file0, "ref_valid_e=%08x, longterm=%08x, mvc_e=%d, cur_poc=%d \n",
|
//FPRINT(g_debug_file0, "ref_valid_e=%08x, longterm=%08x, mvc_e=%d, cur_poc=%d \n",
|
||||||
// validFlags << 16, longTermflags << 16, 0, p_hal->pp->CurrFieldOrderCnt[0]);
|
// validFlags << 16, longTermflags << 16, 0, p_hal->pp->CurrFieldOrderCnt[0]);
|
||||||
|
|
||||||
//FPRINT(g_debug_file0, "--------- [FLUSH_CNT] flush framecnt=%d -------- \n", p_hal->iDecodedNum++);
|
//FPRINT(g_debug_file0, "--------- [FLUSH_CNT] flush framecnt=%d -------- \n", p_hal->iDecodedNum++);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1100,29 +1100,29 @@ MPP_RET vdpu_set_vlc_regs(void *hal, HalRegDrvCtx_t *p_drv)
|
|||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
//pocBase = (RK_U32 *) ((RK_U8 *)mpp_buffer_get_ptr(p_hal->cabac_buf) + VDPU_CABAC_TAB_SIZE);
|
//pocBase = (RK_U32 *) ((RK_U8 *)mpp_buffer_get_ptr(p_hal->cabac_buf) + VDPU_CABAC_TAB_SIZE);
|
||||||
//for (i = 0; i < VDPU_POC_BUF_SIZE / 4; i++)
|
//for (i = 0; i < VDPU_POC_BUF_SIZE / 4; i++)
|
||||||
//{
|
//{
|
||||||
// FPRINT(g_debug_file1, "i=%d, poc_value=%d, idx=%d \n", i, *pocBase++, p_hal->pp->RefFrameList[i / 2].Index7Bits);
|
// FPRINT(g_debug_file1, "i=%d, poc_value=%d, idx=%d \n", i, *pocBase++, p_hal->pp->RefFrameList[i / 2].Index7Bits);
|
||||||
//}
|
//}
|
||||||
//FPRINT(g_debug_file0, "------ g_framecnt=%d \n", p_hal->in_task->g_framecnt);
|
//FPRINT(g_debug_file0, "------ g_framecnt=%d \n", p_hal->in_task->g_framecnt);
|
||||||
|
|
||||||
|
|
||||||
pocBase = (RK_U32 *) ((RK_U8 *)mpp_buffer_get_ptr(p_hal->cabac_buf) + VDPU_CABAC_TAB_SIZE);
|
pocBase = (RK_U32 *) ((RK_U8 *)mpp_buffer_get_ptr(p_hal->cabac_buf) + VDPU_CABAC_TAB_SIZE);
|
||||||
for(i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
RK_S32 dpb_idx = 0, longTermTmp = 0;
|
RK_S32 dpb_idx = 0, longTermTmp = 0;
|
||||||
if (p_hal->pp->RefFrameList[i / 2].bPicEntry != 0xff) {
|
if (p_hal->pp->RefFrameList[i / 2].bPicEntry != 0xff) {
|
||||||
FPRINT(g_debug_file1, "i=%2d, picnum=%d, framenum=%2d,", i, p_hal->pp->FrameNumList[i], p_hal->pp->FrameNumList[i]);
|
FPRINT(g_debug_file1, "i=%2d, picnum=%d, framenum=%2d,", i, p_hal->pp->FrameNumList[i], p_hal->pp->FrameNumList[i]);
|
||||||
longTermTmp = p_hal->pp->RefFrameList[i].AssociatedFlag;
|
longTermTmp = p_hal->pp->RefFrameList[i].AssociatedFlag;
|
||||||
dpb_idx = p_hal->pp->RefFrameList[i / 2].Index7Bits;
|
dpb_idx = p_hal->pp->RefFrameList[i / 2].Index7Bits;
|
||||||
FPRINT(g_debug_file1, " dbp_idx=%d, longterm=%d, poc=%d \n", dpb_idx, longTermTmp, *pocBase);
|
FPRINT(g_debug_file1, " dbp_idx=%d, longterm=%d, poc=%d \n", dpb_idx, longTermTmp, *pocBase);
|
||||||
}
|
}
|
||||||
pocBase +=2;
|
pocBase += 2;
|
||||||
}
|
}
|
||||||
hal_get_regdrv((HalRegDrvCtx_t *)p_hal->regs, VDPU_REFER_VALID_E, &validFlags);
|
hal_get_regdrv((HalRegDrvCtx_t *)p_hal->regs, VDPU_REFER_VALID_E, &validFlags);
|
||||||
FPRINT(g_debug_file1, " view=%d, nonivref=%d, iv_base=%08x, ref_valid_e=%d, mvc_e=%d, cur_poc=%d \n", 0, 0, 0x0, validFlags, 0, *pocBase);
|
FPRINT(g_debug_file1, " view=%d, nonivref=%d, iv_base=%08x, ref_valid_e=%d, mvc_e=%d, cur_poc=%d \n", 0, 0, 0x0, validFlags, 0, *pocBase);
|
||||||
FPRINT(g_debug_file1, "--------- [FLUSH_CNT] flush framecnt=%d --------\n", p_hal->iDecodedNum);
|
FPRINT(g_debug_file1, "--------- [FLUSH_CNT] flush framecnt=%d --------\n", p_hal->iDecodedNum);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1217,7 +1217,7 @@ MPP_RET vdpu_set_asic_regs(void *hal, HalRegDrvCtx_t *p_drv)
|
|||||||
RK_U32 picSizeInMbs = 0;
|
RK_U32 picSizeInMbs = 0;
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
MppBuffer frame_buf = NULL;
|
MppBuffer frame_buf = NULL;
|
||||||
|
|
||||||
|
|
||||||
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
H264dHalCtx_t *p_hal = (H264dHalCtx_t *)hal;
|
||||||
DXVA_PicParams_H264_MVC *pp = p_hal->pp;
|
DXVA_PicParams_H264_MVC *pp = p_hal->pp;
|
||||||
@@ -1228,14 +1228,14 @@ MPP_RET vdpu_set_asic_regs(void *hal, HalRegDrvCtx_t *p_drv)
|
|||||||
/* reference picture physis address */
|
/* reference picture physis address */
|
||||||
for (i = 0, j = 0xff; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
for (i = 0, j = 0xff; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
||||||
if (pp->RefFrameList[i].bPicEntry != 0xff) {
|
if (pp->RefFrameList[i].bPicEntry != 0xff) {
|
||||||
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->RefFrameList[i].Index7Bits, SLOT_BUFFER, &frame_buf); //!< reference phy addr
|
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->RefFrameList[i].Index7Bits, SLOT_BUFFER, &frame_buf); //!< reference phy addr
|
||||||
j = i;
|
j = i;
|
||||||
} else/* if(j == 0xff)*/ {
|
} else { /* if(j == 0xff)*/
|
||||||
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->CurrPic.Index7Bits, SLOT_BUFFER, &frame_buf); //!< current out phy addr
|
mpp_buf_slot_get_prop(p_hal->frame_slots, pp->CurrPic.Index7Bits, SLOT_BUFFER, &frame_buf); //!< current out phy addr
|
||||||
}
|
}
|
||||||
//else {
|
//else {
|
||||||
// mpp_buf_slot_get_prop(p_hal->frame_slots, j, SLOT_BUFFER, &frame_buf); //!< current out phy addr
|
// mpp_buf_slot_get_prop(p_hal->frame_slots, j, SLOT_BUFFER, &frame_buf); //!< current out phy addr
|
||||||
//}
|
//}
|
||||||
|
|
||||||
FUN_CHECK(ret = hal_set_regdrv(p_drv, g_refBase[i], mpp_buffer_get_fd(frame_buf)));
|
FUN_CHECK(ret = hal_set_regdrv(p_drv, g_refBase[i], mpp_buffer_get_fd(frame_buf)));
|
||||||
}
|
}
|
||||||
@@ -1290,49 +1290,49 @@ MPP_RET vdpu_set_asic_regs(void *hal, HalRegDrvCtx_t *p_drv)
|
|||||||
FUN_CHECK(ret = hal_set_regdrv(p_drv, VDPU_TYPE1_QUANT_E, pp->scaleing_list_enable_flag));
|
FUN_CHECK(ret = hal_set_regdrv(p_drv, VDPU_TYPE1_QUANT_E, pp->scaleing_list_enable_flag));
|
||||||
|
|
||||||
if (p_hal->pp->scaleing_list_enable_flag) {
|
if (p_hal->pp->scaleing_list_enable_flag) {
|
||||||
RK_U32 temp = 0;
|
RK_U32 temp = 0;
|
||||||
RK_U32 *ptr = NULL;
|
RK_U32 *ptr = NULL;
|
||||||
|
|
||||||
ptr = (RK_U32 *)((RK_U8 *)mpp_buffer_get_ptr(p_hal->cabac_buf) + VDPU_CABAC_TAB_SIZE + VDPU_POC_BUF_SIZE);
|
ptr = (RK_U32 *)((RK_U8 *)mpp_buffer_get_ptr(p_hal->cabac_buf) + VDPU_CABAC_TAB_SIZE + VDPU_POC_BUF_SIZE);
|
||||||
for(i = 0; i < 6; i++) {
|
for (i = 0; i < 6; i++) {
|
||||||
for(j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
temp = (p_hal->qm->bScalingLists4x4[i][4 * j + 0] << 24) |
|
temp = (p_hal->qm->bScalingLists4x4[i][4 * j + 0] << 24) |
|
||||||
(p_hal->qm->bScalingLists4x4[i][4 * j + 1] << 16) |
|
(p_hal->qm->bScalingLists4x4[i][4 * j + 1] << 16) |
|
||||||
(p_hal->qm->bScalingLists4x4[i][4 * j + 2] << 8) |
|
(p_hal->qm->bScalingLists4x4[i][4 * j + 2] << 8) |
|
||||||
(p_hal->qm->bScalingLists4x4[i][4 * j + 3]);
|
(p_hal->qm->bScalingLists4x4[i][4 * j + 3]);
|
||||||
*ptr++ = temp;
|
*ptr++ = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
for(j = 0; j < 16; j++) {
|
for (j = 0; j < 16; j++) {
|
||||||
temp = (p_hal->qm->bScalingLists8x8[i][4 * j + 0] << 24) |
|
temp = (p_hal->qm->bScalingLists8x8[i][4 * j + 0] << 24) |
|
||||||
(p_hal->qm->bScalingLists8x8[i][4 * j + 1] << 16) |
|
(p_hal->qm->bScalingLists8x8[i][4 * j + 1] << 16) |
|
||||||
(p_hal->qm->bScalingLists8x8[i][4 * j + 2] << 8) |
|
(p_hal->qm->bScalingLists8x8[i][4 * j + 2] << 8) |
|
||||||
(p_hal->qm->bScalingLists8x8[i][4 * j + 3]);
|
(p_hal->qm->bScalingLists8x8[i][4 * j + 3]);
|
||||||
*ptr++ = temp;
|
*ptr++ = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
RK_U8 i = 0, j = 0;
|
RK_U8 i = 0, j = 0;
|
||||||
RK_U8 *ptr = (RK_U8 *)mpp_buffer_get_ptr(p_hal->cabac_buf) + VDPU_CABAC_TAB_SIZE + VDPU_POC_BUF_SIZE;
|
RK_U8 *ptr = (RK_U8 *)mpp_buffer_get_ptr(p_hal->cabac_buf) + VDPU_CABAC_TAB_SIZE + VDPU_POC_BUF_SIZE;
|
||||||
for(i = 0; i < 6; i++) {
|
for (i = 0; i < 6; i++) {
|
||||||
for(j = 0; j < 16; j++) {
|
for (j = 0; j < 16; j++) {
|
||||||
FPRINT(g_debug_file1, "[i=%2d][j=%2d]=%d, ", i, j, *ptr);
|
FPRINT(g_debug_file1, "[i=%2d][j=%2d]=%d, ", i, j, *ptr);
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
FPRINT(g_debug_file1, "\n");
|
FPRINT(g_debug_file1, "\n");
|
||||||
}
|
}
|
||||||
for(i = 6; i < 8; i++) {
|
for (i = 6; i < 8; i++) {
|
||||||
for(j = 0; j < 64; j++) {
|
for (j = 0; j < 64; j++) {
|
||||||
FPRINT(g_debug_file1, "[i=%2d][j=%2d]=%d, ", i, j, *ptr);
|
FPRINT(g_debug_file1, "[i=%2d][j=%2d]=%d, ", i, j, *ptr);
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
FPRINT(g_debug_file1, "\n");
|
FPRINT(g_debug_file1, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUN_CHECK(ret = hal_set_regdrv(p_drv, VDPU_DEC_OUT_DIS, 0)); //!< set defalut 0
|
FUN_CHECK(ret = hal_set_regdrv(p_drv, VDPU_DEC_OUT_DIS, 0)); //!< set defalut 0
|
||||||
|
@@ -37,10 +37,10 @@
|
|||||||
|
|
||||||
static void print_single_regs(HalRegDrvCtx_t *p_drv, const HalRegDrv_t *pcur)
|
static void print_single_regs(HalRegDrvCtx_t *p_drv, const HalRegDrv_t *pcur)
|
||||||
{
|
{
|
||||||
RK_S32 val = 0;
|
RK_S32 val = 0;
|
||||||
hal_get_regdrv(p_drv, pcur->syn_id, (RK_U32 *)&val);
|
hal_get_regdrv(p_drv, pcur->syn_id, (RK_U32 *)&val);
|
||||||
LogInfo((LogCtx_t *)p_drv->log, "name=[%24s], reg=[%.2d], bit=[%.2d], len=[%.2d], val=[%8d]",
|
LogInfo((LogCtx_t *)p_drv->log, "name=[%24s], reg=[%.2d], bit=[%.2d], len=[%.2d], val=[%8d]",
|
||||||
pcur->name, pcur->reg_id, pcur->bitpos, pcur->bitlen, val);
|
pcur->name, pcur->reg_id, pcur->bitpos, pcur->bitlen, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -57,8 +57,8 @@ static MPP_RET vdpu_h264d_print_regs(H264dHalCtx_t *p_hal, HalRegDrvCtx_t *p_drv
|
|||||||
logctx = (LogCtx_t *)p_drv->log;
|
logctx = (LogCtx_t *)p_drv->log;
|
||||||
if (LogEnable(logctx, LOG_LEVEL_INFO)) {
|
if (LogEnable(logctx, LOG_LEVEL_INFO)) {
|
||||||
#if 1
|
#if 1
|
||||||
if (g_print_init_value) {
|
if (g_print_init_value) {
|
||||||
g_print_init_value = 0;
|
g_print_init_value = 0;
|
||||||
LogInfo((LogCtx_t *)p_drv->log, "---------------- VDPU REG START ------------------ ");
|
LogInfo((LogCtx_t *)p_drv->log, "---------------- VDPU REG START ------------------ ");
|
||||||
//!< ---------------- init register -------------
|
//!< ---------------- init register -------------
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_MODE ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_MODE ]);
|
||||||
@@ -97,91 +97,91 @@ static MPP_RET vdpu_h264d_print_regs(H264dHalCtx_t *p_hal, HalRegDrvCtx_t *p_drv
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
{
|
{
|
||||||
LogInfo(logctx, "[SET_REG] g_framecnt=%d, ---- DECODE BEING -------", p_hal->iDecodedNum);
|
LogInfo(logctx, "[SET_REG] g_framecnt=%d, ---- DECODE BEING -------", p_hal->iDecodedNum);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_OUT_DIS ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_OUT_DIS ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_RLC_MODE_E ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_RLC_MODE_E ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_INIT_QP ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_INIT_QP ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFIDX0_ACTIVE ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFIDX0_ACTIVE ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REF_FRAMES ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REF_FRAMES ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_FRAMENUM_LEN ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_FRAMENUM_LEN ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_FRAMENUM ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_FRAMENUM ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_CONST_INTRA_E ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_CONST_INTRA_E ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_FILT_CTRL_PRES ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_FILT_CTRL_PRES ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_RDPIC_CNT_PRES ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_RDPIC_CNT_PRES ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFPIC_MK_LEN ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFPIC_MK_LEN ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_IDR_PIC_E ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_IDR_PIC_E ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_IDR_PIC_ID ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_IDR_PIC_ID ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PPS_ID ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PPS_ID ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_POC_LENGTH ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_POC_LENGTH ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFER_LTERM_E ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFER_LTERM_E ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFER_VALID_E ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFER_VALID_E ]);
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
if (p_hal->pp->RefFrameList[i].bPicEntry != 0xff) { //!< valid
|
if (p_hal->pp->RefFrameList[i].bPicEntry != 0xff) { //!< valid
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[g_refPicNum[i]]);
|
print_single_regs(p_drv, &p_drv->p_emt[g_refPicNum[i]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PICORD_COUNT_E ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PICORD_COUNT_E ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_CABAC_E ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_CABAC_E ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_START_CODE_E ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_START_CODE_E ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_STRM_START_BIT ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_STRM_START_BIT ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_RLC_VLC_BASE ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_RLC_VLC_BASE ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_STREAM_LEN ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_STREAM_LEN ]);
|
||||||
/* P lists */
|
/* P lists */
|
||||||
for (i = 0; i < MPP_ARRAY_ELEMS(g_refPicListP); i++) {
|
for (i = 0; i < MPP_ARRAY_ELEMS(g_refPicListP); i++) {
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[g_refPicListP[i]]);
|
print_single_regs(p_drv, &p_drv->p_emt[g_refPicListP[i]]);
|
||||||
}
|
}
|
||||||
/* B lists */
|
/* B lists */
|
||||||
for (i = 0; i < MPP_ARRAY_ELEMS(g_refPicList0); i++) {
|
for (i = 0; i < MPP_ARRAY_ELEMS(g_refPicList0); i++) {
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[g_refPicList0[i]]);
|
print_single_regs(p_drv, &p_drv->p_emt[g_refPicList0[i]]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[g_refPicList1[i]]);
|
print_single_regs(p_drv, &p_drv->p_emt[g_refPicList1[i]]);
|
||||||
}
|
}
|
||||||
/* reference based address */
|
/* reference based address */
|
||||||
for (i = 0; i < MPP_ARRAY_ELEMS(g_refBase); i++) {
|
for (i = 0; i < MPP_ARRAY_ELEMS(g_refBase); i++) {
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[g_refBase[i]]);
|
print_single_regs(p_drv, &p_drv->p_emt[g_refBase[i]]);
|
||||||
}
|
}
|
||||||
/* inter-view reference picture */
|
/* inter-view reference picture */
|
||||||
if (p_hal->pp->curr_layer_id && p_hal->pp->inter_view_flag) {
|
if (p_hal->pp->curr_layer_id && p_hal->pp->inter_view_flag) {
|
||||||
|
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_INTER_VIEW_BASE]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_INTER_VIEW_BASE]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFER_VALID_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFER_VALID_E]);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PIC_FIXED_QUANT]); //!< VDPU_MVC_E
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PIC_FIXED_QUANT]); //!< VDPU_MVC_E
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_FILTERING_DIS]); //!< filterDisable = 0;
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_FILTERING_DIS]); //!< filterDisable = 0;
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_OUT_BASE]); //!< outPhyAddr, pp->CurrPic.Index7Bits
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_OUT_BASE]); //!< outPhyAddr, pp->CurrPic.Index7Bits
|
||||||
|
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_CH_QP_OFFSET]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_CH_QP_OFFSET]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_CH_QP_OFFSET2]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_CH_QP_OFFSET2]);
|
||||||
|
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DIR_MV_BASE]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DIR_MV_BASE]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_WRITE_MVS_E]); //!< defalut set 1
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_WRITE_MVS_E]); //!< defalut set 1
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DIR_8X8_INFER_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DIR_8X8_INFER_E]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_WEIGHT_PRED_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_WEIGHT_PRED_E]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_WEIGHT_BIPR_IDC]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_WEIGHT_BIPR_IDC]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFIDX1_ACTIVE]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_REFIDX1_ACTIVE]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_FIELDPIC_FLAG_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_FIELDPIC_FLAG_E]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PIC_INTERLACE_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PIC_INTERLACE_E]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PIC_FIELDMODE_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PIC_FIELDMODE_E]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PIC_TOPFIELD_E]); //!< bottomFieldFlag
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_PIC_TOPFIELD_E]); //!< bottomFieldFlag
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_SEQ_MBAFF_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_SEQ_MBAFF_E]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_8X8TRANS_FLAG_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_8X8TRANS_FLAG_E]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_BLACKWHITE_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_BLACKWHITE_E]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_TYPE1_QUANT_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_TYPE1_QUANT_E]);
|
||||||
|
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_OUT_DIS]); //!< set defalut 0
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_OUT_DIS]); //!< set defalut 0
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_CH_8PIX_ILEAV_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_CH_8PIX_ILEAV_E]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_E]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_E]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_QTABLE_BASE]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_QTABLE_BASE]);
|
||||||
LogInfo((LogCtx_t *)p_drv->log, "--------- [FLUSH_CNT] flush framecnt=%d -------- \n", p_hal->iDecodedNum);
|
LogInfo((LogCtx_t *)p_drv->log, "--------- [FLUSH_CNT] flush framecnt=%d -------- \n", p_hal->iDecodedNum);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_IRQ_STAT]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_IRQ_STAT]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_IRQ]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_IRQ]);
|
||||||
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_PIC_INF]);
|
print_single_regs(p_drv, &p_drv->p_emt[VDPU_DEC_PIC_INF]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
(void)i;
|
(void)i;
|
||||||
(void)p_hal;
|
(void)p_hal;
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
}
|
}
|
||||||
@@ -294,7 +294,7 @@ static MPP_RET vdpu_adjust_input(H264dHalCtx_t *p_hal)
|
|||||||
H264dVdpuDpb_t *ilt_dpb = priv->ilt_dpb;
|
H264dVdpuDpb_t *ilt_dpb = priv->ilt_dpb;
|
||||||
|
|
||||||
|
|
||||||
assert(pp->curr_layer_id == 0);
|
assert(pp->curr_layer_id == 0);
|
||||||
|
|
||||||
//!< change input dxva into pdb structure
|
//!< change input dxva into pdb structure
|
||||||
priv->new_dpb_cnt = 0;
|
priv->new_dpb_cnt = 0;
|
||||||
@@ -323,7 +323,7 @@ static MPP_RET vdpu_adjust_input(H264dHalCtx_t *p_hal)
|
|||||||
}
|
}
|
||||||
//!< inter-view frame flag
|
//!< inter-view frame flag
|
||||||
if (new_dpb[i].is_ilt) {
|
if (new_dpb[i].is_ilt) {
|
||||||
assert(0);
|
assert(0);
|
||||||
ilt_dpb[priv->ilt_dpb_cnt] = new_dpb[i];
|
ilt_dpb[priv->ilt_dpb_cnt] = new_dpb[i];
|
||||||
ilt_dpb[priv->ilt_dpb_cnt].valid = 1;
|
ilt_dpb[priv->ilt_dpb_cnt].valid = 1;
|
||||||
priv->ilt_dpb_cnt++;
|
priv->ilt_dpb_cnt++;
|
||||||
@@ -333,49 +333,48 @@ static MPP_RET vdpu_adjust_input(H264dHalCtx_t *p_hal)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p_hal->iDecodedNum == 3)
|
if (p_hal->iDecodedNum == 3) {
|
||||||
{
|
i = i;
|
||||||
i = i;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//for (i = 0; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
//for (i = 0; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
||||||
// if (new_dpb[i].valid) {
|
// if (new_dpb[i].valid) {
|
||||||
// FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", i, new_dpb[i].frame_num, new_dpb[i].frame_num);
|
// FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", i, new_dpb[i].frame_num, new_dpb[i].frame_num);
|
||||||
// FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", new_dpb[i].slot_index, new_dpb[i].is_long_term,
|
// FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", new_dpb[i].slot_index, new_dpb[i].is_long_term,
|
||||||
// new_dpb[i].TOP_POC);
|
// new_dpb[i].TOP_POC);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
//FPRINT(g_debug_file0, "--------- [new DPB] -------- \n");
|
//FPRINT(g_debug_file0, "--------- [new DPB] -------- \n");
|
||||||
//for (i = 0; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
//for (i = 0; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
||||||
// if (old_dpb[i].valid) {
|
// if (old_dpb[i].valid) {
|
||||||
// FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", i, old_dpb[i].frame_num, old_dpb[i].frame_num);
|
// FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", i, old_dpb[i].frame_num, old_dpb[i].frame_num);
|
||||||
// FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", old_dpb[i].slot_index, old_dpb[i].is_long_term,
|
// FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", old_dpb[i].slot_index, old_dpb[i].is_long_term,
|
||||||
// old_dpb[i].TOP_POC);
|
// old_dpb[i].TOP_POC);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
//FPRINT(g_debug_file0, "--------- [Old DPB] -------- \n");
|
//FPRINT(g_debug_file0, "--------- [Old DPB] -------- \n");
|
||||||
|
|
||||||
//!< delete old dpb
|
//!< delete old dpb
|
||||||
for (i = 0; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
for (i = 0; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
||||||
find_flag = 0;
|
find_flag = 0;
|
||||||
|
|
||||||
if (old_dpb[i].valid) {
|
if (old_dpb[i].valid) {
|
||||||
for (j = 0; j < MPP_ARRAY_ELEMS(pp->RefFrameList); j++) {
|
for (j = 0; j < MPP_ARRAY_ELEMS(pp->RefFrameList); j++) {
|
||||||
if(new_dpb[j].valid) {
|
if (new_dpb[j].valid) {
|
||||||
find_flag = (old_dpb[i].frame_num == new_dpb[j].frame_num) ? 1 : 0;
|
find_flag = (old_dpb[i].frame_num == new_dpb[j].frame_num) ? 1 : 0;
|
||||||
if (new_dpb[j].top_used) {
|
if (new_dpb[j].top_used) {
|
||||||
find_flag = (old_dpb[i].TOP_POC == new_dpb[j].TOP_POC) ? find_flag : 0;
|
find_flag = (old_dpb[i].TOP_POC == new_dpb[j].TOP_POC) ? find_flag : 0;
|
||||||
}
|
}
|
||||||
if (new_dpb[j].bot_used) {
|
if (new_dpb[j].bot_used) {
|
||||||
find_flag = (old_dpb[i].BOT_POC == new_dpb[j].BOT_POC) ? find_flag : 0;
|
find_flag = (old_dpb[i].BOT_POC == new_dpb[j].BOT_POC) ? find_flag : 0;
|
||||||
}
|
}
|
||||||
if (find_flag) { //!< found
|
if (find_flag) { //!< found
|
||||||
new_dpb[j].have_same = 1;
|
new_dpb[j].have_same = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//!< not found
|
//!< not found
|
||||||
if (find_flag == 0) {
|
if (find_flag == 0) {
|
||||||
memset(&old_dpb[i], 0, sizeof(H264dVdpuDpb_t));
|
memset(&old_dpb[i], 0, sizeof(H264dVdpuDpb_t));
|
||||||
@@ -383,14 +382,14 @@ static MPP_RET vdpu_adjust_input(H264dHalCtx_t *p_hal)
|
|||||||
}
|
}
|
||||||
//!< add new dpb
|
//!< add new dpb
|
||||||
for (j = 0; j < MPP_ARRAY_ELEMS(pp->RefFrameList); j++) {
|
for (j = 0; j < MPP_ARRAY_ELEMS(pp->RefFrameList); j++) {
|
||||||
if ((new_dpb[j].valid == 0) || new_dpb[j].have_same) {
|
if ((new_dpb[j].valid == 0) || new_dpb[j].have_same) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (i = 0; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
for (i = 0; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
||||||
if (old_dpb[i].valid == 0) {
|
if (old_dpb[i].valid == 0) {
|
||||||
old_dpb[i] = new_dpb[j];
|
old_dpb[i] = new_dpb[j];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//!< re-fill reference dxva syntax
|
//!< re-fill reference dxva syntax
|
||||||
@@ -425,13 +424,13 @@ static MPP_RET vdpu_adjust_input(H264dHalCtx_t *p_hal)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//for (i = 0; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
//for (i = 0; i < MPP_ARRAY_ELEMS(pp->RefFrameList); i++) {
|
||||||
// if (old_dpb[i].valid) {
|
// if (old_dpb[i].valid) {
|
||||||
// FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", i, old_dpb[i].frame_num, old_dpb[i].frame_num);
|
// FPRINT(g_debug_file0, "i=%2d, picnum=%d, framenum=%2d, ", i, old_dpb[i].frame_num, old_dpb[i].frame_num);
|
||||||
// FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", old_dpb[i].slot_index, old_dpb[i].is_long_term,
|
// FPRINT(g_debug_file0, " dbp_idx=%d, longterm=%d, poc=%d \n", old_dpb[i].slot_index, old_dpb[i].is_long_term,
|
||||||
// old_dpb[i].TOP_POC);
|
// old_dpb[i].TOP_POC);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
@@ -483,7 +482,7 @@ MPP_RET vdpu_h264d_init(void *hal, MppHalCfg *cfg)
|
|||||||
vdpu_set_device_regs(p_drv);
|
vdpu_set_device_regs(p_drv);
|
||||||
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_HOR_ALIGN, vdpu_hor_align);
|
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_HOR_ALIGN, vdpu_hor_align);
|
||||||
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_VER_ALIGN, vdpu_ver_align);
|
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_VER_ALIGN, vdpu_ver_align);
|
||||||
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_LEN_ALIGN, NULL);
|
mpp_slots_set_prop(p_hal->frame_slots, SLOTS_LEN_ALIGN, NULL);
|
||||||
|
|
||||||
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
FunctionOut(p_hal->logctx.parr[RUN_HAL]);
|
||||||
(void)cfg;
|
(void)cfg;
|
||||||
@@ -614,9 +613,9 @@ MPP_RET vdpu_h264d_wait(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]);
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
RK_S32 wait_ret = -1;
|
RK_S32 wait_ret = -1;
|
||||||
RK_S32 ret_len = 0, cur_deat = 0;
|
RK_S32 ret_len = 0, cur_deat = 0;
|
||||||
VPU_CMD_TYPE ret_cmd = VPU_CMD_BUTT;
|
VPU_CMD_TYPE ret_cmd = VPU_CMD_BUTT;
|
||||||
static struct timeval tv1, tv2;
|
static struct timeval tv1, tv2;
|
||||||
gettimeofday(&tv1, NULL);
|
gettimeofday(&tv1, NULL);
|
||||||
wait_ret = VPUClientWaitResult(p_hal->vpu_socket, p_drv->p_reg, DEC_X170_REGISTERS, &ret_cmd, &ret_len);
|
wait_ret = VPUClientWaitResult(p_hal->vpu_socket, p_drv->p_reg, DEC_X170_REGISTERS, &ret_cmd, &ret_len);
|
||||||
@@ -624,7 +623,7 @@ MPP_RET vdpu_h264d_wait(void *hal, HalTaskInfo *task)
|
|||||||
cur_deat = (tv2.tv_sec - tv1.tv_sec) * 1000 + (tv2.tv_usec - tv1.tv_usec) / 1000;
|
cur_deat = (tv2.tv_sec - tv1.tv_sec) * 1000 + (tv2.tv_usec - tv1.tv_usec) / 1000;
|
||||||
p_hal->total_time += cur_deat;
|
p_hal->total_time += cur_deat;
|
||||||
p_hal->iDecodedNum++;
|
p_hal->iDecodedNum++;
|
||||||
(void)wait_ret;
|
(void)wait_ret;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FUN_CHECK(ret = hal_set_regdrv(p_drv, VDPU_DEC_IRQ_STAT, 0));
|
FUN_CHECK(ret = hal_set_regdrv(p_drv, VDPU_DEC_IRQ_STAT, 0));
|
||||||
|
@@ -1167,7 +1167,7 @@ RK_S32 hal_h265d_output_pps_packet(void *hal, void *dxva)
|
|||||||
return MPP_ERR_NOMEM;
|
return MPP_ERR_NOMEM;
|
||||||
}
|
}
|
||||||
memset(pps_ptr, 0, 80 * 64);
|
memset(pps_ptr, 0, 80 * 64);
|
||||||
// pps_packet = (RK_U64 *)(pps_ptr + dxva_cxt->pp.pps_id * 80);
|
// pps_packet = (RK_U64 *)(pps_ptr + dxva_cxt->pp.pps_id * 80);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -1367,8 +1367,8 @@ RK_S32 hal_h265d_output_pps_packet(void *hal, void *dxva)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
for(i = 0; i < 64; i++){
|
for (i = 0; i < 64; i++) {
|
||||||
memcpy(pps_ptr+i*80,pps_packet,80);
|
memcpy(pps_ptr + i * 80, pps_packet, 80);
|
||||||
}
|
}
|
||||||
#ifdef dump
|
#ifdef dump
|
||||||
fwrite(pps_ptr, 1, 80 * 64, fp);
|
fwrite(pps_ptr, 1, 80 * 64, fp);
|
||||||
@@ -1501,8 +1501,8 @@ MPP_RET hal_h265d_gen_regs(void *hal, HalTaskInfo *syn)
|
|||||||
|
|
||||||
hw_regs->sw_stream_len = ((dxva_cxt->bitstream_size + 15) & (~15)) + 64;
|
hw_regs->sw_stream_len = ((dxva_cxt->bitstream_size + 15) & (~15)) + 64;
|
||||||
aglin_offset = hw_regs->sw_stream_len - dxva_cxt->bitstream_size;
|
aglin_offset = hw_regs->sw_stream_len - dxva_cxt->bitstream_size;
|
||||||
if(aglin_offset > 0){
|
if (aglin_offset > 0) {
|
||||||
memset((void *)(dxva_cxt->bitstream + dxva_cxt->bitstream_size),0,aglin_offset);
|
memset((void *)(dxva_cxt->bitstream + dxva_cxt->bitstream_size), 0, aglin_offset);
|
||||||
}
|
}
|
||||||
hw_regs->sw_interrupt.sw_dec_e = 1;
|
hw_regs->sw_interrupt.sw_dec_e = 1;
|
||||||
hw_regs->sw_interrupt.sw_dec_timeout_e = 1;
|
hw_regs->sw_interrupt.sw_dec_timeout_e = 1;
|
||||||
@@ -1565,7 +1565,7 @@ MPP_RET hal_h265d_start(void *hal, HalTaskInfo *task)
|
|||||||
hw_regs = ( H265d_REGS_t *)reg_cxt->hw_regs;
|
hw_regs = ( H265d_REGS_t *)reg_cxt->hw_regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hw_regs == NULL){
|
if (hw_regs == NULL) {
|
||||||
mpp_err("hal_h265d_start hw_regs is NULL");
|
mpp_err("hal_h265d_start hw_regs is NULL");
|
||||||
return MPP_ERR_NULL_PTR;
|
return MPP_ERR_NULL_PTR;
|
||||||
}
|
}
|
||||||
|
@@ -202,22 +202,23 @@ public:
|
|||||||
RK_S32 (*rkvpu_close_cxt)(VpuCodecContext **ctx);
|
RK_S32 (*rkvpu_close_cxt)(VpuCodecContext **ctx);
|
||||||
VpulibDlsym()
|
VpulibDlsym()
|
||||||
: rkapi_hdl(NULL),
|
: rkapi_hdl(NULL),
|
||||||
rkvpu_open_cxt(NULL),
|
rkvpu_open_cxt(NULL),
|
||||||
rkvpu_close_cxt(NULL)
|
rkvpu_close_cxt(NULL)
|
||||||
{
|
{
|
||||||
RK_S32 value = !!access("/dev/rkvdec", F_OK);
|
RK_S32 value = !!access("/dev/rkvdec", F_OK);
|
||||||
if (value) {
|
if (value) {
|
||||||
rkapi_hdl = dlopen("/system/lib/librk_on2.so", RTLD_LAZY);
|
rkapi_hdl = dlopen("/system/lib/librk_on2.so", RTLD_LAZY);
|
||||||
}
|
}
|
||||||
if (rkapi_hdl == NULL) {
|
if (rkapi_hdl == NULL) {
|
||||||
rkapi_hdl = dlopen("/system/lib/librk_vpuapi.so", RTLD_LAZY);
|
rkapi_hdl = dlopen("/system/lib/librk_vpuapi.so", RTLD_LAZY);
|
||||||
}
|
}
|
||||||
rkvpu_open_cxt = (RK_S32 (*)(VpuCodecContext **ctx))dlsym(rkapi_hdl, "vpu_open_context");
|
rkvpu_open_cxt = (RK_S32 (*)(VpuCodecContext **ctx))dlsym(rkapi_hdl, "vpu_open_context");
|
||||||
rkvpu_close_cxt = (RK_S32 (*)(VpuCodecContext **ctx))dlsym(rkapi_hdl, "vpu_close_context");
|
rkvpu_close_cxt = (RK_S32 (*)(VpuCodecContext **ctx))dlsym(rkapi_hdl, "vpu_close_context");
|
||||||
mpp_log("dlopen vpu lib");
|
mpp_log("dlopen vpu lib");
|
||||||
}
|
}
|
||||||
|
|
||||||
~VpulibDlsym(){
|
~VpulibDlsym()
|
||||||
|
{
|
||||||
dlclose(rkapi_hdl);
|
dlclose(rkapi_hdl);
|
||||||
mpp_log("dlclose vpu lib");
|
mpp_log("dlclose vpu lib");
|
||||||
}
|
}
|
||||||
@@ -227,8 +228,7 @@ VpulibDlsym gVpulib;
|
|||||||
|
|
||||||
RK_S32 open_orign_vpu(VpuCodecContext **ctx)
|
RK_S32 open_orign_vpu(VpuCodecContext **ctx)
|
||||||
{
|
{
|
||||||
if(NULL != gVpulib.rkvpu_open_cxt)
|
if (NULL != gVpulib.rkvpu_open_cxt) {
|
||||||
{
|
|
||||||
(gVpulib.rkvpu_open_cxt)(ctx);
|
(gVpulib.rkvpu_open_cxt)(ctx);
|
||||||
}
|
}
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
@@ -236,8 +236,7 @@ RK_S32 open_orign_vpu(VpuCodecContext **ctx)
|
|||||||
|
|
||||||
RK_S32 close_orign_vpu(VpuCodecContext **ctx)
|
RK_S32 close_orign_vpu(VpuCodecContext **ctx)
|
||||||
{
|
{
|
||||||
if(NULL != gVpulib.rkvpu_close_cxt)
|
if (NULL != gVpulib.rkvpu_close_cxt) {
|
||||||
{
|
|
||||||
(gVpulib.rkvpu_close_cxt)(ctx);
|
(gVpulib.rkvpu_close_cxt)(ctx);
|
||||||
}
|
}
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
@@ -252,7 +251,7 @@ RK_S32 vpu_open_context(VpuCodecContext **ctx)
|
|||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
value = value || (!!access("/dev/rkvdec", F_OK));
|
value = value || (!!access("/dev/rkvdec", F_OK));
|
||||||
|
|
||||||
if(s != NULL)
|
if (s != NULL)
|
||||||
value = (value & (s->videoCoding != OMX_RK_VIDEO_CodingHEVC));
|
value = (value & (s->videoCoding != OMX_RK_VIDEO_CodingHEVC));
|
||||||
|
|
||||||
if (value || !s) {
|
if (value || !s) {
|
||||||
@@ -303,7 +302,7 @@ RK_S32 vpu_open_context(VpuCodecContext **ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
if(s != NULL){
|
if (s != NULL) {
|
||||||
free(s);
|
free(s);
|
||||||
s = NULL;
|
s = NULL;
|
||||||
}
|
}
|
||||||
@@ -336,7 +335,7 @@ RK_S32 vpu_close_context(VpuCodecContext **ctx)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (s) {
|
if (s) {
|
||||||
s->flush(s);
|
s->flush(s);
|
||||||
VpuApi* api = (VpuApi*)(s->vpuApiObj);
|
VpuApi* api = (VpuApi*)(s->vpuApiObj);
|
||||||
if (s->vpuApiObj) {
|
if (s->vpuApiObj) {
|
||||||
delete api;
|
delete api;
|
||||||
|
@@ -130,7 +130,7 @@ RK_S32 VpuApi:: decode_getoutframe(DecoderOut_t *aDecOut)
|
|||||||
aDecOut->size = 0;
|
aDecOut->size = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(set_eos){
|
if (set_eos) {
|
||||||
aDecOut->size = 0;
|
aDecOut->size = 0;
|
||||||
return VPU_API_EOS_STREAM_REACHED;
|
return VPU_API_EOS_STREAM_REACHED;
|
||||||
}
|
}
|
||||||
@@ -144,8 +144,8 @@ RK_S32 VpuApi:: decode_getoutframe(DecoderOut_t *aDecOut)
|
|||||||
vframe->DisplayHeight = mpp_frame_get_height(mframe);
|
vframe->DisplayHeight = mpp_frame_get_height(mframe);
|
||||||
vframe->FrameWidth = mpp_frame_get_hor_stride(mframe);
|
vframe->FrameWidth = mpp_frame_get_hor_stride(mframe);
|
||||||
vframe->FrameHeight = mpp_frame_get_ver_stride(mframe);
|
vframe->FrameHeight = mpp_frame_get_ver_stride(mframe);
|
||||||
vframe->ErrorInfo = mpp_frame_get_errinfo(mframe);
|
vframe->ErrorInfo = mpp_frame_get_errinfo(mframe);
|
||||||
//mpp_err("vframe->ErrorInfo = %08x \n", vframe->ErrorInfo);
|
//mpp_err("vframe->ErrorInfo = %08x \n", vframe->ErrorInfo);
|
||||||
pts = mpp_frame_get_pts(mframe);
|
pts = mpp_frame_get_pts(mframe);
|
||||||
aDecOut->timeUs = pts;
|
aDecOut->timeUs = pts;
|
||||||
//mpp_err("get one frame timeUs %lld, errinfo=%08x",aDecOut->timeUs, vframe->ErrorInfo);
|
//mpp_err("get one frame timeUs %lld, errinfo=%08x",aDecOut->timeUs, vframe->ErrorInfo);
|
||||||
@@ -195,7 +195,7 @@ RK_S32 VpuApi:: decode_getoutframe(DecoderOut_t *aDecOut)
|
|||||||
}
|
}
|
||||||
if (mpp_frame_get_eos(mframe)) {
|
if (mpp_frame_get_eos(mframe)) {
|
||||||
set_eos = 1;
|
set_eos = 1;
|
||||||
if(buf == NULL){
|
if (buf == NULL) {
|
||||||
aDecOut->size = 0;
|
aDecOut->size = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -192,7 +192,7 @@ RK_S32 VPUMallocLinear(VPUMemLinear_t *p, RK_U32 size)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
MppBuffer buffer = NULL;
|
MppBuffer buffer = NULL;
|
||||||
ret = mpp_buffer_get(NULL, &buffer, size);
|
ret = mpp_buffer_get(NULL, &buffer, size);
|
||||||
if(ret != MPP_OK){
|
if (ret != MPP_OK) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
p->phy_addr = (RK_U32)mpp_buffer_get_fd(buffer);
|
p->phy_addr = (RK_U32)mpp_buffer_get_fd(buffer);
|
||||||
@@ -206,11 +206,11 @@ RK_S32 VPUMallocLinearFromRender(VPUMemLinear_t *p, RK_U32 size, void *ctx)
|
|||||||
{
|
{
|
||||||
VPUMemLinear_t *dma_buf = NULL;
|
VPUMemLinear_t *dma_buf = NULL;
|
||||||
vpu_display_mem_pool_impl *p_mempool = (vpu_display_mem_pool_impl *)ctx;
|
vpu_display_mem_pool_impl *p_mempool = (vpu_display_mem_pool_impl *)ctx;
|
||||||
if(ctx == NULL){
|
if (ctx == NULL) {
|
||||||
return VPUMallocLinear(p,size);
|
return VPUMallocLinear(p, size);
|
||||||
}
|
}
|
||||||
dma_buf = (VPUMemLinear_t *)p_mempool->get_free((vpu_display_mem_pool *)ctx);
|
dma_buf = (VPUMemLinear_t *)p_mempool->get_free((vpu_display_mem_pool *)ctx);
|
||||||
memset(p,0,sizeof(VPUMemLinear_t));
|
memset(p, 0, sizeof(VPUMemLinear_t));
|
||||||
if (dma_buf != NULL) {
|
if (dma_buf != NULL) {
|
||||||
if (dma_buf->size < size) {
|
if (dma_buf->size < size) {
|
||||||
mpp_free(dma_buf);
|
mpp_free(dma_buf);
|
||||||
|
10
mpp/mpi.cpp
10
mpp/mpi.cpp
@@ -65,7 +65,7 @@ static MPP_RET mpi_decode_put_packet(MppCtx ctx, MppPacket packet)
|
|||||||
|
|
||||||
if (NULL == p || p->check != p || NULL == p->ctx || NULL == packet) {
|
if (NULL == p || p->check != p || NULL == p->ctx || NULL == packet) {
|
||||||
mpp_err_f("found invalid context input ctx %p packet %p\n",
|
mpp_err_f("found invalid context input ctx %p packet %p\n",
|
||||||
ctx, packet);
|
ctx, packet);
|
||||||
return MPP_ERR_UNKNOW;
|
return MPP_ERR_UNKNOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ static MPP_RET mpi_decode_get_frame(MppCtx ctx, MppFrame *frame)
|
|||||||
|
|
||||||
if (NULL == p || p->check != p || NULL == p->ctx || NULL == frame) {
|
if (NULL == p || p->check != p || NULL == p->ctx || NULL == frame) {
|
||||||
mpp_err_f("found invalid context input ctx %p frame %p\n",
|
mpp_err_f("found invalid context input ctx %p frame %p\n",
|
||||||
ctx, frame);
|
ctx, frame);
|
||||||
return MPP_ERR_UNKNOW;
|
return MPP_ERR_UNKNOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ static MPP_RET mpi_encode_put_frame(MppCtx ctx, MppFrame frame)
|
|||||||
|
|
||||||
if (NULL == p || p->check != p || NULL == p->ctx || NULL == frame) {
|
if (NULL == p || p->check != p || NULL == p->ctx || NULL == frame) {
|
||||||
mpp_err_f("found invalid context input ctx %p frame %p\n",
|
mpp_err_f("found invalid context input ctx %p frame %p\n",
|
||||||
ctx, frame);
|
ctx, frame);
|
||||||
return MPP_ERR_UNKNOW;
|
return MPP_ERR_UNKNOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ static MPP_RET mpi_encode_get_packet(MppCtx ctx, MppPacket *packet)
|
|||||||
|
|
||||||
if (NULL == p || p->check != p || NULL == p->ctx || NULL == packet) {
|
if (NULL == p || p->check != p || NULL == p->ctx || NULL == packet) {
|
||||||
mpp_err_f("found invalid context input ctx %p packet %p\n",
|
mpp_err_f("found invalid context input ctx %p packet %p\n",
|
||||||
ctx, packet);
|
ctx, packet);
|
||||||
return MPP_ERR_UNKNOW;
|
return MPP_ERR_UNKNOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ MPP_RET mpp_init(MppCtx ctx, MppCtxType type, MppCodingType coding)
|
|||||||
type >= MPP_CTX_BUTT ||
|
type >= MPP_CTX_BUTT ||
|
||||||
coding >= MPP_VIDEO_CodingMax) {
|
coding >= MPP_VIDEO_CodingMax) {
|
||||||
mpp_err_f("invalid input ctx %p type %d coding %d\n",
|
mpp_err_f("invalid input ctx %p type %d coding %d\n",
|
||||||
ctx, type, coding);
|
ctx, type, coding);
|
||||||
return MPP_ERR_NULL_PTR;
|
return MPP_ERR_NULL_PTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -80,24 +80,24 @@ typedef void (*LOG_FUN)(void *ctx, ...);
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define CHECK_RANGE(bitctx, val, _min, _max)\
|
#define CHECK_RANGE(bitctx, val, _min, _max)\
|
||||||
do {\
|
do {\
|
||||||
if ((val) < (_min) || (val) > (_max)) {\
|
if ((val) < (_min) || (val) > (_max)) {\
|
||||||
mpp_log("%d[%d,%d]", val, _min, _max);\
|
mpp_log("%d[%d,%d]", val, _min, _max);\
|
||||||
bitctx->ret = MPP_ERR_VALUE;\
|
bitctx->ret = MPP_ERR_VALUE;\
|
||||||
goto __BITREAD_ERR;\
|
goto __BITREAD_ERR;\
|
||||||
}\
|
}\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#define CHECK_ERROR(bitctx, val)\
|
#define CHECK_ERROR(bitctx, val)\
|
||||||
do {\
|
do {\
|
||||||
if (!(val)) {\
|
if (!(val)) {\
|
||||||
mpp_log("value false");\
|
mpp_log("value false");\
|
||||||
bitctx->ret = MPP_ERR_VALUE;\
|
bitctx->ret = MPP_ERR_VALUE;\
|
||||||
ASSERT(0);\
|
ASSERT(0);\
|
||||||
goto __BITREAD_ERR;\
|
goto __BITREAD_ERR;\
|
||||||
}\
|
}\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
typedef struct bitread_ctx_t {
|
typedef struct bitread_ctx_t {
|
||||||
// Pointer to the next unread (not in curr_byte_) byte in the stream.
|
// Pointer to the next unread (not in curr_byte_) byte in the stream.
|
||||||
|
@@ -152,8 +152,8 @@ int mpp_buffer_get_fd(MppBuffer buffer)
|
|||||||
MppBufferImpl *p = (MppBufferImpl*)buffer;
|
MppBufferImpl *p = (MppBufferImpl*)buffer;
|
||||||
int fd = p->info.fd;
|
int fd = p->info.fd;
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
mpp_assert(fd >= 0);
|
mpp_assert(fd >= 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
|
@@ -298,7 +298,7 @@ MppBufferImpl *mpp_buffer_get_unused(MppBufferGroupImpl *p, size_t size)
|
|||||||
if (!list_empty(&p->list_unused)) {
|
if (!list_empty(&p->list_unused)) {
|
||||||
MppBufferImpl *pos, *n;
|
MppBufferImpl *pos, *n;
|
||||||
list_for_each_entry_safe(pos, n, &p->list_unused, MppBufferImpl, list_status) {
|
list_for_each_entry_safe(pos, n, &p->list_unused, MppBufferImpl, list_status) {
|
||||||
//mpp_log("[RKV_DEBUG]pos->info.size=%d, size=%d \n", pos->info.size, size);
|
//mpp_log("[RKV_DEBUG]pos->info.size=%d, size=%d \n", pos->info.size, size);
|
||||||
if (pos->info.size >= size) {
|
if (pos->info.size >= size) {
|
||||||
buffer = pos;
|
buffer = pos;
|
||||||
inc_buffer_ref_no_lock(buffer);
|
inc_buffer_ref_no_lock(buffer);
|
||||||
|
@@ -54,10 +54,10 @@ struct MppFrameImpl_t {
|
|||||||
* send decoded frame belong which view
|
* send decoded frame belong which view
|
||||||
*/
|
*/
|
||||||
RK_U32 viewid;
|
RK_U32 viewid;
|
||||||
/*
|
/*
|
||||||
* poc - picture order count
|
* poc - picture order count
|
||||||
*/
|
*/
|
||||||
RK_U32 poc;
|
RK_U32 poc;
|
||||||
/*
|
/*
|
||||||
* pts - display time stamp
|
* pts - display time stamp
|
||||||
* dts - decode time stamp
|
* dts - decode time stamp
|
||||||
@@ -71,7 +71,7 @@ struct MppFrameImpl_t {
|
|||||||
*/
|
*/
|
||||||
RK_U32 eos;
|
RK_U32 eos;
|
||||||
RK_U32 info_change;
|
RK_U32 info_change;
|
||||||
RK_U32 errinfo;
|
RK_U32 errinfo;
|
||||||
MppFrameColorRange color_range;
|
MppFrameColorRange color_range;
|
||||||
MppFrameColorPrimaries color_primaries;
|
MppFrameColorPrimaries color_primaries;
|
||||||
MppFrameColorTransferCharacteristic color_trc;
|
MppFrameColorTransferCharacteristic color_trc;
|
||||||
|
@@ -106,11 +106,11 @@ static MPP_RET decoder_init(MppDec *pApi)
|
|||||||
hal_cfg.coding = pApi->coding;
|
hal_cfg.coding = pApi->coding;
|
||||||
hal_cfg.work_mode = HAL_MODE_LIBVPU;
|
hal_cfg.work_mode = HAL_MODE_LIBVPU;
|
||||||
mpp_env_get_u32("h264d_chg_org", &hal_device_id, 0);
|
mpp_env_get_u32("h264d_chg_org", &hal_device_id, 0);
|
||||||
//if (hal_device_id == 1) {
|
//if (hal_device_id == 1) {
|
||||||
hal_cfg.device_id = HAL_RKVDEC;
|
hal_cfg.device_id = HAL_RKVDEC;
|
||||||
//} else {
|
//} else {
|
||||||
// hal_cfg.device_id = HAL_VDPU;
|
// hal_cfg.device_id = HAL_VDPU;
|
||||||
//}
|
//}
|
||||||
hal_cfg.frame_slots = pApi->frame_slots;
|
hal_cfg.frame_slots = pApi->frame_slots;
|
||||||
hal_cfg.packet_slots = pApi->packet_slots;
|
hal_cfg.packet_slots = pApi->packet_slots;
|
||||||
hal_cfg.task_count = parser_cfg.task_count;
|
hal_cfg.task_count = parser_cfg.task_count;
|
||||||
@@ -129,14 +129,14 @@ __FAILED:
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
RK_U32 end_of_flag = 0;
|
RK_U32 end_of_flag = 0;
|
||||||
RK_S32 frame_slot_idx = 0;
|
RK_S32 frame_slot_idx = 0;
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
MppPacket pkt = NULL;
|
MppPacket pkt = NULL;
|
||||||
MppFrame out_frame = NULL;
|
MppFrame out_frame = NULL;
|
||||||
RK_U32 out_yuv_flag = 0;
|
RK_U32 out_yuv_flag = 0;
|
||||||
MppBuffer dec_pkt_buf = NULL;
|
MppBuffer dec_pkt_buf = NULL;
|
||||||
MppBuffer dec_pic_buf = NULL;
|
MppBuffer dec_pic_buf = NULL;
|
||||||
MppBufferGroup mFrameGroup = NULL;
|
MppBufferGroup mFrameGroup = NULL;
|
||||||
MppBufferGroup mStreamGroup = NULL;
|
MppBufferGroup mStreamGroup = NULL;
|
||||||
|
|
||||||
@@ -163,9 +163,9 @@ int main(int argc, char **argv)
|
|||||||
//if (g_debug_file0 == NULL) {
|
//if (g_debug_file0 == NULL) {
|
||||||
// g_debug_file0 = fopen("rk_debugfile_view0.txt", "wb");
|
// g_debug_file0 = fopen("rk_debugfile_view0.txt", "wb");
|
||||||
//}
|
//}
|
||||||
//if (g_debug_file1 == NULL) {
|
//if (g_debug_file1 == NULL) {
|
||||||
// g_debug_file1 = fopen("rk_debugfile_view1.txt", "wb");
|
// g_debug_file1 = fopen("rk_debugfile_view1.txt", "wb");
|
||||||
//}
|
//}
|
||||||
|
|
||||||
MEM_CHECK(ret, pIn && pApi && task);
|
MEM_CHECK(ret, pIn && pApi && task);
|
||||||
mpp_log("== test start == \n");
|
mpp_log("== test start == \n");
|
||||||
@@ -179,7 +179,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
//!< init decoder
|
//!< init decoder
|
||||||
FUN_CHECK(ret = decoder_init(pApi));
|
FUN_CHECK(ret = decoder_init(pApi));
|
||||||
|
|
||||||
//!< initial task
|
//!< initial task
|
||||||
memset(task, 0, sizeof(HalTaskInfo));
|
memset(task, 0, sizeof(HalTaskInfo));
|
||||||
memset(task->dec.refer, -1, sizeof(task->dec.refer));
|
memset(task->dec.refer, -1, sizeof(task->dec.refer));
|
||||||
@@ -188,16 +188,16 @@ int main(int argc, char **argv)
|
|||||||
do {
|
do {
|
||||||
//!< get one packet
|
//!< get one packet
|
||||||
if (pkt == NULL) {
|
if (pkt == NULL) {
|
||||||
if (pIn->is_eof ||
|
if (pIn->is_eof ||
|
||||||
(pIn->iDecFrmNum && (pIn->iFrmdecoded >= pIn->iDecFrmNum))) {
|
(pIn->iDecFrmNum && (pIn->iFrmdecoded >= pIn->iDecFrmNum))) {
|
||||||
mpp_packet_init(&pkt, NULL, 0);
|
mpp_packet_init(&pkt, NULL, 0);
|
||||||
mpp_packet_set_eos(pkt);
|
mpp_packet_set_eos(pkt);
|
||||||
//FPRINT(g_debug_file0, "[READ_PKT]pIn->iFrmdecoded=%d, strm_pkt_len=%d, is_eof=%d \n", pIn->iFrmdecoded, 0, 1);
|
//FPRINT(g_debug_file0, "[READ_PKT]pIn->iFrmdecoded=%d, strm_pkt_len=%d, is_eof=%d \n", pIn->iFrmdecoded, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
FUN_CHECK(ret = h264d_read_one_frame(pIn));
|
FUN_CHECK(ret = h264d_read_one_frame(pIn));
|
||||||
mpp_packet_init(&pkt, pIn->strm.pbuf, pIn->strm.strmbytes);
|
mpp_packet_init(&pkt, pIn->strm.pbuf, pIn->strm.strmbytes);
|
||||||
//FPRINT(g_debug_file0, "[READ_PKT]pIn->iFrmdecoded=%d, strm_pkt_len=%d, is_eof=%d \n",
|
//FPRINT(g_debug_file0, "[READ_PKT]pIn->iFrmdecoded=%d, strm_pkt_len=%d, is_eof=%d \n",
|
||||||
//pIn->iFrmdecoded, pIn->strm.strmbytes, 0);
|
//pIn->iFrmdecoded, pIn->strm.strmbytes, 0);
|
||||||
}
|
}
|
||||||
mpp_log("---- decoder, read_one_frame Frame_no = %d \n", pIn->iFrmdecoded++);
|
mpp_log("---- decoder, read_one_frame Frame_no = %d \n", pIn->iFrmdecoded++);
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ int main(int argc, char **argv)
|
|||||||
mpp_buf_slot_get_prop(pApi->frame_slots, task->dec.output, SLOT_BUFFER, &dec_pic_buf);
|
mpp_buf_slot_get_prop(pApi->frame_slots, task->dec.output, SLOT_BUFFER, &dec_pic_buf);
|
||||||
if (NULL == dec_pic_buf) {
|
if (NULL == dec_pic_buf) {
|
||||||
RK_U32 size = (RK_U32)mpp_buf_slot_get_size(pApi->frame_slots);
|
RK_U32 size = (RK_U32)mpp_buf_slot_get_size(pApi->frame_slots);
|
||||||
// mpp_err("run hal module, size = %d", size);
|
// mpp_err("run hal module, size = %d", size);
|
||||||
mpp_buffer_get(mFrameGroup, &dec_pic_buf, size);
|
mpp_buffer_get(mFrameGroup, &dec_pic_buf, size);
|
||||||
if (dec_pic_buf)
|
if (dec_pic_buf)
|
||||||
mpp_buf_slot_set_prop(pApi->frame_slots, task->dec.output, SLOT_BUFFER, dec_pic_buf);
|
mpp_buf_slot_set_prop(pApi->frame_slots, task->dec.output, SLOT_BUFFER, dec_pic_buf);
|
||||||
@@ -290,16 +290,16 @@ int main(int argc, char **argv)
|
|||||||
} while (!end_of_flag);
|
} while (!end_of_flag);
|
||||||
|
|
||||||
//FPRINT(g_debug_file1, "[FLUSH] flush begin \n");
|
//FPRINT(g_debug_file1, "[FLUSH] flush begin \n");
|
||||||
//!< flush dpb and send to display
|
//!< flush dpb and send to display
|
||||||
FUN_CHECK(ret = mpp_dec_flush(pApi));
|
FUN_CHECK(ret = mpp_dec_flush(pApi));
|
||||||
while (MPP_OK == mpp_buf_slot_dequeue(pApi->frame_slots, &frame_slot_idx, QUEUE_DISPLAY)) {
|
while (MPP_OK == mpp_buf_slot_dequeue(pApi->frame_slots, &frame_slot_idx, QUEUE_DISPLAY)) {
|
||||||
//mpp_log("get_display for index = %d", frame_slot_idx);
|
//mpp_log("get_display for index = %d", frame_slot_idx);
|
||||||
mpp_buf_slot_get_prop(pApi->frame_slots, frame_slot_idx, SLOT_FRAME, &out_frame);
|
mpp_buf_slot_get_prop(pApi->frame_slots, frame_slot_idx, SLOT_FRAME, &out_frame);
|
||||||
if (out_frame) {
|
if (out_frame) {
|
||||||
mpp_frame_deinit(&out_frame);
|
mpp_frame_deinit(&out_frame);
|
||||||
}
|
}
|
||||||
mpp_buf_slot_clr_flag(pApi->frame_slots, frame_slot_idx, SLOT_QUEUE_USE);
|
mpp_buf_slot_clr_flag(pApi->frame_slots, frame_slot_idx, SLOT_QUEUE_USE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FPRINT(g_debug_file1, "+++++++ all test return +++++++ \n");
|
//FPRINT(g_debug_file1, "+++++++ all test return +++++++ \n");
|
||||||
ret = MPP_OK;
|
ret = MPP_OK;
|
||||||
|
@@ -37,16 +37,16 @@
|
|||||||
|
|
||||||
//!< memory malloc check
|
//!< memory malloc check
|
||||||
#define MEM_CHECK(ret, val, ...)\
|
#define MEM_CHECK(ret, val, ...)\
|
||||||
do{ if(!(val)) {\
|
do{ if(!(val)) {\
|
||||||
ret = MPP_ERR_MALLOC;\
|
ret = MPP_ERR_MALLOC;\
|
||||||
mpp_log("Function:%s:%d, ERROR: malloc buffer.\n", __FUNCTION__, __LINE__);\
|
mpp_log("Function:%s:%d, ERROR: malloc buffer.\n", __FUNCTION__, __LINE__);\
|
||||||
mpp_assert(0); goto __FAILED;\
|
mpp_assert(0); goto __FAILED;\
|
||||||
} } while (0)
|
} } while (0)
|
||||||
//!< function return check
|
//!< function return check
|
||||||
#define FUN_CHECK(val)\
|
#define FUN_CHECK(val)\
|
||||||
do{ if((val) < 0) {\
|
do{ if((val) < 0) {\
|
||||||
goto __FAILED;\
|
goto __FAILED;\
|
||||||
} } while (0)
|
} } while (0)
|
||||||
|
|
||||||
|
|
||||||
static MPP_RET vp9_decoder_deinit(MppDec *pApi)
|
static MPP_RET vp9_decoder_deinit(MppDec *pApi)
|
||||||
|
Reference in New Issue
Block a user