changeset 11052:00fcecde822b libavcodec

Add no_repeat_mask option, so that single-pulse vectors can also be expressed in a AMRFixed structure and handled by ff_set_fixed_vector().
author rbultje
date Fri, 29 Jan 2010 16:49:06 +0000
parents 5d4991dd23de
children c57e72227d7d
files acelp_vectors.c acelp_vectors.h
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/acelp_vectors.c	Fri Jan 29 13:51:25 2010 +0000
+++ b/acelp_vectors.c	Fri Jan 29 16:49:06 2010 +0000
@@ -164,6 +164,7 @@
     int i;
     int mask = (1 << bits) - 1;
 
+    fixed_sparse->no_repeat_mask = 0;
     fixed_sparse->n = 2 * half_pulse_count;
     for (i = 0; i < half_pulse_count; i++) {
         const int pos1   = gray_decode[fixed_index[2*i+1] & mask] + i;
@@ -243,14 +244,14 @@
     int i;
 
     for (i=0; i < in->n; i++) {
-        int x   = in->x[i];
+        int x   = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1);
         float y = in->y[i] * scale;
 
         do {
             out[x] += y;
             y *= in->pitch_fac;
             x += in->pitch_lag;
-        } while (x < size);
+        } while (x < size && repeats);
     }
 }
 
@@ -259,11 +260,11 @@
     int i;
 
     for (i=0; i < in->n; i++) {
-        int x  = in->x[i];
+        int x  = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1);
 
         do {
             out[x] = 0.0;
             x += in->pitch_lag;
-        } while (x < size);
+        } while (x < size && repeats);
     }
 }
--- a/acelp_vectors.h	Fri Jan 29 13:51:25 2010 +0000
+++ b/acelp_vectors.h	Fri Jan 29 16:49:06 2010 +0000
@@ -30,6 +30,7 @@
     int      n;
     int      x[10];
     float    y[10];
+    int      no_repeat_mask;
     int      pitch_lag;
     float    pitch_fac;
 } AMRFixed;