int ff_twinvq_decode_frame(AVCodecContext *avctx, void *data,

                           int *got_frame_ptr, AVPacket *avpkt)

{

    AVFrame *frame     = data;

    const uint8_t *buf = avpkt->data;

    int buf_size       = avpkt->size;

    TwinVQContext *tctx = avctx->priv_data;

    const TwinVQModeTab *mtab = tctx->mtab;

    float **out = NULL;

    int ret;



    /* get output buffer */

    if (tctx->discarded_packets >= 2) {

        frame->nb_samples = mtab->size;

        if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {

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

            return ret;

        }

        out = (float **)frame->extended_data;

    }



    if ((ret = tctx->read_bitstream(avctx, tctx, buf, buf_size)) < 0)

        return ret;



    read_and_decode_spectrum(tctx, tctx->spectrum, tctx->bits.ftype);



    imdct_output(tctx, tctx->bits.ftype, tctx->bits.window_type, out);



    FFSWAP(float *, tctx->curr_frame, tctx->prev_frame);



    if (tctx->discarded_packets < 2) {

        tctx->discarded_packets++;

        *got_frame_ptr = 0;

        return buf_size;

    }



    *got_frame_ptr = 1;



    return buf_size;

}

int ff_twinvq_decode_frame(AVCodecContext *avctx, void *data,

                           int *got_frame_ptr, AVPacket *avpkt)

{

    AVFrame *frame     = data;

    const uint8_t *buf = avpkt->data;

    int buf_size       = avpkt->size;

    TwinVQContext *tctx = avctx->priv_data;

    const TwinVQModeTab *mtab = tctx->mtab;

    float **out = NULL;

    int ret;



    

    if (tctx->discarded_packets >= 2) {

        frame->nb_samples = mtab->size;

        if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {

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

            return ret;

        }

        out = (float **)frame->extended_data;

    }



    if ((ret = tctx->read_bitstream(avctx, tctx, buf, buf_size)) < 0)

        return ret;



    read_and_decode_spectrum(tctx, tctx->spectrum, tctx->bits.ftype);



    imdct_output(tctx, tctx->bits.ftype, tctx->bits.window_type, out);



    FFSWAP(float *, tctx->curr_frame, tctx->prev_frame);



    if (tctx->discarded_packets < 2) {

        tctx->discarded_packets++;

        *got_frame_ptr = 0;

        return buf_size;

    }



    *got_frame_ptr = 1;



    return buf_size;

}

int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,

                           int *VAR_2, AVPacket *VAR_3)

{

    AVFrame *frame     = VAR_1;

    const uint8_t *VAR_4 = VAR_3->VAR_1;

    int VAR_5       = VAR_3->size;

    TwinVQContext *tctx = VAR_0->priv_data;

    const TwinVQModeTab *VAR_6 = tctx->VAR_6;

    float **VAR_7 = NULL;

    int VAR_8;



    

    if (tctx->discarded_packets >= 2) {

        frame->nb_samples = VAR_6->size;

        if ((VAR_8 = ff_get_buffer(VAR_0, frame, 0)) < 0) {

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

            return VAR_8;

        }

        VAR_7 = (float **)frame->extended_data;

    }



    if ((VAR_8 = tctx->read_bitstream(VAR_0, tctx, VAR_4, VAR_5)) < 0)

        return VAR_8;



    read_and_decode_spectrum(tctx, tctx->spectrum, tctx->bits.ftype);



    imdct_output(tctx, tctx->bits.ftype, tctx->bits.window_type, VAR_7);



    FFSWAP(float *, tctx->curr_frame, tctx->prev_frame);



    if (tctx->discarded_packets < 2) {

        tctx->discarded_packets++;

        *VAR_2 = 0;

        return VAR_5;

    }



    *VAR_2 = 1;



    return VAR_5;

}

int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{ AVFrame *frame     = VAR_1; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5       = VAR_3->size; TwinVQContext *tctx = VAR_0->priv_data; const TwinVQModeTab *VAR_6 = tctx->VAR_6; float **VAR_7 = NULL; int VAR_8; if (tctx->discarded_packets >= 2) { frame->nb_samples = VAR_6->size; if ((VAR_8 = ff_get_buffer(VAR_0, frame, 0)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_8; } VAR_7 = (float **)frame->extended_data; } if ((VAR_8 = tctx->read_bitstream(VAR_0, tctx, VAR_4, VAR_5)) < 0)
return VAR_8; read_and_decode_spectrum(tctx, tctx->spectrum, tctx->bits.ftype); imdct_output(tctx, tctx->bits.ftype, tctx->bits.window_type, VAR_7); FFSWAP(float *, tctx->curr_frame, tctx->prev_frame); if (tctx->discarded_packets < 2) { tctx->discarded_packets++; *VAR_2 = 0; return VAR_5; } *VAR_2 = 1; return VAR_5; }