aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2009-03-30 03:05:38 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2009-03-30 03:05:38 +0000
commite71365f427964597a2f53f8af6fa60a9aaecffb5 (patch)
tree6568fda2dad25047fe299d6e54902c59eb3deac5 /libavcodec
parent0ae59bb01a86b409ec8277551f540e7db8e69a41 (diff)
downloadffmpeg-e71365f427964597a2f53f8af6fa60a9aaecffb5.tar.gz
mlpdec: Split filter_state_buffer into [fi]irbuf and fp to [fi]ir.
Originally committed as revision 18232 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mlpdec.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index dc4efe255d..727d47f847 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -652,17 +652,18 @@ static void filter_channel(MLPDecodeContext *m, unsigned int substr,
unsigned int channel)
{
SubStream *s = &m->substream[substr];
- int32_t filter_state_buffer[NUM_FILTERS][MAX_BLOCKSIZE + MAX_FIR_ORDER];
- FilterParams *fp[NUM_FILTERS] = { &m->channel_params[channel].filter_params[FIR],
- &m->channel_params[channel].filter_params[IIR], };
- unsigned int filter_shift = fp[FIR]->shift;
+ int32_t firbuf[MAX_BLOCKSIZE + MAX_FIR_ORDER];
+ int32_t iirbuf[MAX_BLOCKSIZE + MAX_IIR_ORDER];
+ FilterParams *fir = &m->channel_params[channel].filter_params[FIR];
+ FilterParams *iir = &m->channel_params[channel].filter_params[IIR];
+ unsigned int filter_shift = fir->shift;
int32_t mask = MSB_MASK(s->quant_step_size[channel]);
int index = MAX_BLOCKSIZE;
int i;
- memcpy(&filter_state_buffer[FIR][MAX_BLOCKSIZE], &fp[FIR]->state[0],
+ memcpy(&firbuf[MAX_BLOCKSIZE], &fir->state[0],
MAX_FIR_ORDER * sizeof(int32_t));
- memcpy(&filter_state_buffer[IIR][MAX_BLOCKSIZE], &fp[IIR]->state[0],
+ memcpy(&iirbuf[MAX_BLOCKSIZE], &iir->state[0],
MAX_IIR_ORDER * sizeof(int32_t));
for (i = 0; i < s->blocksize; i++) {
@@ -673,27 +674,27 @@ static void filter_channel(MLPDecodeContext *m, unsigned int substr,
/* TODO: Move this code to DSPContext? */
- for (order = 0; order < fp[FIR]->order; order++)
- accum += (int64_t)filter_state_buffer[FIR][index + order] *
- fp[FIR]->coeff[order];
- for (order = 0; order < fp[IIR]->order; order++)
- accum += (int64_t)filter_state_buffer[IIR][index + order] *
- fp[IIR]->coeff[order];
+ for (order = 0; order < fir->order; order++)
+ accum += (int64_t)firbuf[index + order] *
+ fir->coeff[order];
+ for (order = 0; order < iir->order; order++)
+ accum += (int64_t)iirbuf[index + order] *
+ iir->coeff[order];
accum = accum >> filter_shift;
result = (accum + residual) & mask;
--index;
- filter_state_buffer[FIR][index] = result;
- filter_state_buffer[IIR][index] = result - accum;
+ firbuf[index] = result;
+ iirbuf[index] = result - accum;
m->sample_buffer[i + s->blockpos][channel] = result;
}
- memcpy(&fp[FIR]->state[0], &filter_state_buffer[FIR][index],
+ memcpy(&fir->state[0], &firbuf[index],
MAX_FIR_ORDER * sizeof(int32_t));
- memcpy(&fp[IIR]->state[0], &filter_state_buffer[IIR][index],
+ memcpy(&iir->state[0], &iirbuf[index],
MAX_IIR_ORDER * sizeof(int32_t));
}