Commit 9a9929e2 authored by rbultje's avatar rbultje

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().



git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21528 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 736dbc82
...@@ -164,6 +164,7 @@ void ff_decode_10_pulses_35bits(const int16_t *fixed_index, ...@@ -164,6 +164,7 @@ void ff_decode_10_pulses_35bits(const int16_t *fixed_index,
int i; int i;
int mask = (1 << bits) - 1; int mask = (1 << bits) - 1;
fixed_sparse->no_repeat_mask = 0;
fixed_sparse->n = 2 * half_pulse_count; fixed_sparse->n = 2 * half_pulse_count;
for (i = 0; i < half_pulse_count; i++) { for (i = 0; i < half_pulse_count; i++) {
const int pos1 = gray_decode[fixed_index[2*i+1] & mask] + 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) ...@@ -243,14 +244,14 @@ void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size)
int i; int i;
for (i=0; i < in->n; 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; float y = in->y[i] * scale;
do { do {
out[x] += y; out[x] += y;
y *= in->pitch_fac; y *= in->pitch_fac;
x += in->pitch_lag; 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) ...@@ -259,11 +260,11 @@ void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size)
int i; int i;
for (i=0; i < in->n; 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 { do {
out[x] = 0.0; out[x] = 0.0;
x += in->pitch_lag; x += in->pitch_lag;
} while (x < size); } while (x < size && repeats);
} }
} }
...@@ -30,6 +30,7 @@ typedef struct { ...@@ -30,6 +30,7 @@ typedef struct {
int n; int n;
int x[10]; int x[10];
float y[10]; float y[10];
int no_repeat_mask;
int pitch_lag; int pitch_lag;
float pitch_fac; float pitch_fac;
} AMRFixed; } AMRFixed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment