static int decode_element(AVCodecContext *avctx, void *data, int ch_index,

                          int channels)

{

    ALACContext *alac = avctx->priv_data;

    int has_size, bps, is_compressed, decorr_shift, decorr_left_weight, ret;

    uint32_t output_samples;

    int i, ch;



    skip_bits(&alac->gb, 4);  /* element instance tag */

    skip_bits(&alac->gb, 12); /* unused header bits */



    /* the number of output samples is stored in the frame */

    has_size = get_bits1(&alac->gb);



    alac->extra_bits = get_bits(&alac->gb, 2) << 3;

    bps = alac->sample_size - alac->extra_bits + channels - 1;

    if (bps > 32) {

        av_log(avctx, AV_LOG_ERROR, "bps is unsupported: %d\n", bps);

        return AVERROR_PATCHWELCOME;

    }



    /* whether the frame is compressed */

    is_compressed = !get_bits1(&alac->gb);



    if (has_size)

        output_samples = get_bits_long(&alac->gb, 32);

    else

        output_samples = alac->max_samples_per_frame;

    if (!output_samples || output_samples > alac->max_samples_per_frame) {

        av_log(avctx, AV_LOG_ERROR, "invalid samples per frame: %d\n",

               output_samples);

        return AVERROR_INVALIDDATA;

    }

    if (!alac->nb_samples) {

        /* get output buffer */

        alac->frame.nb_samples = output_samples;

        if ((ret = avctx->get_buffer(avctx, &alac->frame)) < 0) {

            av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

            return ret;

        }

    } else if (output_samples != alac->nb_samples) {

        av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %u != %d\n",

               output_samples, alac->nb_samples);

        return AVERROR_INVALIDDATA;

    }

    alac->nb_samples = output_samples;

    if (alac->direct_output) {

        for (ch = 0; ch < channels; ch++)

            alac->output_samples_buffer[ch] = (int32_t *)alac->frame.extended_data[ch_index + ch];

    }



    if (is_compressed) {

        int16_t lpc_coefs[2][32];

        int lpc_order[2];

        int prediction_type[2];

        int lpc_quant[2];

        int rice_history_mult[2];



        decorr_shift       = get_bits(&alac->gb, 8);

        decorr_left_weight = get_bits(&alac->gb, 8);



        for (ch = 0; ch < channels; ch++) {

            prediction_type[ch]   = get_bits(&alac->gb, 4);

            lpc_quant[ch]         = get_bits(&alac->gb, 4);

            rice_history_mult[ch] = get_bits(&alac->gb, 3);

            lpc_order[ch]         = get_bits(&alac->gb, 5);



            /* read the predictor table */

            for (i = lpc_order[ch] - 1; i >= 0; i--)

                lpc_coefs[ch][i] = get_sbits(&alac->gb, 16);

        }



        if (alac->extra_bits) {

            for (i = 0; i < alac->nb_samples; i++) {

                if(get_bits_left(&alac->gb) <= 0)

                    return -1;

                for (ch = 0; ch < channels; ch++)

                    alac->extra_bits_buffer[ch][i] = get_bits(&alac->gb, alac->extra_bits);

            }

        }

        for (ch = 0; ch < channels; ch++) {

            int ret=rice_decompress(alac, alac->predict_error_buffer[ch],

                            alac->nb_samples, bps,

                            rice_history_mult[ch] * alac->rice_history_mult / 4);

            if(ret<0)

                return ret;



            /* adaptive FIR filter */

            if (prediction_type[ch] == 15) {

                /* Prediction type 15 runs the adaptive FIR twice.

                 * The first pass uses the special-case coef_num = 31, while

                 * the second pass uses the coefs from the bitstream.

                 *

                 * However, this prediction type is not currently used by the

                 * reference encoder.

                 */

                lpc_prediction(alac->predict_error_buffer[ch],

                               alac->predict_error_buffer[ch],

                               alac->nb_samples, bps, NULL, 31, 0);

            } else if (prediction_type[ch] > 0) {

                av_log(avctx, AV_LOG_WARNING, "unknown prediction type: %i\n",

                       prediction_type[ch]);

            }

            lpc_prediction(alac->predict_error_buffer[ch],

                           alac->output_samples_buffer[ch], alac->nb_samples,

                           bps, lpc_coefs[ch], lpc_order[ch], lpc_quant[ch]);

        }

    } else {

        /* not compressed, easy case */

        for (i = 0; i < alac->nb_samples; i++) {

            if(get_bits_left(&alac->gb) <= 0)

                return -1;

            for (ch = 0; ch < channels; ch++) {

                alac->output_samples_buffer[ch][i] =

                         get_sbits_long(&alac->gb, alac->sample_size);

            }

        }

        alac->extra_bits   = 0;

        decorr_shift       = 0;

        decorr_left_weight = 0;

    }



    if (channels == 2 && decorr_left_weight) {

        decorrelate_stereo(alac->output_samples_buffer, alac->nb_samples,

                           decorr_shift, decorr_left_weight);

    }



    if (alac->extra_bits) {

        append_extra_bits(alac->output_samples_buffer, alac->extra_bits_buffer,

                          alac->extra_bits, channels, alac->nb_samples);

    }



    if(av_sample_fmt_is_planar(avctx->sample_fmt)) {

    switch(alac->sample_size) {

    case 16: {

        for (ch = 0; ch < channels; ch++) {

            int16_t *outbuffer = (int16_t *)alac->frame.extended_data[ch_index + ch];

            for (i = 0; i < alac->nb_samples; i++)

                *outbuffer++ = alac->output_samples_buffer[ch][i];

        }}

        break;

    case 24: {

        for (ch = 0; ch < channels; ch++) {

            for (i = 0; i < alac->nb_samples; i++)

                alac->output_samples_buffer[ch][i] <<= 8;

        }}

        break;

    }

    }else{

        switch(alac->sample_size) {

        case 16: {

            int16_t *outbuffer = ((int16_t *)alac->frame.extended_data[0]) + ch_index;

            for (i = 0; i < alac->nb_samples; i++) {

                for (ch = 0; ch < channels; ch++)

                    *outbuffer++ = alac->output_samples_buffer[ch][i];

                outbuffer += alac->channels - channels;

            }

            }

            break;

        case 24: {

            int32_t *outbuffer = ((int32_t *)alac->frame.extended_data[0]) + ch_index;

            for (i = 0; i < alac->nb_samples; i++) {

                for (ch = 0; ch < channels; ch++)

                    *outbuffer++ = alac->output_samples_buffer[ch][i] << 8;

                outbuffer += alac->channels - channels;

            }

            }

            break;

        case 32: {

            int32_t *outbuffer = ((int32_t *)alac->frame.extended_data[0]) + ch_index;

            for (i = 0; i < alac->nb_samples; i++) {

                for (ch = 0; ch < channels; ch++)

                    *outbuffer++ = alac->output_samples_buffer[ch][i];

                outbuffer += alac->channels - channels;

            }

            }

            break;

        }

    }



    return 0;

}

static int decode_element(AVCodecContext *avctx, void *data, int ch_index,

                          int channels)

{

    ALACContext *alac = avctx->priv_data;

    int has_size, bps, is_compressed, decorr_shift, decorr_left_weight, ret;

    uint32_t output_samples;

    int i, ch;



    skip_bits(&alac->gb, 4);  

    skip_bits(&alac->gb, 12); 



    

    has_size = get_bits1(&alac->gb);



    alac->extra_bits = get_bits(&alac->gb, 2) << 3;

    bps = alac->sample_size - alac->extra_bits + channels - 1;

    if (bps > 32) {

        av_log(avctx, AV_LOG_ERROR, "bps is unsupported: %d\n", bps);

        return AVERROR_PATCHWELCOME;

    }



    

    is_compressed = !get_bits1(&alac->gb);



    if (has_size)

        output_samples = get_bits_long(&alac->gb, 32);

    else

        output_samples = alac->max_samples_per_frame;

    if (!output_samples || output_samples > alac->max_samples_per_frame) {

        av_log(avctx, AV_LOG_ERROR, "invalid samples per frame: %d\n",

               output_samples);

        return AVERROR_INVALIDDATA;

    }

    if (!alac->nb_samples) {

        

        alac->frame.nb_samples = output_samples;

        if ((ret = avctx->get_buffer(avctx, &alac->frame)) < 0) {

            av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

            return ret;

        }

    } else if (output_samples != alac->nb_samples) {

        av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %u != %d\n",

               output_samples, alac->nb_samples);

        return AVERROR_INVALIDDATA;

    }

    alac->nb_samples = output_samples;

    if (alac->direct_output) {

        for (ch = 0; ch < channels; ch++)

            alac->output_samples_buffer[ch] = (int32_t *)alac->frame.extended_data[ch_index + ch];

    }



    if (is_compressed) {

        int16_t lpc_coefs[2][32];

        int lpc_order[2];

        int prediction_type[2];

        int lpc_quant[2];

        int rice_history_mult[2];



        decorr_shift       = get_bits(&alac->gb, 8);

        decorr_left_weight = get_bits(&alac->gb, 8);



        for (ch = 0; ch < channels; ch++) {

            prediction_type[ch]   = get_bits(&alac->gb, 4);

            lpc_quant[ch]         = get_bits(&alac->gb, 4);

            rice_history_mult[ch] = get_bits(&alac->gb, 3);

            lpc_order[ch]         = get_bits(&alac->gb, 5);



            

            for (i = lpc_order[ch] - 1; i >= 0; i--)

                lpc_coefs[ch][i] = get_sbits(&alac->gb, 16);

        }



        if (alac->extra_bits) {

            for (i = 0; i < alac->nb_samples; i++) {

                if(get_bits_left(&alac->gb) <= 0)

                    return -1;

                for (ch = 0; ch < channels; ch++)

                    alac->extra_bits_buffer[ch][i] = get_bits(&alac->gb, alac->extra_bits);

            }

        }

        for (ch = 0; ch < channels; ch++) {

            int ret=rice_decompress(alac, alac->predict_error_buffer[ch],

                            alac->nb_samples, bps,

                            rice_history_mult[ch] * alac->rice_history_mult / 4);

            if(ret<0)

                return ret;



            

            if (prediction_type[ch] == 15) {

                













                lpc_prediction(alac->predict_error_buffer[ch],

                               alac->predict_error_buffer[ch],

                               alac->nb_samples, bps, NULL, 31, 0);

            } else if (prediction_type[ch] > 0) {

                av_log(avctx, AV_LOG_WARNING, "unknown prediction type: %i\n",

                       prediction_type[ch]);

            }

            lpc_prediction(alac->predict_error_buffer[ch],

                           alac->output_samples_buffer[ch], alac->nb_samples,

                           bps, lpc_coefs[ch], lpc_order[ch], lpc_quant[ch]);

        }

    } else {

        

        for (i = 0; i < alac->nb_samples; i++) {

            if(get_bits_left(&alac->gb) <= 0)

                return -1;

            for (ch = 0; ch < channels; ch++) {

                alac->output_samples_buffer[ch][i] =

                         get_sbits_long(&alac->gb, alac->sample_size);

            }

        }

        alac->extra_bits   = 0;

        decorr_shift       = 0;

        decorr_left_weight = 0;

    }



    if (channels == 2 && decorr_left_weight) {

        decorrelate_stereo(alac->output_samples_buffer, alac->nb_samples,

                           decorr_shift, decorr_left_weight);

    }



    if (alac->extra_bits) {

        append_extra_bits(alac->output_samples_buffer, alac->extra_bits_buffer,

                          alac->extra_bits, channels, alac->nb_samples);

    }



    if(av_sample_fmt_is_planar(avctx->sample_fmt)) {

    switch(alac->sample_size) {

    case 16: {

        for (ch = 0; ch < channels; ch++) {

            int16_t *outbuffer = (int16_t *)alac->frame.extended_data[ch_index + ch];

            for (i = 0; i < alac->nb_samples; i++)

                *outbuffer++ = alac->output_samples_buffer[ch][i];

        }}

        break;

    case 24: {

        for (ch = 0; ch < channels; ch++) {

            for (i = 0; i < alac->nb_samples; i++)

                alac->output_samples_buffer[ch][i] <<= 8;

        }}

        break;

    }

    }else{

        switch(alac->sample_size) {

        case 16: {

            int16_t *outbuffer = ((int16_t *)alac->frame.extended_data[0]) + ch_index;

            for (i = 0; i < alac->nb_samples; i++) {

                for (ch = 0; ch < channels; ch++)

                    *outbuffer++ = alac->output_samples_buffer[ch][i];

                outbuffer += alac->channels - channels;

            }

            }

            break;

        case 24: {

            int32_t *outbuffer = ((int32_t *)alac->frame.extended_data[0]) + ch_index;

            for (i = 0; i < alac->nb_samples; i++) {

                for (ch = 0; ch < channels; ch++)

                    *outbuffer++ = alac->output_samples_buffer[ch][i] << 8;

                outbuffer += alac->channels - channels;

            }

            }

            break;

        case 32: {

            int32_t *outbuffer = ((int32_t *)alac->frame.extended_data[0]) + ch_index;

            for (i = 0; i < alac->nb_samples; i++) {

                for (ch = 0; ch < channels; ch++)

                    *outbuffer++ = alac->output_samples_buffer[ch][i];

                outbuffer += alac->channels - channels;

            }

            }

            break;

        }

    }



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int VAR_2,

                          int VAR_3)

{

    ALACContext *alac = VAR_0->priv_data;

    int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_16;

    uint32_t output_samples;

    int VAR_10, VAR_11;



    skip_bits(&alac->gb, 4);  

    skip_bits(&alac->gb, 12); 



    

    VAR_4 = get_bits1(&alac->gb);



    alac->extra_bits = get_bits(&alac->gb, 2) << 3;

    VAR_5 = alac->sample_size - alac->extra_bits + VAR_3 - 1;

    if (VAR_5 > 32) {

        av_log(VAR_0, AV_LOG_ERROR, "VAR_5 is unsupported: %d\n", VAR_5);

        return AVERROR_PATCHWELCOME;

    }



    

    VAR_6 = !get_bits1(&alac->gb);



    if (VAR_4)

        output_samples = get_bits_long(&alac->gb, 32);

    else

        output_samples = alac->max_samples_per_frame;

    if (!output_samples || output_samples > alac->max_samples_per_frame) {

        av_log(VAR_0, AV_LOG_ERROR, "invalid samples per frame: %d\n",

               output_samples);

        return AVERROR_INVALIDDATA;

    }

    if (!alac->nb_samples) {

        

        alac->frame.nb_samples = output_samples;

        if ((VAR_16 = VAR_0->get_buffer(VAR_0, &alac->frame)) < 0) {

            av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n");

            return VAR_16;

        }

    } else if (output_samples != alac->nb_samples) {

        av_log(VAR_0, AV_LOG_ERROR, "sample count mismatch: %u != %d\n",

               output_samples, alac->nb_samples);

        return AVERROR_INVALIDDATA;

    }

    alac->nb_samples = output_samples;

    if (alac->direct_output) {

        for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++)

            alac->output_samples_buffer[VAR_11] = (int32_t *)alac->frame.extended_data[VAR_2 + VAR_11];

    }



    if (VAR_6) {

        int16_t lpc_coefs[2][32];

        int VAR_12[2];

        int VAR_13[2];

        int VAR_14[2];

        int VAR_15[2];



        VAR_7       = get_bits(&alac->gb, 8);

        VAR_8 = get_bits(&alac->gb, 8);



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

            VAR_13[VAR_11]   = get_bits(&alac->gb, 4);

            VAR_14[VAR_11]         = get_bits(&alac->gb, 4);

            VAR_15[VAR_11] = get_bits(&alac->gb, 3);

            VAR_12[VAR_11]         = get_bits(&alac->gb, 5);



            

            for (VAR_10 = VAR_12[VAR_11] - 1; VAR_10 >= 0; VAR_10--)

                lpc_coefs[VAR_11][VAR_10] = get_sbits(&alac->gb, 16);

        }



        if (alac->extra_bits) {

            for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) {

                if(get_bits_left(&alac->gb) <= 0)

                    return -1;

                for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++)

                    alac->extra_bits_buffer[VAR_11][VAR_10] = get_bits(&alac->gb, alac->extra_bits);

            }

        }

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

            int VAR_16=rice_decompress(alac, alac->predict_error_buffer[VAR_11],

                            alac->nb_samples, VAR_5,

                            VAR_15[VAR_11] * alac->VAR_15 / 4);

            if(VAR_16<0)

                return VAR_16;



            

            if (VAR_13[VAR_11] == 15) {

                













                lpc_prediction(alac->predict_error_buffer[VAR_11],

                               alac->predict_error_buffer[VAR_11],

                               alac->nb_samples, VAR_5, NULL, 31, 0);

            } else if (VAR_13[VAR_11] > 0) {

                av_log(VAR_0, AV_LOG_WARNING, "unknown prediction type: %VAR_10\n",

                       VAR_13[VAR_11]);

            }

            lpc_prediction(alac->predict_error_buffer[VAR_11],

                           alac->output_samples_buffer[VAR_11], alac->nb_samples,

                           VAR_5, lpc_coefs[VAR_11], VAR_12[VAR_11], VAR_14[VAR_11]);

        }

    } else {

        

        for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) {

            if(get_bits_left(&alac->gb) <= 0)

                return -1;

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

                alac->output_samples_buffer[VAR_11][VAR_10] =

                         get_sbits_long(&alac->gb, alac->sample_size);

            }

        }

        alac->extra_bits   = 0;

        VAR_7       = 0;

        VAR_8 = 0;

    }



    if (VAR_3 == 2 && VAR_8) {

        decorrelate_stereo(alac->output_samples_buffer, alac->nb_samples,

                           VAR_7, VAR_8);

    }



    if (alac->extra_bits) {

        append_extra_bits(alac->output_samples_buffer, alac->extra_bits_buffer,

                          alac->extra_bits, VAR_3, alac->nb_samples);

    }



    if(av_sample_fmt_is_planar(VAR_0->sample_fmt)) {

    switch(alac->sample_size) {

    case 16: {

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

            int16_t *outbuffer = (int16_t *)alac->frame.extended_data[VAR_2 + VAR_11];

            for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++)

                *outbuffer++ = alac->output_samples_buffer[VAR_11][VAR_10];

        }}

        break;

    case 24: {

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

            for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++)

                alac->output_samples_buffer[VAR_11][VAR_10] <<= 8;

        }}

        break;

    }

    }else{

        switch(alac->sample_size) {

        case 16: {

            int16_t *outbuffer = ((int16_t *)alac->frame.extended_data[0]) + VAR_2;

            for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) {

                for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++)

                    *outbuffer++ = alac->output_samples_buffer[VAR_11][VAR_10];

                outbuffer += alac->VAR_3 - VAR_3;

            }

            }

            break;

        case 24: {

            int32_t *outbuffer = ((int32_t *)alac->frame.extended_data[0]) + VAR_2;

            for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) {

                for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++)

                    *outbuffer++ = alac->output_samples_buffer[VAR_11][VAR_10] << 8;

                outbuffer += alac->VAR_3 - VAR_3;

            }

            }

            break;

        case 32: {

            int32_t *outbuffer = ((int32_t *)alac->frame.extended_data[0]) + VAR_2;

            for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) {

                for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++)

                    *outbuffer++ = alac->output_samples_buffer[VAR_11][VAR_10];

                outbuffer += alac->VAR_3 - VAR_3;

            }

            }

            break;

        }

    }



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int VAR_2,
int VAR_3)
{ ALACContext *alac = VAR_0->priv_data; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_16; uint32_t output_samples; int VAR_10, VAR_11; skip_bits(&alac->gb, 4); skip_bits(&alac->gb, 12); VAR_4 = get_bits1(&alac->gb); alac->extra_bits = get_bits(&alac->gb, 2) << 3; VAR_5 = alac->sample_size - alac->extra_bits + VAR_3 - 1; if (VAR_5 > 32) { av_log(VAR_0, AV_LOG_ERROR, "VAR_5 is unsupported: %d\n", VAR_5); return AVERROR_PATCHWELCOME; } VAR_6 = !get_bits1(&alac->gb); if (VAR_4)
output_samples = get_bits_long(&alac->gb, 32); else
output_samples = alac->max_samples_per_frame; if (!output_samples || output_samples > alac->max_samples_per_frame) { av_log(VAR_0, AV_LOG_ERROR, "invalid samples per frame: %d\n",
output_samples); return AVERROR_INVALIDDATA; } if (!alac->nb_samples) { alac->frame.nb_samples = output_samples; if ((VAR_16 = VAR_0->get_buffer(VAR_0, &alac->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_16; } } else if (output_samples != alac->nb_samples) { av_log(VAR_0, AV_LOG_ERROR, "sample count mismatch: %u != %d\n",
output_samples, alac->nb_samples); return AVERROR_INVALIDDATA; } alac->nb_samples = output_samples; if (alac->direct_output) { for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) alac->output_samples_buffer[VAR_11] = (int32_t *)alac->frame.extended_data[VAR_2 + VAR_11]; } if (VAR_6) { int16_t lpc_coefs[2][32]; int VAR_12[2]; int VAR_13[2]; int VAR_14[2]; int VAR_15[2]; VAR_7       = get_bits(&alac->gb, 8); VAR_8 = get_bits(&alac->gb, 8); for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) { VAR_13[VAR_11]   = get_bits(&alac->gb, 4); VAR_14[VAR_11]         = get_bits(&alac->gb, 4); VAR_15[VAR_11] = get_bits(&alac->gb, 3); VAR_12[VAR_11]         = get_bits(&alac->gb, 5); for (VAR_10 = VAR_12[VAR_11] - 1; VAR_10 >= 0; VAR_10--) lpc_coefs[VAR_11][VAR_10] = get_sbits(&alac->gb, 16); } if (alac->extra_bits) { for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) { if(get_bits_left(&alac->gb) <= 0)
return -1; for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) alac->extra_bits_buffer[VAR_11][VAR_10] = get_bits(&alac->gb, alac->extra_bits); } } for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) { int VAR_16=rice_decompress(alac, alac->predict_error_buffer[VAR_11],
alac->nb_samples, VAR_5,
VAR_15[VAR_11] * alac->VAR_15 / 4); if(VAR_16<0)
return VAR_16; if (VAR_13[VAR_11] == 15) { lpc_prediction(alac->predict_error_buffer[VAR_11],
alac->predict_error_buffer[VAR_11],
alac->nb_samples, VAR_5, NULL, 31, 0); } else if (VAR_13[VAR_11] > 0) { av_log(VAR_0, AV_LOG_WARNING, "unknown prediction type: %VAR_10\n",
VAR_13[VAR_11]); } lpc_prediction(alac->predict_error_buffer[VAR_11],
alac->output_samples_buffer[VAR_11], alac->nb_samples,
VAR_5, lpc_coefs[VAR_11], VAR_12[VAR_11], VAR_14[VAR_11]); } } else { for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) { if(get_bits_left(&alac->gb) <= 0)
return -1; for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) { alac->output_samples_buffer[VAR_11][VAR_10] =
get_sbits_long(&alac->gb, alac->sample_size); } } alac->extra_bits   = 0; VAR_7       = 0; VAR_8 = 0; } if (VAR_3 == 2 && VAR_8) { decorrelate_stereo(alac->output_samples_buffer, alac->nb_samples,
VAR_7, VAR_8); } if (alac->extra_bits) { append_extra_bits(alac->output_samples_buffer, alac->extra_bits_buffer,
alac->extra_bits, VAR_3, alac->nb_samples); } if(av_sample_fmt_is_planar(VAR_0->sample_fmt)) { switch(alac->sample_size) { case 16: { for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) { int16_t *outbuffer = (int16_t *)alac->frame.extended_data[VAR_2 + VAR_11]; for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) *outbuffer++ = alac->output_samples_buffer[VAR_11][VAR_10]; }} break; case 24: { for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) { for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) alac->output_samples_buffer[VAR_11][VAR_10] <<= 8; }} break; } }else{ switch(alac->sample_size) { case 16: { int16_t *outbuffer = ((int16_t *)alac->frame.extended_data[0]) + VAR_2; for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) { for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) *outbuffer++ = alac->output_samples_buffer[VAR_11][VAR_10]; outbuffer += alac->VAR_3 - VAR_3; } } break; case 24: { int32_t *outbuffer = ((int32_t *)alac->frame.extended_data[0]) + VAR_2; for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) { for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) *outbuffer++ = alac->output_samples_buffer[VAR_11][VAR_10] << 8; outbuffer += alac->VAR_3 - VAR_3; } } break; case 32: { int32_t *outbuffer = ((int32_t *)alac->frame.extended_data[0]) + VAR_2; for (VAR_10 = 0; VAR_10 < alac->nb_samples; VAR_10++) { for (VAR_11 = 0; VAR_11 < VAR_3; VAR_11++) *outbuffer++ = alac->output_samples_buffer[VAR_11][VAR_10]; outbuffer += alac->VAR_3 - VAR_3; } } break; } } return 0; }