static int decode_residuals(FLACContext *s, int channel, int pred_order)

{

    int i, tmp, partition, method_type, rice_order;

    int sample = 0, samples;



    method_type = get_bits(&s->gb, 2);

    if (method_type > 1) {

        av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",

               method_type);

        return -1;

    }



    rice_order = get_bits(&s->gb, 4);



    samples= s->blocksize >> rice_order;

    if (pred_order > samples) {

        av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n",

               pred_order, samples);

        return -1;

    }



    sample=

    i= pred_order;

    for (partition = 0; partition < (1 << rice_order); partition++) {

        tmp = get_bits(&s->gb, method_type == 0 ? 4 : 5);

        if (tmp == (method_type == 0 ? 15 : 31)) {

            tmp = get_bits(&s->gb, 5);

            for (; i < samples; i++, sample++)

                s->decoded[channel][sample] = get_sbits_long(&s->gb, tmp);

        } else {

            for (; i < samples; i++, sample++) {

                s->decoded[channel][sample] = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);

            }

        }

        i= 0;

    }



    return 0;

}

static int decode_residuals(FLACContext *s, int channel, int pred_order)

{

    int i, tmp, partition, method_type, rice_order;

    int sample = 0, samples;



    method_type = get_bits(&s->gb, 2);

    if (method_type > 1) {

        av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",

               method_type);

        return -1;

    }



    rice_order = get_bits(&s->gb, 4);



    samples= s->blocksize >> rice_order;

    if (pred_order > samples) {

        av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n",

               pred_order, samples);

        return -1;

    }



    sample=

    i= pred_order;

    for (partition = 0; partition < (1 << rice_order); partition++) {

        tmp = get_bits(&s->gb, method_type == 0 ? 4 : 5);

        if (tmp == (method_type == 0 ? 15 : 31)) {

            tmp = get_bits(&s->gb, 5);

            for (; i < samples; i++, sample++)

                s->decoded[channel][sample] = get_sbits_long(&s->gb, tmp);

        } else {

            for (; i < samples; i++, sample++) {

                s->decoded[channel][sample] = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);

            }

        }

        i= 0;

    }



    return 0;

}

static int FUNC_0(FLACContext *VAR_0, int VAR_1, int VAR_2)

{

    int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;

    int VAR_8 = 0, VAR_9;



    VAR_6 = get_bits(&VAR_0->gb, 2);

    if (VAR_6 > 1) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",

               VAR_6);

        return -1;

    }



    VAR_7 = get_bits(&VAR_0->gb, 4);



    VAR_9= VAR_0->blocksize >> VAR_7;

    if (VAR_2 > VAR_9) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid predictor order: %VAR_3 > %VAR_3\n",

               VAR_2, VAR_9);

        return -1;

    }



    VAR_8=

    VAR_3= VAR_2;

    for (VAR_5 = 0; VAR_5 < (1 << VAR_7); VAR_5++) {

        VAR_4 = get_bits(&VAR_0->gb, VAR_6 == 0 ? 4 : 5);

        if (VAR_4 == (VAR_6 == 0 ? 15 : 31)) {

            VAR_4 = get_bits(&VAR_0->gb, 5);

            for (; VAR_3 < VAR_9; VAR_3++, VAR_8++)

                VAR_0->decoded[VAR_1][VAR_8] = get_sbits_long(&VAR_0->gb, VAR_4);

        } else {

            for (; VAR_3 < VAR_9; VAR_3++, VAR_8++) {

                VAR_0->decoded[VAR_1][VAR_8] = get_sr_golomb_flac(&VAR_0->gb, VAR_4, INT_MAX, 0);

            }

        }

        VAR_3= 0;

    }



    return 0;

}

static int FUNC_0(FLACContext *VAR_0, int VAR_1, int VAR_2)
{ int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; int VAR_8 = 0, VAR_9; VAR_6 = get_bits(&VAR_0->gb, 2); if (VAR_6 > 1) { av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",
VAR_6); return -1; } VAR_7 = get_bits(&VAR_0->gb, 4); VAR_9= VAR_0->blocksize >> VAR_7; if (VAR_2 > VAR_9) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid predictor order: %VAR_3 > %VAR_3\n",
VAR_2, VAR_9); return -1; } VAR_8=
VAR_3= VAR_2; for (VAR_5 = 0; VAR_5 < (1 << VAR_7); VAR_5++) { VAR_4 = get_bits(&VAR_0->gb, VAR_6 == 0 ? 4 : 5); if (VAR_4 == (VAR_6 == 0 ? 15 : 31)) { VAR_4 = get_bits(&VAR_0->gb, 5); for (; VAR_3 < VAR_9; VAR_3++, VAR_8++) VAR_0->decoded[VAR_1][VAR_8] = get_sbits_long(&VAR_0->gb, VAR_4); } else { for (; VAR_3 < VAR_9; VAR_3++, VAR_8++) { VAR_0->decoded[VAR_1][VAR_8] = get_sr_golomb_flac(&VAR_0->gb, VAR_4, INT_MAX, 0); } } VAR_3= 0; } return 0; }