static int decode_subframe(WmallDecodeCtx *s)

{

    int offset        = s->samples_per_frame;

    int subframe_len  = s->samples_per_frame;

    int total_samples = s->samples_per_frame * s->num_channels;

    int i, j, rawpcm_tile, padding_zeroes, res;



    s->subframe_offset = get_bits_count(&s->gb);



    /* reset channel context and find the next block offset and size

        == the next block of the channel with the smallest number of

        decoded samples */

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

        if (offset > s->channel[i].decoded_samples) {

            offset = s->channel[i].decoded_samples;

            subframe_len =

                s->channel[i].subframe_len[s->channel[i].cur_subframe];

        }

    }



    /* get a list of all channels that contain the estimated block */

    s->channels_for_cur_subframe = 0;

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

        const int cur_subframe = s->channel[i].cur_subframe;

        /* subtract already processed samples */

        total_samples -= s->channel[i].decoded_samples;



        /* and count if there are multiple subframes that match our profile */

        if (offset == s->channel[i].decoded_samples &&

            subframe_len == s->channel[i].subframe_len[cur_subframe]) {

            total_samples -= s->channel[i].subframe_len[cur_subframe];

            s->channel[i].decoded_samples +=

                s->channel[i].subframe_len[cur_subframe];

            s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i;

            ++s->channels_for_cur_subframe;

        }

    }



    /* check if the frame will be complete after processing the

        estimated block */

    if (!total_samples)

        s->parsed_all_subframes = 1;





    s->seekable_tile = get_bits1(&s->gb);

    if (s->seekable_tile) {

        clear_codec_buffers(s);



        s->do_arith_coding    = get_bits1(&s->gb);

        if (s->do_arith_coding) {

            avpriv_request_sample(s->avctx, "Arithmetic coding");

            return AVERROR_PATCHWELCOME;

        }

        s->do_ac_filter       = get_bits1(&s->gb);

        s->do_inter_ch_decorr = get_bits1(&s->gb);

        s->do_mclms           = get_bits1(&s->gb);



        if (s->do_ac_filter)

            decode_ac_filter(s);



        if (s->do_mclms)

            decode_mclms(s);



        if ((res = decode_cdlms(s)) < 0)

            return res;

        s->movave_scaling = get_bits(&s->gb, 3);

        s->quant_stepsize = get_bits(&s->gb, 8) + 1;



        reset_codec(s);

    } else if (!s->cdlms[0][0].order) {

        av_log(s->avctx, AV_LOG_DEBUG,

               "Waiting for seekable tile\n");

        s->frame.nb_samples = 0;

        return -1;

    }



    rawpcm_tile = get_bits1(&s->gb);



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

        s->is_channel_coded[i] = 1;



    if (!rawpcm_tile) {

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

            s->is_channel_coded[i] = get_bits1(&s->gb);



        if (s->bV3RTM) {

            // LPC

            s->do_lpc = get_bits1(&s->gb);

            if (s->do_lpc) {

                decode_lpc(s);

                avpriv_request_sample(s->avctx, "Expect wrong output since "

                                      "inverse LPC filter");

            }

        } else

            s->do_lpc = 0;

    }





    if (get_bits1(&s->gb))

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

    else

        padding_zeroes = 0;



    if (rawpcm_tile) {

        int bits = s->bits_per_sample - padding_zeroes;

        if (bits <= 0) {

            av_log(s->avctx, AV_LOG_ERROR,

                   "Invalid number of padding bits in raw PCM tile\n");

            return AVERROR_INVALIDDATA;

        }

        av_dlog(s->avctx, "RAWPCM %d bits per sample. "

                "total %d bits, remain=%d\n", bits,

                bits * s->num_channels * subframe_len, get_bits_count(&s->gb));

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

            for (j = 0; j < subframe_len; j++)

                s->channel_coeffs[i][j] = get_sbits(&s->gb, bits);

    } else {

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

            if (s->is_channel_coded[i]) {

                decode_channel_residues(s, i, subframe_len);

                if (s->seekable_tile)

                    use_high_update_speed(s, i);

                else

                    use_normal_update_speed(s, i);

                revert_cdlms(s, i, 0, subframe_len);

            } else {

                memset(s->channel_residues[i], 0, sizeof(**s->channel_residues) * subframe_len);

            }

    }

    if (s->do_mclms)

        revert_mclms(s, subframe_len);

    if (s->do_inter_ch_decorr)

        revert_inter_ch_decorr(s, subframe_len);

    if (s->do_ac_filter)

        revert_acfilter(s, subframe_len);



    /* Dequantize */

    if (s->quant_stepsize != 1)

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

            for (j = 0; j < subframe_len; j++)

                s->channel_residues[i][j] *= s->quant_stepsize;



    /* Write to proper output buffer depending on bit-depth */

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

        int c = s->channel_indexes_for_cur_subframe[i];

        int subframe_len = s->channel[c].subframe_len[s->channel[c].cur_subframe];



        for (j = 0; j < subframe_len; j++) {

            if (s->bits_per_sample == 16) {

                *s->samples_16[c]++ = (int16_t) s->channel_residues[c][j] << padding_zeroes;

            } else {

                *s->samples_32[c]++ = s->channel_residues[c][j] << padding_zeroes;

            }

        }

    }



    /* handled one subframe */

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

        int c = s->channel_indexes_for_cur_subframe[i];

        if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) {

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

            return AVERROR_INVALIDDATA;

        }

        ++s->channel[c].cur_subframe;

    }

    return 0;

}

static int decode_subframe(WmallDecodeCtx *s)

{

    int offset        = s->samples_per_frame;

    int subframe_len  = s->samples_per_frame;

    int total_samples = s->samples_per_frame * s->num_channels;

    int i, j, rawpcm_tile, padding_zeroes, res;



    s->subframe_offset = get_bits_count(&s->gb);



    





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

        if (offset > s->channel[i].decoded_samples) {

            offset = s->channel[i].decoded_samples;

            subframe_len =

                s->channel[i].subframe_len[s->channel[i].cur_subframe];

        }

    }



    

    s->channels_for_cur_subframe = 0;

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

        const int cur_subframe = s->channel[i].cur_subframe;

        

        total_samples -= s->channel[i].decoded_samples;



        

        if (offset == s->channel[i].decoded_samples &&

            subframe_len == s->channel[i].subframe_len[cur_subframe]) {

            total_samples -= s->channel[i].subframe_len[cur_subframe];

            s->channel[i].decoded_samples +=

                s->channel[i].subframe_len[cur_subframe];

            s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i;

            ++s->channels_for_cur_subframe;

        }

    }



    



    if (!total_samples)

        s->parsed_all_subframes = 1;





    s->seekable_tile = get_bits1(&s->gb);

    if (s->seekable_tile) {

        clear_codec_buffers(s);



        s->do_arith_coding    = get_bits1(&s->gb);

        if (s->do_arith_coding) {

            avpriv_request_sample(s->avctx, "Arithmetic coding");

            return AVERROR_PATCHWELCOME;

        }

        s->do_ac_filter       = get_bits1(&s->gb);

        s->do_inter_ch_decorr = get_bits1(&s->gb);

        s->do_mclms           = get_bits1(&s->gb);



        if (s->do_ac_filter)

            decode_ac_filter(s);



        if (s->do_mclms)

            decode_mclms(s);



        if ((res = decode_cdlms(s)) < 0)

            return res;

        s->movave_scaling = get_bits(&s->gb, 3);

        s->quant_stepsize = get_bits(&s->gb, 8) + 1;



        reset_codec(s);

    } else if (!s->cdlms[0][0].order) {

        av_log(s->avctx, AV_LOG_DEBUG,

               "Waiting for seekable tile\n");

        s->frame.nb_samples = 0;

        return -1;

    }



    rawpcm_tile = get_bits1(&s->gb);



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

        s->is_channel_coded[i] = 1;



    if (!rawpcm_tile) {

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

            s->is_channel_coded[i] = get_bits1(&s->gb);



        if (s->bV3RTM) {

            

            s->do_lpc = get_bits1(&s->gb);

            if (s->do_lpc) {

                decode_lpc(s);

                avpriv_request_sample(s->avctx, "Expect wrong output since "

                                      "inverse LPC filter");

            }

        } else

            s->do_lpc = 0;

    }





    if (get_bits1(&s->gb))

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

    else

        padding_zeroes = 0;



    if (rawpcm_tile) {

        int bits = s->bits_per_sample - padding_zeroes;

        if (bits <= 0) {

            av_log(s->avctx, AV_LOG_ERROR,

                   "Invalid number of padding bits in raw PCM tile\n");

            return AVERROR_INVALIDDATA;

        }

        av_dlog(s->avctx, "RAWPCM %d bits per sample. "

                "total %d bits, remain=%d\n", bits,

                bits * s->num_channels * subframe_len, get_bits_count(&s->gb));

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

            for (j = 0; j < subframe_len; j++)

                s->channel_coeffs[i][j] = get_sbits(&s->gb, bits);

    } else {

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

            if (s->is_channel_coded[i]) {

                decode_channel_residues(s, i, subframe_len);

                if (s->seekable_tile)

                    use_high_update_speed(s, i);

                else

                    use_normal_update_speed(s, i);

                revert_cdlms(s, i, 0, subframe_len);

            } else {

                memset(s->channel_residues[i], 0, sizeof(**s->channel_residues) * subframe_len);

            }

    }

    if (s->do_mclms)

        revert_mclms(s, subframe_len);

    if (s->do_inter_ch_decorr)

        revert_inter_ch_decorr(s, subframe_len);

    if (s->do_ac_filter)

        revert_acfilter(s, subframe_len);



    

    if (s->quant_stepsize != 1)

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

            for (j = 0; j < subframe_len; j++)

                s->channel_residues[i][j] *= s->quant_stepsize;



    

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

        int c = s->channel_indexes_for_cur_subframe[i];

        int subframe_len = s->channel[c].subframe_len[s->channel[c].cur_subframe];



        for (j = 0; j < subframe_len; j++) {

            if (s->bits_per_sample == 16) {

                *s->samples_16[c]++ = (int16_t) s->channel_residues[c][j] << padding_zeroes;

            } else {

                *s->samples_32[c]++ = s->channel_residues[c][j] << padding_zeroes;

            }

        }

    }



    

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

        int c = s->channel_indexes_for_cur_subframe[i];

        if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) {

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

            return AVERROR_INVALIDDATA;

        }

        ++s->channel[c].cur_subframe;

    }

    return 0;

}

        s->frame.nb_samples = 0;
static int FUNC_0(WmallDecodeCtx *VAR_0)

{

    int VAR_1        = VAR_0->samples_per_frame;

    int VAR_2  = VAR_0->samples_per_frame;

    int VAR_3 = VAR_0->samples_per_frame * VAR_0->num_channels;

    int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;



    VAR_0->subframe_offset = get_bits_count(&VAR_0->gb);



    





    for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++) {

        if (VAR_1 > VAR_0->channel[VAR_4].decoded_samples) {

            VAR_1 = VAR_0->channel[VAR_4].decoded_samples;

            VAR_2 =

                VAR_0->channel[VAR_4].VAR_2[VAR_0->channel[VAR_4].cur_subframe];

        }

    }



    

    VAR_0->channels_for_cur_subframe = 0;

    for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++) {

        const int cur_subframe = VAR_0->channel[VAR_4].cur_subframe;

        

        VAR_3 -= VAR_0->channel[VAR_4].decoded_samples;



        

        if (VAR_1 == VAR_0->channel[VAR_4].decoded_samples &&

            VAR_2 == VAR_0->channel[VAR_4].VAR_2[cur_subframe]) {

            VAR_3 -= VAR_0->channel[VAR_4].VAR_2[cur_subframe];

            VAR_0->channel[VAR_4].decoded_samples +=

                VAR_0->channel[VAR_4].VAR_2[cur_subframe];

            VAR_0->channel_indexes_for_cur_subframe[VAR_0->channels_for_cur_subframe] = VAR_4;

            ++VAR_0->channels_for_cur_subframe;

        }

    }



    



    if (!VAR_3)

        VAR_0->parsed_all_subframes = 1;





    VAR_0->seekable_tile = get_bits1(&VAR_0->gb);

    if (VAR_0->seekable_tile) {

        clear_codec_buffers(VAR_0);



        VAR_0->do_arith_coding    = get_bits1(&VAR_0->gb);

        if (VAR_0->do_arith_coding) {

            avpriv_request_sample(VAR_0->avctx, "Arithmetic coding");

            return AVERROR_PATCHWELCOME;

        }

        VAR_0->do_ac_filter       = get_bits1(&VAR_0->gb);

        VAR_0->do_inter_ch_decorr = get_bits1(&VAR_0->gb);

        VAR_0->do_mclms           = get_bits1(&VAR_0->gb);



        if (VAR_0->do_ac_filter)

            decode_ac_filter(VAR_0);



        if (VAR_0->do_mclms)

            decode_mclms(VAR_0);



        if ((VAR_8 = decode_cdlms(VAR_0)) < 0)

            return VAR_8;

        VAR_0->movave_scaling = get_bits(&VAR_0->gb, 3);

        VAR_0->quant_stepsize = get_bits(&VAR_0->gb, 8) + 1;



        reset_codec(VAR_0);

    } else if (!VAR_0->cdlms[0][0].order) {

        av_log(VAR_0->avctx, AV_LOG_DEBUG,

               "Waiting for seekable tile\n");

        VAR_0->frame.nb_samples = 0;

        return -1;

    }



    VAR_6 = get_bits1(&VAR_0->gb);



    for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++)

        VAR_0->is_channel_coded[VAR_4] = 1;



    if (!VAR_6) {

        for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++)

            VAR_0->is_channel_coded[VAR_4] = get_bits1(&VAR_0->gb);



        if (VAR_0->bV3RTM) {

            

            VAR_0->do_lpc = get_bits1(&VAR_0->gb);

            if (VAR_0->do_lpc) {

                decode_lpc(VAR_0);

                avpriv_request_sample(VAR_0->avctx, "Expect wrong output since "

                                      "inverse LPC filter");

            }

        } else

            VAR_0->do_lpc = 0;

    }





    if (get_bits1(&VAR_0->gb))

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

    else

        VAR_7 = 0;



    if (VAR_6) {

        int VAR_9 = VAR_0->bits_per_sample - VAR_7;

        if (VAR_9 <= 0) {

            av_log(VAR_0->avctx, AV_LOG_ERROR,

                   "Invalid number of padding VAR_9 in raw PCM tile\n");

            return AVERROR_INVALIDDATA;

        }

        av_dlog(VAR_0->avctx, "RAWPCM %d VAR_9 per sample. "

                "total %d VAR_9, remain=%d\n", VAR_9,

                VAR_9 * VAR_0->num_channels * VAR_2, get_bits_count(&VAR_0->gb));

        for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++)

            for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++)

                VAR_0->channel_coeffs[VAR_4][VAR_5] = get_sbits(&VAR_0->gb, VAR_9);

    } else {

        for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++)

            if (VAR_0->is_channel_coded[VAR_4]) {

                decode_channel_residues(VAR_0, VAR_4, VAR_2);

                if (VAR_0->seekable_tile)

                    use_high_update_speed(VAR_0, VAR_4);

                else

                    use_normal_update_speed(VAR_0, VAR_4);

                revert_cdlms(VAR_0, VAR_4, 0, VAR_2);

            } else {

                memset(VAR_0->channel_residues[VAR_4], 0, sizeof(**VAR_0->channel_residues) * VAR_2);

            }

    }

    if (VAR_0->do_mclms)

        revert_mclms(VAR_0, VAR_2);

    if (VAR_0->do_inter_ch_decorr)

        revert_inter_ch_decorr(VAR_0, VAR_2);

    if (VAR_0->do_ac_filter)

        revert_acfilter(VAR_0, VAR_2);



    

    if (VAR_0->quant_stepsize != 1)

        for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++)

            for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++)

                VAR_0->channel_residues[VAR_4][VAR_5] *= VAR_0->quant_stepsize;



    

    for (VAR_4 = 0; VAR_4 < VAR_0->channels_for_cur_subframe; VAR_4++) {

        int c = VAR_0->channel_indexes_for_cur_subframe[VAR_4];

        int VAR_2 = VAR_0->channel[c].VAR_2[VAR_0->channel[c].cur_subframe];



        for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) {

            if (VAR_0->bits_per_sample == 16) {

                *VAR_0->samples_16[c]++ = (int16_t) VAR_0->channel_residues[c][VAR_5] << VAR_7;

            } else {

                *VAR_0->samples_32[c]++ = VAR_0->channel_residues[c][VAR_5] << VAR_7;

            }

        }

    }



    

    for (VAR_4 = 0; VAR_4 < VAR_0->channels_for_cur_subframe; VAR_4++) {

        int c = VAR_0->channel_indexes_for_cur_subframe[VAR_4];

        if (VAR_0->channel[c].cur_subframe >= VAR_0->channel[c].num_subframes) {

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

            return AVERROR_INVALIDDATA;

        }

        ++VAR_0->channel[c].cur_subframe;

    }

    return 0;

}

static int FUNC_0(WmallDecodeCtx *VAR_0)
{ int VAR_1        = VAR_0->samples_per_frame; int VAR_2  = VAR_0->samples_per_frame; int VAR_3 = VAR_0->samples_per_frame * VAR_0->num_channels; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; VAR_0->subframe_offset = get_bits_count(&VAR_0->gb); for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++) { if (VAR_1 > VAR_0->channel[VAR_4].decoded_samples) { VAR_1 = VAR_0->channel[VAR_4].decoded_samples; VAR_2 =
VAR_0->channel[VAR_4].VAR_2[VAR_0->channel[VAR_4].cur_subframe]; } } VAR_0->channels_for_cur_subframe = 0; for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++) { const int cur_subframe = VAR_0->channel[VAR_4].cur_subframe; VAR_3 -= VAR_0->channel[VAR_4].decoded_samples; if (VAR_1 == VAR_0->channel[VAR_4].decoded_samples &&
VAR_2 == VAR_0->channel[VAR_4].VAR_2[cur_subframe]) { VAR_3 -= VAR_0->channel[VAR_4].VAR_2[cur_subframe]; VAR_0->channel[VAR_4].decoded_samples +=
VAR_0->channel[VAR_4].VAR_2[cur_subframe]; VAR_0->channel_indexes_for_cur_subframe[VAR_0->channels_for_cur_subframe] = VAR_4; ++VAR_0->channels_for_cur_subframe; } } if (!VAR_3)
VAR_0->parsed_all_subframes = 1; VAR_0->seekable_tile = get_bits1(&VAR_0->gb); if (VAR_0->seekable_tile) { clear_codec_buffers(VAR_0); VAR_0->do_arith_coding    = get_bits1(&VAR_0->gb); if (VAR_0->do_arith_coding) { avpriv_request_sample(VAR_0->avctx, "Arithmetic coding"); return AVERROR_PATCHWELCOME; } VAR_0->do_ac_filter       = get_bits1(&VAR_0->gb); VAR_0->do_inter_ch_decorr = get_bits1(&VAR_0->gb); VAR_0->do_mclms           = get_bits1(&VAR_0->gb); if (VAR_0->do_ac_filter)
decode_ac_filter(VAR_0); if (VAR_0->do_mclms)
decode_mclms(VAR_0); if ((VAR_8 = decode_cdlms(VAR_0)) < 0)
return VAR_8; VAR_0->movave_scaling = get_bits(&VAR_0->gb, 3); VAR_0->quant_stepsize = get_bits(&VAR_0->gb, 8) + 1; reset_codec(VAR_0); } else if (!VAR_0->cdlms[0][0].order) { av_log(VAR_0->avctx, AV_LOG_DEBUG,
"Waiting for seekable tile\n"); VAR_0->frame.nb_samples = 0; return -1; } VAR_6 = get_bits1(&VAR_0->gb); for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++) VAR_0->is_channel_coded[VAR_4] = 1; if (!VAR_6) { for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++) VAR_0->is_channel_coded[VAR_4] = get_bits1(&VAR_0->gb); if (VAR_0->bV3RTM) { VAR_0->do_lpc = get_bits1(&VAR_0->gb); if (VAR_0->do_lpc) { decode_lpc(VAR_0); avpriv_request_sample(VAR_0->avctx, "Expect wrong output since "
"inverse LPC filter"); } } else VAR_0->do_lpc = 0; } if (get_bits1(&VAR_0->gb))
VAR_7 = get_bits(&VAR_0->gb, 5); else
VAR_7 = 0; if (VAR_6) { int VAR_9 = VAR_0->bits_per_sample - VAR_7; if (VAR_9 <= 0) { av_log(VAR_0->avctx, AV_LOG_ERROR,
"Invalid number of padding VAR_9 in raw PCM tile\n"); return AVERROR_INVALIDDATA; } av_dlog(VAR_0->avctx, "RAWPCM %d VAR_9 per sample. "
"total %d VAR_9, remain=%d\n", VAR_9,
VAR_9 * VAR_0->num_channels * VAR_2, get_bits_count(&VAR_0->gb)); for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++) for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) VAR_0->channel_coeffs[VAR_4][VAR_5] = get_sbits(&VAR_0->gb, VAR_9); } else { for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++) if (VAR_0->is_channel_coded[VAR_4]) { decode_channel_residues(VAR_0, VAR_4, VAR_2); if (VAR_0->seekable_tile)
use_high_update_speed(VAR_0, VAR_4); else
use_normal_update_speed(VAR_0, VAR_4); revert_cdlms(VAR_0, VAR_4, 0, VAR_2); } else { memset(VAR_0->channel_residues[VAR_4], 0, sizeof(**VAR_0->channel_residues) * VAR_2); } } if (VAR_0->do_mclms)
revert_mclms(VAR_0, VAR_2); if (VAR_0->do_inter_ch_decorr)
revert_inter_ch_decorr(VAR_0, VAR_2); if (VAR_0->do_ac_filter)
revert_acfilter(VAR_0, VAR_2); if (VAR_0->quant_stepsize != 1)
for (VAR_4 = 0; VAR_4 < VAR_0->num_channels; VAR_4++) for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) VAR_0->channel_residues[VAR_4][VAR_5] *= VAR_0->quant_stepsize; for (VAR_4 = 0; VAR_4 < VAR_0->channels_for_cur_subframe; VAR_4++) { int c = VAR_0->channel_indexes_for_cur_subframe[VAR_4]; int VAR_2 = VAR_0->channel[c].VAR_2[VAR_0->channel[c].cur_subframe]; for (VAR_5 = 0; VAR_5 < VAR_2; VAR_5++) { if (VAR_0->bits_per_sample == 16) { *VAR_0->samples_16[c]++ = (int16_t) VAR_0->channel_residues[c][VAR_5] << VAR_7; } else { *VAR_0->samples_32[c]++ = VAR_0->channel_residues[c][VAR_5] << VAR_7; } } } for (VAR_4 = 0; VAR_4 < VAR_0->channels_for_cur_subframe; VAR_4++) { int c = VAR_0->channel_indexes_for_cur_subframe[VAR_4]; if (VAR_0->channel[c].cur_subframe >= VAR_0->channel[c].num_subframes) { av_log(VAR_0->avctx, AV_LOG_ERROR, "broken subframe\n"); return AVERROR_INVALIDDATA; } ++VAR_0->channel[c].cur_subframe; } return 0; }