FFmpeg AVCodecContext结构体debug变量剖析
背景說明
????????????當設置AVCodecContext結構體debug字段為1的時候,將會打印如下的調試信息:1)對每一個分片打印詳細記錄? 2)打印SPS/PPS參數值
這兩項參數對于解碼來說,相當重要,IDR幀是解碼的關鍵,SPS/PPS記錄了解碼圖像相關參數
代碼剖析
1)static int h264_slice_init(H264Context *h, H264SliceContext *sl, const H2645NAL *nal)
??? if (h->avctx->debug & FF_DEBUG_PICT_INFO) {
??????? av_log(h->avctx, AV_LOG_DEBUG,
?????????????? "slice:%d %s mb:%d %c%s%s frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n",
?????????????? sl->slice_num,
?????????????? (h->picture_structure == PICT_FRAME ? "F" : h->picture_structure == PICT_TOP_FIELD ? "T" : "B"),
?????????????? sl->mb_y * h->mb_width + sl->mb_x,
?????????????? av_get_picture_type_char(sl->slice_type),
?????????????? sl->slice_type_fixed ? " fix" : "",
?????????????? nal->type == H264_NAL_IDR_SLICE ? " IDR" : "",
?????????????? h->poc.frame_num,
?????????????? h->cur_pic_ptr->field_poc[0],
?????????????? h->cur_pic_ptr->field_poc[1],
?????????????? sl->ref_count[0], sl->ref_count[1],
?????????????? sl->qscale,
?????????????? sl->deblocking_filter,
?????????????? sl->slice_alpha_c0_offset, sl->slice_beta_offset,
?????????????? sl->pwt.use_weight,
?????????????? sl->pwt.use_weight == 1 && sl->pwt.use_weight_chroma ? "c" : "",
?????????????? sl->slice_type == AV_PICTURE_TYPE_B ? (sl->direct_spatial_mv_pred ? "SPAT" : "TEMP") : "");
??? }
打印:
slice:1 F mb:0 I IDR frame:0 poc:65536/65536 ref:0/0 qp:25 loop:1:0:0 weight:0
slice:1 F mb:0 P frame:4 poc:65540/65540 ref:1/1 qp:26 loop:1:0:0 weight:0
/* do all the per-slice initialization needed before we can start decoding the
?* actual MBs */
2)int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps, int bit_length)
??? if (avctx->debug & FF_DEBUG_PICT_INFO) {
??????? av_log(avctx, AV_LOG_DEBUG,
?????????????? "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n",
?????????????? pps_id, pps->sps_id,
?????????????? pps->cabac ? "CABAC" : "CAVLC",
?????????????? pps->slice_group_count,
?????????????? pps->ref_count[0], pps->ref_count[1],
?????????????? pps->weighted_pred ? "weighted" : "",
?????????????? pps->init_qp, pps->init_qs, pps->chroma_qp_index_offset[0], pps->chroma_qp_index_offset[1],
?????????????? pps->deblocking_filter_parameters_present ? "LPAR" : "",
?????????????? pps->constrained_intra_pred ? "CONSTR" : "",
?????????????? pps->redundant_pic_cnt_present ? "REDU" : "",
?????????????? pps->transform_8x8_mode ? "8x8DCT" : "");
??? }
打印
pps:0 sps:0 CAVLC slice_groups:1 ref:1/1? qp:26/26/0/0 LPAR ?
3)int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps, int ignore_truncation)
??? if (avctx->debug & FF_DEBUG_PICT_INFO) {
??????? static const char csp[4][5] = { "Gray", "420", "422", "444" };
??????? av_log(avctx, AV_LOG_DEBUG,
?????????????? "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32"/%"PRId32" b%d reo:%d\n",
?????????????? sps_id, sps->profile_idc, sps->level_idc,
?????????????? sps->poc_type,
?????????????? sps->ref_frame_count,
?????????????? sps->mb_width, sps->mb_height,
?????????????? sps->frame_mbs_only_flag ? "FRM" : (sps->mb_aff ? "MB-AFF" : "PIC-AFF"),
?????????????? sps->direct_8x8_inference_flag ? "8B8" : "",
?????????????? sps->crop_left, sps->crop_right,
?????????????? sps->crop_top, sps->crop_bottom,
?????????????? sps->vui_parameters_present_flag ? "VUI" : "",
?????????????? csp[sps->chroma_format_idc],
?????????????? sps->timing_info_present_flag ? sps->num_units_in_tick : 0,
?????????????? sps->timing_info_present_flag ? sps->time_scale : 0,
?????????????? sps->bit_depth_luma,
?????????????? sps->bitstream_restriction_flag ? sps->num_reorder_frames : -1
?????????????? );
??? }
打印
sps:0 profile:66/42 poc:0 ref:1 120x68 FRM 8B8 crop:0/0/0/8 VUI 420 1800/90000 b8 reo:-1
轉載于:https://blog.51cto.com/fengyuzaitu/2058590
總結
以上是生活随笔為你收集整理的FFmpeg AVCodecContext结构体debug变量剖析的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 升级Hbase,解决bug问题
- 下一篇: 【Nginx-20180108】Ngin