static inline int decode_subframe(FLACContext *s, int channel)

{

    int type, wasted = 0;

    int i, tmp;



    s->curr_bps = s->bps;

    if (channel == 0) {

        if (s->decorrelation == RIGHT_SIDE)

            s->curr_bps++;

    } else {

        if (s->decorrelation == LEFT_SIDE || s->decorrelation == MID_SIDE)

            s->curr_bps++;

    }

    if (s->curr_bps > 32) {

        ff_log_missing_feature(s->avctx, "decorrelated bit depth > 32", 0);

        return -1;

    }



    if (get_bits1(&s->gb)) {

        av_log(s->avctx, AV_LOG_ERROR, "invalid subframe padding\n");

        return -1;

    }

    type = get_bits(&s->gb, 6);



    if (get_bits1(&s->gb)) {

        wasted = 1;

        while (!get_bits1(&s->gb))

            wasted++;

        s->curr_bps -= wasted;

    }



//FIXME use av_log2 for types

    if (type == 0) {

        tmp = get_sbits_long(&s->gb, s->curr_bps);

        for (i = 0; i < s->blocksize; i++)

            s->decoded[channel][i] = tmp;

    } else if (type == 1) {

        for (i = 0; i < s->blocksize; i++)

            s->decoded[channel][i] = get_sbits_long(&s->gb, s->curr_bps);

    } else if ((type >= 8) && (type <= 12)) {

        if (decode_subframe_fixed(s, channel, type & ~0x8) < 0)

            return -1;

    } else if (type >= 32) {

        if (decode_subframe_lpc(s, channel, (type & ~0x20)+1) < 0)

            return -1;

    } else {

        av_log(s->avctx, AV_LOG_ERROR, "invalid coding type\n");

        return -1;

    }



    if (wasted) {

        int i;

        for (i = 0; i < s->blocksize; i++)

            s->decoded[channel][i] <<= wasted;

    }



    return 0;

}

static inline int decode_subframe(FLACContext *s, int channel)

{

    int type, wasted = 0;

    int i, tmp;



    s->curr_bps = s->bps;

    if (channel == 0) {

        if (s->decorrelation == RIGHT_SIDE)

            s->curr_bps++;

    } else {

        if (s->decorrelation == LEFT_SIDE || s->decorrelation == MID_SIDE)

            s->curr_bps++;

    }

    if (s->curr_bps > 32) {

        ff_log_missing_feature(s->avctx, "decorrelated bit depth > 32", 0);

        return -1;

    }



    if (get_bits1(&s->gb)) {

        av_log(s->avctx, AV_LOG_ERROR, "invalid subframe padding\n");

        return -1;

    }

    type = get_bits(&s->gb, 6);



    if (get_bits1(&s->gb)) {

        wasted = 1;

        while (!get_bits1(&s->gb))

            wasted++;

        s->curr_bps -= wasted;

    }





    if (type == 0) {

        tmp = get_sbits_long(&s->gb, s->curr_bps);

        for (i = 0; i < s->blocksize; i++)

            s->decoded[channel][i] = tmp;

    } else if (type == 1) {

        for (i = 0; i < s->blocksize; i++)

            s->decoded[channel][i] = get_sbits_long(&s->gb, s->curr_bps);

    } else if ((type >= 8) && (type <= 12)) {

        if (decode_subframe_fixed(s, channel, type & ~0x8) < 0)

            return -1;

    } else if (type >= 32) {

        if (decode_subframe_lpc(s, channel, (type & ~0x20)+1) < 0)

            return -1;

    } else {

        av_log(s->avctx, AV_LOG_ERROR, "invalid coding type\n");

        return -1;

    }



    if (wasted) {

        int i;

        for (i = 0; i < s->blocksize; i++)

            s->decoded[channel][i] <<= wasted;

    }



    return 0;

}

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

{

    int VAR_2, VAR_3 = 0;

    int VAR_6, VAR_5;



    VAR_0->curr_bps = VAR_0->bps;

    if (VAR_1 == 0) {

        if (VAR_0->decorrelation == RIGHT_SIDE)

            VAR_0->curr_bps++;

    } else {

        if (VAR_0->decorrelation == LEFT_SIDE || VAR_0->decorrelation == MID_SIDE)

            VAR_0->curr_bps++;

    }

    if (VAR_0->curr_bps > 32) {

        ff_log_missing_feature(VAR_0->avctx, "decorrelated bit depth > 32", 0);

        return -1;

    }



    if (get_bits1(&VAR_0->gb)) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid subframe padding\n");

        return -1;

    }

    VAR_2 = get_bits(&VAR_0->gb, 6);



    if (get_bits1(&VAR_0->gb)) {

        VAR_3 = 1;

        while (!get_bits1(&VAR_0->gb))

            VAR_3++;

        VAR_0->curr_bps -= VAR_3;

    }





    if (VAR_2 == 0) {

        VAR_5 = get_sbits_long(&VAR_0->gb, VAR_0->curr_bps);

        for (VAR_6 = 0; VAR_6 < VAR_0->blocksize; VAR_6++)

            VAR_0->decoded[VAR_1][VAR_6] = VAR_5;

    } else if (VAR_2 == 1) {

        for (VAR_6 = 0; VAR_6 < VAR_0->blocksize; VAR_6++)

            VAR_0->decoded[VAR_1][VAR_6] = get_sbits_long(&VAR_0->gb, VAR_0->curr_bps);

    } else if ((VAR_2 >= 8) && (VAR_2 <= 12)) {

        if (decode_subframe_fixed(VAR_0, VAR_1, VAR_2 & ~0x8) < 0)

            return -1;

    } else if (VAR_2 >= 32) {

        if (decode_subframe_lpc(VAR_0, VAR_1, (VAR_2 & ~0x20)+1) < 0)

            return -1;

    } else {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid coding VAR_2\n");

        return -1;

    }



    if (VAR_3) {

        int VAR_6;

        for (VAR_6 = 0; VAR_6 < VAR_0->blocksize; VAR_6++)

            VAR_0->decoded[VAR_1][VAR_6] <<= VAR_3;

    }



    return 0;

}

static inline int FUNC_0(FLACContext *VAR_0, int VAR_1)
{ int VAR_2, VAR_3 = 0; int VAR_6, VAR_5; VAR_0->curr_bps = VAR_0->bps; if (VAR_1 == 0) { if (VAR_0->decorrelation == RIGHT_SIDE)
VAR_0->curr_bps++; } else { if (VAR_0->decorrelation == LEFT_SIDE || VAR_0->decorrelation == MID_SIDE)
VAR_0->curr_bps++; } if (VAR_0->curr_bps > 32) { ff_log_missing_feature(VAR_0->avctx, "decorrelated bit depth > 32", 0); return -1; } if (get_bits1(&VAR_0->gb)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid subframe padding\n"); return -1; } VAR_2 = get_bits(&VAR_0->gb, 6); if (get_bits1(&VAR_0->gb)) { VAR_3 = 1; while (!get_bits1(&VAR_0->gb))
VAR_3++; VAR_0->curr_bps -= VAR_3; } if (VAR_2 == 0) { VAR_5 = get_sbits_long(&VAR_0->gb, VAR_0->curr_bps); for (VAR_6 = 0; VAR_6 < VAR_0->blocksize; VAR_6++) VAR_0->decoded[VAR_1][VAR_6] = VAR_5; } else if (VAR_2 == 1) { for (VAR_6 = 0; VAR_6 < VAR_0->blocksize; VAR_6++) VAR_0->decoded[VAR_1][VAR_6] = get_sbits_long(&VAR_0->gb, VAR_0->curr_bps); } else if ((VAR_2 >= 8) && (VAR_2 <= 12)) { if (decode_subframe_fixed(VAR_0, VAR_1, VAR_2 & ~0x8) < 0)
return -1; } else if (VAR_2 >= 32) { if (decode_subframe_lpc(VAR_0, VAR_1, (VAR_2 & ~0x20)+1) < 0)
return -1; } else { av_log(VAR_0->avctx, AV_LOG_ERROR, "invalid coding VAR_2\n"); return -1; } if (VAR_3) { int VAR_6; for (VAR_6 = 0; VAR_6 < VAR_0->blocksize; VAR_6++) VAR_0->decoded[VAR_1][VAR_6] <<= VAR_3; } return 0; }