本文共 3029 字,大约阅读时间需要 10 分钟。
前面博文已经说过,在JM8.6编码端如何开启trace_enc.txt功能以及如何利用trace_enc.txt文件的信息来分析码流,在此,不再赘述.下面来看看在解码端如何开启trace_dec.txt. 在JM8.6解码端的define.h文件中有:
#if defined _DEBUG#define TRACE 0 //!< 0:Trace off 1:Trace on#else#define TRACE 0 //!< 0:Trace off 1:Trace on#endif
只需要把代码改为下面的即可开启trace_dec.txt的功能:
#if defined _DEBUG#define TRACE 1 //!< 0:Trace off 1:Trace on#else#define TRACE 0 //!< 0:Trace off 1:Trace on#endif
这里面实际上用到了C语言中的条件编译, 如果把控制trace的开关放在配置文件中,其实也是可以的,但是,程序中就多了很多要编译的代码,这样不好,影响性能. 所以,还是用条件编译比较好.
生成的trace_dec.txt文件的部分内容为:
Annex B NALU w/ long startcode, len 8, forbidden_bit 0, nal_reference_idc 3, nal_unit_type 7
@0 SPS: profile_idc 01000010 ( 66)
@8 SPS: constrained_set0_flag 0 ( 0) @9 SPS: constrained_set1_flag 0 ( 0) @10 SPS: constrained_set2_flag 0 ( 0) @11 SPS: reserved_zero_5bits 00000 ( 0) @16 SPS: level_idc 00011110 ( 30) @24 SPS: seq_parameter_set_id 1 ( 0) @25 SPS: log2_max_frame_num_minus4 1 ( 0) @26 SPS: pic_order_cnt_type 1 ( 0) @27 SPS: log2_max_pic_order_cnt_lsb_minus4 1 ( 0) @28 SPS: num_ref_frames 0001011 ( 10) @35 SPS: gaps_in_frame_num_value_allowed_flag 0 ( 0) @36 SPS: pic_width_in_mbs_minus1 0001011 ( 10) @43 SPS: pic_height_in_map_units_minus1 0001001 ( 8) @50 SPS: frame_mbs_only_flag 1 ( 1) @51 SPS: direct_8x8_inference_flag 0 ( 0) @52 SPS: frame_cropping_flag 0 ( 0) @53 SPS: vui_parameters_present_flag 0 ( 0) Annex B NALU w/ long startcode, len 5, forbidden_bit 0, nal_reference_idc 3, nal_unit_type 8@54 PPS: pic_parameter_set_id 1 ( 0)
@55 PPS: seq_parameter_set_id 1 ( 0) @56 PPS: entropy_coding_mode_flag 0 ( 0) @57 PPS: pic_order_present_flag 0 ( 0) @58 PPS: num_slice_groups_minus1 1 ( 0) @59 PPS: num_ref_idx_l0_active_minus1 0001010 ( 9) @66 PPS: num_ref_idx_l1_active_minus1 0001010 ( 9) @73 PPS: weighted prediction flag 0 ( 0) @74 PPS: weighted_bipred_idc 00 ( 0) @76 PPS: pic_init_qp_minus26 1 ( 0) @77 PPS: pic_init_qs_minus26 1 ( 0) @78 PPS: chroma_qp_index_offset 1 ( 0) @79 PPS: deblocking_filter_control_present_flag 0 ( 0) @80 PPS: constrained_intra_pred_flag 0 ( 0) @81 PPS: redundant_pic_cnt_present_flag 0 ( 0) Last NALU in FileAnnex B NALU w/ long startcode, len 2741, forbidden_bit 0, nal_reference_idc 3, nal_unit_type 5
@82 SH: first_mb_in_slice 1 ( 0)
@83 SH: slice_type 0001000 ( 7) @90 SH: pic_parameter_set_id 1 ( 0) @91 SH: frame_num 0000 ( 0) @95 SH: idr_pic_id 1 ( 0) @96 SH: pic_order_cnt_lsb 0000 ( 0) @100 SH: no_output_of_prior_pics_flag 0 ( 0) @101 SH: long_term_reference_flag 0 ( 0) @102 SH: slice_qp_delta 00100 ( 2)*********** POC: 0 (I/P) MB: 0 Slice: 0 Type 2 **********
@107 mb_type 1 ( 0) @108 intra4x4_pred_mode 1 ( -1) @109 intra4x4_pred_mode 0001 ( 1) @113 intra4x4_pred_mode 1 ( -1) @114 intra4x4_pred_mode 0110 ( 6) @118 intra4x4_pred_mode 0001 ( 1) @122 intra4x4_pred_mode 0111 ( 7) @126 intra4x4_pred_mode 1 ( -1) @127 intra4x4_pred_mode 1 ( -1) @128 intra4x4_pred_mode 0000 ( 0)......
根据上述内容,可以辅助分析JM8.6解码端是如何对码流进行解析的(即如何解析一个NALU).
转载地址:http://xjzti.baihongyu.com/