libavcodec/qcelpdec.c:753: error: Buffer Overrun L2
  Offset: [0, 15] Size: 5 by call to `decode_lspf`.

libavcodec/qcelpdec.c:699:16: Call
697.     /* get output buffer */
698.     frame->nb_samples = 160;
699.     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
                    ^
700.         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
701.         return ret;

libavcodec/decode.c:1144:9: Call
  1142. 
  1143.     if (ret < 0)
  1144.         av_frame_unref(frame);
                ^
  1145. 
  1146.     return ret;

libavutil/frame.c:310:5: Call
    308.     int i;
    309. 
    310.     wipe_side_data(frame);
             ^
    311. 
    312.     for (i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)

libavutil/frame.c:62:9: Call
      60. 
      61.     for (i = 0; i < frame->nb_side_data; i++) {
      62.         free_side_data(&frame->side_data[i]);
                  ^
      63.     }
      64.     frame->nb_side_data = 0;

libavutil/frame.c:53:5: Call
        51. 
        52.     av_freep(&sd->data);
        53.     av_dict_free(&sd->metadata);
                ^
        54.     av_freep(ptr_sd);
        55. }

libavutil/dict.c:186:5: Call
          184.         av_free(m->elems);
          185.     }
          186.     av_freep(pm);
                   ^
          187. }
          188. 

libavutil/mem.c:198:26: Assignment
            196. 
            197.     memcpy(&val, arg, sizeof(val));
            198.     memcpy(arg, &(void *){ NULL }, sizeof(val));
                                          ^
            199.     av_free(val);
            200. }

libavcodec/qcelpdec.c:750:5: Call
748.     }
749. 
750.     decode_gain_and_index(q, gain);
         ^
751.     compute_svector(q, gain, outbuffer);
752. 

libavcodec/qcelpdec.c:198:1: Parameter `q->frame.cindex[*]`
  196.  * TIA/EIA/IS-733 2.4.6.2
  197.  */
  198. static void decode_gain_and_index(QCELPContext *q, float *gain)
       ^
  199. {
  200.     int i, subframes_count, g1[16];

libavcodec/qcelpdec.c:751:5: Call
749. 
750.     decode_gain_and_index(q, gain);
751.     compute_svector(q, gain, outbuffer);
         ^
752. 
753.     if (decode_lspf(q, quantized_lspf) < 0) {

libavcodec/qcelpdec.c:312:1: Parameter `q->frame.lspv[*]`
  310.  * @param cdn_vector array for the generated scaled codebook vector
  311.  */
  312. static void compute_svector(QCELPContext *q, const float *gain,
       ^
  313.                             float *cdn_vector)
  314. {

libavcodec/qcelpdec.c:753:9: Call
751.     compute_svector(q, gain, outbuffer);
752. 
753.     if (decode_lspf(q, quantized_lspf) < 0) {
             ^
754.         warn_insufficient_frame_quality(avctx, "Badly received packets in frame.");
755.         goto erasure;

libavcodec/qcelpdec.c:114:1: <Offset trace>
112.  * TIA/EIA/IS-733 2.4.3.2.6.2-2, 2.4.8.7.3
113.  */
114. static int decode_lspf(QCELPContext *q, float *lspf)
     ^
115. {
116.     int i;

libavcodec/qcelpdec.c:114:1: Parameter `q->frame.lspv[*]`
  112.  * TIA/EIA/IS-733 2.4.3.2.6.2-2, 2.4.8.7.3
  113.  */
  114. static int decode_lspf(QCELPContext *q, float *lspf)
       ^
  115. {
  116.     int i;

libavcodec/qcelpdata.h:414:1: <Length trace>
412. { 539,1564},{1142, 533},{ 984, 391},{2130,1089}};
413. 
414. static const qcelp_vector * const qcelp_lspvq[5] = {
     ^
415.     qcelp_lspvq1,
416.     qcelp_lspvq2,

libavcodec/qcelpdata.h:414:1: Array declaration
  412. { 539,1564},{1142, 533},{ 984, 391},{2130,1089}};
  413. 
  414. static const qcelp_vector * const qcelp_lspvq[5] = {
       ^
  415.     qcelp_lspvq1,
  416.     qcelp_lspvq2,

libavcodec/qcelpdec.c:168:43: Array access: Offset: [0, 15] Size: 5 by call to `decode_lspf` 
  166.         tmp_lspf = 0.0;
  167.         for (i = 0; i < 5; i++) {
  168.             lspf[2 * i + 0] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][0] * 0.0001;
                                                 ^
  169.             lspf[2 * i + 1] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][1] * 0.0001;
  170.         }

static int decode_lspf(QCELPContext *q, float *lspf)
{
    int i;
    float tmp_lspf, smooth, erasure_coeff;
    const float *predictors;
    if (q->bitrate == RATE_OCTAVE || q->bitrate == I_F_Q) {
        predictors = q->prev_bitrate != RATE_OCTAVE &&
                     q->prev_bitrate != I_F_Q ? q->prev_lspf
                                              : q->predictor_lspf;
        if (q->bitrate == RATE_OCTAVE) {
            q->octave_count++;
            for (i = 0; i < 10; i++) {
                q->predictor_lspf[i] =
                             lspf[i] = (q->frame.lspv[i] ?  QCELP_LSP_SPREAD_FACTOR
                                                         : -QCELP_LSP_SPREAD_FACTOR) +
                                        predictors[i] * QCELP_LSP_OCTAVE_PREDICTOR   +
                                        (i + 1) * ((1 - QCELP_LSP_OCTAVE_PREDICTOR) / 11);
            }
            smooth = q->octave_count < 10 ? .875 : 0.1;
        } else {
            erasure_coeff = QCELP_LSP_OCTAVE_PREDICTOR;
            assert(q->bitrate == I_F_Q);
            if (q->erasure_count > 1)
                erasure_coeff *= q->erasure_count < 4 ? 0.9 : 0.7;
            for (i = 0; i < 10; i++) {
                q->predictor_lspf[i] =
                             lspf[i] = (i + 1) * (1 - erasure_coeff) / 11 +
                                       erasure_coeff * predictors[i];
            }
            smooth = 0.125;
        }
        lspf[0] = FFMAX(lspf[0], QCELP_LSP_SPREAD_FACTOR);
        for (i = 1; i < 10; i++)
            lspf[i] = FFMAX(lspf[i], lspf[i - 1] + QCELP_LSP_SPREAD_FACTOR);
        lspf[9] = FFMIN(lspf[9], 1.0 - QCELP_LSP_SPREAD_FACTOR);
        for (i = 9; i > 0; i--)
            lspf[i - 1] = FFMIN(lspf[i - 1], lspf[i] - QCELP_LSP_SPREAD_FACTOR);
        ff_weighted_vector_sumf(lspf, lspf, q->prev_lspf, smooth, 1.0 - smooth, 10);
    } else {
        q->octave_count = 0;
        tmp_lspf = 0.0;
        for (i = 0; i < 5; i++) {
            lspf[2 * i + 0] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][0] * 0.0001;
            lspf[2 * i + 1] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][1] * 0.0001;
        }
        if (q->bitrate == RATE_QUARTER) {
            if (lspf[9] <= .70 || lspf[9] >= .97)
                return -1;
            for (i = 3; i < 10; i++)
                if (fabs(lspf[i] - lspf[i - 2]) < .08)
                    return -1;
        } else {
            if (lspf[9] <= .66 || lspf[9] >= .985)
                return -1;
            for (i = 4; i < 10; i++)
                if (fabs(lspf[i] - lspf[i - 4]) < .0931)
                    return -1;
        }
    }
    return 0;
}
['static int qcelp_decode_frame(AVCodecContext *avctx, void *data,\n                              int *got_frame_ptr, AVPacket *avpkt)\n{\n    const uint8_t *buf = avpkt->data;\n    int buf_size       = avpkt->size;\n    QCELPContext *q    = avctx->priv_data;\n    AVFrame *frame     = data;\n    float *outbuffer;\n    int   i, ret;\n    float quantized_lspf[10], lpc[10];\n    float gain[16];\n    float *formant_mem;\n    frame->nb_samples = 160;\n    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {\n        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\\n");\n        return ret;\n    }\n    outbuffer = (float *)frame->data[0];\n    if ((q->bitrate = determine_bitrate(avctx, buf_size, &buf)) == I_F_Q) {\n        warn_insufficient_frame_quality(avctx, "bitrate cannot be determined.");\n        goto erasure;\n    }\n    if (q->bitrate == RATE_OCTAVE &&\n        (q->first16bits = AV_RB16(buf)) == 0xFFFF) {\n        warn_insufficient_frame_quality(avctx, "Bitrate is 1/8 and first 16 bits are on.");\n        goto erasure;\n    }\n    if (q->bitrate > SILENCE) {\n        const QCELPBitmap *bitmaps     = qcelp_unpacking_bitmaps_per_rate[q->bitrate];\n        const QCELPBitmap *bitmaps_end = qcelp_unpacking_bitmaps_per_rate[q->bitrate] +\n                                         qcelp_unpacking_bitmaps_lengths[q->bitrate];\n        uint8_t *unpacked_data         = (uint8_t *)&q->frame;\n        bitstream_init8(&q->bc, buf, buf_size);\n        memset(&q->frame, 0, sizeof(QCELPFrame));\n        for (; bitmaps < bitmaps_end; bitmaps++)\n            unpacked_data[bitmaps->index] |= bitstream_read(&q->bc, bitmaps->bitlen) << bitmaps->bitpos;\n        if (q->frame.reserved) {\n            warn_insufficient_frame_quality(avctx, "Wrong data in reserved frame area.");\n            goto erasure;\n        }\n        if (q->bitrate == RATE_QUARTER &&\n            codebook_sanity_check_for_rate_quarter(q->frame.cbgain)) {\n            warn_insufficient_frame_quality(avctx, "Codebook gain sanity check failed.");\n            goto erasure;\n        }\n        if (q->bitrate >= RATE_HALF) {\n            for (i = 0; i < 4; i++) {\n                if (q->frame.pfrac[i] && q->frame.plag[i] >= 124) {\n                    warn_insufficient_frame_quality(avctx, "Cannot initialize pitch filter.");\n                    goto erasure;\n                }\n            }\n        }\n    }\n    decode_gain_and_index(q, gain);\n    compute_svector(q, gain, outbuffer);\n    if (decode_lspf(q, quantized_lspf) < 0) {\n        warn_insufficient_frame_quality(avctx, "Badly received packets in frame.");\n        goto erasure;\n    }\n    apply_pitch_filters(q, outbuffer);\n    if (q->bitrate == I_F_Q) {\nerasure:\n        q->bitrate = I_F_Q;\n        q->erasure_count++;\n        decode_gain_and_index(q, gain);\n        compute_svector(q, gain, outbuffer);\n        decode_lspf(q, quantized_lspf);\n        apply_pitch_filters(q, outbuffer);\n    } else\n        q->erasure_count = 0;\n    formant_mem = q->formant_mem + 10;\n    for (i = 0; i < 4; i++) {\n        interpolate_lpc(q, quantized_lspf, lpc, i);\n        ff_celp_lp_synthesis_filterf(formant_mem, lpc, outbuffer + i * 40, 40, 10);\n        formant_mem += 40;\n    }\n    postfilter(q, outbuffer, lpc);\n    memcpy(q->formant_mem, q->formant_mem + 160, 10 * sizeof(float));\n    memcpy(q->prev_lspf, quantized_lspf, sizeof(q->prev_lspf));\n    q->prev_bitrate  = q->bitrate;\n    *got_frame_ptr = 1;\n    return buf_size;\n}', 'int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)\n{\n    const AVHWAccel *hwaccel = avctx->hwaccel;\n    int override_dimensions = 1;\n    int ret;\n    switch (avctx->codec_type) {\n    case AVMEDIA_TYPE_VIDEO:\n        if (frame->width <= 0 || frame->height <= 0) {\n            frame->width  = FFMAX(avctx->width, avctx->coded_width);\n            frame->height = FFMAX(avctx->height, avctx->coded_height);\n            override_dimensions = 0;\n        }\n        if (frame->format < 0)\n            frame->format              = avctx->pix_fmt;\n        if (!frame->sample_aspect_ratio.num)\n            frame->sample_aspect_ratio = avctx->sample_aspect_ratio;\n        if (av_image_check_sar(frame->width, frame->height,\n                               frame->sample_aspect_ratio) < 0) {\n            av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\\n",\n                   frame->sample_aspect_ratio.num,\n                   frame->sample_aspect_ratio.den);\n            frame->sample_aspect_ratio = (AVRational){ 0, 1 };\n        }\n        if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)\n            return ret;\n        break;\n    case AVMEDIA_TYPE_AUDIO:\n        if (!frame->sample_rate)\n            frame->sample_rate    = avctx->sample_rate;\n        if (frame->format < 0)\n            frame->format         = avctx->sample_fmt;\n        if (!frame->channel_layout) {\n            if (avctx->channel_layout) {\n                 if (av_get_channel_layout_nb_channels(avctx->channel_layout) !=\n                     avctx->channels) {\n                     av_log(avctx, AV_LOG_ERROR, "Inconsistent channel "\n                            "configuration.\\n");\n                     return AVERROR(EINVAL);\n                 }\n                frame->channel_layout = avctx->channel_layout;\n            } else {\n                if (avctx->channels > FF_SANE_NB_CHANNELS) {\n                    av_log(avctx, AV_LOG_ERROR, "Too many channels: %d.\\n",\n                           avctx->channels);\n                    return AVERROR(ENOSYS);\n                }\n                frame->channel_layout = av_get_default_channel_layout(avctx->channels);\n                if (!frame->channel_layout)\n                    frame->channel_layout = (1ULL << avctx->channels) - 1;\n            }\n        }\n        break;\n    default: return AVERROR(EINVAL);\n    }\n    ret = ff_decode_frame_props(avctx, frame);\n    if (ret < 0)\n        return ret;\n    if (hwaccel) {\n        if (hwaccel->alloc_frame) {\n            ret = hwaccel->alloc_frame(avctx, frame);\n            goto end;\n        }\n    } else\n        avctx->sw_pix_fmt = avctx->pix_fmt;\n    ret = avctx->get_buffer2(avctx, frame, flags);\n    if (ret < 0)\n        goto end;\n    ret = attach_decode_data(frame);\n    if (ret < 0)\n        goto end;\nend:\n    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions &&\n        !(avctx->codec->caps_internal & FF_CODEC_CAP_EXPORTS_CROPPING)) {\n        frame->width  = avctx->width;\n        frame->height = avctx->height;\n    }\n    if (ret < 0)\n        av_frame_unref(frame);\n    return ret;\n}', 'void av_frame_unref(AVFrame *frame)\n{\n    int i;\n    wipe_side_data(frame);\n    for (i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)\n        av_buffer_unref(&frame->buf[i]);\n    for (i = 0; i < frame->nb_extended_buf; i++)\n        av_buffer_unref(&frame->extended_buf[i]);\n    av_freep(&frame->extended_buf);\n    av_buffer_unref(&frame->hw_frames_ctx);\n    av_buffer_unref(&frame->opaque_ref);\n    get_frame_defaults(frame);\n}', 'static void wipe_side_data(AVFrame *frame)\n{\n    int i;\n    for (i = 0; i < frame->nb_side_data; i++) {\n        free_side_data(&frame->side_data[i]);\n    }\n    frame->nb_side_data = 0;\n    av_freep(&frame->side_data);\n}', 'static void free_side_data(AVFrameSideData **ptr_sd)\n{\n    AVFrameSideData *sd = *ptr_sd;\n    av_freep(&sd->data);\n    av_dict_free(&sd->metadata);\n    av_freep(ptr_sd);\n}', 'void av_dict_free(AVDictionary **pm)\n{\n    AVDictionary *m = *pm;\n    if (m) {\n        while (m->count--) {\n            av_free(m->elems[m->count].key);\n            av_free(m->elems[m->count].value);\n        }\n        av_free(m->elems);\n    }\n    av_freep(pm);\n}', 'void av_freep(void *arg)\n{\n    void *val;\n    memcpy(&val, arg, sizeof(val));\n    memcpy(arg, &(void *){ NULL }, sizeof(val));\n    av_free(val);\n}', 'static void decode_gain_and_index(QCELPContext *q, float *gain)\n{\n    int i, subframes_count, g1[16];\n    float slope;\n    if (q->bitrate >= RATE_QUARTER) {\n        switch (q->bitrate) {\n        case RATE_FULL: subframes_count = 16; break;\n        case RATE_HALF: subframes_count =  4; break;\n        default:        subframes_count =  5;\n        }\n        for (i = 0; i < subframes_count; i++) {\n            g1[i] = 4 * q->frame.cbgain[i];\n            if (q->bitrate == RATE_FULL && !((i + 1) & 3)) {\n                g1[i] += av_clip((g1[i - 1] + g1[i - 2] + g1[i - 3]) / 3 - 6, 0, 32);\n            }\n            gain[i] = qcelp_g12ga[g1[i]];\n            if (q->frame.cbsign[i]) {\n                gain[i] = -gain[i];\n                q->frame.cindex[i] = (q->frame.cindex[i] - 89) & 127;\n            }\n        }\n        q->prev_g1[0]         = g1[i - 2];\n        q->prev_g1[1]         = g1[i - 1];\n        q->last_codebook_gain = qcelp_g12ga[g1[i - 1]];\n        if (q->bitrate == RATE_QUARTER) {\n            gain[7] =       gain[4];\n            gain[6] = 0.4 * gain[3] + 0.6 * gain[4];\n            gain[5] =       gain[3];\n            gain[4] = 0.8 * gain[2] + 0.2 * gain[3];\n            gain[3] = 0.2 * gain[1] + 0.8 * gain[2];\n            gain[2] =       gain[1];\n            gain[1] = 0.6 * gain[0] + 0.4 * gain[1];\n        }\n    } else if (q->bitrate != SILENCE) {\n        if (q->bitrate == RATE_OCTAVE) {\n            g1[0] = 2 * q->frame.cbgain[0] +\n                    av_clip((q->prev_g1[0] + q->prev_g1[1]) / 2 - 5, 0, 54);\n            subframes_count = 8;\n        } else {\n            assert(q->bitrate == I_F_Q);\n            g1[0] = q->prev_g1[1];\n            switch (q->erasure_count) {\n            case 1 : break;\n            case 2 : g1[0] -= 1; break;\n            case 3 : g1[0] -= 2; break;\n            default: g1[0] -= 6;\n            }\n            if (g1[0] < 0)\n                g1[0] = 0;\n            subframes_count = 4;\n        }\n        slope = 0.5 * (qcelp_g12ga[g1[0]] - q->last_codebook_gain) / subframes_count;\n        for (i = 1; i <= subframes_count; i++)\n                gain[i - 1] = q->last_codebook_gain + slope * i;\n        q->last_codebook_gain = gain[i - 2];\n        q->prev_g1[0]         = q->prev_g1[1];\n        q->prev_g1[1]         = g1[0];\n    }\n}', 'static void compute_svector(QCELPContext *q, const float *gain,\n                            float *cdn_vector)\n{\n    int i, j, k;\n    uint16_t cbseed, cindex;\n    float *rnd, tmp_gain, fir_filter_value;\n    switch (q->bitrate) {\n    case RATE_FULL:\n        for (i = 0; i < 16; i++) {\n            tmp_gain = gain[i] * QCELP_RATE_FULL_CODEBOOK_RATIO;\n            cindex   = -q->frame.cindex[i];\n            for (j = 0; j < 10; j++)\n                *cdn_vector++ = tmp_gain * qcelp_rate_full_codebook[cindex++ & 127];\n        }\n        break;\n    case RATE_HALF:\n        for (i = 0; i < 4; i++) {\n            tmp_gain = gain[i] * QCELP_RATE_HALF_CODEBOOK_RATIO;\n            cindex   = -q->frame.cindex[i];\n            for (j = 0; j < 40; j++)\n                *cdn_vector++ = tmp_gain * qcelp_rate_half_codebook[cindex++ & 127];\n        }\n        break;\n    case RATE_QUARTER:\n        cbseed = (0x0003 & q->frame.lspv[4]) << 14 |\n                 (0x003F & q->frame.lspv[3]) <<  8 |\n                 (0x0060 & q->frame.lspv[2]) <<  1 |\n                 (0x0007 & q->frame.lspv[1]) <<  3 |\n                 (0x0038 & q->frame.lspv[0]) >>  3;\n        rnd    = q->rnd_fir_filter_mem + 20;\n        for (i = 0; i < 8; i++) {\n            tmp_gain = gain[i] * (QCELP_SQRT1887 / 32768.0);\n            for (k = 0; k < 20; k++) {\n                cbseed = 521 * cbseed + 259;\n                *rnd   = (int16_t) cbseed;\n                fir_filter_value = 0.0;\n                for (j = 0; j < 10; j++)\n                    fir_filter_value += qcelp_rnd_fir_coefs[j] *\n                                        (rnd[-j] + rnd[-20+j]);\n                fir_filter_value += qcelp_rnd_fir_coefs[10] * rnd[-10];\n                *cdn_vector++     = tmp_gain * fir_filter_value;\n                rnd++;\n            }\n        }\n        memcpy(q->rnd_fir_filter_mem, q->rnd_fir_filter_mem + 160,\n               20 * sizeof(float));\n        break;\n    case RATE_OCTAVE:\n        cbseed = q->first16bits;\n        for (i = 0; i < 8; i++) {\n            tmp_gain = gain[i] * (QCELP_SQRT1887 / 32768.0);\n            for (j = 0; j < 20; j++) {\n                cbseed        = 521 * cbseed + 259;\n                *cdn_vector++ = tmp_gain * (int16_t) cbseed;\n            }\n        }\n        break;\n    case I_F_Q:\n        cbseed = -44;\n        for (i = 0; i < 4; i++) {\n            tmp_gain = gain[i] * QCELP_RATE_FULL_CODEBOOK_RATIO;\n            for (j = 0; j < 40; j++)\n                *cdn_vector++ = tmp_gain * qcelp_rate_full_codebook[cbseed++ & 127];\n        }\n        break;\n    case SILENCE:\n        memset(cdn_vector, 0, 160 * sizeof(float));\n        break;\n    }\n}', 'static int decode_lspf(QCELPContext *q, float *lspf)\n{\n    int i;\n    float tmp_lspf, smooth, erasure_coeff;\n    const float *predictors;\n    if (q->bitrate == RATE_OCTAVE || q->bitrate == I_F_Q) {\n        predictors = q->prev_bitrate != RATE_OCTAVE &&\n                     q->prev_bitrate != I_F_Q ? q->prev_lspf\n                                              : q->predictor_lspf;\n        if (q->bitrate == RATE_OCTAVE) {\n            q->octave_count++;\n            for (i = 0; i < 10; i++) {\n                q->predictor_lspf[i] =\n                             lspf[i] = (q->frame.lspv[i] ?  QCELP_LSP_SPREAD_FACTOR\n                                                         : -QCELP_LSP_SPREAD_FACTOR) +\n                                        predictors[i] * QCELP_LSP_OCTAVE_PREDICTOR   +\n                                        (i + 1) * ((1 - QCELP_LSP_OCTAVE_PREDICTOR) / 11);\n            }\n            smooth = q->octave_count < 10 ? .875 : 0.1;\n        } else {\n            erasure_coeff = QCELP_LSP_OCTAVE_PREDICTOR;\n            assert(q->bitrate == I_F_Q);\n            if (q->erasure_count > 1)\n                erasure_coeff *= q->erasure_count < 4 ? 0.9 : 0.7;\n            for (i = 0; i < 10; i++) {\n                q->predictor_lspf[i] =\n                             lspf[i] = (i + 1) * (1 - erasure_coeff) / 11 +\n                                       erasure_coeff * predictors[i];\n            }\n            smooth = 0.125;\n        }\n        lspf[0] = FFMAX(lspf[0], QCELP_LSP_SPREAD_FACTOR);\n        for (i = 1; i < 10; i++)\n            lspf[i] = FFMAX(lspf[i], lspf[i - 1] + QCELP_LSP_SPREAD_FACTOR);\n        lspf[9] = FFMIN(lspf[9], 1.0 - QCELP_LSP_SPREAD_FACTOR);\n        for (i = 9; i > 0; i--)\n            lspf[i - 1] = FFMIN(lspf[i - 1], lspf[i] - QCELP_LSP_SPREAD_FACTOR);\n        ff_weighted_vector_sumf(lspf, lspf, q->prev_lspf, smooth, 1.0 - smooth, 10);\n    } else {\n        q->octave_count = 0;\n        tmp_lspf = 0.0;\n        for (i = 0; i < 5; i++) {\n            lspf[2 * i + 0] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][0] * 0.0001;\n            lspf[2 * i + 1] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][1] * 0.0001;\n        }\n        if (q->bitrate == RATE_QUARTER) {\n            if (lspf[9] <= .70 || lspf[9] >= .97)\n                return -1;\n            for (i = 3; i < 10; i++)\n                if (fabs(lspf[i] - lspf[i - 2]) < .08)\n                    return -1;\n        } else {\n            if (lspf[9] <= .66 || lspf[9] >= .985)\n                return -1;\n            for (i = 4; i < 10; i++)\n                if (fabs(lspf[i] - lspf[i - 4]) < .0931)\n                    return -1;\n        }\n    }\n    return 0;\n}']