]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavcodec/qcelpdec.c
More OKed parts of the QCELP decoder
[frescor/ffmpeg.git] / libavcodec / qcelpdec.c
index 1b52d3f5cdeb74e499b9fb873b40c3bdd37856c2..1ad76590f91f8026b621849bef7f3752adf44b04 100644 (file)
 #undef NDEBUG
 #include <assert.h>
 
+static void weighted_vector_sumf(float *out,
+                                 const float *in_a,
+                                 const float *in_b,
+                                 float weight_coeff_a,
+                                 float weight_coeff_b,
+                                 int length) {
+    int   i;
+
+    for (i = 0; i < length; i++)
+        out[i] = weight_coeff_a * in_a[i]
+               + weight_coeff_b * in_b[i];
+}
+
 /**
  * Apply filter in pitch-subframe steps.
  *
@@ -90,6 +103,22 @@ static const float *do_pitchfilter(float memory[303],
     return memory + 143;
 }
 
+static int buf_size2framerate(const int buf_size) {
+    switch (buf_size) {
+    case 35:
+        return RATE_FULL;
+    case 17:
+        return RATE_HALF;
+    case  8:
+        return RATE_QUARTER;
+    case  4:
+        return RATE_OCTAVE;
+    case  1:
+        return SILENCE;
+    }
+    return -1;
+}
+
 static void warn_insufficient_frame_quality(AVCodecContext *avctx,
                                             const char *message) {
     av_log(avctx, AV_LOG_WARNING, "Frame #%d, IFQ: %s\n", avctx->frame_number, message);