Mercurial > libavcodec.hg
comparison mlpdec.c @ 9505:bcef741a555a libavcodec
truehd: Simplify rematrix_channels() as per Michael's original review.
author | ramiro |
---|---|
date | Sat, 18 Apr 2009 19:39:07 +0000 |
parents | dc643c3c285e |
children | 50feb15cbf2a |
comparison
equal
deleted
inserted
replaced
9504:dc643c3c285e | 9505:bcef741a555a |
---|---|
846 | 846 |
847 for (mat = 0; mat < s->num_primitive_matrices; mat++) { | 847 for (mat = 0; mat < s->num_primitive_matrices; mat++) { |
848 int matrix_noise_shift = s->matrix_noise_shift[mat]; | 848 int matrix_noise_shift = s->matrix_noise_shift[mat]; |
849 unsigned int dest_ch = s->matrix_out_ch[mat]; | 849 unsigned int dest_ch = s->matrix_out_ch[mat]; |
850 int32_t mask = MSB_MASK(s->quant_step_size[dest_ch]); | 850 int32_t mask = MSB_MASK(s->quant_step_size[dest_ch]); |
851 int index = s->num_primitive_matrices - mat; | |
852 int index2 = 2 * index + 1; | |
851 | 853 |
852 /* TODO: DSPContext? */ | 854 /* TODO: DSPContext? */ |
853 | 855 |
854 for (i = 0; i < s->blockpos; i++) { | 856 for (i = 0; i < s->blockpos; i++) { |
855 int64_t accum = 0; | 857 int64_t accum = 0; |
856 for (src_ch = 0; src_ch <= maxchan; src_ch++) { | 858 for (src_ch = 0; src_ch <= maxchan; src_ch++) { |
857 accum += (int64_t)m->sample_buffer[i][src_ch] | 859 accum += (int64_t)m->sample_buffer[i][src_ch] |
858 * s->matrix_coeff[mat][src_ch]; | 860 * s->matrix_coeff[mat][src_ch]; |
859 } | 861 } |
860 if (matrix_noise_shift) { | 862 if (matrix_noise_shift) { |
861 uint32_t index = s->num_primitive_matrices - mat; | 863 index &= m->access_unit_size_pow2 - 1; |
862 index = (i * (index * 2 + 1) + index) & (m->access_unit_size_pow2 - 1); | |
863 accum += m->noise_buffer[index] << (matrix_noise_shift + 7); | 864 accum += m->noise_buffer[index] << (matrix_noise_shift + 7); |
865 index += index2; | |
864 } | 866 } |
865 m->sample_buffer[i][dest_ch] = ((accum >> 14) & mask) | 867 m->sample_buffer[i][dest_ch] = ((accum >> 14) & mask) |
866 + m->bypassed_lsbs[i][mat]; | 868 + m->bypassed_lsbs[i][mat]; |
867 } | 869 } |
868 } | 870 } |