3535
3636DIO_s8 DIO_LinearToALaw (DIO_s16 sample )
3737{
38- const int cClip = 32635 ;
39- const static char LogTable [128 ] =
38+ const DIO_s16 cClip = 32635 ;
39+ const static DIO_s8 LogTable [128 ] =
4040 {
4141 1 ,1 ,2 ,2 ,3 ,3 ,3 ,3 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 ,
4242 6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 ,
4343 7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,
4444 7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7 ,7
4545 };
4646
47- int sign , exponent , mantissa ;
48- char compandedValue ;
47+ DIO_s32 sign , exponent , mantissa ;
48+ DIO_s8 compandedValue ;
4949 sample = (sample == -32768 ) ? -32767 : sample ;
5050 sign = ((~sample ) >> 8 ) & 0x80 ;
5151 if (!sign )
@@ -68,7 +68,7 @@ DIO_s8 DIO_LinearToALaw(DIO_s16 sample)
6868
6969DIO_s16 DIO_ALawToLinear (DIO_s8 aLawByte )
7070{
71- const static short ALawDecompTable [256 ]= {
71+ const static DIO_s16 ALawDecompTable [256 ]= {
7272 5504 , 5248 , 6016 , 5760 , 4480 , 4224 , 4992 , 4736 ,
7373 7552 , 7296 , 8064 , 7808 , 6528 , 6272 , 7040 , 6784 ,
7474 2752 , 2624 , 3008 , 2880 , 2240 , 2112 , 2496 , 2368 ,
@@ -101,15 +101,15 @@ DIO_s16 DIO_ALawToLinear(DIO_s8 aLawByte)
101101 -1888 , -1824 , -2016 , -1952 , -1632 , -1568 , -1760 , -1696 ,
102102 -688 , -656 , -752 , -720 , -560 , -528 , -624 , -592 ,
103103 -944 , -912 , -1008 , -976 , -816 , -784 , -880 , -848 };
104- int addr = ((int )aLawByte )+ 128 ; // done for compilers with poor expr type enforcement
104+ DIO_s16 addr = ((DIO_s16 )aLawByte )+ 128 ; // done for compilers with poor expr type enforcement
105105 return ALawDecompTable [addr ];
106106}
107107
108108// see companders.h
109109// fixed-radix IIR averager implementation supporting arbitrarily chosen windows
110110DIO_s32 DIO_IIRavgFR (DIO_s32 prevAvg , DIO_u16 windowLen , DIO_s16 newSample , DIO_u8 radix )
111111{
112- int iirAvg = 0 ;
112+ DIO_s32 iirAvg = 0 ;
113113 iirAvg = ((prevAvg * (windowLen - 1 )) + (DIO_I2FR (newSample ,radix )))/windowLen ;
114114 return iirAvg ;
115115}
@@ -119,7 +119,7 @@ DIO_s32 DIO_IIRavgFR (DIO_s32 prevAvg, DIO_u16 windowLen, DIO_s16 newSample,
119119// and only shift operations for cpu efficiency
120120DIO_s32 DIO_IIRavgPower2FR (DIO_s32 prevAvg , DIO_u8 windowLenInBits , DIO_s16 newSample , DIO_u8 radix )
121121{
122- int iirAvg = 0 ;
122+ DIO_s32 iirAvg = 0 ;
123123 iirAvg = (((prevAvg <<windowLenInBits )- prevAvg ) + (DIO_I2FR (newSample ,radix )))>>windowLenInBits ;
124124 return iirAvg ;
125125}
0 commit comments