static int hls_coding_quadtree(HEVCContext *s, int x0, int y0,

                               int log2_cb_size, int cb_depth)

{

    HEVCLocalContext *lc = s->HEVClc;

    const int cb_size    = 1 << log2_cb_size;

    int ret;



    lc->ct.depth = cb_depth;

    if (x0 + cb_size <= s->sps->width  &&

        y0 + cb_size <= s->sps->height &&

        log2_cb_size > s->sps->log2_min_cb_size) {

        SAMPLE(s->split_cu_flag, x0, y0) =

            ff_hevc_split_coding_unit_flag_decode(s, cb_depth, x0, y0);

    } else {

        SAMPLE(s->split_cu_flag, x0, y0) =

            (log2_cb_size > s->sps->log2_min_cb_size);

    }

    if (s->pps->cu_qp_delta_enabled_flag &&

        log2_cb_size >= s->sps->log2_ctb_size - s->pps->diff_cu_qp_delta_depth) {

        lc->tu.is_cu_qp_delta_coded = 0;

        lc->tu.cu_qp_delta          = 0;

    }



    if (SAMPLE(s->split_cu_flag, x0, y0)) {

        const int cb_size_split = cb_size >> 1;

        const int x1 = x0 + cb_size_split;

        const int y1 = y0 + cb_size_split;



        int more_data = 0;



        more_data = hls_coding_quadtree(s, x0, y0, log2_cb_size - 1, cb_depth + 1);

        if (more_data < 0)

            return more_data;



        if (more_data && x1 < s->sps->width)

            more_data = hls_coding_quadtree(s, x1, y0, log2_cb_size - 1, cb_depth + 1);

        if (more_data && y1 < s->sps->height)

            more_data = hls_coding_quadtree(s, x0, y1, log2_cb_size - 1, cb_depth + 1);

        if (more_data && x1 < s->sps->width &&

            y1 < s->sps->height) {

            return hls_coding_quadtree(s, x1, y1, log2_cb_size - 1, cb_depth + 1);

        }

        if (more_data)

            return ((x1 + cb_size_split) < s->sps->width ||

                    (y1 + cb_size_split) < s->sps->height);

        else

            return 0;

    } else {

        ret = hls_coding_unit(s, x0, y0, log2_cb_size);

        if (ret < 0)

            return ret;

        if ((!((x0 + cb_size) %

               (1 << (s->sps->log2_ctb_size))) ||

             (x0 + cb_size >= s->sps->width)) &&

            (!((y0 + cb_size) %

               (1 << (s->sps->log2_ctb_size))) ||

             (y0 + cb_size >= s->sps->height))) {

            int end_of_slice_flag = ff_hevc_end_of_slice_flag_decode(s);

            return !end_of_slice_flag;

        } else {

            return 1;

        }

    }



    return 0;

}

static int hls_coding_quadtree(HEVCContext *s, int x0, int y0,

                               int log2_cb_size, int cb_depth)

{

    HEVCLocalContext *lc = s->HEVClc;

    const int cb_size    = 1 << log2_cb_size;

    int ret;



    lc->ct.depth = cb_depth;

    if (x0 + cb_size <= s->sps->width  &&

        y0 + cb_size <= s->sps->height &&

        log2_cb_size > s->sps->log2_min_cb_size) {

        SAMPLE(s->split_cu_flag, x0, y0) =

            ff_hevc_split_coding_unit_flag_decode(s, cb_depth, x0, y0);

    } else {

        SAMPLE(s->split_cu_flag, x0, y0) =

            (log2_cb_size > s->sps->log2_min_cb_size);

    }

    if (s->pps->cu_qp_delta_enabled_flag &&

        log2_cb_size >= s->sps->log2_ctb_size - s->pps->diff_cu_qp_delta_depth) {

        lc->tu.is_cu_qp_delta_coded = 0;

        lc->tu.cu_qp_delta          = 0;

    }



    if (SAMPLE(s->split_cu_flag, x0, y0)) {

        const int cb_size_split = cb_size >> 1;

        const int x1 = x0 + cb_size_split;

        const int y1 = y0 + cb_size_split;



        int more_data = 0;



        more_data = hls_coding_quadtree(s, x0, y0, log2_cb_size - 1, cb_depth + 1);

        if (more_data < 0)

            return more_data;



        if (more_data && x1 < s->sps->width)

            more_data = hls_coding_quadtree(s, x1, y0, log2_cb_size - 1, cb_depth + 1);

        if (more_data && y1 < s->sps->height)

            more_data = hls_coding_quadtree(s, x0, y1, log2_cb_size - 1, cb_depth + 1);

        if (more_data && x1 < s->sps->width &&

            y1 < s->sps->height) {

            return hls_coding_quadtree(s, x1, y1, log2_cb_size - 1, cb_depth + 1);

        }

        if (more_data)

            return ((x1 + cb_size_split) < s->sps->width ||

                    (y1 + cb_size_split) < s->sps->height);

        else

            return 0;

    } else {

        ret = hls_coding_unit(s, x0, y0, log2_cb_size);

        if (ret < 0)

            return ret;

        if ((!((x0 + cb_size) %

               (1 << (s->sps->log2_ctb_size))) ||

             (x0 + cb_size >= s->sps->width)) &&

            (!((y0 + cb_size) %

               (1 << (s->sps->log2_ctb_size))) ||

             (y0 + cb_size >= s->sps->height))) {

            int end_of_slice_flag = ff_hevc_end_of_slice_flag_decode(s);

            return !end_of_slice_flag;

        } else {

            return 1;

        }

    }



    return 0;

}

        if (more_data && x1 < s->sps->width)         if (more_data && y1 < s->sps->height)
static int FUNC_0(HEVCContext *VAR_0, int VAR_1, int VAR_2,

                               int VAR_3, int VAR_4)

{

    HEVCLocalContext *lc = VAR_0->HEVClc;

    const int VAR_5    = 1 << VAR_3;

    int VAR_6;



    lc->ct.depth = VAR_4;

    if (VAR_1 + VAR_5 <= VAR_0->sps->width  &&

        VAR_2 + VAR_5 <= VAR_0->sps->height &&

        VAR_3 > VAR_0->sps->log2_min_cb_size) {

        SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2) =

            ff_hevc_split_coding_unit_flag_decode(VAR_0, VAR_4, VAR_1, VAR_2);

    } else {

        SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2) =

            (VAR_3 > VAR_0->sps->log2_min_cb_size);

    }

    if (VAR_0->pps->cu_qp_delta_enabled_flag &&

        VAR_3 >= VAR_0->sps->log2_ctb_size - VAR_0->pps->diff_cu_qp_delta_depth) {

        lc->tu.is_cu_qp_delta_coded = 0;

        lc->tu.cu_qp_delta          = 0;

    }



    if (SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2)) {

        const int VAR_7 = VAR_5 >> 1;

        const int VAR_8 = VAR_1 + VAR_7;

        const int VAR_9 = VAR_2 + VAR_7;



        int VAR_10 = 0;



        VAR_10 = FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3 - 1, VAR_4 + 1);

        if (VAR_10 < 0)

            return VAR_10;



        if (VAR_10 && VAR_8 < VAR_0->sps->width)

            VAR_10 = FUNC_0(VAR_0, VAR_8, VAR_2, VAR_3 - 1, VAR_4 + 1);

        if (VAR_10 && VAR_9 < VAR_0->sps->height)

            VAR_10 = FUNC_0(VAR_0, VAR_1, VAR_9, VAR_3 - 1, VAR_4 + 1);

        if (VAR_10 && VAR_8 < VAR_0->sps->width &&

            VAR_9 < VAR_0->sps->height) {

            return FUNC_0(VAR_0, VAR_8, VAR_9, VAR_3 - 1, VAR_4 + 1);

        }

        if (VAR_10)

            return ((VAR_8 + VAR_7) < VAR_0->sps->width ||

                    (VAR_9 + VAR_7) < VAR_0->sps->height);

        else

            return 0;

    } else {

        VAR_6 = hls_coding_unit(VAR_0, VAR_1, VAR_2, VAR_3);

        if (VAR_6 < 0)

            return VAR_6;

        if ((!((VAR_1 + VAR_5) %

               (1 << (VAR_0->sps->log2_ctb_size))) ||

             (VAR_1 + VAR_5 >= VAR_0->sps->width)) &&

            (!((VAR_2 + VAR_5) %

               (1 << (VAR_0->sps->log2_ctb_size))) ||

             (VAR_2 + VAR_5 >= VAR_0->sps->height))) {

            int VAR_11 = ff_hevc_end_of_slice_flag_decode(VAR_0);

            return !VAR_11;

        } else {

            return 1;

        }

    }



    return 0;

}

static int FUNC_0(HEVCContext *VAR_0, int VAR_1, int VAR_2,
int VAR_3, int VAR_4)
{ HEVCLocalContext *lc = VAR_0->HEVClc; const int VAR_5    = 1 << VAR_3; int VAR_6; lc->ct.depth = VAR_4; if (VAR_1 + VAR_5 <= VAR_0->sps->width  &&
VAR_2 + VAR_5 <= VAR_0->sps->height &&
VAR_3 > VAR_0->sps->log2_min_cb_size) { SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2) =
ff_hevc_split_coding_unit_flag_decode(VAR_0, VAR_4, VAR_1, VAR_2); } else { SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2) =
(VAR_3 > VAR_0->sps->log2_min_cb_size); } if (VAR_0->pps->cu_qp_delta_enabled_flag &&
VAR_3 >= VAR_0->sps->log2_ctb_size - VAR_0->pps->diff_cu_qp_delta_depth) { lc->tu.is_cu_qp_delta_coded = 0; lc->tu.cu_qp_delta          = 0; } if (SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2)) { const int VAR_7 = VAR_5 >> 1; const int VAR_8 = VAR_1 + VAR_7; const int VAR_9 = VAR_2 + VAR_7; int VAR_10 = 0; VAR_10 = FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3 - 1, VAR_4 + 1); if (VAR_10 < 0)
return VAR_10; if (VAR_10 && VAR_8 < VAR_0->sps->width)
VAR_10 = FUNC_0(VAR_0, VAR_8, VAR_2, VAR_3 - 1, VAR_4 + 1); if (VAR_10 && VAR_9 < VAR_0->sps->height)
VAR_10 = FUNC_0(VAR_0, VAR_1, VAR_9, VAR_3 - 1, VAR_4 + 1); if (VAR_10 && VAR_8 < VAR_0->sps->width &&
VAR_9 < VAR_0->sps->height) { return FUNC_0(VAR_0, VAR_8, VAR_9, VAR_3 - 1, VAR_4 + 1); } if (VAR_10)
return ((VAR_8 + VAR_7) < VAR_0->sps->width ||
(VAR_9 + VAR_7) < VAR_0->sps->height); else
return 0; } else { VAR_6 = hls_coding_unit(VAR_0, VAR_1, VAR_2, VAR_3); if (VAR_6 < 0)
return VAR_6; if ((!((VAR_1 + VAR_5) %
(1 << (VAR_0->sps->log2_ctb_size))) ||
(VAR_1 + VAR_5 >= VAR_0->sps->width)) &&
(!((VAR_2 + VAR_5) %
(1 << (VAR_0->sps->log2_ctb_size))) ||
(VAR_2 + VAR_5 >= VAR_0->sps->height))) { int VAR_11 = ff_hevc_end_of_slice_flag_decode(VAR_0); return !VAR_11; } else { return 1; } } return 0; }