static int truespeech_decode_frame(AVCodecContext *avctx,

                void *data, int *data_size,

                AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    TSContext *c = avctx->priv_data;



    int i, j;

    short *samples = data;

    int consumed = 0;

    int16_t out_buf[240];

    int iterations;



    if (!buf_size)

        return 0;



    if (buf_size < 32) {

        av_log(avctx, AV_LOG_ERROR,

               "Too small input buffer (%d bytes), need at least 32 bytes\n", buf_size);

        return -1;

    }

    iterations = FFMIN(buf_size / 32, *data_size / 480);

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

        truespeech_read_frame(c, buf + consumed);

        consumed += 32;



        truespeech_correlate_filter(c);

        truespeech_filters_merge(c);



        memset(out_buf, 0, 240 * 2);

        for(i = 0; i < 4; i++) {

            truespeech_apply_twopoint_filter(c, i);

            truespeech_place_pulses(c, out_buf + i * 60, i);

            truespeech_update_filters(c, out_buf + i * 60, i);

            truespeech_synth(c, out_buf + i * 60, i);

        }



        truespeech_save_prevvec(c);



        /* finally output decoded frame */

        for(i = 0; i < 240; i++)

            *samples++ = out_buf[i];



    }



    *data_size = consumed * 15;



    return consumed;

}

static int truespeech_decode_frame(AVCodecContext *avctx,

                void *data, int *data_size,

                AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    TSContext *c = avctx->priv_data;



    int i, j;

    short *samples = data;

    int consumed = 0;

    int16_t out_buf[240];

    int iterations;



    if (!buf_size)

        return 0;



    if (buf_size < 32) {

        av_log(avctx, AV_LOG_ERROR,

               "Too small input buffer (%d bytes), need at least 32 bytes\n", buf_size);

        return -1;

    }

    iterations = FFMIN(buf_size / 32, *data_size / 480);

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

        truespeech_read_frame(c, buf + consumed);

        consumed += 32;



        truespeech_correlate_filter(c);

        truespeech_filters_merge(c);



        memset(out_buf, 0, 240 * 2);

        for(i = 0; i < 4; i++) {

            truespeech_apply_twopoint_filter(c, i);

            truespeech_place_pulses(c, out_buf + i * 60, i);

            truespeech_update_filters(c, out_buf + i * 60, i);

            truespeech_synth(c, out_buf + i * 60, i);

        }



        truespeech_save_prevvec(c);



        

        for(i = 0; i < 240; i++)

            *samples++ = out_buf[i];



    }



    *data_size = consumed * 15;



    return consumed;

}

static int FUNC_0(AVCodecContext *VAR_0,

                void *VAR_1, int *VAR_2,

                AVPacket *VAR_3)

{

    const uint8_t *VAR_4 = VAR_3->VAR_1;

    int VAR_5 = VAR_3->size;

    TSContext *c = VAR_0->priv_data;



    int VAR_6, VAR_7;

    short *VAR_8 = VAR_1;

    int VAR_9 = 0;

    int16_t out_buf[240];

    int VAR_10;



    if (!VAR_5)

        return 0;



    if (VAR_5 < 32) {

        av_log(VAR_0, AV_LOG_ERROR,

               "Too small input buffer (%d bytes), need at least 32 bytes\n", VAR_5);

        return -1;

    }

    VAR_10 = FFMIN(VAR_5 / 32, *VAR_2 / 480);

    for(VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) {

        truespeech_read_frame(c, VAR_4 + VAR_9);

        VAR_9 += 32;



        truespeech_correlate_filter(c);

        truespeech_filters_merge(c);



        memset(out_buf, 0, 240 * 2);

        for(VAR_6 = 0; VAR_6 < 4; VAR_6++) {

            truespeech_apply_twopoint_filter(c, VAR_6);

            truespeech_place_pulses(c, out_buf + VAR_6 * 60, VAR_6);

            truespeech_update_filters(c, out_buf + VAR_6 * 60, VAR_6);

            truespeech_synth(c, out_buf + VAR_6 * 60, VAR_6);

        }



        truespeech_save_prevvec(c);



        

        for(VAR_6 = 0; VAR_6 < 240; VAR_6++)

            *VAR_8++ = out_buf[VAR_6];



    }



    *VAR_2 = VAR_9 * 15;



    return VAR_9;

}

static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{ const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; TSContext *c = VAR_0->priv_data; int VAR_6, VAR_7; short *VAR_8 = VAR_1; int VAR_9 = 0; int16_t out_buf[240]; int VAR_10; if (!VAR_5)
return 0; if (VAR_5 < 32) { av_log(VAR_0, AV_LOG_ERROR,
"Too small input buffer (%d bytes), need at least 32 bytes\n", VAR_5); return -1; } VAR_10 = FFMIN(VAR_5 / 32, *VAR_2 / 480); for(VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) { truespeech_read_frame(c, VAR_4 + VAR_9); VAR_9 += 32; truespeech_correlate_filter(c); truespeech_filters_merge(c); memset(out_buf, 0, 240 * 2); for(VAR_6 = 0; VAR_6 < 4; VAR_6++) { truespeech_apply_twopoint_filter(c, VAR_6); truespeech_place_pulses(c, out_buf + VAR_6 * 60, VAR_6); truespeech_update_filters(c, out_buf + VAR_6 * 60, VAR_6); truespeech_synth(c, out_buf + VAR_6 * 60, VAR_6); } truespeech_save_prevvec(c); for(VAR_6 = 0; VAR_6 < 240; VAR_6++) *VAR_8++ = out_buf[VAR_6]; } *VAR_2 = VAR_9 * 15; return VAR_9; }