aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2010-01-29 16:49:06 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2010-01-29 16:49:06 +0000
commit5e4e9042c4e11bcf4fd1734f17e0379eab422e41 (patch)
tree49f0c79ec1beb7d25c95794847b18ef7bbfcc8ec /libavcodec
parent4a27f326c538ffcbb484aca67e4120b03091a85a (diff)
downloadffmpeg-5e4e9042c4e11bcf4fd1734f17e0379eab422e41.tar.gz
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(). Originally committed as revision 21528 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/acelp_vectors.c9
-rw-r--r--libavcodec/acelp_vectors.h1
2 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/acelp_vectors.c b/libavcodec/acelp_vectors.c
index c9a6f40839..736987bbb8 100644
--- a/libavcodec/acelp_vectors.c
+++ b/libavcodec/acelp_vectors.c
@@ -164,6 +164,7 @@ void ff_decode_10_pulses_35bits(const int16_t *fixed_index,
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 @@ void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size)
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 @@ void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size)
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);
}
}
diff --git a/libavcodec/acelp_vectors.h b/libavcodec/acelp_vectors.h
index 3a72ef91e7..2cc5f36649 100644
--- a/libavcodec/acelp_vectors.h
+++ b/libavcodec/acelp_vectors.h
@@ -30,6 +30,7 @@ typedef struct {
int n;
int x[10];
float y[10];
+ int no_repeat_mask;
int pitch_lag;
float pitch_fac;
} AMRFixed;