亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

FFmpeg AVCodecContext結構體剖析

發布時間:2020-08-10 17:00:17 來源:網絡 閱讀:1402 作者:fengyuzaitu 欄目:編程語言

flag變量分析

嘗試降低解碼延時:CODEC_FLAG_LOW_DELAY


#define CODEC_FLAG_LOW_DELAY????? 0x00080000 ///< Force low delay.

h364 解碼中
int ff_h364_set_parameter_from_sps(H264Context *h)

??? if (h->flags & CODEC_FLAG_LOW_DELAY ||
??????? (h->sps.bitstream_restriction_flag &&
???????? !h->sps.num_reorder_frames)) {
??????? if (h->avctx->has_b_frames > 1 || h->delayed_pic[0])
??????????? av_log(h->avctx, AV_LOG_WARNING, "Delayed frames seen. "
?????????????????? "Reenabling low delay requires a codec flush.\n");
??????? else
??????????? h->low_delay = 1;
??? }


結果

avcodec_decode_video2接收到SPS/PPS,和I幀碼流之后,測試顯示需要20毫秒之后,解碼出圖像,跟CODEC_FLAG_LOW_DELAY解碼標志位,優化快速解碼出圖像,沒有任何的效果
場景
?目前使用2.3.6版本設置AVCodecContext的flags:
?flags |= CODEC_FLAG_LOW_DELAY
?沒有任何的效果
2.3.6版本
avcodec.h (libavcodec) line 744 : #define CODEC_FLAG_LOW_DELAY????? 0x00080000 ///< Force low delay.
/**
?* @deprecated use the flag "naq" in the "mpv_flags" private option of the
?* mpegvideo encoders
?*/
#define CODEC_FLAG_NORMALIZE_AQP? 0x00020000
#endif
#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
#define CODEC_FLAG_LOW_DELAY????? 0x00080000 ///< Force low delay.

4.0.2版本
avcodec.h (libavcodec) line 878 : #define AV_CODEC_FLAG_LOW_DELAY?????? (1 << 19)
/* encoding support
?? These flags can be passed in AVCodecContext.flags before initialization.
?? Note: Not everything is supported yet.
*/
/**
?* Force low delay.
?*/
#define AV_CODEC_FLAG_LOW_DELAY?????? (1 << 19)



debug變量分析

????????????當設置AVCodecContext結構體debug字段為1的時候,將會打印如下的調試信息:1)對每一個分片打印詳細記錄? 2)打印SPS/PPS參數值
這兩項參數對于解碼來說,相當重要,IDR幀是解碼的關鍵,SPS/PPS記錄了解碼圖像相關參數


代碼剖析
1)static int h364_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_h364_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_h364_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

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

雅江县| 石家庄市| 拉萨市| 平江县| 河东区| 明溪县| 平湖市| 托克逊县| 翁源县| 锡林郭勒盟| 平远县| 乌苏市| 宣城市| 阳江市| 监利县| 县级市| 旬邑县| 子长县| 曲沃县| 庄河市| 垣曲县| 庐江县| 定襄县| 鄂伦春自治旗| 颍上县| 万年县| 伊金霍洛旗| 木兰县| 新绛县| 堆龙德庆县| 四川省| 铁力市| 略阳县| 闽清县| 自贡市| 交城县| 福安市| 丰宁| 台安县| 涡阳县| 陆丰市|