diff options
Diffstat (limited to 'ac3dec/rematrix.c')
-rw-r--r-- | ac3dec/rematrix.c | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/ac3dec/rematrix.c b/ac3dec/rematrix.c index caa70943..f1df19b1 100644 --- a/ac3dec/rematrix.c +++ b/ac3dec/rematrix.c @@ -28,52 +28,60 @@ #include "ac3_internal.h" -#include "decode.h" #include "rematrix.h" + struct rematrix_band_s { - uint_32 start; - uint_32 end; + uint32_t start; + uint32_t end; +} rematrix_band[] = { + {13, 24}, + {25, 36}, + {37, 60}, + {61, 252} }; -struct rematrix_band_s rematrix_band[] = { {13,24}, {25,36}, {37 ,60}, {61,252}}; -static inline uint_32 min(uint_32 a,uint_32 b); +/** + * + **/ -static inline uint_32 -min(uint_32 a,uint_32 b) +inline uint32_t min (uint32_t a, uint32_t b) { - return (a < b ? a : b); + return (a < b) ? a : b; } -/* This routine simply does stereo rematixing for the 2 channel - * stereo mode */ -void rematrix(audblk_t *audblk, stream_samples_t samples) + +/** + * This routine simply does stereo remartixing for the 2 channel + * stereo mode + **/ + +void rematrix (audblk_t *audblk, stream_samples_t samples) { - uint_32 num_bands; - uint_32 start; - uint_32 end; - uint_32 i,j; - float left,right; + uint32_t num_bands; + uint32_t start; + uint32_t end; + int i,j; - if(!audblk->cplinu || audblk->cplbegf > 2) + if (!audblk->cplinu || audblk->cplbegf > 2) num_bands = 4; else if (audblk->cplbegf > 0) num_bands = 3; else num_bands = 2; - for(i=0;i < num_bands; i++) - { - if(!audblk->rematflg[i]) + for (i=0; i < num_bands; i++) { + if (!audblk->rematflg[i]) continue; start = rematrix_band[i].start; - end = min(rematrix_band[i].end ,12 * audblk->cplbegf + 36); + end = min (rematrix_band[i].end ,12 * audblk->cplbegf + 36); - for(j=start;j < end; j++) - { + for (j=start;j < end; j++) { + float left,right; + left = samples[0][j] + samples[1][j]; right = samples[0][j] - samples[1][j]; samples[0][j] = left; |