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);

            if (CONFIG_ERROR_RESILIENCE)

                ff_me_cmp_init(&h->mecc, h->avctx);

            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_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);

            if (CONFIG_ERROR_RESILIENCE)

                ff_me_cmp_init(&h->mecc, h->avctx);

            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 FUNC_0(H264Context *VAR_0)

{

    if (VAR_0->flags & CODEC_FLAG_LOW_DELAY ||

        (VAR_0->sps.bitstream_restriction_flag &&

         !VAR_0->sps.num_reorder_frames)) {

        if (VAR_0->avctx->has_b_frames > 1 || VAR_0->delayed_pic[0])

            av_log(VAR_0->avctx, AV_LOG_WARNING, "Delayed frames seen. "

                   "Reenabling low delay requires a codec flush.\n");

        else

            VAR_0->low_delay = 1;

    }



    if (VAR_0->avctx->has_b_frames < 2)

        VAR_0->avctx->has_b_frames = !VAR_0->low_delay;



    if (VAR_0->avctx->bits_per_raw_sample != VAR_0->sps.bit_depth_luma ||

        VAR_0->cur_chroma_format_idc      != VAR_0->sps.chroma_format_idc) {

        if (VAR_0->sps.bit_depth_luma >= 8 && VAR_0->sps.bit_depth_luma <= 10) {

            VAR_0->avctx->bits_per_raw_sample = VAR_0->sps.bit_depth_luma;

            VAR_0->cur_chroma_format_idc      = VAR_0->sps.chroma_format_idc;

            VAR_0->pixel_shift                = VAR_0->sps.bit_depth_luma > 8;



            ff_h264dsp_init(&VAR_0->h264dsp, VAR_0->sps.bit_depth_luma,

                            VAR_0->sps.chroma_format_idc);

            ff_h264chroma_init(&VAR_0->h264chroma, VAR_0->sps.bit_depth_chroma);

            ff_h264qpel_init(&VAR_0->h264qpel, VAR_0->sps.bit_depth_luma);

            ff_h264_pred_init(&VAR_0->hpc, VAR_0->avctx->codec_id, VAR_0->sps.bit_depth_luma,

                              VAR_0->sps.chroma_format_idc);

            if (CONFIG_ERROR_RESILIENCE)

                ff_me_cmp_init(&VAR_0->mecc, VAR_0->avctx);

            ff_videodsp_init(&VAR_0->vdsp, VAR_0->sps.bit_depth_luma);

        } else {

            av_log(VAR_0->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n",

                   VAR_0->sps.bit_depth_luma);

            return AVERROR_INVALIDDATA;

        }

    }

    return 0;

}

int FUNC_0(H264Context *VAR_0)
{ if (VAR_0->flags & CODEC_FLAG_LOW_DELAY ||
(VAR_0->sps.bitstream_restriction_flag &&
!VAR_0->sps.num_reorder_frames)) { if (VAR_0->avctx->has_b_frames > 1 || VAR_0->delayed_pic[0])
av_log(VAR_0->avctx, AV_LOG_WARNING, "Delayed frames seen. "
"Reenabling low delay requires a codec flush.\n"); else
VAR_0->low_delay = 1; } if (VAR_0->avctx->has_b_frames < 2)
VAR_0->avctx->has_b_frames = !VAR_0->low_delay; if (VAR_0->avctx->bits_per_raw_sample != VAR_0->sps.bit_depth_luma ||
VAR_0->cur_chroma_format_idc      != VAR_0->sps.chroma_format_idc) { if (VAR_0->sps.bit_depth_luma >= 8 && VAR_0->sps.bit_depth_luma <= 10) { VAR_0->avctx->bits_per_raw_sample = VAR_0->sps.bit_depth_luma; VAR_0->cur_chroma_format_idc      = VAR_0->sps.chroma_format_idc; VAR_0->pixel_shift                = VAR_0->sps.bit_depth_luma > 8; ff_h264dsp_init(&VAR_0->h264dsp, VAR_0->sps.bit_depth_luma,
VAR_0->sps.chroma_format_idc); ff_h264chroma_init(&VAR_0->h264chroma, VAR_0->sps.bit_depth_chroma); ff_h264qpel_init(&VAR_0->h264qpel, VAR_0->sps.bit_depth_luma); ff_h264_pred_init(&VAR_0->hpc, VAR_0->avctx->codec_id, VAR_0->sps.bit_depth_luma,
VAR_0->sps.chroma_format_idc); if (CONFIG_ERROR_RESILIENCE)
ff_me_cmp_init(&VAR_0->mecc, VAR_0->avctx); ff_videodsp_init(&VAR_0->vdsp, VAR_0->sps.bit_depth_luma); } else { av_log(VAR_0->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n",
VAR_0->sps.bit_depth_luma); return AVERROR_INVALIDDATA; } } return 0; }