static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread)

{

    HEVCContext *s  = avctxt->priv_data;

    int ctb_size    = 1 << s->ps.sps->log2_ctb_size;

    int more_data   = 1;

    int x_ctb       = 0;

    int y_ctb       = 0;

    int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs];



    if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) {

        av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n");

        return AVERROR_INVALIDDATA;

    }



    if (s->sh.dependent_slice_segment_flag) {

        int prev_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1];

        if (s->tab_slice_address[prev_rs] != s->sh.slice_addr) {

            av_log(s->avctx, AV_LOG_ERROR, "Previous slice segment missing\n");

            return AVERROR_INVALIDDATA;

        }

    }



    while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) {

        int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];



        x_ctb = (ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size;

        y_ctb = (ctb_addr_rs / ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size;

        hls_decode_neighbour(s, x_ctb, y_ctb, ctb_addr_ts);



        ff_hevc_cabac_init(s, ctb_addr_ts);



        hls_sao_param(s, x_ctb >> s->ps.sps->log2_ctb_size, y_ctb >> s->ps.sps->log2_ctb_size);



        s->deblock[ctb_addr_rs].beta_offset = s->sh.beta_offset;

        s->deblock[ctb_addr_rs].tc_offset   = s->sh.tc_offset;

        s->filter_slice_edges[ctb_addr_rs]  = s->sh.slice_loop_filter_across_slices_enabled_flag;



        more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0);

        if (more_data < 0) {

            s->tab_slice_address[ctb_addr_rs] = -1;

            return more_data;

        }





        ctb_addr_ts++;

        ff_hevc_save_states(s, ctb_addr_ts);

        ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size);

    }



    if (x_ctb + ctb_size >= s->ps.sps->width &&

        y_ctb + ctb_size >= s->ps.sps->height)

        ff_hevc_hls_filter(s, x_ctb, y_ctb, ctb_size);



    return ctb_addr_ts;

}

static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread)

{

    HEVCContext *s  = avctxt->priv_data;

    int ctb_size    = 1 << s->ps.sps->log2_ctb_size;

    int more_data   = 1;

    int x_ctb       = 0;

    int y_ctb       = 0;

    int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs];



    if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) {

        av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n");

        return AVERROR_INVALIDDATA;

    }



    if (s->sh.dependent_slice_segment_flag) {

        int prev_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1];

        if (s->tab_slice_address[prev_rs] != s->sh.slice_addr) {

            av_log(s->avctx, AV_LOG_ERROR, "Previous slice segment missing\n");

            return AVERROR_INVALIDDATA;

        }

    }



    while (more_data && ctb_addr_ts < s->ps.sps->ctb_size) {

        int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts];



        x_ctb = (ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size;

        y_ctb = (ctb_addr_rs / ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size;

        hls_decode_neighbour(s, x_ctb, y_ctb, ctb_addr_ts);



        ff_hevc_cabac_init(s, ctb_addr_ts);



        hls_sao_param(s, x_ctb >> s->ps.sps->log2_ctb_size, y_ctb >> s->ps.sps->log2_ctb_size);



        s->deblock[ctb_addr_rs].beta_offset = s->sh.beta_offset;

        s->deblock[ctb_addr_rs].tc_offset   = s->sh.tc_offset;

        s->filter_slice_edges[ctb_addr_rs]  = s->sh.slice_loop_filter_across_slices_enabled_flag;



        more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0);

        if (more_data < 0) {

            s->tab_slice_address[ctb_addr_rs] = -1;

            return more_data;

        }





        ctb_addr_ts++;

        ff_hevc_save_states(s, ctb_addr_ts);

        ff_hevc_hls_filters(s, x_ctb, y_ctb, ctb_size);

    }



    if (x_ctb + ctb_size >= s->ps.sps->width &&

        y_ctb + ctb_size >= s->ps.sps->height)

        ff_hevc_hls_filter(s, x_ctb, y_ctb, ctb_size);



    return ctb_addr_ts;

}

        ff_hevc_cabac_init(s, ctb_addr_ts);         ff_hevc_cabac_init(s, ctb_addr_ts);             s->tab_slice_address[ctb_addr_rs] = -1;             return more_data;
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1)

{

    HEVCContext *s  = VAR_0->priv_data;

    int VAR_2    = 1 << s->ps.sps->log2_ctb_size;

    int VAR_3   = 1;

    int VAR_4       = 0;

    int VAR_5       = 0;

    int VAR_6 = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs];



    if (!VAR_6 && s->sh.dependent_slice_segment_flag) {

        av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n");

        return AVERROR_INVALIDDATA;

    }



    if (s->sh.dependent_slice_segment_flag) {

        int VAR_7 = s->ps.pps->ctb_addr_ts_to_rs[VAR_6 - 1];

        if (s->tab_slice_address[VAR_7] != s->sh.slice_addr) {

            av_log(s->avctx, AV_LOG_ERROR, "Previous slice segment missing\n");

            return AVERROR_INVALIDDATA;

        }

    }



    while (VAR_3 && VAR_6 < s->ps.sps->VAR_2) {

        int VAR_8 = s->ps.pps->ctb_addr_ts_to_rs[VAR_6];



        VAR_4 = (VAR_8 % ((s->ps.sps->width + VAR_2 - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size;

        VAR_5 = (VAR_8 / ((s->ps.sps->width + VAR_2 - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size;

        hls_decode_neighbour(s, VAR_4, VAR_5, VAR_6);



        ff_hevc_cabac_init(s, VAR_6);



        hls_sao_param(s, VAR_4 >> s->ps.sps->log2_ctb_size, VAR_5 >> s->ps.sps->log2_ctb_size);



        s->deblock[VAR_8].beta_offset = s->sh.beta_offset;

        s->deblock[VAR_8].tc_offset   = s->sh.tc_offset;

        s->filter_slice_edges[VAR_8]  = s->sh.slice_loop_filter_across_slices_enabled_flag;



        VAR_3 = hls_coding_quadtree(s, VAR_4, VAR_5, s->ps.sps->log2_ctb_size, 0);

        if (VAR_3 < 0) {

            s->tab_slice_address[VAR_8] = -1;

            return VAR_3;

        }





        VAR_6++;

        ff_hevc_save_states(s, VAR_6);

        ff_hevc_hls_filters(s, VAR_4, VAR_5, VAR_2);

    }



    if (VAR_4 + VAR_2 >= s->ps.sps->width &&

        VAR_5 + VAR_2 >= s->ps.sps->height)

        ff_hevc_hls_filter(s, VAR_4, VAR_5, VAR_2);



    return VAR_6;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1)
{ HEVCContext *s  = VAR_0->priv_data; int VAR_2    = 1 << s->ps.sps->log2_ctb_size; int VAR_3   = 1; int VAR_4       = 0; int VAR_5       = 0; int VAR_6 = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; if (!VAR_6 && s->sh.dependent_slice_segment_flag) { av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n"); return AVERROR_INVALIDDATA; } if (s->sh.dependent_slice_segment_flag) { int VAR_7 = s->ps.pps->ctb_addr_ts_to_rs[VAR_6 - 1]; if (s->tab_slice_address[VAR_7] != s->sh.slice_addr) { av_log(s->avctx, AV_LOG_ERROR, "Previous slice segment missing\n"); return AVERROR_INVALIDDATA; } } while (VAR_3 && VAR_6 < s->ps.sps->VAR_2) { int VAR_8 = s->ps.pps->ctb_addr_ts_to_rs[VAR_6]; VAR_4 = (VAR_8 % ((s->ps.sps->width + VAR_2 - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; VAR_5 = (VAR_8 / ((s->ps.sps->width + VAR_2 - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; hls_decode_neighbour(s, VAR_4, VAR_5, VAR_6); ff_hevc_cabac_init(s, VAR_6); hls_sao_param(s, VAR_4 >> s->ps.sps->log2_ctb_size, VAR_5 >> s->ps.sps->log2_ctb_size); s->deblock[VAR_8].beta_offset = s->sh.beta_offset; s->deblock[VAR_8].tc_offset   = s->sh.tc_offset; s->filter_slice_edges[VAR_8]  = s->sh.slice_loop_filter_across_slices_enabled_flag; VAR_3 = hls_coding_quadtree(s, VAR_4, VAR_5, s->ps.sps->log2_ctb_size, 0); if (VAR_3 < 0) { s->tab_slice_address[VAR_8] = -1; return VAR_3; } VAR_6++; ff_hevc_save_states(s, VAR_6); ff_hevc_hls_filters(s, VAR_4, VAR_5, VAR_2); } if (VAR_4 + VAR_2 >= s->ps.sps->width &&
VAR_5 + VAR_2 >= s->ps.sps->height)
ff_hevc_hls_filter(s, VAR_4, VAR_5, VAR_2); return VAR_6; }