OLD | NEW |
1 /* Copyright (c) 2007-2008 CSIRO | 1 /* Copyright (c) 2007-2008 CSIRO |
2 Copyright (c) 2007-2009 Xiph.Org Foundation | 2 Copyright (c) 2007-2009 Xiph.Org Foundation |
3 Copyright (c) 2008-2009 Gregory Maxwell | 3 Copyright (c) 2008-2009 Gregory Maxwell |
4 Written by Jean-Marc Valin and Gregory Maxwell */ | 4 Written by Jean-Marc Valin and Gregory Maxwell */ |
5 /* | 5 /* |
6 Redistribution and use in source and binary forms, with or without | 6 Redistribution and use in source and binary forms, with or without |
7 modification, are permitted provided that the following conditions | 7 modification, are permitted provided that the following conditions |
8 are met: | 8 are met: |
9 | 9 |
10 - Redistributions of source code must retain the above copyright | 10 - Redistributions of source code must retain the above copyright |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 iside = 0; | 898 iside = 0; |
899 fill &= (1<<B)-1; | 899 fill &= (1<<B)-1; |
900 delta = -16384; | 900 delta = -16384; |
901 } else if (itheta == 16384) | 901 } else if (itheta == 16384) |
902 { | 902 { |
903 imid = 0; | 903 imid = 0; |
904 iside = 32767; | 904 iside = 32767; |
905 fill &= ((1<<B)-1)<<B; | 905 fill &= ((1<<B)-1)<<B; |
906 delta = 16384; | 906 delta = 16384; |
907 } else { | 907 } else { |
908 imid = bitexact_cos(itheta); | 908 imid = bitexact_cos((opus_int16)itheta); |
909 iside = bitexact_cos(16384-itheta); | 909 iside = bitexact_cos((opus_int16)(16384-itheta)); |
910 /* This is the mid vs side allocation that minimizes squared error | 910 /* This is the mid vs side allocation that minimizes squared error |
911 in that band. */ | 911 in that band. */ |
912 delta = FRAC_MUL16((N-1)<<7,bitexact_log2tan(iside,imid)); | 912 delta = FRAC_MUL16((N-1)<<7,bitexact_log2tan(iside,imid)); |
913 } | 913 } |
914 | 914 |
915 #ifdef FIXED_POINT | 915 #ifdef FIXED_POINT |
916 mid = imid; | 916 mid = imid; |
917 side = iside; | 917 side = iside; |
918 #else | 918 #else |
919 mid = (1.f/32768)*imid; | 919 mid = (1.f/32768)*imid; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 collapse_masks[i*C+0] = (unsigned char)x_cm; | 1293 collapse_masks[i*C+0] = (unsigned char)x_cm; |
1294 collapse_masks[i*C+C-1] = (unsigned char)y_cm; | 1294 collapse_masks[i*C+C-1] = (unsigned char)y_cm; |
1295 balance += pulses[i] + tell; | 1295 balance += pulses[i] + tell; |
1296 | 1296 |
1297 /* Update the folding position only as long as we have 1 bit/sample depth
*/ | 1297 /* Update the folding position only as long as we have 1 bit/sample depth
*/ |
1298 update_lowband = b>(N<<BITRES); | 1298 update_lowband = b>(N<<BITRES); |
1299 } | 1299 } |
1300 RESTORE_STACK; | 1300 RESTORE_STACK; |
1301 } | 1301 } |
1302 | 1302 |
OLD | NEW |