2 #include "ac3_decoder.h"
3 #include "ac3_internal.h"
5 struct rematrix_band_s {
10 static struct rematrix_band_s rematrix_band[] = { {13,24}, {25,36}, {37 ,60}, {61,252}};
12 static __inline__ u32 min (u32 a, u32 b)
14 return (a < b ? a : b);
17 /* This routine simply does stereo rematixing for the 2 channel
19 void rematrix (ac3dec_t * p_ac3dec)
27 if (p_ac3dec->audblk.cplinu || p_ac3dec->audblk.cplbegf > 2)
29 else if (p_ac3dec->audblk.cplbegf > 0)
34 for (i=0;i < num_bands; i++) {
35 if (!p_ac3dec->audblk.rematflg[i])
38 start = rematrix_band[i].start;
39 end = min(rematrix_band[i].end ,12 * p_ac3dec->audblk.cplbegf + 36);
41 for (j=start;j < end; j++) {
42 left = 0.5f * (p_ac3dec->coeffs.fbw[0][j] + p_ac3dec->coeffs.fbw[1][j]);
43 right = 0.5f * (p_ac3dec->coeffs.fbw[0][j] - p_ac3dec->coeffs.fbw[1][j]);
44 p_ac3dec->coeffs.fbw[0][j] = left;
45 p_ac3dec->coeffs.fbw[1][j] = right;