]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/g729dec.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / g729dec.c
index b38945cd6c2d6befbf5b841da43c64068891feeb..f394184d52cb1dd0e212a314fcb3e6dd033a3a5a 100644 (file)
@@ -333,12 +333,12 @@ 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)
+static int32_t scalarproduct_int16_c(const int16_t * v1, const int16_t * v2, int order)
 {
     int res = 0;
 
     while (order--)
-        res += (*v1++ * *v2++) >> shift;
+        res += *v1++ * *v2++;
 
     return res;
 }
@@ -371,6 +371,8 @@ static av_cold int decoder_init(AVCodecContext * avctx)
 
     ctx->exc = &ctx->exc_base[PITCH_DELAY_MAX+INTERPOL_LEN];
 
+    ctx->pitch_delay_int_prev = PITCH_DELAY_MIN;
+
     /* random seed initialization */
     ctx->rand_value = 21845;
 
@@ -560,7 +562,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
                 gain_corr_factor = cb_gain_1st_6k4[gc_1st_index][1] +
                                    cb_gain_2nd_6k4[gc_2nd_index][1];
 
-                /* Without check below overflow can occure in ff_acelp_update_past_gain.
+                /* Without check below overflow can occur in ff_acelp_update_past_gain.
                    It is not issue for G.729, because gain_corr_factor in it's case is always
                    greater than 1024, while in G.729D it can be even zero. */
                 gain_corr_factor = FFMAX(gain_corr_factor, 1024);
@@ -587,7 +589,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
               two times larger than in original G.729.
 
               If bit-exact result is not issue then gain_corr_factor
-              can be simpler devided by 2 before call to g729_get_gain_code
+              can be simpler divided by 2 before call to g729_get_gain_code
               instead of using correction below.
             */
             if (packet_type == FORMAT_G729D_6K4) {
@@ -622,7 +624,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
             1,
             0,
             0x800))
-            /* Overflow occured, downscale excitation signal... */
+            /* Overflow occurred, downscale excitation signal... */
             for (j = 0; j < 2 * SUBFRAME_SIZE + PITCH_DELAY_MAX + INTERPOL_LEN; j++)
                 ctx->exc_base[j] >>= 2;
 
@@ -712,14 +714,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
     return buf_size;
 }
 
-AVCodec ff_g729_decoder =
-{
+AVCodec ff_g729_decoder = {
     .name           = "g729",
     .type           = AVMEDIA_TYPE_AUDIO,
     .id             = CODEC_ID_G729,
     .priv_data_size = sizeof(G729Context),
     .init           = decoder_init,
     .decode         = decode_frame,
-    .capabilities = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("G.729"),
+    .capabilities   = CODEC_CAP_DR1,
+    .long_name      = NULL_IF_CONFIG_SMALL("G.729"),
 };