#include <stddef.h>
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/float_dsp.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"
-#include "dsputil.h"
#include "qcelpdata.h"
#include "celp_filters.h"
#include "acelp_filters.h"
} qcelp_packet_rate;
typedef struct {
- AVFrame avframe;
GetBitContext gb;
qcelp_packet_rate bitrate;
QCELPFrame frame; /**< unpacked data frame */
for (i = 0; i < 10; i++)
q->prev_lspf[i] = (i + 1) / 11.;
- avcodec_get_frame_defaults(&q->avframe);
- avctx->coded_frame = &q->avframe;
-
return 0;
}
{
int i;
- for (i = 0; i < 160; i += 40)
- ff_scale_vector_to_given_sum_of_squares(v_out + i, v_in + i,
- ff_scalarproduct_float_c(v_ref + i,
- v_ref + i,
- 40),
- 40);
+ for (i = 0; i < 160; i += 40) {
+ float res = avpriv_scalarproduct_float_c(v_ref + i, v_ref + i, 40);
+ ff_scale_vector_to_given_sum_of_squares(v_out + i, v_in + i, res, 40);
+ }
}
/**
return I_F_Q;
if (bitrate == SILENCE) {
- //FIXME: Remove experimental warning when tested with samples.
- av_log_ask_for_sample(avctx, "'Blank frame handling is experimental.");
+ // FIXME: Remove this warning when tested with samples.
+ avpriv_request_sample(avctx, "Blank frame handling");
}
return bitrate;
}
ff_tilt_compensation(&q->postfilter_tilt_mem, 0.3, pole_out + 10, 160);
ff_adaptive_gain_control(samples, pole_out + 10,
- ff_scalarproduct_float_c(q->formant_mem + 10,
- q->formant_mem + 10, 160),
+ avpriv_scalarproduct_float_c(q->formant_mem + 10,
+ q->formant_mem + 10,
+ 160),
160, 0.9375, &q->postfilter_agc_mem);
}
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
QCELPContext *q = avctx->priv_data;
+ AVFrame *frame = data;
float *outbuffer;
int i, ret;
float quantized_lspf[10], lpc[10];
float *formant_mem;
/* get output buffer */
- q->avframe.nb_samples = 160;
- if ((ret = avctx->get_buffer(avctx, &q->avframe)) < 0) {
+ frame->nb_samples = 160;
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
- outbuffer = (float *)q->avframe.data[0];
+ outbuffer = (float *)frame->data[0];
if ((q->bitrate = determine_bitrate(avctx, buf_size, &buf)) == I_F_Q) {
warn_insufficient_frame_quality(avctx, "bitrate cannot be determined.");
memcpy(q->prev_lspf, quantized_lspf, sizeof(q->prev_lspf));
q->prev_bitrate = q->bitrate;
- *got_frame_ptr = 1;
- *(AVFrame *)data = q->avframe;
+ *got_frame_ptr = 1;
return buf_size;
}