diff options
author | Ben Avison <bavison@riscosopen.org> | 2014-03-20 18:59:15 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-03-26 20:41:48 +0100 |
commit | 3f4e73afe92743e96a633aa5b80416e4714e4783 (patch) | |
tree | 8c8dacd0c6830a5d99b2a8abe24a13e033bd0ef5 /libavcodec/mlpdec.c | |
parent | f38af0143c1849e8c8cea8d3374b4a554763eeee (diff) | |
download | ffmpeg-3f4e73afe92743e96a633aa5b80416e4714e4783.tar.gz |
truehd: break out part of rematrix_channels into platform-specific callback.
Verified with profiling that this doesn't have a measurable effect upon
overall performance.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r-- | libavcodec/mlpdec.c | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index cbd900073f..01ded5c3e1 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -1024,7 +1024,7 @@ static void fill_noise_buffer(MLPDecodeContext *m, unsigned int substr) static void rematrix_channels(MLPDecodeContext *m, unsigned int substr) { SubStream *s = &m->substream[substr]; - unsigned int mat, src_ch, i; + unsigned int mat; unsigned int maxchan; maxchan = s->max_matrix_channel; @@ -1036,31 +1036,18 @@ static void rematrix_channels(MLPDecodeContext *m, unsigned int substr) } for (mat = 0; mat < s->num_primitive_matrices; mat++) { - int matrix_noise_shift = s->matrix_noise_shift[mat]; unsigned int dest_ch = s->matrix_out_ch[mat]; - int32_t mask = MSB_MASK(s->quant_step_size[dest_ch]); - int32_t *coeffs = s->matrix_coeff[mat]; - int index = s->num_primitive_matrices - mat; - int index2 = 2 * index + 1; - - /* TODO: DSPContext? */ - - for (i = 0; i < s->blockpos; i++) { - int32_t bypassed_lsb = m->bypassed_lsbs[i][mat]; - int32_t *samples = m->sample_buffer[i]; - int64_t accum = 0; - - for (src_ch = 0; src_ch <= maxchan; src_ch++) - accum += (int64_t) samples[src_ch] * coeffs[src_ch]; - - if (matrix_noise_shift) { - index &= m->access_unit_size_pow2 - 1; - accum += m->noise_buffer[index] << (matrix_noise_shift + 7); - index += index2; - } - - samples[dest_ch] = ((accum >> 14) & mask) + bypassed_lsb; - } + m->dsp.mlp_rematrix_channel(&m->sample_buffer[0][0], + s->matrix_coeff[mat], + &m->bypassed_lsbs[0][mat], + m->noise_buffer, + s->num_primitive_matrices - mat, + dest_ch, + s->blockpos, + maxchan, + s->matrix_noise_shift[mat], + m->access_unit_size_pow2, + MSB_MASK(s->quant_step_size[dest_ch])); } } |