]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/g729dec.c
atrac1: give a valid context pointer to av_log().
[ffmpeg] / libavcodec / g729dec.c
index de384dd1849e2be051fa646ae09ba6c27969f61f..d76567974fe89d74517d369bc782997698e89442 100644 (file)
@@ -332,6 +332,16 @@ static int16_t g729d_voice_decision(int onset, int prev_voice_decision, const in
     return voice_decision;
 }
 
+static int32_t scalarproduct_int16_c(const int16_t * v1, const int16_t * v2, int order, int shift)
+{
+    int res = 0;
+
+    while (order--)
+        res += (*v1++ * *v2++) >> shift;
+
+    return res;
+}
+
 static av_cold int decoder_init(AVCodecContext * avctx)
 {
     G729Context* ctx = avctx->priv_data;
@@ -367,8 +377,8 @@ static av_cold int decoder_init(AVCodecContext * avctx)
     for(i=0; i<4; i++)
         ctx->quant_energy[i] = -14336; // -14 in (5.10)
 
-    avctx->dsp_mask= ~AV_CPU_FLAG_FORCE;
     dsputil_init(&ctx->dsp, avctx);
+    ctx->dsp.scalarproduct_int16 = scalarproduct_int16_c;
 
     return 0;
 }
@@ -426,7 +436,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
         frame_erasure |= buf[i];
     frame_erasure = !frame_erasure;
 
-    init_get_bits(&gb, buf, buf_size);
+    init_get_bits(&gb, buf, 8*buf_size);
 
     ma_predictor     = get_bits(&gb, 1);
     quantizer_1st    = get_bits(&gb, VQ_1ST_BITS);
@@ -604,6 +614,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
             SUBFRAME_SIZE,
             10,
             1,
+            0,
             0x800))
             /* Overflow occured, downscale excitation signal... */
             for (j = 0; j < 2 * SUBFRAME_SIZE + PITCH_DELAY_MAX + INTERPOL_LEN; j++)
@@ -625,6 +636,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
                     SUBFRAME_SIZE,
                     10,
                     0,
+                    0,
                     0x800);
         } else {
             ff_celp_lp_synthesis_filter(
@@ -634,6 +646,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
                     SUBFRAME_SIZE,
                     10,
                     0,
+                    0,
                     0x800);
         }
         /* Save data (without postfilter) for use in next subframe. */