From ee62b364be0c30cba83b5ff10a3ca8c3e866ade6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 6 Apr 2015 20:33:58 +0200 Subject: h264: eliminate ff_h264_set_parameter_from_sps() That function currently does two things -- reinitializing the DSP contexts and setting low_delay based on the SPS values. The former more appropriately belongs in h264_slice_header_init(), while the latter only really makes sense in decode_slice_header(). The third call to ff_h264_set_parameter_from_sps(), done immediately after parsing a new SPS, appears to serve no useful purpose, so it is just dropped. Also, drop now unneeded H264Context.cur_chroma_format_idc. --- libavcodec/h264.c | 43 ------------------------------------------- 1 file changed, 43 deletions(-) (limited to 'libavcodec/h264.c') diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 5acc4634d7..4a3da24502 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -570,7 +570,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h) h->avctx = avctx; h->dequant_coeff_pps = -1; - h->cur_chroma_format_idc = -1; h->picture_structure = PICT_FRAME; h->slice_context_count = 1; @@ -1175,44 +1174,6 @@ int ff_h264_get_profile(SPS *sps) return profile; } -int ff_h264_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; - } - - if (h->avctx->has_b_frames < 2) - h->avctx->has_b_frames = !h->low_delay; - - if (h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma || - h->cur_chroma_format_idc != h->sps.chroma_format_idc) { - if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) { - h->avctx->bits_per_raw_sample = h->sps.bit_depth_luma; - h->cur_chroma_format_idc = h->sps.chroma_format_idc; - h->pixel_shift = h->sps.bit_depth_luma > 8; - - ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma, - h->sps.chroma_format_idc); - ff_h264chroma_init(&h->h264chroma, h->sps.bit_depth_chroma); - ff_h264qpel_init(&h->h264qpel, h->sps.bit_depth_luma); - ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma, - h->sps.chroma_format_idc); - ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma); - } else { - av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n", - h->sps.bit_depth_luma); - return AVERROR_INVALIDDATA; - } - } - return 0; -} - int ff_set_ref_count(H264Context *h, H264SliceContext *sl) { int ref_count[2], list_count; @@ -1559,10 +1520,6 @@ again: ff_h264_decode_seq_parameter_set(h); } - ret = ff_h264_set_parameter_from_sps(h); - if (ret < 0) - goto end; - break; case NAL_PPS: init_get_bits(&h->gb, ptr, bit_length); -- cgit v1.2.3