124 Commits

Author SHA1 Message Date
John Regan
ac021570a3 fix undefined behavior: unaligned read
Casting a type pointer into a larger type pointer requires
alignment. This replaces the unportable code with a portable
equivalent.
2022-07-07 10:54:23 -04:00
John Regan
5cc33e5af7 fix undefined behavior: left shift a negative integer
C/C++ leaves left-shifting a negative integer up to the compiler
implementation.

On most platforms, left-shifting a negative integer is the same as
casting to the unsigned equivalent, then casting back into the signed
type.

This replaces the left-shift with the mathematical equivalent and avoids
the undefined behavior.

Ideally this should be performed for any case of left-shifting a signed
type, but this commit only covers cases picked up by the undefined
behavior sanitizer.
2022-07-07 10:35:08 -04:00
John Regan
c2665b890c Fix undefined behavior: shift exponent is too large
Previously, the bestOrder value was being decremented inside
the loop. This caused the following:

In the case where the loop enters with bestOrder == 2, the
value is decremented to 1, and the following operations occurs:

m_tnsPredGains[channelIndex] >> (8 * bestOrder - 16)

bestOrder being 1 - this evaluates to (8 - 16), causing an integer
underflow, and a right shift by 4294967288. m_tnsPredGains is a
32-bit unsigned int, right-shifting by a value > 32 is undefined.

I think the intent of the loop conditional is to avoid running the
calculation with bestOrder == 1 - as far as I can tell, this is
the lowest possible value.

By re-arranging the comparison and using a prefix decrement,
we can exhibit the same behavior but avoid the case where
bestOrder == 1 within the loop body.
2022-07-07 09:52:33 -04:00
Christian R. Helmrich
4ef4bc3c96 fix warning, credit 2022-06-30 07:00:12 +00:00
John Regan
d21008f87b fixes for issue #24 2022-06-20 18:00:10 +00:00
John Regan
74512c0ce1 correction to C API 2022-06-17 18:00:24 +00:00
Christian R. Helmrich
7688ab502e finish 1.1.8 release 2021-10-27 10:00:00 +02:00
Christian R. Helmrich
f145f63fe5 code cleanup, CBR 2021-09-27 12:00:00 +02:00
Christian R. Helmrich
e72c4b1dcb allow 22-kHz SBR 2021-07-30 23:00:00 +02:00
Christian R. Helmrich
057bb87e64 clean DTX and RC 2021-06-28 23:00:00 +02:00
Christian R. Helmrich
e38b9a3d7d finish 1.1.6 release 2021-05-22 18:00:00 +02:00
Christian R. Helmrich
1592b40c66 allow delayless SBR 2021-05-16 14:00:00 +02:00
Christian R. Helmrich
a327f120c1 retune TNS for SBR 2021-05-13 01:00:01 +02:00
Christian R. Helmrich
08ac873cef near-mono tuning 2021-05-08 18:00:00 +02:00
Christian R. Helmrich
aaf8b0aa5a finish reader, SBR 2021-05-06 22:00:00 +02:00
Christian R. Helmrich
accb67be08 tune value for SBR 2021-05-04 10:00:00 +02:00
Christian R. Helmrich
9a1c4ee39d clean extra frames 2021-04-30 11:00:00 +02:00
Christian R. Helmrich
94a4ed9adf finish 1.1.5 release 2021-04-24 11:00:00 +02:00
Christian R. Helmrich
ab91fd8f9c realign and clean 2021-03-21 00:00:00 +01:00
Christian R. Helmrich
5bfcbaca3e clean up new code 2021-03-12 22:00:00 +01:00
Christian R. Helmrich
2d0fa2f10d some fine-tuning 2021-03-06 13:00:00 +01:00
Christian R. Helmrich
86f24988e2 improve IPF writing 2021-02-28 19:00:03 +01:00
Christian R. Helmrich
7d2b818e5a complete pred_dir 2021-01-30 23:00:00 +01:00
Christian R. Helmrich
0b14fafc2d finish 1.1.2 release 2021-01-25 23:00:00 +01:00
Christian R. Helmrich
9ed76efe87 some code cleanup 2021-01-23 18:00:00 +01:00
Christian R. Helmrich
193dc26823 seek compatibility 2021-01-23 02:00:00 +01:00
Christian R. Helmrich
920a3e8d56 non-SBR pre-roll 2021-01-17 19:00:10 +01:00
Christian R. Helmrich
0f31ad0043 update the readme# 2020-12-31 09:00:32 +00:00
Christian R. Helmrich
94b846b673 finish 1.1.1 release 2020-12-31 09:00:32 +00:00
Christian R. Helmrich
7211490815 fix 3-subband SBR 2020-12-31 09:00:32 +00:00
Christian R. Helmrich
f8d15db9fc 3-subband SBR mode 2020-12-31 09:00:32 +00:00
Christian R. Helmrich
4002bff2bf temporary workaround for Apple issue FB8928108 2020-12-05 12:00:00 +01:00
Christian R. Helmrich
c71ec4805a fix #16 and mode a 2020-11-28 22:00:01 +01:00
Christian R. Helmrich
7f47aaab53 bugfix, rate tuning 2020-11-25 01:00:00 +01:00
Christian R. Helmrich
f1d66fb3e4 SBR bit allocation 2020-11-22 21:00:00 +01:00
Christian R. Helmrich
5373500b9c SBR bit allocation 2020-11-20 22:00:00 +01:00
Christian R. Helmrich
6fe06fa78b SBR temporal res. 2020-11-17 22:00:00 +01:00
Christian R. Helmrich
1281acbe66 fix previous commit 2020-11-15 00:00:00 +01:00
Christian R. Helmrich
16d3fbaca6 low-resolution SBR 2020-11-13 21:00:01 +01:00
Christian R. Helmrich
1259070c19 add SBR bit syntax 2020-11-10 20:00:02 +01:00
Christian R. Helmrich
39dc185256 editorial changes 2020-10-24 02:00:00 +02:00
Christian R. Helmrich
a43f9b31f7 mode 0/9 tunings 2020-10-23 10:00:00 +02:00
Christian R. Helmrich
9323a9d0e8 fix for 8 and 64 kHz 2020-09-28 11:00:00 +02:00
Christian R. Helmrich
e9bd99bf84 cleanup, 32 kHz fix 2020-09-26 20:00:00 +02:00
Christian R. Helmrich
d2bede2449 finish 1.0.7 release 2020-08-25 01:00:00 +02:00
Christian R. Helmrich
399a5b78d8 editorial changes 2020-08-18 12:00:00 +02:00
Christian R. Helmrich
b033287115 rate ctrl, 32 kHz fix 2020-08-18 01:00:00 +02:00
Christian R. Helmrich
051900fe7c LR tuning, stss fix 2020-08-05 01:00:01 +02:00
Christian R. Helmrich
c72996090e fixes and cleanup 2020-07-27 01:00:00 +02:00
Christian R. Helmrich
f8ad0b34d7 fixes, finish tuning 2020-07-25 14:00:14 +02:00