]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ra144.c
aacenc: 10l, missed a reference when refactoring the psymodel.
[ffmpeg] / libavcodec / ra144.c
index c528c3274a030e86049415d5327f091c1d2f5c7e..9baa06850f7726780c873d0f8d177e4a4d64ea62 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <stdint.h>
 #include "avcodec.h"
+#include "celp_filters.h"
 #include "ra144.h"
 
 const int16_t ff_gain_val_tab[256][3] = {
@@ -1502,8 +1503,8 @@ const int16_t * const ff_lpc_refl_cb[10]={
     lpc_refl_cb6, lpc_refl_cb7, lpc_refl_cb8, lpc_refl_cb9, lpc_refl_cb10
 };
 
-void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
-                const int8_t *s2, const int8_t *s3)
+static void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
+                       const int8_t *s2, const int8_t *s3)
 {
     int i;
     int v[3];
@@ -1684,3 +1685,36 @@ int ff_irms(const int16_t *data)
 
     return 0x20000000 / (ff_t_sqrt(sum) >> 8);
 }
+
+void ff_subblock_synthesis(RA144Context *ractx, const uint16_t *lpc_coefs,
+                           int cba_idx, int cb1_idx, int cb2_idx,
+                           int gval, int gain)
+{
+    uint16_t buffer_a[40];
+    uint16_t *block;
+    int m[3];
+
+    if (cba_idx) {
+        cba_idx += BLOCKSIZE/2 - 1;
+        ff_copy_and_dup(buffer_a, ractx->adapt_cb, cba_idx);
+        m[0] = (ff_irms(buffer_a) * gval) >> 12;
+    } else {
+        m[0] = 0;
+    }
+    m[1] = (ff_cb1_base[cb1_idx] * gval) >> 8;
+    m[2] = (ff_cb2_base[cb2_idx] * gval) >> 8;
+    memmove(ractx->adapt_cb, ractx->adapt_cb + BLOCKSIZE,
+            (BUFFERSIZE - BLOCKSIZE) * sizeof(*ractx->adapt_cb));
+
+    block = ractx->adapt_cb + BUFFERSIZE - BLOCKSIZE;
+
+    ff_add_wav(block, gain, cba_idx, m, cba_idx? buffer_a: NULL,
+               ff_cb1_vects[cb1_idx], ff_cb2_vects[cb2_idx]);
+
+    memcpy(ractx->curr_sblock, ractx->curr_sblock + 40,
+           10*sizeof(*ractx->curr_sblock));
+
+    if (ff_celp_lp_synthesis_filter(ractx->curr_sblock + 10, lpc_coefs,
+                                    block, BLOCKSIZE, 10, 1, 0xfff))
+        memset(ractx->curr_sblock, 0, 50*sizeof(*ractx->curr_sblock));
+}