static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,

                             const AVFrame *frame, int *got_packet_ptr)

{

    G726Context *c = avctx->priv_data;

    const int16_t *samples = (const int16_t *)frame->data[0];

    PutBitContext pb;

    int i, ret, out_size;



    out_size = (frame->nb_samples * c->code_size + 7) / 8;

    if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)))

        return ret;

    init_put_bits(&pb, avpkt->data, avpkt->size);



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

        put_bits(&pb, c->code_size, g726_encode(c, *samples++));



    flush_put_bits(&pb);



    avpkt->size = out_size;

    *got_packet_ptr = 1;

    return 0;

}

static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,

                             const AVFrame *frame, int *got_packet_ptr)

{

    G726Context *c = avctx->priv_data;

    const int16_t *samples = (const int16_t *)frame->data[0];

    PutBitContext pb;

    int i, ret, out_size;



    out_size = (frame->nb_samples * c->code_size + 7) / 8;

    if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)))

        return ret;

    init_put_bits(&pb, avpkt->data, avpkt->size);



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

        put_bits(&pb, c->code_size, g726_encode(c, *samples++));



    flush_put_bits(&pb);



    avpkt->size = out_size;

    *got_packet_ptr = 1;

    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,

                             const AVFrame *VAR_2, int *VAR_3)

{

    G726Context *c = VAR_0->priv_data;

    const int16_t *VAR_4 = (const int16_t *)VAR_2->data[0];

    PutBitContext pb;

    int VAR_5, VAR_6, VAR_7;



    VAR_7 = (VAR_2->nb_samples * c->code_size + 7) / 8;

    if ((VAR_6 = ff_alloc_packet2(VAR_0, VAR_1, VAR_7)))

        return VAR_6;

    init_put_bits(&pb, VAR_1->data, VAR_1->size);



    for (VAR_5 = 0; VAR_5 < VAR_2->nb_samples; VAR_5++)

        put_bits(&pb, c->code_size, g726_encode(c, *VAR_4++));



    flush_put_bits(&pb);



    VAR_1->size = VAR_7;

    *VAR_3 = 1;

    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,
const AVFrame *VAR_2, int *VAR_3)
{ G726Context *c = VAR_0->priv_data; const int16_t *VAR_4 = (const int16_t *)VAR_2->data[0]; PutBitContext pb; int VAR_5, VAR_6, VAR_7; VAR_7 = (VAR_2->nb_samples * c->code_size + 7) / 8; if ((VAR_6 = ff_alloc_packet2(VAR_0, VAR_1, VAR_7)))
return VAR_6; init_put_bits(&pb, VAR_1->data, VAR_1->size); for (VAR_5 = 0; VAR_5 < VAR_2->nb_samples; VAR_5++) put_bits(&pb, c->code_size, g726_encode(c, *VAR_4++)); flush_put_bits(&pb); VAR_1->size = VAR_7; *VAR_3 = 1; return 0; }