mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-16 22:21:11 +08:00
[astyle]: format code
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@297 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -186,11 +186,11 @@ MPP_RET dummy_dec_prepare(void *dec, MppPacket pkt, HalDecTask *task)
|
|||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
MPP_RET dummy_dec_parse(void *dec, HalDecTask *task)
|
MPP_RET dummy_dec_parse(void *dec, HalDecTask *task)
|
||||||
{
|
{
|
||||||
(void)dec;
|
(void)dec;
|
||||||
(void)task;
|
(void)task;
|
||||||
|
|
||||||
return MPP_OK;
|
return MPP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ParserApi dummy_dec_parser = {
|
const ParserApi dummy_dec_parser = {
|
||||||
|
@@ -506,26 +506,26 @@ __RETURN:
|
|||||||
*/
|
*/
|
||||||
MPP_RET h264d_prepare(void *decoder, MppPacket in_pkt, HalDecTask *in_task)
|
MPP_RET h264d_prepare(void *decoder, MppPacket in_pkt, HalDecTask *in_task)
|
||||||
{
|
{
|
||||||
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;
|
||||||
MppPacketImpl *pkt = (MppPacketImpl *)in_pkt;
|
MppPacketImpl *pkt = (MppPacketImpl *)in_pkt;
|
||||||
|
|
||||||
INP_CHECK(ret, ctx, !decoder && !in_pkt && !in_task);
|
INP_CHECK(ret, ctx, !decoder && !in_pkt && !in_task);
|
||||||
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
p_Dec->p_Inp->in_buf = (RK_U8 *)pkt->pos;
|
p_Dec->p_Inp->in_buf = (RK_U8 *)pkt->pos;
|
||||||
p_Dec->p_Inp->in_size = &pkt->size;
|
p_Dec->p_Inp->in_size = &pkt->size;
|
||||||
p_Dec->p_Inp->is_eos = pkt->flag & MPP_PACKET_FLAG_EOS;
|
p_Dec->p_Inp->is_eos = pkt->flag & MPP_PACKET_FLAG_EOS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
FunctionOut(p_Dec->logctx.parr[RUN_PARSE]);
|
||||||
__RETURN:
|
__RETURN:
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
//__FAILED:
|
//__FAILED:
|
||||||
// return ret;
|
// return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1650,9 +1650,9 @@ MPP_RET exit_picture(H264dVideoCtx_t *p_Vid, H264_StorePic_t **dec_picture)
|
|||||||
set_curframe_poc((*dec_picture), &p_Vid->p_Dec->regs);
|
set_curframe_poc((*dec_picture), &p_Vid->p_Dec->regs);
|
||||||
#endif
|
#endif
|
||||||
FUN_CHECK(ret = store_picture_in_dpb(p_Vid->p_Dpb_layer[(*dec_picture)->layer_id], *dec_picture));
|
FUN_CHECK(ret = store_picture_in_dpb(p_Vid->p_Dpb_layer[(*dec_picture)->layer_id], *dec_picture));
|
||||||
FPRINT(g_debug_file1, "decoder ending, g_framecnt=%d \n", p_Vid->g_framecnt);
|
FPRINT(g_debug_file1, "decoder ending, g_framecnt=%d \n", p_Vid->g_framecnt);
|
||||||
|
|
||||||
mpp_log("decoder ending, g_framecnt=%d \n", p_Vid->g_framecnt++);
|
mpp_log("decoder ending, g_framecnt=%d \n", p_Vid->g_framecnt++);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -85,8 +85,8 @@ static MPP_RET fill_stream_data(H264dDxvaCtx_t *dxva_ctx, H264_Nalu_t *p_nal)
|
|||||||
p_long->wBadSliceChopping = 0; //!< set to 0 in Rock-Chip RKVDEC IP
|
p_long->wBadSliceChopping = 0; //!< set to 0 in Rock-Chip RKVDEC IP
|
||||||
memcpy(&dxva_ctx->bitstream[dxva_ctx->strm_offset], start_code, sizeof(start_code));
|
memcpy(&dxva_ctx->bitstream[dxva_ctx->strm_offset], start_code, sizeof(start_code));
|
||||||
dxva_ctx->strm_offset += sizeof(start_code);
|
dxva_ctx->strm_offset += sizeof(start_code);
|
||||||
memcpy(&dxva_ctx->bitstream[dxva_ctx->strm_offset], p_nal->sodb_buf, p_nal->sodb_len);
|
memcpy(&dxva_ctx->bitstream[dxva_ctx->strm_offset], p_nal->sodb_buf, p_nal->sodb_len);
|
||||||
dxva_ctx->strm_offset += p_nal->sodb_len;
|
dxva_ctx->strm_offset += p_nal->sodb_len;
|
||||||
p_long->SliceBytesInBuffer = dxva_ctx->strm_offset - p_long->BSNALunitDataLocation;
|
p_long->SliceBytesInBuffer = dxva_ctx->strm_offset - p_long->BSNALunitDataLocation;
|
||||||
|
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
|
@@ -384,7 +384,7 @@ static void malloc_dpb_memory_index(H264dVideoCtx_t *p_Vid, RK_S32 structure, RK
|
|||||||
{
|
{
|
||||||
RK_U8 idx = 1;
|
RK_U8 idx = 1;
|
||||||
H264_DpbMark_t *pmem_dpb = p_Vid->p_Dec->dpb_mark;
|
H264_DpbMark_t *pmem_dpb = p_Vid->p_Dec->dpb_mark;
|
||||||
//!< malloc
|
//!< malloc
|
||||||
if (!combine_flag) {
|
if (!combine_flag) {
|
||||||
while (pmem_dpb[idx].top_used || pmem_dpb[idx].bot_used) {
|
while (pmem_dpb[idx].top_used || pmem_dpb[idx].bot_used) {
|
||||||
idx++;
|
idx++;
|
||||||
@@ -569,7 +569,7 @@ static void update_pic_num(H264_SLICE_t *currSlice)
|
|||||||
static MPP_RET init_picture_decoding(H264dVideoCtx_t *p_Vid, H264_SLICE_t *pSlice)
|
static MPP_RET init_picture_decoding(H264dVideoCtx_t *p_Vid, H264_SLICE_t *pSlice)
|
||||||
{
|
{
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
//!< MVC idr_flag==1
|
//!< MVC idr_flag==1
|
||||||
if (pSlice->layer_id && !pSlice->svc_extension_flag && !pSlice->mvcExt.non_idr_flag) {
|
if (pSlice->layer_id && !pSlice->svc_extension_flag && !pSlice->mvcExt.non_idr_flag) {
|
||||||
ASSERT(pSlice->layer_id == 1);
|
ASSERT(pSlice->layer_id == 1);
|
||||||
FUN_CHECK(ret = idr_memory_management(p_Vid->p_Dpb_layer[pSlice->layer_id], p_Vid->dec_picture));
|
FUN_CHECK(ret = idr_memory_management(p_Vid->p_Dpb_layer[pSlice->layer_id], p_Vid->dec_picture));
|
||||||
|
@@ -45,8 +45,8 @@ static void reset_slice(H264dVideoCtx_t *p_Vid)
|
|||||||
currSlice->p_Cur = p_Vid->p_Cur;
|
currSlice->p_Cur = p_Vid->p_Cur;
|
||||||
currSlice->p_Inp = p_Vid->p_Inp;
|
currSlice->p_Inp = p_Vid->p_Inp;
|
||||||
currSlice->logctx = &p_Vid->p_Dec->logctx;
|
currSlice->logctx = &p_Vid->p_Dec->logctx;
|
||||||
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;
|
||||||
//--- reset listP listB
|
//--- reset listP listB
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
currSlice->listP[i] = p_Vid->p_Cur->listP[i];
|
currSlice->listP[i] = p_Vid->p_Cur->listP[i];
|
||||||
@@ -137,7 +137,7 @@ static MPP_RET read_nalu(H264_SLICE_t *currSlice)
|
|||||||
p_Cur->strm.endcode_found = (p_Inp->is_eos && p_Cur->nalu.sodb_len) ? 1 : p_Cur->strm.endcode_found;
|
p_Cur->strm.endcode_found = (p_Inp->is_eos && p_Cur->nalu.sodb_len) ? 1 : p_Cur->strm.endcode_found;
|
||||||
p_Dec->nalu_ret = p_Inp->is_eos ? (p_Cur->nalu.sodb_len ? EndOfNalu : EndofStream) : HaveNoStream;
|
p_Dec->nalu_ret = p_Inp->is_eos ? (p_Cur->nalu.sodb_len ? EndOfNalu : EndofStream) : HaveNoStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionIn(logctx->parr[RUN_PARSE]);
|
FunctionIn(logctx->parr[RUN_PARSE]);
|
||||||
|
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
@@ -157,7 +157,7 @@ static MPP_RET parser_nalu_header(H264_SLICE_t *currSlice)
|
|||||||
|
|
||||||
FunctionIn(logctx->parr[RUN_PARSE]);
|
FunctionIn(logctx->parr[RUN_PARSE]);
|
||||||
set_bitread_ctx(p_bitctx, cur_nal->sodb_buf, cur_nal->sodb_len);
|
set_bitread_ctx(p_bitctx, cur_nal->sodb_buf, cur_nal->sodb_len);
|
||||||
g_strm_bytes += p_Cur->nalu.sodb_len;
|
g_strm_bytes += p_Cur->nalu.sodb_len;
|
||||||
set_bitread_logctx(p_bitctx, logctx->parr[LOG_READ_NALU]);
|
set_bitread_logctx(p_bitctx, logctx->parr[LOG_READ_NALU]);
|
||||||
WRITE_LOG(p_bitctx, "================== NAL begin ===================");
|
WRITE_LOG(p_bitctx, "================== NAL begin ===================");
|
||||||
READ_BITS(ret, p_bitctx, 1, &cur_nal->forbidden_bit, "forbidden_bit");
|
READ_BITS(ret, p_bitctx, 1, &cur_nal->forbidden_bit, "forbidden_bit");
|
||||||
@@ -167,11 +167,11 @@ static MPP_RET parser_nalu_header(H264_SLICE_t *currSlice)
|
|||||||
if (g_nalu_cnt == 344) {
|
if (g_nalu_cnt == 344) {
|
||||||
g_nalu_cnt = g_nalu_cnt;
|
g_nalu_cnt = g_nalu_cnt;
|
||||||
}
|
}
|
||||||
//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");
|
||||||
//}
|
//}
|
||||||
//FPRINT(g_debug_file1, "g_nalu_cnt = %d, nal_unit_type = %d, nalu_size = %d\n", g_nalu_cnt++, cur_nal->nal_unit_type, cur_nal->sodb_len);
|
//FPRINT(g_debug_file1, "g_nalu_cnt = %d, nal_unit_type = %d, nalu_size = %d\n", g_nalu_cnt++, cur_nal->nal_unit_type, cur_nal->sodb_len);
|
||||||
|
|
||||||
|
|
||||||
cur_nal->ualu_header_bytes = 1;
|
cur_nal->ualu_header_bytes = 1;
|
||||||
@@ -206,7 +206,7 @@ static MPP_RET parser_nalu_header(H264_SLICE_t *currSlice)
|
|||||||
}
|
}
|
||||||
set_bitread_ctx(p_bitctx, (cur_nal->sodb_buf + cur_nal->ualu_header_bytes), (cur_nal->sodb_len - cur_nal->ualu_header_bytes)); // reset
|
set_bitread_ctx(p_bitctx, (cur_nal->sodb_buf + cur_nal->ualu_header_bytes), (cur_nal->sodb_len - cur_nal->ualu_header_bytes)); // reset
|
||||||
|
|
||||||
FunctionOut(logctx->parr[RUN_PARSE]);
|
FunctionOut(logctx->parr[RUN_PARSE]);
|
||||||
|
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
__FAILED:
|
__FAILED:
|
||||||
|
@@ -435,108 +435,107 @@ MPP_RET process_slice(H264_SLICE_t *currSlice)
|
|||||||
WRITE_LOG(p_bitctx, "----------------------------- SLICE begin --------------------------------");
|
WRITE_LOG(p_bitctx, "----------------------------- SLICE begin --------------------------------");
|
||||||
//!< read slice head syntax
|
//!< read slice head syntax
|
||||||
READ_UE(ret, p_bitctx, &currSlice->start_mb_nr, "first_mb_in_slice");
|
READ_UE(ret, p_bitctx, &currSlice->start_mb_nr, "first_mb_in_slice");
|
||||||
//FPRINT(g_debug_file1, "first_mb_in_slice = %d \n", currSlice->start_mb_nr);
|
//FPRINT(g_debug_file1, "first_mb_in_slice = %d \n", currSlice->start_mb_nr);
|
||||||
if (currSlice->start_mb_nr == 0/*is_new_picture(currSlice)*/) {
|
if (currSlice->start_mb_nr == 0/*is_new_picture(currSlice)*/) {
|
||||||
READ_UE(ret, p_bitctx, &temp, "slice_type");
|
READ_UE(ret, p_bitctx, &temp, "slice_type");
|
||||||
p_Vid->slice_type = currSlice->slice_type = temp % 5;
|
p_Vid->slice_type = currSlice->slice_type = temp % 5;
|
||||||
READ_UE(ret, p_bitctx, &currSlice->pic_parameter_set_id, "slice_pic_parameter_set_id");
|
READ_UE(ret, p_bitctx, &currSlice->pic_parameter_set_id, "slice_pic_parameter_set_id");
|
||||||
init_slice_parmeters(currSlice);
|
init_slice_parmeters(currSlice);
|
||||||
FUN_CHECK(ret = set_slice_user_parmeters(currSlice));
|
FUN_CHECK(ret = set_slice_user_parmeters(currSlice));
|
||||||
//!< read rest slice header syntax
|
//!< read rest slice header syntax
|
||||||
READ_BITS(ret, p_bitctx, currSlice->active_sps->log2_max_frame_num_minus4 + 4, &currSlice->frame_num, "frame_num");
|
READ_BITS(ret, p_bitctx, currSlice->active_sps->log2_max_frame_num_minus4 + 4, &currSlice->frame_num, "frame_num");
|
||||||
if (currSlice->active_sps->frame_mbs_only_flag) { //!< user in_slice info
|
if (currSlice->active_sps->frame_mbs_only_flag) { //!< user in_slice info
|
||||||
p_Vid->structure = FRAME;
|
p_Vid->structure = FRAME;
|
||||||
currSlice->field_pic_flag = 0;
|
currSlice->field_pic_flag = 0;
|
||||||
currSlice->bottom_field_flag = 0;
|
currSlice->bottom_field_flag = 0;
|
||||||
} else {
|
} else {
|
||||||
READ_ONEBIT(ret, p_bitctx, &currSlice->field_pic_flag, "field_pic_flag");
|
READ_ONEBIT(ret, p_bitctx, &currSlice->field_pic_flag, "field_pic_flag");
|
||||||
if (currSlice->field_pic_flag) {
|
if (currSlice->field_pic_flag) {
|
||||||
READ_ONEBIT(ret, p_bitctx, &currSlice->bottom_field_flag, "field_pic_flag");
|
READ_ONEBIT(ret, p_bitctx, &currSlice->bottom_field_flag, "field_pic_flag");
|
||||||
p_Vid->structure = currSlice->bottom_field_flag ? BOTTOM_FIELD : TOP_FIELD;
|
p_Vid->structure = currSlice->bottom_field_flag ? BOTTOM_FIELD : TOP_FIELD;
|
||||||
} else {
|
} else {
|
||||||
p_Vid->structure = FRAME;
|
p_Vid->structure = FRAME;
|
||||||
currSlice->bottom_field_flag = 0;
|
currSlice->bottom_field_flag = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currSlice->structure = p_Vid->structure;
|
currSlice->structure = p_Vid->structure;
|
||||||
currSlice->mb_aff_frame_flag = (currSlice->active_sps->mb_adaptive_frame_field_flag && (currSlice->field_pic_flag == 0));
|
currSlice->mb_aff_frame_flag = (currSlice->active_sps->mb_adaptive_frame_field_flag && (currSlice->field_pic_flag == 0));
|
||||||
if (currSlice->idr_flag) {
|
if (currSlice->idr_flag) {
|
||||||
READ_UE(ret, p_bitctx, &currSlice->idr_pic_id, "idr_pic_id");
|
READ_UE(ret, p_bitctx, &currSlice->idr_pic_id, "idr_pic_id");
|
||||||
} else if (currSlice->svc_extension_flag == 0 && currSlice->mvcExt.non_idr_flag == 0) {
|
} else if (currSlice->svc_extension_flag == 0 && currSlice->mvcExt.non_idr_flag == 0) {
|
||||||
READ_UE(ret, p_bitctx, &currSlice->idr_pic_id, "idr_pic_id");
|
READ_UE(ret, p_bitctx, &currSlice->idr_pic_id, "idr_pic_id");
|
||||||
}
|
}
|
||||||
if (currSlice->active_sps->pic_order_cnt_type == 0) {
|
if (currSlice->active_sps->pic_order_cnt_type == 0) {
|
||||||
READ_BITS(ret, p_bitctx, currSlice->active_sps->log2_max_pic_order_cnt_lsb_minus4 + 4, &currSlice->pic_order_cnt_lsb, "pic_order_cnt_lsb");
|
READ_BITS(ret, p_bitctx, currSlice->active_sps->log2_max_pic_order_cnt_lsb_minus4 + 4, &currSlice->pic_order_cnt_lsb, "pic_order_cnt_lsb");
|
||||||
if (currSlice->p_Vid->active_pps->bottom_field_pic_order_in_frame_present_flag == 1
|
if (currSlice->p_Vid->active_pps->bottom_field_pic_order_in_frame_present_flag == 1
|
||||||
&& !currSlice->field_pic_flag) {
|
&& !currSlice->field_pic_flag) {
|
||||||
READ_SE(ret, p_bitctx, &currSlice->delta_pic_order_cnt_bottom, "delta_pic_order_cnt_bottom");
|
READ_SE(ret, p_bitctx, &currSlice->delta_pic_order_cnt_bottom, "delta_pic_order_cnt_bottom");
|
||||||
} else {
|
} else {
|
||||||
currSlice->delta_pic_order_cnt_bottom = 0;
|
currSlice->delta_pic_order_cnt_bottom = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currSlice->active_sps->pic_order_cnt_type == 1) {
|
if (currSlice->active_sps->pic_order_cnt_type == 1) {
|
||||||
if (!currSlice->active_sps->delta_pic_order_always_zero_flag) {
|
if (!currSlice->active_sps->delta_pic_order_always_zero_flag) {
|
||||||
READ_SE(ret, p_bitctx, &currSlice->delta_pic_order_cnt[0], "delta_pic_order_cnt[0]");
|
READ_SE(ret, p_bitctx, &currSlice->delta_pic_order_cnt[0], "delta_pic_order_cnt[0]");
|
||||||
|
|
||||||
if (currSlice->p_Vid->active_pps->bottom_field_pic_order_in_frame_present_flag == 1 && !currSlice->field_pic_flag) {
|
if (currSlice->p_Vid->active_pps->bottom_field_pic_order_in_frame_present_flag == 1 && !currSlice->field_pic_flag) {
|
||||||
READ_SE(ret, p_bitctx, &currSlice->delta_pic_order_cnt[1], "delta_pic_order_cnt[1]");
|
READ_SE(ret, p_bitctx, &currSlice->delta_pic_order_cnt[1], "delta_pic_order_cnt[1]");
|
||||||
} else {
|
} else {
|
||||||
currSlice->delta_pic_order_cnt[1] = 0; // set to zero if not in stream
|
currSlice->delta_pic_order_cnt[1] = 0; // set to zero if not in stream
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currSlice->delta_pic_order_cnt[0] = 0;
|
currSlice->delta_pic_order_cnt[0] = 0;
|
||||||
currSlice->delta_pic_order_cnt[1] = 0;
|
currSlice->delta_pic_order_cnt[1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//!< redundant_pic_cnt is missing here
|
//!< redundant_pic_cnt is missing here
|
||||||
ASSERT(currSlice->p_Vid->active_pps->redundant_pic_cnt_present_flag == 0); // add by dw, high 4:2:2 profile not support
|
ASSERT(currSlice->p_Vid->active_pps->redundant_pic_cnt_present_flag == 0); // add by dw, high 4:2:2 profile not support
|
||||||
if (currSlice->p_Vid->active_pps->redundant_pic_cnt_present_flag) {
|
if (currSlice->p_Vid->active_pps->redundant_pic_cnt_present_flag) {
|
||||||
READ_UE(ret, p_bitctx, &currSlice->redundant_pic_cnt, "redundant_pic_cnt");
|
READ_UE(ret, p_bitctx, &currSlice->redundant_pic_cnt, "redundant_pic_cnt");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currSlice->slice_type == B_SLICE) {
|
if (currSlice->slice_type == B_SLICE) {
|
||||||
READ_ONEBIT(ret, p_bitctx, &currSlice->direct_spatial_mv_pred_flag, "direct_spatial_mv_pred_flag");
|
READ_ONEBIT(ret, p_bitctx, &currSlice->direct_spatial_mv_pred_flag, "direct_spatial_mv_pred_flag");
|
||||||
} else {
|
} else {
|
||||||
currSlice->direct_spatial_mv_pred_flag = 0;
|
currSlice->direct_spatial_mv_pred_flag = 0;
|
||||||
}
|
}
|
||||||
currSlice->num_ref_idx_active[LIST_0] = currSlice->p_Vid->active_pps->num_ref_idx_l0_default_active_minus1 + 1;
|
currSlice->num_ref_idx_active[LIST_0] = currSlice->p_Vid->active_pps->num_ref_idx_l0_default_active_minus1 + 1;
|
||||||
currSlice->num_ref_idx_active[LIST_1] = currSlice->p_Vid->active_pps->num_ref_idx_l1_default_active_minus1 + 1;
|
currSlice->num_ref_idx_active[LIST_1] = currSlice->p_Vid->active_pps->num_ref_idx_l1_default_active_minus1 + 1;
|
||||||
|
|
||||||
if (currSlice->slice_type == P_SLICE
|
if (currSlice->slice_type == P_SLICE
|
||||||
|| currSlice->slice_type == SP_SLICE || currSlice->slice_type == B_SLICE) {
|
|| currSlice->slice_type == SP_SLICE || currSlice->slice_type == B_SLICE) {
|
||||||
//!< direct_spatial_mv_pred_flag
|
//!< direct_spatial_mv_pred_flag
|
||||||
READ_ONEBIT(ret, p_bitctx, &currSlice->num_ref_idx_override_flag, "num_ref_idx_override_flag");
|
READ_ONEBIT(ret, p_bitctx, &currSlice->num_ref_idx_override_flag, "num_ref_idx_override_flag");
|
||||||
if (currSlice->num_ref_idx_override_flag) {
|
if (currSlice->num_ref_idx_override_flag) {
|
||||||
READ_UE(ret, p_bitctx, &currSlice->num_ref_idx_active[LIST_0], "num_ref_idx_active0");
|
READ_UE(ret, p_bitctx, &currSlice->num_ref_idx_active[LIST_0], "num_ref_idx_active0");
|
||||||
currSlice->num_ref_idx_active[LIST_0] += 1;
|
currSlice->num_ref_idx_active[LIST_0] += 1;
|
||||||
if (currSlice->slice_type == B_SLICE) {
|
if (currSlice->slice_type == B_SLICE) {
|
||||||
READ_UE(ret, p_bitctx, &currSlice->num_ref_idx_active[LIST_1], "num_ref_idx_active1");
|
READ_UE(ret, p_bitctx, &currSlice->num_ref_idx_active[LIST_1], "num_ref_idx_active1");
|
||||||
currSlice->num_ref_idx_active[LIST_1] += 1;
|
currSlice->num_ref_idx_active[LIST_1] += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currSlice->slice_type != B_SLICE) {
|
if (currSlice->slice_type != B_SLICE) {
|
||||||
currSlice->num_ref_idx_active[LIST_1] = 0;
|
currSlice->num_ref_idx_active[LIST_1] = 0;
|
||||||
}
|
}
|
||||||
//!<----------------------------
|
//!<----------------------------
|
||||||
|
|
||||||
//FPRINT(g_debug_file1, "--- new frame ---- \n");
|
//FPRINT(g_debug_file1, "--- new frame ---- \n");
|
||||||
FUN_CHECK(ret = ref_pic_list_mvc_modification(currSlice));
|
FUN_CHECK(ret = ref_pic_list_mvc_modification(currSlice));
|
||||||
if ((currSlice->p_Vid->active_pps->weighted_pred_flag
|
if ((currSlice->p_Vid->active_pps->weighted_pred_flag
|
||||||
&& (currSlice->slice_type == P_SLICE || currSlice->slice_type == SP_SLICE))
|
&& (currSlice->slice_type == P_SLICE || currSlice->slice_type == SP_SLICE))
|
||||||
|| (currSlice->p_Vid->active_pps->weighted_bipred_idc == 1 && (currSlice->slice_type == B_SLICE))) {
|
|| (currSlice->p_Vid->active_pps->weighted_bipred_idc == 1 && (currSlice->slice_type == B_SLICE))) {
|
||||||
FUN_CHECK(ret = pred_weight_table(currSlice));
|
FUN_CHECK(ret = pred_weight_table(currSlice));
|
||||||
}
|
}
|
||||||
if (currSlice->nal_reference_idc) {
|
if (currSlice->nal_reference_idc) {
|
||||||
FUN_CHECK(ret = dec_ref_pic_marking(currSlice));
|
FUN_CHECK(ret = dec_ref_pic_marking(currSlice));
|
||||||
}
|
}
|
||||||
if (g_max_bytes < (p_bitctx->used_bits>>3))
|
if (g_max_bytes < (p_bitctx->used_bits >> 3)) {
|
||||||
{
|
g_max_bytes = (p_bitctx->used_bits >> 3);
|
||||||
g_max_bytes = (p_bitctx->used_bits>>3);
|
}
|
||||||
}
|
currSlice->is_new_picture_flag = 1;
|
||||||
currSlice->is_new_picture_flag = 1;
|
}
|
||||||
}
|
|
||||||
FunctionOut(logctx->parr[RUN_PARSE]);
|
FunctionOut(logctx->parr[RUN_PARSE]);
|
||||||
|
|
||||||
return ret = MPP_OK;
|
return ret = MPP_OK;
|
||||||
|
@@ -626,7 +626,7 @@ static RK_S32 hls_slice_header(HEVCContext *s)
|
|||||||
SliceHeader *sh = &s->sh;
|
SliceHeader *sh = &s->sh;
|
||||||
RK_S32 i, ret;
|
RK_S32 i, ret;
|
||||||
RK_S32 value, pps_id;
|
RK_S32 value, pps_id;
|
||||||
RK_S32 bit_begin;
|
RK_S32 bit_begin;
|
||||||
|
|
||||||
#ifdef JCTVC_M0458_INTERLAYER_RPS_SIG
|
#ifdef JCTVC_M0458_INTERLAYER_RPS_SIG
|
||||||
int NumILRRefIdx;
|
int NumILRRefIdx;
|
||||||
|
@@ -1633,8 +1633,8 @@ RK_S32 mpp_hevc_decode_nal_sps(HEVCContext *s)
|
|||||||
READ_BIT1(gb, &sps->set_mfm_enabled_flag);
|
READ_BIT1(gb, &sps->set_mfm_enabled_flag);
|
||||||
#endif
|
#endif
|
||||||
READ_BIT1(gb, &sps->sps_strong_intra_smoothing_enable_flag);
|
READ_BIT1(gb, &sps->sps_strong_intra_smoothing_enable_flag);
|
||||||
sps->vui.sar.num = 0;
|
sps->vui.sar.num = 0;
|
||||||
sps->vui.sar.den = 1;
|
sps->vui.sar.den = 1;
|
||||||
READ_BIT1(gb, &vui_present);
|
READ_BIT1(gb, &vui_present);
|
||||||
if (vui_present)
|
if (vui_present)
|
||||||
decode_vui(s, sps);
|
decode_vui(s, sps);
|
||||||
|
@@ -210,11 +210,11 @@ static HEVCFrame *find_ref_idx(HEVCContext *s, int poc)
|
|||||||
|
|
||||||
int mpp_hevc_slice_rpl(HEVCContext *s)
|
int mpp_hevc_slice_rpl(HEVCContext *s)
|
||||||
{
|
{
|
||||||
RK_U8 list_idx;
|
RK_U8 list_idx;
|
||||||
RK_U32 i;
|
RK_U32 i;
|
||||||
RK_S32 j, ret;
|
RK_S32 j, ret;
|
||||||
RefPicList *rpl = NULL;
|
RefPicList *rpl = NULL;
|
||||||
RK_S32 cand_lists[3];
|
RK_S32 cand_lists[3];
|
||||||
|
|
||||||
SliceHeader *sh = &s->sh;
|
SliceHeader *sh = &s->sh;
|
||||||
RK_U8 nb_list = sh->slice_type == B_SLICE ? 2 : 1;
|
RK_U8 nb_list = sh->slice_type == B_SLICE ? 2 : 1;
|
||||||
@@ -238,8 +238,8 @@ int mpp_hevc_slice_rpl(HEVCContext *s)
|
|||||||
* ST_CURR_BEF - ST_CURR_AFT - LT_CURR for the L0 and
|
* ST_CURR_BEF - ST_CURR_AFT - LT_CURR for the L0 and
|
||||||
* ST_CURR_AFT - ST_CURR_BEF - LT_CURR for the L1 */
|
* ST_CURR_AFT - ST_CURR_BEF - LT_CURR for the L1 */
|
||||||
cand_lists[0] = list_idx ? ST_CURR_AFT : ST_CURR_BEF;
|
cand_lists[0] = list_idx ? ST_CURR_AFT : ST_CURR_BEF;
|
||||||
cand_lists[1] = list_idx ? ST_CURR_BEF : ST_CURR_AFT;
|
cand_lists[1] = list_idx ? ST_CURR_BEF : ST_CURR_AFT;
|
||||||
cand_lists[2] = LT_CURR;
|
cand_lists[2] = LT_CURR;
|
||||||
/* concatenate the candidate lists for the current frame */
|
/* concatenate the candidate lists for the current frame */
|
||||||
while ((RK_U32)rpl_tmp.nb_refs < sh->nb_refs[list_idx]) {
|
while ((RK_U32)rpl_tmp.nb_refs < sh->nb_refs[list_idx]) {
|
||||||
for (i = 0; i < MPP_ARRAY_ELEMS(cand_lists); i++) {
|
for (i = 0; i < MPP_ARRAY_ELEMS(cand_lists); i++) {
|
||||||
|
@@ -98,7 +98,7 @@ static RK_S32 show_help()
|
|||||||
RK_U32 i = 0;
|
RK_U32 i = 0;
|
||||||
RK_U32 n = sizeof(parserCmd) / sizeof(ParserCmd_t);
|
RK_U32 n = sizeof(parserCmd) / sizeof(ParserCmd_t);
|
||||||
|
|
||||||
mpp_log("usage: parserDemo [options] input_file, \n\n");
|
mpp_log("usage: parserDemo [options] input_file, \n\n");
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
mpp_log("-%s %s\t\t%s\n",
|
mpp_log("-%s %s\t\t%s\n",
|
||||||
parserCmd[i].name, parserCmd[i].argname, parserCmd[i].help);
|
parserCmd[i].name, parserCmd[i].argname, parserCmd[i].help);
|
||||||
@@ -367,7 +367,7 @@ RK_S32 hevc_parser_test(ParserDemoCmdContext_t *cmd)
|
|||||||
RK_U8 *tmpbuf = buf;
|
RK_U8 *tmpbuf = buf;
|
||||||
RK_U8 *pos = NULL;
|
RK_U8 *pos = NULL;
|
||||||
|
|
||||||
nal_len = get_next_nal(pInFile, buf);
|
nal_len = get_next_nal(pInFile, buf);
|
||||||
mpp_err("get nal len from file %d", nal_len);
|
mpp_err("get nal len from file %d", nal_len);
|
||||||
do {
|
do {
|
||||||
mpp_packet_init(&rkpkt, tmpbuf, nal_len);
|
mpp_packet_init(&rkpkt, tmpbuf, nal_len);
|
||||||
@@ -432,7 +432,7 @@ RK_S32 hevc_parser_test(ParserDemoCmdContext_t *cmd)
|
|||||||
#if 1//def DUMP
|
#if 1//def DUMP
|
||||||
RK_U32 stride_w, stride_h;
|
RK_U32 stride_w, stride_h;
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
MppBuffer framebuf;
|
MppBuffer framebuf;
|
||||||
stride_w = mpp_frame_get_hor_stride(frame);
|
stride_w = mpp_frame_get_hor_stride(frame);
|
||||||
stride_h = mpp_frame_get_ver_stride(frame);
|
stride_h = mpp_frame_get_ver_stride(frame);
|
||||||
framebuf = mpp_frame_get_buffer(frame);
|
framebuf = mpp_frame_get_buffer(frame);
|
||||||
@@ -495,9 +495,9 @@ RK_S32 hevc_parser_test(ParserDemoCmdContext_t *cmd)
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
RK_S32 ret = 0;
|
RK_S32 ret = 0;
|
||||||
ParserDemoCmdContext_t demoCmdCtx;
|
ParserDemoCmdContext_t demoCmdCtx;
|
||||||
ParserDemoCmdContext_t* cmd = NULL;
|
ParserDemoCmdContext_t* cmd = NULL;
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
show_usage();
|
show_usage();
|
||||||
|
@@ -211,7 +211,7 @@ static void slot_ops_with_log(mpp_list *logs, MppBufSlotEntry *slot, MppBufSlotO
|
|||||||
mpp_err("found invalid operation code %d\n", op);
|
mpp_err("found invalid operation code %d\n", op);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
mpp_assert((RK_S16)(status&MPP_SLOT_HW_REF_MASK) >= 0);
|
mpp_assert((RK_S16)(status & MPP_SLOT_HW_REF_MASK) >= 0);
|
||||||
slot->status = status;
|
slot->status = status;
|
||||||
buf_slot_dbg(BUF_SLOT_DBG_OPS_RUNTIME, "index %2d op: %s status in %08x out %08x",
|
buf_slot_dbg(BUF_SLOT_DBG_OPS_RUNTIME, "index %2d op: %s status in %08x out %08x",
|
||||||
index, op_string[op], before, status);
|
index, op_string[op], before, status);
|
||||||
|
@@ -116,7 +116,7 @@ void *mpp_dec_parser_thread(void *data)
|
|||||||
task_ready = task_dec->valid;
|
task_ready = task_dec->valid;
|
||||||
if (!task_ready)
|
if (!task_ready)
|
||||||
continue;
|
continue;
|
||||||
parser_parse(dec->parser, task_dec);
|
parser_parse(dec->parser, task_dec);
|
||||||
/*
|
/*
|
||||||
* 4. parse local task and slot to check whether new buffer or info change is needed.
|
* 4. parse local task and slot to check whether new buffer or info change is needed.
|
||||||
*
|
*
|
||||||
|
@@ -212,7 +212,7 @@ MPP_RET hal_h264d_gen_regs(void *hal, HalTask *task)
|
|||||||
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
FunctionIn(p_hal->logctx.parr[RUN_HAL]);
|
||||||
|
|
||||||
explain_input_buffer(hal, &task->dec);
|
explain_input_buffer(hal, &task->dec);
|
||||||
prepare_spspps_packet(hal, &p_hal->pkts->spspps);
|
prepare_spspps_packet(hal, &p_hal->pkts->spspps);
|
||||||
prepare_framerps_packet(hal, &p_hal->pkts->rps);
|
prepare_framerps_packet(hal, &p_hal->pkts->rps);
|
||||||
prepare_scanlist_packet(hal, &p_hal->pkts->scanlist);
|
prepare_scanlist_packet(hal, &p_hal->pkts->scanlist);
|
||||||
prepare_stream_packet(hal, &p_hal->pkts->strm);
|
prepare_stream_packet(hal, &p_hal->pkts->strm);
|
||||||
|
@@ -464,28 +464,26 @@ void generate_regs(void *hal, FifoCtx_t *pkt)
|
|||||||
fifo_fwrite_data(pkt); //!< "REGH" header 32 bit
|
fifo_fwrite_data(pkt); //!< "REGH" header 32 bit
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
* \brief
|
* \brief
|
||||||
* for debug
|
* for debug
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
*/
|
*/
|
||||||
void fprint_fifo_data(FILE *fp, FifoCtx_t *pkt)
|
void fprint_fifo_data(FILE *fp, FifoCtx_t *pkt)
|
||||||
{
|
{
|
||||||
RK_U32 i = 0, pkt_size = 0;
|
RK_U32 i = 0, pkt_size = 0;
|
||||||
RK_U8 *ptr = (RK_U8 *)pkt->pbuf;
|
RK_U8 *ptr = (RK_U8 *)pkt->pbuf;
|
||||||
if (fp) {
|
if (fp) {
|
||||||
pkt_size = pkt->index * sizeof(RK_U64);
|
pkt_size = pkt->index * sizeof(RK_U64);
|
||||||
fprintf(fp, "------ Header=%08x, size=%d ------ \n", pkt->header, pkt_size);
|
fprintf(fp, "------ Header=%08x, size=%d ------ \n", pkt->header, pkt_size);
|
||||||
for (i = 0; i < pkt_size;)
|
for (i = 0; i < pkt_size;) {
|
||||||
{
|
fprintf(fp, "0x%02x, ", ptr[i]);
|
||||||
fprintf(fp, "0x%02x, ", ptr[i]);
|
i++;
|
||||||
i++;
|
if ((i % 16) == 0) {
|
||||||
if ((i % 16) == 0)
|
fprintf(fp, "\n");
|
||||||
{
|
}
|
||||||
fprintf(fp, "\n");
|
}
|
||||||
}
|
fprintf(fp, "\n\n");
|
||||||
}
|
}
|
||||||
fprintf(fp, "\n\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -378,9 +378,9 @@ static RK_S32 _count = 0;
|
|||||||
|
|
||||||
static RK_U64 mpp_get_bits(RK_U64 src, RK_S32 size, RK_S32 offset)
|
static RK_U64 mpp_get_bits(RK_U64 src, RK_S32 size, RK_S32 offset)
|
||||||
{
|
{
|
||||||
RK_S32 i;
|
RK_S32 i;
|
||||||
RK_U64 temp = 0;
|
RK_U64 temp = 0;
|
||||||
|
|
||||||
mpp_assert(size + offset <= 64);// 64 is the FIFO_BIT_WIDTH
|
mpp_assert(size + offset <= 64);// 64 is the FIFO_BIT_WIDTH
|
||||||
|
|
||||||
for (i = 0; i < size ; i++) {
|
for (i = 0; i < size ; i++) {
|
||||||
@@ -414,9 +414,9 @@ static void mpp_put_bits(RK_U64 data, RK_S32 size, RK_U64* Dec_Fifo, RK_S32 *p_f
|
|||||||
|
|
||||||
static void mpp_align(RK_S32 align_width, RK_U64* Dec_Fifo, RK_S32 *p_fifo_index, RK_S32 *p_bit_offset, RK_S32 *p_bit_len, RK_S32 fifo_len)
|
static void mpp_align(RK_S32 align_width, RK_U64* Dec_Fifo, RK_S32 *p_fifo_index, RK_S32 *p_bit_offset, RK_S32 *p_bit_len, RK_S32 fifo_len)
|
||||||
{
|
{
|
||||||
RK_S32 i;
|
RK_S32 i;
|
||||||
RK_U64 temp = 0;
|
RK_U64 temp = 0;
|
||||||
RK_S32 len = 0;
|
RK_S32 len = 0;
|
||||||
|
|
||||||
if (*p_fifo_index >= fifo_len) return;
|
if (*p_fifo_index >= fifo_len) return;
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ static void mpp_align(RK_S32 align_width, RK_U64* Dec_Fifo, RK_S32 *p_fifo_index
|
|||||||
|
|
||||||
static void hal_record_scaling_list(scalingFactor_t *pScalingFactor_out, scalingList_t *pScalingList)
|
static void hal_record_scaling_list(scalingFactor_t *pScalingFactor_out, scalingList_t *pScalingList)
|
||||||
{
|
{
|
||||||
RK_S32 i;
|
RK_S32 i;
|
||||||
RK_U32 g_scalingListNum_model[SCALING_LIST_SIZE_NUM] = {6, 6, 6, 2}; // from C Model
|
RK_U32 g_scalingListNum_model[SCALING_LIST_SIZE_NUM] = {6, 6, 6, 2}; // from C Model
|
||||||
RK_U32 nIndex = 0;
|
RK_U32 nIndex = 0;
|
||||||
RK_U32 sizeId, matrixId, listId;
|
RK_U32 sizeId, matrixId, listId;
|
||||||
@@ -580,8 +580,8 @@ static int hal_h265d_slice_rpl(void *dxva, SliceHeader_t *sh, RefPicListTab_t *r
|
|||||||
RK_U8 list_idx;
|
RK_U8 list_idx;
|
||||||
RK_U32 i, j;
|
RK_U32 i, j;
|
||||||
RK_U8 bef_nb_refs = 0, aft_nb_refs = 0, lt_cur_nb_refs = 0;
|
RK_U8 bef_nb_refs = 0, aft_nb_refs = 0, lt_cur_nb_refs = 0;
|
||||||
h265d_dxva2_picture_context_t *dxva_cxt = NULL;
|
h265d_dxva2_picture_context_t *dxva_cxt = NULL;
|
||||||
RK_S32 cand_lists[3];
|
RK_S32 cand_lists[3];
|
||||||
|
|
||||||
memset(ref, 0, sizeof(RefPicListTab_t));
|
memset(ref, 0, sizeof(RefPicListTab_t));
|
||||||
dxva_cxt = (h265d_dxva2_picture_context_t*)dxva;
|
dxva_cxt = (h265d_dxva2_picture_context_t*)dxva;
|
||||||
@@ -614,10 +614,10 @@ static int hal_h265d_slice_rpl(void *dxva, SliceHeader_t *sh, RefPicListTab_t *r
|
|||||||
/* The order of the elements is
|
/* The order of the elements is
|
||||||
* ST_CURR_BEF - ST_CURR_AFT - LT_CURR for the L0 and
|
* ST_CURR_BEF - ST_CURR_AFT - LT_CURR for the L0 and
|
||||||
* ST_CURR_AFT - ST_CURR_BEF - LT_CURR for the L1 */
|
* ST_CURR_AFT - ST_CURR_BEF - LT_CURR for the L1 */
|
||||||
|
|
||||||
cand_lists[0] = list_idx ? ST_CURR_AFT : ST_CURR_BEF;
|
cand_lists[0] = list_idx ? ST_CURR_AFT : ST_CURR_BEF;
|
||||||
cand_lists[1] = list_idx ? ST_CURR_BEF : ST_CURR_AFT;
|
cand_lists[1] = list_idx ? ST_CURR_BEF : ST_CURR_AFT;
|
||||||
cand_lists[2] = LT_CURR;
|
cand_lists[2] = LT_CURR;
|
||||||
/* concatenate the candidate lists for the current frame */
|
/* concatenate the candidate lists for the current frame */
|
||||||
while ((RK_U32)rpl_tmp.nb_refs < sh->nb_refs[list_idx]) {
|
while ((RK_U32)rpl_tmp.nb_refs < sh->nb_refs[list_idx]) {
|
||||||
for (i = 0; i < MPP_ARRAY_ELEMS(cand_lists); i++) {
|
for (i = 0; i < MPP_ARRAY_ELEMS(cand_lists); i++) {
|
||||||
@@ -670,8 +670,8 @@ static RK_S32 hal_h265d_slice_output_rps(void *dxva, void *rps_buf)
|
|||||||
RK_U8 lowdelay_flag[600];
|
RK_U8 lowdelay_flag[600];
|
||||||
slice_ref_map_t rps_pic_info[600][2][15];
|
slice_ref_map_t rps_pic_info[600][2][15];
|
||||||
RK_U32 nb_refs = 0;
|
RK_U32 nb_refs = 0;
|
||||||
RK_S32 bit_begin;
|
RK_S32 bit_begin;
|
||||||
h265d_dxva2_picture_context_t *dxva_cxt = NULL;
|
h265d_dxva2_picture_context_t *dxva_cxt = NULL;
|
||||||
|
|
||||||
memset(&rps_pic_info, 0, sizeof(rps_pic_info));
|
memset(&rps_pic_info, 0, sizeof(rps_pic_info));
|
||||||
memset(&slice_nb_rps_poc, 0, sizeof(slice_nb_rps_poc));
|
memset(&slice_nb_rps_poc, 0, sizeof(slice_nb_rps_poc));
|
||||||
@@ -944,7 +944,7 @@ static RK_S32 hal_h265d_slice_output_rps(void *dxva, void *rps_buf)
|
|||||||
RK_S32 bit_offset = 0;
|
RK_S32 bit_offset = 0;
|
||||||
RK_S32 fifo_len = nb_slice * 4;//size of rps_packet
|
RK_S32 fifo_len = nb_slice * 4;//size of rps_packet
|
||||||
RK_S32 bit_len = 0;
|
RK_S32 bit_len = 0;
|
||||||
RK_U64 *rps_packet = mpp_malloc(RK_U64, fifo_len);
|
RK_U64 *rps_packet = mpp_malloc(RK_U64, fifo_len);
|
||||||
|
|
||||||
for (k = 0; k < (RK_U32)nb_slice; k++) {
|
for (k = 0; k < (RK_U32)nb_slice; k++) {
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
@@ -980,8 +980,8 @@ static RK_S32 hal_h265d_slice_output_rps(void *dxva, void *rps_buf)
|
|||||||
if (rps_buf != NULL) {
|
if (rps_buf != NULL) {
|
||||||
memcpy(rps_buf, rps_packet, nb_slice * 32);
|
memcpy(rps_buf, rps_packet, nb_slice * 32);
|
||||||
}
|
}
|
||||||
mpp_free(rps_packet);
|
mpp_free(rps_packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1023,13 +1023,13 @@ RK_S32 hal_h265d_output_pps_packet(void *hal, void *dxva)
|
|||||||
RK_S32 bit_len = 0;
|
RK_S32 bit_len = 0;
|
||||||
RK_S32 i, j;
|
RK_S32 i, j;
|
||||||
RK_U32 addr;
|
RK_U32 addr;
|
||||||
RK_U64 *pps_packet = NULL;
|
RK_U64 *pps_packet = NULL;
|
||||||
RK_U32 log2_min_cb_size;
|
RK_U32 log2_min_cb_size;
|
||||||
RK_S32 width, height;
|
RK_S32 width, height;
|
||||||
h265d_reg_context_t *reg_cxt = ( h265d_reg_context_t *)hal;
|
h265d_reg_context_t *reg_cxt = ( h265d_reg_context_t *)hal;
|
||||||
h265d_dxva2_picture_context_t *dxva_cxt = (h265d_dxva2_picture_context_t*)dxva;
|
h265d_dxva2_picture_context_t *dxva_cxt = (h265d_dxva2_picture_context_t*)dxva;
|
||||||
|
|
||||||
_count = 0;
|
_count = 0;
|
||||||
if (NULL == reg_cxt || dxva_cxt == NULL) {
|
if (NULL == reg_cxt || dxva_cxt == NULL) {
|
||||||
|
|
||||||
mpp_err("%s:%s:%d reg_cxt or dxva_cxt is NULL", __FILE__, __FUNCTION__, __LINE__);
|
mpp_err("%s:%s:%d reg_cxt or dxva_cxt is NULL", __FILE__, __FUNCTION__, __LINE__);
|
||||||
@@ -1215,7 +1215,7 @@ RK_S32 hal_h265d_output_pps_packet(void *hal, void *dxva)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
RK_U8 *p0, *p1;
|
RK_U8 *p0, *p1;
|
||||||
RK_U8 *ptr_scaling = (RK_U8 *)mpp_buffer_get_ptr(reg_cxt->scaling_list_data);
|
RK_U8 *ptr_scaling = (RK_U8 *)mpp_buffer_get_ptr(reg_cxt->scaling_list_data);
|
||||||
if (dxva_cxt->pp.scaling_list_data_present_flag) {
|
if (dxva_cxt->pp.scaling_list_data_present_flag) {
|
||||||
addr = (dxva_cxt->pp.pps_id + 16) * 1360;
|
addr = (dxva_cxt->pp.pps_id + 16) * 1360;
|
||||||
@@ -1237,9 +1237,9 @@ RK_S32 hal_h265d_output_pps_packet(void *hal, void *dxva)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
mpp_put_bits(0 , 32 , pps_packet, &fifo_index, &bit_offset, &bit_len, fifo_len);
|
mpp_put_bits(0 , 32 , pps_packet, &fifo_index, &bit_offset, &bit_len, fifo_len);
|
||||||
|
|
||||||
p0 = (RK_U8*)&pps_packet[9];
|
p0 = (RK_U8*)&pps_packet[9];
|
||||||
p1 = (RK_U8*)&addr;
|
p1 = (RK_U8*)&addr;
|
||||||
p0[2] = p1[0];
|
p0[2] = p1[0];
|
||||||
p0[3] = p1[1];
|
p0[3] = p1[1];
|
||||||
p0[4] = p1[2];
|
p0[4] = p1[2];
|
||||||
@@ -1252,17 +1252,17 @@ RK_S32 hal_h265d_output_pps_packet(void *hal, void *dxva)
|
|||||||
fwrite(pps_ptr, 1, 80 * 64, fp);
|
fwrite(pps_ptr, 1, 80 * 64, fp);
|
||||||
fflush(fp);
|
fflush(fp);
|
||||||
#endif
|
#endif
|
||||||
mpp_free(pps_packet);
|
mpp_free(pps_packet);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET hal_h265d_gen_regs(void *hal, HalTask *syn)
|
MPP_RET hal_h265d_gen_regs(void *hal, HalTask *syn)
|
||||||
{
|
{
|
||||||
RK_U32 uiMaxCUWidth, uiMaxCUHeight;
|
RK_U32 uiMaxCUWidth, uiMaxCUHeight;
|
||||||
RK_U32 log2_min_cb_size;
|
RK_U32 log2_min_cb_size;
|
||||||
RK_S32 width, height, numCuInWidth;
|
RK_S32 width, height, numCuInWidth;
|
||||||
RK_S32 stride_y, stride_uv, virstrid_y, virstrid_yuv;
|
RK_S32 stride_y, stride_uv, virstrid_y, virstrid_yuv;
|
||||||
|
|
||||||
H265d_REGS_t *hw_regs;
|
H265d_REGS_t *hw_regs;
|
||||||
RK_S32 ret = MPP_SUCCESS;
|
RK_S32 ret = MPP_SUCCESS;
|
||||||
@@ -1306,21 +1306,21 @@ MPP_RET hal_h265d_gen_regs(void *hal, HalTask *syn)
|
|||||||
uiMaxCUWidth = 1 << (dxva_cxt->pp.log2_diff_max_min_luma_coding_block_size +
|
uiMaxCUWidth = 1 << (dxva_cxt->pp.log2_diff_max_min_luma_coding_block_size +
|
||||||
dxva_cxt->pp.log2_min_luma_coding_block_size_minus3 + 3);
|
dxva_cxt->pp.log2_min_luma_coding_block_size_minus3 + 3);
|
||||||
uiMaxCUHeight = uiMaxCUWidth;
|
uiMaxCUHeight = uiMaxCUWidth;
|
||||||
|
|
||||||
log2_min_cb_size = dxva_cxt->pp.log2_min_luma_coding_block_size_minus3 + 3;
|
log2_min_cb_size = dxva_cxt->pp.log2_min_luma_coding_block_size_minus3 + 3;
|
||||||
|
|
||||||
width = (dxva_cxt->pp.PicWidthInMinCbsY << log2_min_cb_size);
|
width = (dxva_cxt->pp.PicWidthInMinCbsY << log2_min_cb_size);
|
||||||
|
|
||||||
height = (dxva_cxt->pp.PicHeightInMinCbsY << log2_min_cb_size);
|
height = (dxva_cxt->pp.PicHeightInMinCbsY << log2_min_cb_size);
|
||||||
|
|
||||||
numCuInWidth = width / uiMaxCUWidth + (width % uiMaxCUWidth != 0);
|
numCuInWidth = width / uiMaxCUWidth + (width % uiMaxCUWidth != 0);
|
||||||
|
|
||||||
stride_y = ((((numCuInWidth * uiMaxCUWidth * (dxva_cxt->pp.bit_depth_luma_minus8 + 8) + 2047)
|
stride_y = ((((numCuInWidth * uiMaxCUWidth * (dxva_cxt->pp.bit_depth_luma_minus8 + 8) + 2047)
|
||||||
& (~2047)) | 2048) >> 3);
|
& (~2047)) | 2048) >> 3);
|
||||||
stride_uv = ((((numCuInWidth * uiMaxCUHeight * (dxva_cxt->pp.bit_depth_chroma_minus8 + 8) + 2047)
|
stride_uv = ((((numCuInWidth * uiMaxCUHeight * (dxva_cxt->pp.bit_depth_chroma_minus8 + 8) + 2047)
|
||||||
& (~2047)) | 2048) >> 3);
|
& (~2047)) | 2048) >> 3);
|
||||||
virstrid_y = stride_y * height;
|
virstrid_y = stride_y * height;
|
||||||
|
|
||||||
virstrid_yuv = virstrid_y + stride_uv * height / 2;
|
virstrid_yuv = virstrid_y + stride_uv * height / 2;
|
||||||
|
|
||||||
hw_regs->sw_picparameter.sw_slice_num = dxva_cxt->slice_count;
|
hw_regs->sw_picparameter.sw_slice_num = dxva_cxt->slice_count;
|
||||||
@@ -1486,4 +1486,4 @@ const MppHalApi hal_api_h265d = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -485,12 +485,12 @@ static void find_next_nalu(InputParams *p_in)
|
|||||||
RK_U32 g_nalu_cnt2 = 0;
|
RK_U32 g_nalu_cnt2 = 0;
|
||||||
static MPP_RET read_next_nalu(InputParams *p_in)
|
static MPP_RET read_next_nalu(InputParams *p_in)
|
||||||
{
|
{
|
||||||
RK_S32 forbidden_bit = -1;
|
RK_S32 forbidden_bit = -1;
|
||||||
RK_S32 nal_reference_idc = -1;
|
RK_S32 nal_reference_idc = -1;
|
||||||
RK_S32 nal_unit_type = -1;
|
RK_S32 nal_unit_type = -1;
|
||||||
RK_S32 nalu_header_bytes = -1;
|
RK_S32 nalu_header_bytes = -1;
|
||||||
RK_U32 first_mb_in_slice = -1;
|
RK_U32 first_mb_in_slice = -1;
|
||||||
RK_S32 svc_extension_flag = -1;
|
RK_S32 svc_extension_flag = -1;
|
||||||
|
|
||||||
GetBitCtx_t *pStrmData = (GetBitCtx_t *)p_in->bitctx;
|
GetBitCtx_t *pStrmData = (GetBitCtx_t *)p_in->bitctx;
|
||||||
memset(pStrmData, 0, sizeof(GetBitCtx_t));
|
memset(pStrmData, 0, sizeof(GetBitCtx_t));
|
||||||
@@ -499,32 +499,31 @@ static MPP_RET read_next_nalu(InputParams *p_in)
|
|||||||
ASSERT(forbidden_bit == 0);
|
ASSERT(forbidden_bit == 0);
|
||||||
read_bits( pStrmData, 2, &nal_reference_idc);
|
read_bits( pStrmData, 2, &nal_reference_idc);
|
||||||
read_bits( pStrmData, 5, &nal_unit_type);
|
read_bits( pStrmData, 5, &nal_unit_type);
|
||||||
if (g_nalu_cnt2 == 344)
|
if (g_nalu_cnt2 == 344) {
|
||||||
{
|
g_nalu_cnt2 = g_nalu_cnt2;
|
||||||
g_nalu_cnt2 = g_nalu_cnt2;
|
}
|
||||||
}
|
//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");
|
//}
|
||||||
//}
|
//FPRINT(g_debug_file0, "g_nalu_cnt = %d, nal_unit_type = %d, nalu_size = %d\n", g_nalu_cnt2++, nal_unit_type, p_in->IO.nalubytes);
|
||||||
//FPRINT(g_debug_file0, "g_nalu_cnt = %d, nal_unit_type = %d, nalu_size = %d\n", g_nalu_cnt2++, nal_unit_type, p_in->IO.nalubytes);
|
|
||||||
|
|
||||||
nalu_header_bytes = 1;
|
nalu_header_bytes = 1;
|
||||||
if ((nal_unit_type == NALU_TYPE_PREFIX) || (nal_unit_type == NALU_TYPE_SLC_EXT)) {
|
if ((nal_unit_type == NALU_TYPE_PREFIX) || (nal_unit_type == NALU_TYPE_SLC_EXT)) {
|
||||||
read_bits(pStrmData, 1, &svc_extension_flag);
|
read_bits(pStrmData, 1, &svc_extension_flag);
|
||||||
if (!svc_extension_flag && nal_unit_type == NALU_TYPE_SLC_EXT) {//!< MVC
|
if (!svc_extension_flag && nal_unit_type == NALU_TYPE_SLC_EXT) {//!< MVC
|
||||||
nal_unit_type = NALU_TYPE_SLICE;
|
nal_unit_type = NALU_TYPE_SLICE;
|
||||||
}
|
}
|
||||||
nalu_header_bytes += 3;
|
nalu_header_bytes += 3;
|
||||||
}
|
}
|
||||||
//-- parse slice
|
//-- parse slice
|
||||||
if ( nal_unit_type == NALU_TYPE_SLICE || nal_unit_type == NALU_TYPE_IDR) {
|
if ( nal_unit_type == NALU_TYPE_SLICE || nal_unit_type == NALU_TYPE_IDR) {
|
||||||
set_streamdata(pStrmData, (p_in->IO.pNALU + nalu_header_bytes), 4); // reset
|
set_streamdata(pStrmData, (p_in->IO.pNALU + nalu_header_bytes), 4); // reset
|
||||||
read_ue(pStrmData, &first_mb_in_slice);
|
read_ue(pStrmData, &first_mb_in_slice);
|
||||||
//FPRINT(g_debug_file0, "first_mb_in_slice = %d \n", first_mb_in_slice);
|
//FPRINT(g_debug_file0, "first_mb_in_slice = %d \n", first_mb_in_slice);
|
||||||
//if (first_mb_in_slice == 0) {
|
//if (first_mb_in_slice == 0) {
|
||||||
// FPRINT(g_debug_file0, "--- new frame ---- \n");
|
// FPRINT(g_debug_file0, "--- new frame ---- \n");
|
||||||
//}
|
//}
|
||||||
if (!p_in->is_fist_frame && (first_mb_in_slice == 0)) {
|
if (!p_in->is_fist_frame && (first_mb_in_slice == 0)) {
|
||||||
p_in->is_new_frame = 1;
|
p_in->is_new_frame = 1;
|
||||||
}
|
}
|
||||||
@@ -758,17 +757,16 @@ MPP_RET h264d_read_one_frame(InputParams *p_in, MppPacket pkt)
|
|||||||
find_next_nalu(p_in);
|
find_next_nalu(p_in);
|
||||||
read_next_nalu(p_in);
|
read_next_nalu(p_in);
|
||||||
} while (!p_in->is_new_frame && !p_in->is_eof);
|
} while (!p_in->is_new_frame && !p_in->is_eof);
|
||||||
//if (first_mb_in_slice == 0) {
|
//if (first_mb_in_slice == 0) {
|
||||||
//FPRINT(g_debug_file0, "--- new frame ---- \n");
|
//FPRINT(g_debug_file0, "--- new frame ---- \n");
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//-- set code input context
|
//-- set code input context
|
||||||
((MppPacketImpl *)pkt)->pos = p_in->strm.pbuf;
|
((MppPacketImpl *)pkt)->pos = p_in->strm.pbuf;
|
||||||
((MppPacketImpl *)pkt)->size = p_in->strm.strmbytes;
|
((MppPacketImpl *)pkt)->size = p_in->strm.strmbytes;
|
||||||
if (g_max_slice_data < p_in->strm.strmbytes)
|
if (g_max_slice_data < p_in->strm.strmbytes) {
|
||||||
{
|
g_max_slice_data = p_in->strm.strmbytes;
|
||||||
g_max_slice_data = p_in->strm.strmbytes;
|
}
|
||||||
}
|
|
||||||
if (p_in->is_eof) {
|
if (p_in->is_eof) {
|
||||||
mpp_packet_set_eos(pkt);
|
mpp_packet_set_eos(pkt);
|
||||||
}
|
}
|
||||||
|
@@ -109,9 +109,9 @@ __FAILED:
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
//FILE *g_debug_file = NULL;
|
//FILE *g_debug_file = NULL;
|
||||||
//RK_S32 m_max_bytes = 0;
|
//RK_S32 m_max_bytes = 0;
|
||||||
//RK_S32 m_max_slice_data = 0;
|
//RK_S32 m_max_slice_data = 0;
|
||||||
MPP_RET ret = MPP_ERR_UNKNOW;
|
MPP_RET ret = MPP_ERR_UNKNOW;
|
||||||
|
|
||||||
InputParams *pIn = mpp_calloc(InputParams, 1);
|
InputParams *pIn = mpp_calloc(InputParams, 1);
|
||||||
@@ -132,18 +132,18 @@ int main(int argc, char **argv)
|
|||||||
do {
|
do {
|
||||||
if (!pkt->size) {
|
if (!pkt->size) {
|
||||||
FUN_CHECK(ret = h264d_read_one_frame(pIn, (MppPacket)pkt));
|
FUN_CHECK(ret = h264d_read_one_frame(pIn, (MppPacket)pkt));
|
||||||
//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");
|
||||||
//}
|
//}
|
||||||
//FPRINT(g_debug_file1, "---- read_one_frame Frame_no = %d, size = %d \n", pIn->iFrmdecoded, pkt->size);
|
//FPRINT(g_debug_file1, "---- read_one_frame Frame_no = %d, size = %d \n", pIn->iFrmdecoded, pkt->size);
|
||||||
mpp_log("---- decoder, read_one_frame Frame_no = %d \n", pIn->iFrmdecoded++);
|
mpp_log("---- decoder, read_one_frame Frame_no = %d \n", pIn->iFrmdecoded++);
|
||||||
}
|
}
|
||||||
FUN_CHECK(ret = parser_prepare(pApi->parser, pkt, &task->dec));
|
FUN_CHECK(ret = parser_prepare(pApi->parser, pkt, &task->dec));
|
||||||
FUN_CHECK(ret = parser_parse(pApi->parser, &task->dec));
|
FUN_CHECK(ret = parser_parse(pApi->parser, &task->dec));
|
||||||
//FPRINT(g_debug_file1, "parse, frame_no = %d, size = %d \n", pIn->iFrmdecoded, pkt->size);
|
//FPRINT(g_debug_file1, "parse, frame_no = %d, size = %d \n", pIn->iFrmdecoded, pkt->size);
|
||||||
if (((HalDecTask*)&task->dec)->valid) {
|
if (((HalDecTask*)&task->dec)->valid) {
|
||||||
FUN_CHECK(ret = mpp_hal_reg_gen(pApi->hal, task));
|
FUN_CHECK(ret = mpp_hal_reg_gen(pApi->hal, task));
|
||||||
//!< end of stream
|
//!< end of stream
|
||||||
if (!pkt->size && (pkt->flag & MPP_PACKET_FLAG_EOS)) {
|
if (!pkt->size && (pkt->flag & MPP_PACKET_FLAG_EOS)) {
|
||||||
break;
|
break;
|
||||||
@@ -166,23 +166,23 @@ __FAILED:
|
|||||||
mpp_free(pkt);
|
mpp_free(pkt);
|
||||||
mpp_free(task);
|
mpp_free(task);
|
||||||
|
|
||||||
//g_debug_file = fopen("rk_debugfile_view0.txt", "rb");
|
//g_debug_file = fopen("rk_debugfile_view0.txt", "rb");
|
||||||
//if(g_debug_file)
|
//if(g_debug_file)
|
||||||
// fscanf(g_debug_file, "(max_bytes)%d, (max_slice_data)%d \n", &m_max_bytes, &m_max_slice_data);
|
// fscanf(g_debug_file, "(max_bytes)%d, (max_slice_data)%d \n", &m_max_bytes, &m_max_slice_data);
|
||||||
//FCLOSE(g_debug_file);
|
//FCLOSE(g_debug_file);
|
||||||
//if (m_max_bytes < g_max_bytes)
|
//if (m_max_bytes < g_max_bytes)
|
||||||
//{
|
//{
|
||||||
// m_max_bytes = g_max_bytes;
|
// m_max_bytes = g_max_bytes;
|
||||||
//}
|
//}
|
||||||
//if (m_max_slice_data < g_max_slice_data)
|
//if (m_max_slice_data < g_max_slice_data)
|
||||||
//{
|
//{
|
||||||
// m_max_slice_data = g_max_slice_data;
|
// m_max_slice_data = g_max_slice_data;
|
||||||
//}
|
//}
|
||||||
//g_debug_file = fopen("rk_debugfile_view0.txt", "ab+");
|
//g_debug_file = fopen("rk_debugfile_view0.txt", "ab+");
|
||||||
//if(g_debug_file)
|
//if(g_debug_file)
|
||||||
// fprintf(g_debug_file, "(max_bytes)%d, (max_slice_data)%d \n", g_max_bytes, g_max_slice_data);
|
// fprintf(g_debug_file, "(max_bytes)%d, (max_slice_data)%d \n", g_max_bytes, g_max_slice_data);
|
||||||
|
|
||||||
//FCLOSE(g_debug_file);
|
//FCLOSE(g_debug_file);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user