static int hevc_frame_start(HEVCContext *s)

{

    HEVCLocalContext *lc = &s->HEVClc;

    int ret;



    memset(s->horizontal_bs, 0, 2 * s->bs_width * (s->bs_height + 1));

    memset(s->vertical_bs,   0, 2 * s->bs_width * (s->bs_height + 1));

    memset(s->cbf_luma,      0, s->sps->min_tb_width * s->sps->min_tb_height);

    memset(s->is_pcm,        0, s->sps->min_pu_width * s->sps->min_pu_height);



    lc->start_of_tiles_x = 0;

    s->is_decoded        = 0;




    if (s->pps->tiles_enabled_flag)

        lc->end_of_tiles_x = s->pps->column_width[0] << s->sps->log2_ctb_size;



    ret = ff_hevc_set_new_ref(s, s->sps->sao_enabled ? &s->sao_frame : &s->frame,

                              s->poc);

    if (ret < 0)

        goto fail;



    ret = ff_hevc_frame_rps(s);

    if (ret < 0) {

        av_log(s->avctx, AV_LOG_ERROR, "Error constructing the frame RPS.\n");

        goto fail;

    }



    ret = set_side_data(s);

    if (ret < 0)

        goto fail;



    av_frame_unref(s->output_frame);

    ret = ff_hevc_output_frame(s, s->output_frame, 0);

    if (ret < 0)

        goto fail;



    ff_thread_finish_setup(s->avctx);



    return 0;



fail:

    if (s->ref)

        ff_thread_report_progress(&s->ref->tf, INT_MAX, 0);

    s->ref = NULL;

    return ret;

}
static int hevc_frame_start(HEVCContext *s)

{

    HEVCLocalContext *lc = &s->HEVClc;

    int ret;



    memset(s->horizontal_bs, 0, 2 * s->bs_width * (s->bs_height + 1));

    memset(s->vertical_bs,   0, 2 * s->bs_width * (s->bs_height + 1));

    memset(s->cbf_luma,      0, s->sps->min_tb_width * s->sps->min_tb_height);

    memset(s->is_pcm,        0, s->sps->min_pu_width * s->sps->min_pu_height);



    lc->start_of_tiles_x = 0;

    s->is_decoded        = 0;




    if (s->pps->tiles_enabled_flag)

        lc->end_of_tiles_x = s->pps->column_width[0] << s->sps->log2_ctb_size;



    ret = ff_hevc_set_new_ref(s, s->sps->sao_enabled ? &s->sao_frame : &s->frame,

                              s->poc);

    if (ret < 0)

        goto fail;



    ret = ff_hevc_frame_rps(s);

    if (ret < 0) {

        av_log(s->avctx, AV_LOG_ERROR, "Error constructing the frame RPS.\n");

        goto fail;

    }



    ret = set_side_data(s);

    if (ret < 0)

        goto fail;



    av_frame_unref(s->output_frame);

    ret = ff_hevc_output_frame(s, s->output_frame, 0);

    if (ret < 0)

        goto fail;



    ff_thread_finish_setup(s->avctx);



    return 0;



fail:

    if (s->ref)

        ff_thread_report_progress(&s->ref->tf, INT_MAX, 0);

    s->ref = NULL;

    return ret;

}
static int FUNC_0(HEVCContext *VAR_0)

{

    HEVCLocalContext *lc = &VAR_0->HEVClc;

    int VAR_1;



    memset(VAR_0->horizontal_bs, 0, 2 * VAR_0->bs_width * (VAR_0->bs_height + 1));

    memset(VAR_0->vertical_bs,   0, 2 * VAR_0->bs_width * (VAR_0->bs_height + 1));

    memset(VAR_0->cbf_luma,      0, VAR_0->sps->min_tb_width * VAR_0->sps->min_tb_height);

    memset(VAR_0->is_pcm,        0, VAR_0->sps->min_pu_width * VAR_0->sps->min_pu_height);



    lc->start_of_tiles_x = 0;

    VAR_0->is_decoded        = 0;




    if (VAR_0->pps->tiles_enabled_flag)

        lc->end_of_tiles_x = VAR_0->pps->column_width[0] << VAR_0->sps->log2_ctb_size;



    VAR_1 = ff_hevc_set_new_ref(VAR_0, VAR_0->sps->sao_enabled ? &VAR_0->sao_frame : &VAR_0->frame,

                              VAR_0->poc);

    if (VAR_1 < 0)

        goto fail;



    VAR_1 = ff_hevc_frame_rps(VAR_0);

    if (VAR_1 < 0) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "Error constructing the frame RPS.\n");

        goto fail;

    }



    VAR_1 = set_side_data(VAR_0);

    if (VAR_1 < 0)

        goto fail;



    av_frame_unref(VAR_0->output_frame);

    VAR_1 = ff_hevc_output_frame(VAR_0, VAR_0->output_frame, 0);

    if (VAR_1 < 0)

        goto fail;



    ff_thread_finish_setup(VAR_0->avctx);



    return 0;



fail:

    if (VAR_0->ref)

        ff_thread_report_progress(&VAR_0->ref->tf, INT_MAX, 0);

    VAR_0->ref = NULL;

    return VAR_1;

}
static int FUNC_0(HEVCContext *VAR_0)
{ HEVCLocalContext *lc = &VAR_0->HEVClc; int VAR_1; memset(VAR_0->horizontal_bs, 0, 2 * VAR_0->bs_width * (VAR_0->bs_height + 1)); memset(VAR_0->vertical_bs,   0, 2 * VAR_0->bs_width * (VAR_0->bs_height + 1)); memset(VAR_0->cbf_luma,      0, VAR_0->sps->min_tb_width * VAR_0->sps->min_tb_height); memset(VAR_0->is_pcm,        0, VAR_0->sps->min_pu_width * VAR_0->sps->min_pu_height); lc->start_of_tiles_x = 0; VAR_0->is_decoded        = 0; if (VAR_0->pps->tiles_enabled_flag)
lc->end_of_tiles_x = VAR_0->pps->column_width[0] << VAR_0->sps->log2_ctb_size; VAR_1 = ff_hevc_set_new_ref(VAR_0, VAR_0->sps->sao_enabled ? &VAR_0->sao_frame : &VAR_0->frame,
VAR_0->poc); if (VAR_1 < 0)
goto fail; VAR_1 = ff_hevc_frame_rps(VAR_0); if (VAR_1 < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error constructing the frame RPS.\n"); goto fail; } VAR_1 = set_side_data(VAR_0); if (VAR_1 < 0)
goto fail; av_frame_unref(VAR_0->output_frame); VAR_1 = ff_hevc_output_frame(VAR_0, VAR_0->output_frame, 0); if (VAR_1 < 0)
goto fail; ff_thread_finish_setup(VAR_0->avctx); return 0; fail:
if (VAR_0->ref)
ff_thread_report_progress(&VAR_0->ref->tf, INT_MAX, 0); VAR_0->ref = NULL; return VAR_1; }