static int subframe_count_exact(FlacEncodeContext *s, FlacSubframe *sub,

                                int pred_order)

{

    int p, porder, psize;

    int i, part_end;

    int count = 0;



    /* subframe header */

    count += 8;



    /* subframe */

    if (sub->type == FLAC_SUBFRAME_CONSTANT) {

        count += sub->obits;

    } else if (sub->type == FLAC_SUBFRAME_VERBATIM) {

        count += s->frame.blocksize * sub->obits;

    } else {

        /* warm-up samples */

        count += pred_order * sub->obits;



        /* LPC coefficients */

        if (sub->type == FLAC_SUBFRAME_LPC)

            count += 4 + 5 + pred_order * s->options.lpc_coeff_precision;



        /* rice-encoded block */

        count += 2;



        /* partition order */

        porder = sub->rc.porder;

        psize  = s->frame.blocksize >> porder;

        count += 4;



        /* residual */

        i        = pred_order;

        part_end = psize;

        for (p = 0; p < 1 << porder; p++) {

            int k = sub->rc.params[p];

            count += 4;

            count += rice_count_exact(&sub->residual[i], part_end - i, k);

            i = part_end;

            part_end = FFMIN(s->frame.blocksize, part_end + psize);

        }

    }



    return count;

}

static int subframe_count_exact(FlacEncodeContext *s, FlacSubframe *sub,

                                int pred_order)

{

    int p, porder, psize;

    int i, part_end;

    int count = 0;



    

    count += 8;



    

    if (sub->type == FLAC_SUBFRAME_CONSTANT) {

        count += sub->obits;

    } else if (sub->type == FLAC_SUBFRAME_VERBATIM) {

        count += s->frame.blocksize * sub->obits;

    } else {

        

        count += pred_order * sub->obits;



        

        if (sub->type == FLAC_SUBFRAME_LPC)

            count += 4 + 5 + pred_order * s->options.lpc_coeff_precision;



        

        count += 2;



        

        porder = sub->rc.porder;

        psize  = s->frame.blocksize >> porder;

        count += 4;



        

        i        = pred_order;

        part_end = psize;

        for (p = 0; p < 1 << porder; p++) {

            int k = sub->rc.params[p];

            count += 4;

            count += rice_count_exact(&sub->residual[i], part_end - i, k);

            i = part_end;

            part_end = FFMIN(s->frame.blocksize, part_end + psize);

        }

    }



    return count;

}

    int count = 0; static int subframe_count_exact(FlacEncodeContext *s, FlacSubframe *sub,                                 int pred_order)     int count = 0;
static int FUNC_0(FlacEncodeContext *VAR_0, FlacSubframe *VAR_1,

                                int VAR_2)

{

    int VAR_3, VAR_4, VAR_5;

    int VAR_6, VAR_7;

    int VAR_8 = 0;



    

    VAR_8 += 8;



    

    if (VAR_1->type == FLAC_SUBFRAME_CONSTANT) {

        VAR_8 += VAR_1->obits;

    } else if (VAR_1->type == FLAC_SUBFRAME_VERBATIM) {

        VAR_8 += VAR_0->frame.blocksize * VAR_1->obits;

    } else {

        

        VAR_8 += VAR_2 * VAR_1->obits;



        

        if (VAR_1->type == FLAC_SUBFRAME_LPC)

            VAR_8 += 4 + 5 + VAR_2 * VAR_0->options.lpc_coeff_precision;



        

        VAR_8 += 2;



        

        VAR_4 = VAR_1->rc.VAR_4;

        VAR_5  = VAR_0->frame.blocksize >> VAR_4;

        VAR_8 += 4;



        

        VAR_6        = VAR_2;

        VAR_7 = VAR_5;

        for (VAR_3 = 0; VAR_3 < 1 << VAR_4; VAR_3++) {

            int VAR_9 = VAR_1->rc.params[VAR_3];

            VAR_8 += 4;

            VAR_8 += rice_count_exact(&VAR_1->residual[VAR_6], VAR_7 - VAR_6, VAR_9);

            VAR_6 = VAR_7;

            VAR_7 = FFMIN(VAR_0->frame.blocksize, VAR_7 + VAR_5);

        }

    }



    return VAR_8;

}

static int FUNC_0(FlacEncodeContext *VAR_0, FlacSubframe *VAR_1,
int VAR_2)
{ int VAR_3, VAR_4, VAR_5; int VAR_6, VAR_7; int VAR_8 = 0; VAR_8 += 8; if (VAR_1->type == FLAC_SUBFRAME_CONSTANT) { VAR_8 += VAR_1->obits; } else if (VAR_1->type == FLAC_SUBFRAME_VERBATIM) { VAR_8 += VAR_0->frame.blocksize * VAR_1->obits; } else { VAR_8 += VAR_2 * VAR_1->obits; if (VAR_1->type == FLAC_SUBFRAME_LPC)
VAR_8 += 4 + 5 + VAR_2 * VAR_0->options.lpc_coeff_precision; VAR_8 += 2; VAR_4 = VAR_1->rc.VAR_4; VAR_5  = VAR_0->frame.blocksize >> VAR_4; VAR_8 += 4; VAR_6        = VAR_2; VAR_7 = VAR_5; for (VAR_3 = 0; VAR_3 < 1 << VAR_4; VAR_3++) { int VAR_9 = VAR_1->rc.params[VAR_3]; VAR_8 += 4; VAR_8 += rice_count_exact(&VAR_1->residual[VAR_6], VAR_7 - VAR_6, VAR_9); VAR_6 = VAR_7; VAR_7 = FFMIN(VAR_0->frame.blocksize, VAR_7 + VAR_5); } } return VAR_8; }