static uint32_t calc_optimal_rice_params(RiceContext *rc, int porder,

                                         uint32_t *sums, int n, int pred_order)

{

    int i;

    int k, cnt, part;

    uint32_t all_bits;



    part = (1 << porder);

    all_bits = 0;



    cnt = (n >> porder) - pred_order;

    for(i=0; i<part; i++) {

        if(i == 1) cnt = (n >> porder);

        k = find_optimal_param(sums[i], cnt);

        rc->params[i] = k;

        all_bits += rice_encode_count(sums[i], cnt, k);

    }

    all_bits += (4 * part);



    rc->porder = porder;



    return all_bits;

}

static uint32_t calc_optimal_rice_params(RiceContext *rc, int porder,

                                         uint32_t *sums, int n, int pred_order)

{

    int i;

    int k, cnt, part;

    uint32_t all_bits;



    part = (1 << porder);

    all_bits = 0;



    cnt = (n >> porder) - pred_order;

    for(i=0; i<part; i++) {

        if(i == 1) cnt = (n >> porder);

        k = find_optimal_param(sums[i], cnt);

        rc->params[i] = k;

        all_bits += rice_encode_count(sums[i], cnt, k);

    }

    all_bits += (4 * part);



    rc->porder = porder;



    return all_bits;

}

static uint32_t FUNC_0(RiceContext *rc, int porder,

                                         uint32_t *sums, int n, int pred_order)

{

    int VAR_0;

    int VAR_1, VAR_2, VAR_3;

    uint32_t all_bits;



    VAR_3 = (1 << porder);

    all_bits = 0;



    VAR_2 = (n >> porder) - pred_order;

    for(VAR_0=0; VAR_0<VAR_3; VAR_0++) {

        if(VAR_0 == 1) VAR_2 = (n >> porder);

        VAR_1 = find_optimal_param(sums[VAR_0], VAR_2);

        rc->params[VAR_0] = VAR_1;

        all_bits += rice_encode_count(sums[VAR_0], VAR_2, VAR_1);

    }

    all_bits += (4 * VAR_3);



    rc->porder = porder;



    return all_bits;

}

static uint32_t FUNC_0(RiceContext *rc, int porder,
uint32_t *sums, int n, int pred_order)
{ int VAR_0; int VAR_1, VAR_2, VAR_3; uint32_t all_bits; VAR_3 = (1 << porder); all_bits = 0; VAR_2 = (n >> porder) - pred_order; for(VAR_0=0; VAR_0<VAR_3; VAR_0++) { if(VAR_0 == 1) VAR_2 = (n >> porder); VAR_1 = find_optimal_param(sums[VAR_0], VAR_2); rc->params[VAR_0] = VAR_1; all_bits += rice_encode_count(sums[VAR_0], VAR_2, VAR_1); } all_bits += (4 * VAR_3); rc->porder = porder; return all_bits; }