summaryrefslogtreecommitdiff
path: root/libavcodec/mlpdec.c
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2009-04-18 19:39:07 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2009-04-18 19:39:07 +0000
commit15e6748b724299b86e8919b0797c398c27449ddf (patch)
treea69d01cefbce5e5ef5e98dc8043c157368f2e96a /libavcodec/mlpdec.c
parent95c14b1eea17d6322c10fa97de1d05bbbed1e23d (diff)
truehd: Simplify rematrix_channels() as per Michael's original review.
Originally committed as revision 18612 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r--libavcodec/mlpdec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index a86ad3f15e..25d0b4f0c1 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -848,6 +848,8 @@ static void rematrix_channels(MLPDecodeContext *m, unsigned int substr)
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]);
+ int index = s->num_primitive_matrices - mat;
+ int index2 = 2 * index + 1;
/* TODO: DSPContext? */
@@ -858,9 +860,9 @@ static void rematrix_channels(MLPDecodeContext *m, unsigned int substr)
* s->matrix_coeff[mat][src_ch];
}
if (matrix_noise_shift) {
- uint32_t index = s->num_primitive_matrices - mat;
- index = (i * (index * 2 + 1) + index) & (m->access_unit_size_pow2 - 1);
+ index &= m->access_unit_size_pow2 - 1;
accum += m->noise_buffer[index] << (matrix_noise_shift + 7);
+ index += index2;
}
m->sample_buffer[i][dest_ch] = ((accum >> 14) & mask)
+ m->bypassed_lsbs[i][mat];