Commit Graph

172 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
00423757b1 finish 1.1.9 release 2021-12-17 11:00:00 +01:00
Christian R. Helmrich
7ebdd6308a fixes for issue #21 2021-11-10 06:00:00 +01: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
acd53a2198 finish 1.1.7 release 2021-08-30 09:00:00 +02:00
Christian R. Helmrich
9d500c648d loudness leveling 2021-07-31 23: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
b11042a0f0 correct csgp atom 2021-05-29 16:00:01 +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
cc4151b9c7 Universal2 support 2021-04-01 23:00:00 +02:00
Christian R. Helmrich
c3a90381de clean up new code 2021-04-01 20:00:00 +02:00
Christian R. Helmrich
d59780dcff fix Unicode text 2021-04-01 01:00:03 +02:00
Christian R. Helmrich
27e9e9e02e finish 1.1.4 release 2021-03-27 15:00:00 +01:00
Christian R. Helmrich
760f862fd5 app -> work path 2021-03-27 01:00:00 +01:00
Christian R. Helmrich
ad8881519d fix frame flushing 2021-03-23 11:00:00 +01:00
Christian R. Helmrich
ea8fed7f7e finish rel. notes 2021-03-22 01:00:00 +01: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
0bde366c7f autom. IPF update 2021-03-08 21:00:00 +01:00
Christian R. Helmrich
2d0fa2f10d some fine-tuning 2021-03-06 13:00:00 +01:00
Christian R. Helmrich
8cdc188bb6 editorial changes 2021-02-28 23: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
7a2c4048dd reduce binary sizes 2021-01-30 10:00:00 +01:00
Christian R. Helmrich
0b14fafc2d finish 1.1.2 release 2021-01-25 23:00:00 +01:00
Christian R. Helmrich
44f6b15bb8 editorial changes 2021-01-24 01: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
803c5fef8e Revert "only IPF in stss box"
This reverts commit 64668104aa
2021-01-23 00:01:43 +00:00
Christian R. Helmrich
64668104aa only IPF in stss box 2021-01-20 22:00:00 +01:00
Christian R. Helmrich
920a3e8d56 non-SBR pre-roll 2021-01-17 19:00:10 +01:00
Christian R. Helmrich
36964d2051 finish 1.1.1 release 2020-12-31 10:00:00 +01:00
Christian R. Helmrich
0f31ad0043 update the readme# 2020-12-31 09:00:32 +00:00
Christian R. Helmrich
a1bdb884f3 update rel. notes 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