static int cng_decode_frame(AVCodecContext *avctx, void *data,
                              int *got_frame_ptr, AVPacket *avpkt)
{
    CNGContext *p = avctx->priv_data;
    int buf_size  = avpkt->size;
    int ret, i;
    int16_t *buf_out;
    float e = 1.0;
    float scaling;
    if (avpkt->size) {
        float dbov = -avpkt->data[0] / 10.0;
        p->target_energy = 1081109975 * pow(10, dbov) * 0.75;
        memset(p->target_refl_coef, 0, sizeof(p->refl_coef));
        for (i = 0; i < FFMIN(avpkt->size - 1, p->order); i++) {
            p->target_refl_coef[i] = (avpkt->data[1 + i] - 127) / 128.0;
        }
        make_lpc_coefs(p->lpc_coef, p->refl_coef, p->order);
    }
    p->energy = p->energy / 2 + p->target_energy / 2;
    for (i = 0; i < p->order; i++)
        p->refl_coef[i] = 0.6 *p->refl_coef[i] + 0.4 * p->target_refl_coef[i];
    for (i = 0; i < p->order; i++)
        e *= 1.0 - p->refl_coef[i]*p->refl_coef[i];
    scaling = sqrt(e * p->energy / 1081109975);
    for (i = 0; i < avctx->frame_size; i++) {
        int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000;
        p->excitation[i] = scaling * r;
    }
    ff_celp_lp_synthesis_filterf(p->filter_out + p->order, p->lpc_coef,
                                 p->excitation, avctx->frame_size, p->order);
    p->avframe.nb_samples = avctx->frame_size;
    if ((ret = avctx->get_buffer(avctx, &p->avframe)) < 0) {
        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
        return ret;
    }
    buf_out = (int16_t *)p->avframe.data[0];
    for (i = 0; i < avctx->frame_size; i++)
        buf_out[i] = p->filter_out[i + p->order];
    memcpy(p->filter_out, p->filter_out + avctx->frame_size,
           p->order * sizeof(*p->filter_out));
    *got_frame_ptr   = 1;
    *(AVFrame *)data = p->avframe;
    return buf_size;
}
['static int cng_decode_frame(AVCodecContext *avctx, void *data,\n                              int *got_frame_ptr, AVPacket *avpkt)\n{\n    CNGContext *p = avctx->priv_data;\n    int buf_size  = avpkt->size;\n    int ret, i;\n    int16_t *buf_out;\n    float e = 1.0;\n    float scaling;\n    if (avpkt->size) {\n        float dbov = -avpkt->data[0] / 10.0;\n        p->target_energy = 1081109975 * pow(10, dbov) * 0.75;\n        memset(p->target_refl_coef, 0, sizeof(p->refl_coef));\n        for (i = 0; i < FFMIN(avpkt->size - 1, p->order); i++) {\n            p->target_refl_coef[i] = (avpkt->data[1 + i] - 127) / 128.0;\n        }\n        make_lpc_coefs(p->lpc_coef, p->refl_coef, p->order);\n    }\n    p->energy = p->energy / 2 + p->target_energy / 2;\n    for (i = 0; i < p->order; i++)\n        p->refl_coef[i] = 0.6 *p->refl_coef[i] + 0.4 * p->target_refl_coef[i];\n    for (i = 0; i < p->order; i++)\n        e *= 1.0 - p->refl_coef[i]*p->refl_coef[i];\n    scaling = sqrt(e * p->energy / 1081109975);\n    for (i = 0; i < avctx->frame_size; i++) {\n        int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000;\n        p->excitation[i] = scaling * r;\n    }\n    ff_celp_lp_synthesis_filterf(p->filter_out + p->order, p->lpc_coef,\n                                 p->excitation, avctx->frame_size, p->order);\n    p->avframe.nb_samples = avctx->frame_size;\n    if ((ret = avctx->get_buffer(avctx, &p->avframe)) < 0) {\n        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\\n");\n        return ret;\n    }\n    buf_out = (int16_t *)p->avframe.data[0];\n    for (i = 0; i < avctx->frame_size; i++)\n        buf_out[i] = p->filter_out[i + p->order];\n    memcpy(p->filter_out, p->filter_out + avctx->frame_size,\n           p->order * sizeof(*p->filter_out));\n    *got_frame_ptr   = 1;\n    *(AVFrame *)data = p->avframe;\n    return buf_size;\n}', 'static inline unsigned int av_lfg_get(AVLFG *c){\n    c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];\n    return c->state[c->index++ & 63];\n}']