[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:
ChenHengming
2015-09-24 14:18:29 +00:00
parent 71234c6a16
commit 24ab3a135c
18 changed files with 260 additions and 265 deletions

View File

@@ -187,10 +187,10 @@ MPP_RET dummy_dec_prepare(void *dec, MppPacket pkt, HalDecTask *task)
}
MPP_RET dummy_dec_parse(void *dec, HalDecTask *task)
{
(void)dec;
(void)task;
(void)dec;
(void)task;
return MPP_OK;
return MPP_OK;
}
const ParserApi dummy_dec_parser = {

View File

@@ -506,26 +506,26 @@ __RETURN:
*/
MPP_RET h264d_prepare(void *decoder, MppPacket in_pkt, HalDecTask *in_task)
{
MPP_RET ret = MPP_ERR_UNKNOW;
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
MppPacketImpl *pkt = (MppPacketImpl *)in_pkt;
MPP_RET ret = MPP_ERR_UNKNOW;
H264_DecCtx_t *p_Dec = (H264_DecCtx_t *)decoder;
MppPacketImpl *pkt = (MppPacketImpl *)in_pkt;
INP_CHECK(ret, ctx, !decoder && !in_pkt && !in_task);
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
p_Dec->p_Inp->in_buf = (RK_U8 *)pkt->pos;
p_Dec->p_Inp->in_size = &pkt->size;
p_Dec->p_Inp->is_eos = pkt->flag & MPP_PACKET_FLAG_EOS;
FunctionIn(p_Dec->logctx.parr[RUN_PARSE]);
p_Dec->p_Inp->in_buf = (RK_U8 *)pkt->pos;
p_Dec->p_Inp->in_size = &pkt->size;
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 ret = MPP_OK;
return ret = MPP_OK;
//__FAILED:
// return ret;
// return ret;
}

View File

@@ -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);
#endif
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++);

View File

@@ -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
memcpy(&dxva_ctx->bitstream[dxva_ctx->strm_offset], start_code, 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);
dxva_ctx->strm_offset += 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;
p_long->SliceBytesInBuffer = dxva_ctx->strm_offset - p_long->BSNALunitDataLocation;
return ret = MPP_OK;

View File

@@ -384,7 +384,7 @@ static void malloc_dpb_memory_index(H264dVideoCtx_t *p_Vid, RK_S32 structure, RK
{
RK_U8 idx = 1;
H264_DpbMark_t *pmem_dpb = p_Vid->p_Dec->dpb_mark;
//!< malloc
//!< malloc
if (!combine_flag) {
while (pmem_dpb[idx].top_used || pmem_dpb[idx].bot_used) {
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)
{
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) {
ASSERT(pSlice->layer_id == 1);
FUN_CHECK(ret = idr_memory_management(p_Vid->p_Dpb_layer[pSlice->layer_id], p_Vid->dec_picture));

View File

@@ -45,8 +45,8 @@ static void reset_slice(H264dVideoCtx_t *p_Vid)
currSlice->p_Cur = p_Vid->p_Cur;
currSlice->p_Inp = p_Vid->p_Inp;
currSlice->logctx = &p_Vid->p_Dec->logctx;
currSlice->active_sps = p_Vid->active_sps;
currSlice->active_pps = p_Vid->active_pps;
currSlice->active_sps = p_Vid->active_sps;
currSlice->active_pps = p_Vid->active_pps;
//--- reset listP listB
for (i = 0; i < 2; i++) {
currSlice->listP[i] = p_Vid->p_Cur->listP[i];
@@ -157,7 +157,7 @@ static MPP_RET parser_nalu_header(H264_SLICE_t *currSlice)
FunctionIn(logctx->parr[RUN_PARSE]);
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]);
WRITE_LOG(p_bitctx, "================== NAL begin ===================");
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) {
g_nalu_cnt = g_nalu_cnt;
}
//if (g_debug_file1 == NULL)
//{
// 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);
//if (g_debug_file1 == NULL)
//{
// 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);
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
FunctionOut(logctx->parr[RUN_PARSE]);
FunctionOut(logctx->parr[RUN_PARSE]);
return ret = MPP_OK;
__FAILED:

View File

@@ -435,108 +435,107 @@ MPP_RET process_slice(H264_SLICE_t *currSlice)
WRITE_LOG(p_bitctx, "----------------------------- SLICE begin --------------------------------");
//!< read slice head syntax
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);
if (currSlice->start_mb_nr == 0/*is_new_picture(currSlice)*/) {
READ_UE(ret, p_bitctx, &temp, "slice_type");
p_Vid->slice_type = currSlice->slice_type = temp % 5;
READ_UE(ret, p_bitctx, &currSlice->pic_parameter_set_id, "slice_pic_parameter_set_id");
init_slice_parmeters(currSlice);
FUN_CHECK(ret = set_slice_user_parmeters(currSlice));
//!< read rest slice header syntax
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
p_Vid->structure = FRAME;
currSlice->field_pic_flag = 0;
currSlice->bottom_field_flag = 0;
} else {
READ_ONEBIT(ret, p_bitctx, &currSlice->field_pic_flag, "field_pic_flag");
if (currSlice->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;
} else {
p_Vid->structure = FRAME;
currSlice->bottom_field_flag = 0;
}
}
currSlice->structure = p_Vid->structure;
currSlice->mb_aff_frame_flag = (currSlice->active_sps->mb_adaptive_frame_field_flag && (currSlice->field_pic_flag == 0));
if (currSlice->idr_flag) {
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) {
READ_UE(ret, p_bitctx, &currSlice->idr_pic_id, "idr_pic_id");
}
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");
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_bottom, "delta_pic_order_cnt_bottom");
} else {
currSlice->delta_pic_order_cnt_bottom = 0;
}
}
if (currSlice->active_sps->pic_order_cnt_type == 1) {
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]");
//FPRINT(g_debug_file1, "first_mb_in_slice = %d \n", currSlice->start_mb_nr);
if (currSlice->start_mb_nr == 0/*is_new_picture(currSlice)*/) {
READ_UE(ret, p_bitctx, &temp, "slice_type");
p_Vid->slice_type = currSlice->slice_type = temp % 5;
READ_UE(ret, p_bitctx, &currSlice->pic_parameter_set_id, "slice_pic_parameter_set_id");
init_slice_parmeters(currSlice);
FUN_CHECK(ret = set_slice_user_parmeters(currSlice));
//!< read rest slice header syntax
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
p_Vid->structure = FRAME;
currSlice->field_pic_flag = 0;
currSlice->bottom_field_flag = 0;
} else {
READ_ONEBIT(ret, p_bitctx, &currSlice->field_pic_flag, "field_pic_flag");
if (currSlice->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;
} else {
p_Vid->structure = FRAME;
currSlice->bottom_field_flag = 0;
}
}
currSlice->structure = p_Vid->structure;
currSlice->mb_aff_frame_flag = (currSlice->active_sps->mb_adaptive_frame_field_flag && (currSlice->field_pic_flag == 0));
if (currSlice->idr_flag) {
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) {
READ_UE(ret, p_bitctx, &currSlice->idr_pic_id, "idr_pic_id");
}
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");
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_bottom, "delta_pic_order_cnt_bottom");
} else {
currSlice->delta_pic_order_cnt_bottom = 0;
}
}
if (currSlice->active_sps->pic_order_cnt_type == 1) {
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]");
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]");
} else {
currSlice->delta_pic_order_cnt[1] = 0; // set to zero if not in stream
}
} else {
currSlice->delta_pic_order_cnt[0] = 0;
currSlice->delta_pic_order_cnt[1] = 0;
}
}
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]");
} else {
currSlice->delta_pic_order_cnt[1] = 0; // set to zero if not in stream
}
} else {
currSlice->delta_pic_order_cnt[0] = 0;
currSlice->delta_pic_order_cnt[1] = 0;
}
}
//!< 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
if (currSlice->p_Vid->active_pps->redundant_pic_cnt_present_flag) {
READ_UE(ret, p_bitctx, &currSlice->redundant_pic_cnt, "redundant_pic_cnt");
}
//!< 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
if (currSlice->p_Vid->active_pps->redundant_pic_cnt_present_flag) {
READ_UE(ret, p_bitctx, &currSlice->redundant_pic_cnt, "redundant_pic_cnt");
}
if (currSlice->slice_type == B_SLICE) {
READ_ONEBIT(ret, p_bitctx, &currSlice->direct_spatial_mv_pred_flag, "direct_spatial_mv_pred_flag");
} else {
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_1] = currSlice->p_Vid->active_pps->num_ref_idx_l1_default_active_minus1 + 1;
if (currSlice->slice_type == B_SLICE) {
READ_ONEBIT(ret, p_bitctx, &currSlice->direct_spatial_mv_pred_flag, "direct_spatial_mv_pred_flag");
} else {
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_1] = currSlice->p_Vid->active_pps->num_ref_idx_l1_default_active_minus1 + 1;
if (currSlice->slice_type == P_SLICE
|| currSlice->slice_type == SP_SLICE || currSlice->slice_type == B_SLICE) {
//!< direct_spatial_mv_pred_flag
READ_ONEBIT(ret, p_bitctx, &currSlice->num_ref_idx_override_flag, "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");
currSlice->num_ref_idx_active[LIST_0] += 1;
if (currSlice->slice_type == B_SLICE) {
READ_UE(ret, p_bitctx, &currSlice->num_ref_idx_active[LIST_1], "num_ref_idx_active1");
currSlice->num_ref_idx_active[LIST_1] += 1;
}
}
}
if (currSlice->slice_type != B_SLICE) {
currSlice->num_ref_idx_active[LIST_1] = 0;
}
//!<----------------------------
if (currSlice->slice_type == P_SLICE
|| currSlice->slice_type == SP_SLICE || currSlice->slice_type == B_SLICE) {
//!< direct_spatial_mv_pred_flag
READ_ONEBIT(ret, p_bitctx, &currSlice->num_ref_idx_override_flag, "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");
currSlice->num_ref_idx_active[LIST_0] += 1;
if (currSlice->slice_type == B_SLICE) {
READ_UE(ret, p_bitctx, &currSlice->num_ref_idx_active[LIST_1], "num_ref_idx_active1");
currSlice->num_ref_idx_active[LIST_1] += 1;
}
}
}
if (currSlice->slice_type != B_SLICE) {
currSlice->num_ref_idx_active[LIST_1] = 0;
}
//!<----------------------------
//FPRINT(g_debug_file1, "--- new frame ---- \n");
FUN_CHECK(ret = ref_pic_list_mvc_modification(currSlice));
if ((currSlice->p_Vid->active_pps->weighted_pred_flag
&& (currSlice->slice_type == P_SLICE || currSlice->slice_type == SP_SLICE))
|| (currSlice->p_Vid->active_pps->weighted_bipred_idc == 1 && (currSlice->slice_type == B_SLICE))) {
FUN_CHECK(ret = pred_weight_table(currSlice));
}
if (currSlice->nal_reference_idc) {
FUN_CHECK(ret = dec_ref_pic_marking(currSlice));
}
if (g_max_bytes < (p_bitctx->used_bits>>3))
{
g_max_bytes = (p_bitctx->used_bits>>3);
}
currSlice->is_new_picture_flag = 1;
}
//FPRINT(g_debug_file1, "--- new frame ---- \n");
FUN_CHECK(ret = ref_pic_list_mvc_modification(currSlice));
if ((currSlice->p_Vid->active_pps->weighted_pred_flag
&& (currSlice->slice_type == P_SLICE || currSlice->slice_type == SP_SLICE))
|| (currSlice->p_Vid->active_pps->weighted_bipred_idc == 1 && (currSlice->slice_type == B_SLICE))) {
FUN_CHECK(ret = pred_weight_table(currSlice));
}
if (currSlice->nal_reference_idc) {
FUN_CHECK(ret = dec_ref_pic_marking(currSlice));
}
if (g_max_bytes < (p_bitctx->used_bits >> 3)) {
g_max_bytes = (p_bitctx->used_bits >> 3);
}
currSlice->is_new_picture_flag = 1;
}
FunctionOut(logctx->parr[RUN_PARSE]);
return ret = MPP_OK;

View File

@@ -626,7 +626,7 @@ static RK_S32 hls_slice_header(HEVCContext *s)
SliceHeader *sh = &s->sh;
RK_S32 i, ret;
RK_S32 value, pps_id;
RK_S32 bit_begin;
RK_S32 bit_begin;
#ifdef JCTVC_M0458_INTERLAYER_RPS_SIG
int NumILRRefIdx;

View File

@@ -1633,8 +1633,8 @@ RK_S32 mpp_hevc_decode_nal_sps(HEVCContext *s)
READ_BIT1(gb, &sps->set_mfm_enabled_flag);
#endif
READ_BIT1(gb, &sps->sps_strong_intra_smoothing_enable_flag);
sps->vui.sar.num = 0;
sps->vui.sar.den = 1;
sps->vui.sar.num = 0;
sps->vui.sar.den = 1;
READ_BIT1(gb, &vui_present);
if (vui_present)
decode_vui(s, sps);

View File

@@ -210,11 +210,11 @@ static HEVCFrame *find_ref_idx(HEVCContext *s, int poc)
int mpp_hevc_slice_rpl(HEVCContext *s)
{
RK_U8 list_idx;
RK_U32 i;
RK_S32 j, ret;
RefPicList *rpl = NULL;
RK_S32 cand_lists[3];
RK_U8 list_idx;
RK_U32 i;
RK_S32 j, ret;
RefPicList *rpl = NULL;
RK_S32 cand_lists[3];
SliceHeader *sh = &s->sh;
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_AFT - ST_CURR_BEF - LT_CURR for the L1 */
cand_lists[0] = list_idx ? ST_CURR_AFT : ST_CURR_BEF;
cand_lists[1] = list_idx ? ST_CURR_BEF : ST_CURR_AFT;
cand_lists[2] = LT_CURR;
cand_lists[1] = list_idx ? ST_CURR_BEF : ST_CURR_AFT;
cand_lists[2] = LT_CURR;
/* concatenate the candidate lists for the current frame */
while ((RK_U32)rpl_tmp.nb_refs < sh->nb_refs[list_idx]) {
for (i = 0; i < MPP_ARRAY_ELEMS(cand_lists); i++) {

View File

@@ -98,7 +98,7 @@ static RK_S32 show_help()
RK_U32 i = 0;
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++) {
mpp_log("-%s %s\t\t%s\n",
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 *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);
do {
mpp_packet_init(&rkpkt, tmpbuf, nal_len);
@@ -432,7 +432,7 @@ RK_S32 hevc_parser_test(ParserDemoCmdContext_t *cmd)
#if 1//def DUMP
RK_U32 stride_w, stride_h;
void *ptr = NULL;
MppBuffer framebuf;
MppBuffer framebuf;
stride_w = mpp_frame_get_hor_stride(frame);
stride_h = mpp_frame_get_ver_stride(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)
{
RK_S32 ret = 0;
RK_S32 ret = 0;
ParserDemoCmdContext_t demoCmdCtx;
ParserDemoCmdContext_t* cmd = NULL;
ParserDemoCmdContext_t* cmd = NULL;
if (argc == 1) {
show_usage();

View File

@@ -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);
} 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;
buf_slot_dbg(BUF_SLOT_DBG_OPS_RUNTIME, "index %2d op: %s status in %08x out %08x",
index, op_string[op], before, status);

View File

@@ -116,7 +116,7 @@ void *mpp_dec_parser_thread(void *data)
task_ready = task_dec->valid;
if (!task_ready)
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.
*

View File

@@ -472,20 +472,18 @@ void generate_regs(void *hal, FifoCtx_t *pkt)
*/
void fprint_fifo_data(FILE *fp, FifoCtx_t *pkt)
{
RK_U32 i = 0, pkt_size = 0;
RK_U8 *ptr = (RK_U8 *)pkt->pbuf;
if (fp) {
pkt_size = pkt->index * sizeof(RK_U64);
fprintf(fp, "------ Header=%08x, size=%d ------ \n", pkt->header, pkt_size);
for (i = 0; i < pkt_size;)
{
fprintf(fp, "0x%02x, ", ptr[i]);
i++;
if ((i % 16) == 0)
{
fprintf(fp, "\n");
}
}
fprintf(fp, "\n\n");
}
RK_U32 i = 0, pkt_size = 0;
RK_U8 *ptr = (RK_U8 *)pkt->pbuf;
if (fp) {
pkt_size = pkt->index * sizeof(RK_U64);
fprintf(fp, "------ Header=%08x, size=%d ------ \n", pkt->header, pkt_size);
for (i = 0; i < pkt_size;) {
fprintf(fp, "0x%02x, ", ptr[i]);
i++;
if ((i % 16) == 0) {
fprintf(fp, "\n");
}
}
fprintf(fp, "\n\n");
}
}

View File

@@ -378,7 +378,7 @@ static RK_S32 _count = 0;
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;
mpp_assert(size + offset <= 64);// 64 is the FIFO_BIT_WIDTH
@@ -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)
{
RK_S32 i;
RK_U64 temp = 0;
RK_S32 len = 0;
RK_S32 i;
RK_U64 temp = 0;
RK_S32 len = 0;
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)
{
RK_S32 i;
RK_S32 i;
RK_U32 g_scalingListNum_model[SCALING_LIST_SIZE_NUM] = {6, 6, 6, 2}; // from C Model
RK_U32 nIndex = 0;
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_U32 i, j;
RK_U8 bef_nb_refs = 0, aft_nb_refs = 0, lt_cur_nb_refs = 0;
h265d_dxva2_picture_context_t *dxva_cxt = NULL;
RK_S32 cand_lists[3];
h265d_dxva2_picture_context_t *dxva_cxt = NULL;
RK_S32 cand_lists[3];
memset(ref, 0, sizeof(RefPicListTab_t));
dxva_cxt = (h265d_dxva2_picture_context_t*)dxva;
@@ -615,9 +615,9 @@ static int hal_h265d_slice_rpl(void *dxva, SliceHeader_t *sh, RefPicListTab_t *r
* ST_CURR_BEF - ST_CURR_AFT - LT_CURR for the L0 and
* ST_CURR_AFT - ST_CURR_BEF - LT_CURR for the L1 */
cand_lists[0] = list_idx ? ST_CURR_AFT : ST_CURR_BEF;
cand_lists[1] = list_idx ? ST_CURR_BEF : ST_CURR_AFT;
cand_lists[2] = LT_CURR;
cand_lists[0] = list_idx ? ST_CURR_AFT : ST_CURR_BEF;
cand_lists[1] = list_idx ? ST_CURR_BEF : ST_CURR_AFT;
cand_lists[2] = LT_CURR;
/* concatenate the candidate lists for the current frame */
while ((RK_U32)rpl_tmp.nb_refs < sh->nb_refs[list_idx]) {
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];
slice_ref_map_t rps_pic_info[600][2][15];
RK_U32 nb_refs = 0;
RK_S32 bit_begin;
h265d_dxva2_picture_context_t *dxva_cxt = NULL;
RK_S32 bit_begin;
h265d_dxva2_picture_context_t *dxva_cxt = NULL;
memset(&rps_pic_info, 0, sizeof(rps_pic_info));
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 fifo_len = nb_slice * 4;//size of rps_packet
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 (j = 0; j < 2; j++) {
@@ -980,7 +980,7 @@ static RK_S32 hal_h265d_slice_output_rps(void *dxva, void *rps_buf)
if (rps_buf != NULL) {
memcpy(rps_buf, rps_packet, nb_slice * 32);
}
mpp_free(rps_packet);
mpp_free(rps_packet);
}
return 0;
@@ -1023,13 +1023,13 @@ RK_S32 hal_h265d_output_pps_packet(void *hal, void *dxva)
RK_S32 bit_len = 0;
RK_S32 i, j;
RK_U32 addr;
RK_U64 *pps_packet = NULL;
RK_U32 log2_min_cb_size;
RK_S32 width, height;
RK_U64 *pps_packet = NULL;
RK_U32 log2_min_cb_size;
RK_S32 width, height;
h265d_reg_context_t *reg_cxt = ( h265d_reg_context_t *)hal;
h265d_dxva2_picture_context_t *dxva_cxt = (h265d_dxva2_picture_context_t*)dxva;
_count = 0;
_count = 0;
if (NULL == reg_cxt || dxva_cxt == NULL) {
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);
if (dxva_cxt->pp.scaling_list_data_present_flag) {
addr = (dxva_cxt->pp.pps_id + 16) * 1360;
@@ -1238,8 +1238,8 @@ RK_S32 hal_h265d_output_pps_packet(void *hal, void *dxva)
#endif
mpp_put_bits(0 , 32 , pps_packet, &fifo_index, &bit_offset, &bit_len, fifo_len);
p0 = (RK_U8*)&pps_packet[9];
p1 = (RK_U8*)&addr;
p0 = (RK_U8*)&pps_packet[9];
p1 = (RK_U8*)&addr;
p0[2] = p1[0];
p0[3] = p1[1];
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);
fflush(fp);
#endif
mpp_free(pps_packet);
mpp_free(pps_packet);
return 0;
}
MPP_RET hal_h265d_gen_regs(void *hal, HalTask *syn)
{
RK_U32 uiMaxCUWidth, uiMaxCUHeight;
RK_U32 log2_min_cb_size;
RK_S32 width, height, numCuInWidth;
RK_S32 stride_y, stride_uv, virstrid_y, virstrid_yuv;
RK_U32 uiMaxCUWidth, uiMaxCUHeight;
RK_U32 log2_min_cb_size;
RK_S32 width, height, numCuInWidth;
RK_S32 stride_y, stride_uv, virstrid_y, virstrid_yuv;
H265d_REGS_t *hw_regs;
RK_S32 ret = MPP_SUCCESS;

View File

@@ -485,12 +485,12 @@ static void find_next_nalu(InputParams *p_in)
RK_U32 g_nalu_cnt2 = 0;
static MPP_RET read_next_nalu(InputParams *p_in)
{
RK_S32 forbidden_bit = -1;
RK_S32 nal_reference_idc = -1;
RK_S32 nal_unit_type = -1;
RK_S32 nalu_header_bytes = -1;
RK_U32 first_mb_in_slice = -1;
RK_S32 svc_extension_flag = -1;
RK_S32 forbidden_bit = -1;
RK_S32 nal_reference_idc = -1;
RK_S32 nal_unit_type = -1;
RK_S32 nalu_header_bytes = -1;
RK_U32 first_mb_in_slice = -1;
RK_S32 svc_extension_flag = -1;
GetBitCtx_t *pStrmData = (GetBitCtx_t *)p_in->bitctx;
memset(pStrmData, 0, sizeof(GetBitCtx_t));
@@ -499,32 +499,31 @@ static MPP_RET read_next_nalu(InputParams *p_in)
ASSERT(forbidden_bit == 0);
read_bits( pStrmData, 2, &nal_reference_idc);
read_bits( pStrmData, 5, &nal_unit_type);
if (g_nalu_cnt2 == 344)
{
g_nalu_cnt2 = g_nalu_cnt2;
}
//if (g_debug_file0 == NULL)
//{
// 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);
if (g_nalu_cnt2 == 344) {
g_nalu_cnt2 = g_nalu_cnt2;
}
//if (g_debug_file0 == NULL)
//{
// 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);
nalu_header_bytes = 1;
if ((nal_unit_type == NALU_TYPE_PREFIX) || (nal_unit_type == NALU_TYPE_SLC_EXT)) {
read_bits(pStrmData, 1, &svc_extension_flag);
if (!svc_extension_flag && nal_unit_type == NALU_TYPE_SLC_EXT) {//!< MVC
nal_unit_type = NALU_TYPE_SLICE;
}
read_bits(pStrmData, 1, &svc_extension_flag);
if (!svc_extension_flag && nal_unit_type == NALU_TYPE_SLC_EXT) {//!< MVC
nal_unit_type = NALU_TYPE_SLICE;
}
nalu_header_bytes += 3;
}
//-- parse slice
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
read_ue(pStrmData, &first_mb_in_slice);
//FPRINT(g_debug_file0, "first_mb_in_slice = %d \n", first_mb_in_slice);
//if (first_mb_in_slice == 0) {
// FPRINT(g_debug_file0, "--- new frame ---- \n");
//}
//FPRINT(g_debug_file0, "first_mb_in_slice = %d \n", first_mb_in_slice);
//if (first_mb_in_slice == 0) {
// FPRINT(g_debug_file0, "--- new frame ---- \n");
//}
if (!p_in->is_fist_frame && (first_mb_in_slice == 0)) {
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);
read_next_nalu(p_in);
} while (!p_in->is_new_frame && !p_in->is_eof);
//if (first_mb_in_slice == 0) {
//FPRINT(g_debug_file0, "--- new frame ---- \n");
//}
//if (first_mb_in_slice == 0) {
//FPRINT(g_debug_file0, "--- new frame ---- \n");
//}
//-- set code input context
((MppPacketImpl *)pkt)->pos = p_in->strm.pbuf;
((MppPacketImpl *)pkt)->size = p_in->strm.strmbytes;
if (g_max_slice_data < p_in->strm.strmbytes)
{
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;
}
if (p_in->is_eof) {
mpp_packet_set_eos(pkt);
}

View File

@@ -109,9 +109,9 @@ __FAILED:
int main(int argc, char **argv)
{
//FILE *g_debug_file = NULL;
//RK_S32 m_max_bytes = 0;
//RK_S32 m_max_slice_data = 0;
//FILE *g_debug_file = NULL;
//RK_S32 m_max_bytes = 0;
//RK_S32 m_max_slice_data = 0;
MPP_RET ret = MPP_ERR_UNKNOW;
InputParams *pIn = mpp_calloc(InputParams, 1);
@@ -132,16 +132,16 @@ int main(int argc, char **argv)
do {
if (!pkt->size) {
FUN_CHECK(ret = h264d_read_one_frame(pIn, (MppPacket)pkt));
//if (g_debug_file1 == NULL)
//{
// 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);
mpp_log("---- decoder, read_one_frame Frame_no = %d \n", pIn->iFrmdecoded++);
//if (g_debug_file1 == NULL)
//{
// 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);
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));
//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) {
FUN_CHECK(ret = mpp_hal_reg_gen(pApi->hal, task));
//!< end of stream
@@ -166,23 +166,23 @@ __FAILED:
mpp_free(pkt);
mpp_free(task);
//g_debug_file = fopen("rk_debugfile_view0.txt", "rb");
//if(g_debug_file)
// fscanf(g_debug_file, "(max_bytes)%d, (max_slice_data)%d \n", &m_max_bytes, &m_max_slice_data);
//FCLOSE(g_debug_file);
//if (m_max_bytes < g_max_bytes)
//{
// m_max_bytes = g_max_bytes;
//}
//if (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+");
//if(g_debug_file)
// fprintf(g_debug_file, "(max_bytes)%d, (max_slice_data)%d \n", g_max_bytes, g_max_slice_data);
//g_debug_file = fopen("rk_debugfile_view0.txt", "rb");
//if(g_debug_file)
// fscanf(g_debug_file, "(max_bytes)%d, (max_slice_data)%d \n", &m_max_bytes, &m_max_slice_data);
//FCLOSE(g_debug_file);
//if (m_max_bytes < g_max_bytes)
//{
// m_max_bytes = g_max_bytes;
//}
//if (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+");
//if(g_debug_file)
// 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;
}