]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/qcelpdec.c
libvpx: support vp9
[ffmpeg] / libavcodec / qcelpdec.c
index a3af2378f3f672a791128a88bd9e1446c885c798..b702175c19e5afc0e1024fc6930084c42aab384f 100644 (file)
 
 #include <stddef.h>
 
+#include "libavutil/channel_layout.h"
 #include "avcodec.h"
 #include "internal.h"
 #include "get_bits.h"
-
+#include "dsputil.h"
 #include "qcelpdata.h"
-
-#include "celp_math.h"
 #include "celp_filters.h"
 #include "acelp_filters.h"
 #include "acelp_vectors.h"
@@ -91,7 +90,9 @@ static av_cold int qcelp_decode_init(AVCodecContext *avctx)
     QCELPContext *q = avctx->priv_data;
     int i;
 
-    avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
+    avctx->channels       = 1;
+    avctx->channel_layout = AV_CH_LAYOUT_MONO;
+    avctx->sample_fmt     = AV_SAMPLE_FMT_FLT;
 
     for (i = 0; i < 10; i++)
         q->prev_lspf[i] = (i + 1) / 11.;
@@ -401,8 +402,9 @@ static void apply_gain_ctrl(float *v_out, const float *v_ref, const float *v_in)
 
     for (i = 0; i < 160; i += 40)
         ff_scale_vector_to_given_sum_of_squares(v_out + i, v_in + i,
-                                                ff_dot_productf(v_ref + i,
-                                                                v_ref + i, 40),
+                                                ff_scalarproduct_float_c(v_ref + i,
+                                                                         v_ref + i,
+                                                                         40),
                                                 40);
 }
 
@@ -678,8 +680,8 @@ static void postfilter(QCELPContext *q, float *samples, float *lpc)
     ff_tilt_compensation(&q->postfilter_tilt_mem, 0.3, pole_out + 10, 160);
 
     ff_adaptive_gain_control(samples, pole_out + 10,
-                             ff_dot_productf(q->formant_mem + 10,
-                                             q->formant_mem + 10, 160),
+                             ff_scalarproduct_float_c(q->formant_mem + 10,
+                                                      q->formant_mem + 10, 160),
                              160, 0.9375, &q->postfilter_agc_mem);
 }
 
@@ -697,7 +699,7 @@ static int qcelp_decode_frame(AVCodecContext *avctx, void *data,
 
     /* get output buffer */
     q->avframe.nb_samples = 160;
-    if ((ret = avctx->get_buffer(avctx, &q->avframe)) < 0) {
+    if ((ret = ff_get_buffer(avctx, &q->avframe)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return ret;
     }
@@ -793,7 +795,7 @@ erasure:
 AVCodec ff_qcelp_decoder = {
     .name           = "qcelp",
     .type           = AVMEDIA_TYPE_AUDIO,
-    .id             = CODEC_ID_QCELP,
+    .id             = AV_CODEC_ID_QCELP,
     .init           = qcelp_decode_init,
     .decode         = qcelp_decode_frame,
     .capabilities   = CODEC_CAP_DR1,