Commit graph

31 commits

Author SHA1 Message Date
Jean-Marc Valin
60b8f5b803
Add SHL32_ovflw() and use it in IMDCT
Prevents integer overflow UB in the headroom left shift when
the signal blows up on bad bitstreams (if it triggers, the
signal was already unusable anyway).
2025-04-08 13:40:35 -04:00
Jean-Marc Valin
edffe56b30
Add PSHR32_ovflw() and use it in IMDCT
Prevents integer overflow UB in the shift rounding when the signal blows
up on bad bitstreams (if it triggers, the signal was already unusable
anyway).
2025-03-21 17:17:19 -04:00
Jean-Marc Valin
c79a9bd1dd
Support 32-bit window and comb filter 2025-02-13 12:50:05 -05:00
Jean-Marc Valin
3116093d34
Support for full 32-bit FFT/MDCT twiddles/scaling 2025-02-13 12:50:04 -05:00
Jean-Marc Valin
abd512f7f6
Defining MAXG/MING/GCONST for log gain 2025-02-13 12:50:02 -05:00
Jean-Marc Valin
fbed746cb2
Relaxing checks for MULT16_32_QX()
MULT16_32_QX() is now implemented using a signed-unsigned multiply,
so the second argument can now have one extra bit compared to the
old signed-signed implementation.

Reviewed by Mark Harris
2022-07-22 12:22:12 -04:00
Jean-Marc Valin
3cc09dee34
Avoid left shifts of negative values in debug macros
Reviewed by Mark Harris
2022-07-05 17:27:31 -04:00
Jean-Marc Valin
31b922e79c
Silence some warnings for fixed-point debug builds
Reviewed by Timothy B. Terriberry.
2022-06-28 01:02:37 -04:00
Felicia Lim
7b05f44f4b
celt_lpc: avoid overflows when computing lpcs in fixed point
The LPCs are computed in 32-bit, so increase the allowed range from +/-8
to +/-64 to avoid overflows caught during fuzzing. Before downshifting
back down to the +/-8 range in the final 16-bit output, perform bandwidth
extension to avoid any additional overflow issues.
2021-03-02 21:35:16 -08:00
Mark Harris
d6d70371e8
Fix compiler warnings
- celt/modes.c:430:14: warning: cast from 'const unsigned char *' to
  'opus_int16 *' increases required alignment from 1 to 2 [-Wcast-align]
- 'C[0][1]' may be used uninitialized [-Wmaybe-uninitialized]
- Unused variable/parameter
- Value stored is never read
- MSVC warnings about "possible loss of data" due to type conversions
- MSVC warning C4146: unary minus operator applied to unsigned type
- silk/NLSF_del_dec_quant.c:137:20: warning: array subscript is above
  array bounds [-Warray-bounds] (gcc -O3 false positive)
- src/mlp_train.h:39:20: warning: function declaration isn't a prototype
  [-Wstrict-prototypes]
- Remove SMALL_FOOTPRINT code from SSE 4.1 FIR implementation, matching
  the C implementation.

The clang -Wcast-align warnings with SSE intrinsics are a known
clang issue: https://llvm.org/bugs/show_bug.cgi?id=20670
2017-02-26 19:10:45 -08:00
James Zern
c9ba55208c
fixed_debug.h: delete some dead code
this has the side-effect of removing some C++ style comments

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2017-01-12 23:35:55 -05:00
Jean-Marc Valin
a0bd7d3b84 fixes overflows in celt_iir() by doing proper saturation 2016-07-22 15:57:01 -04:00
Jean-Marc Valin
273906404c silencing overflows in MDCT and FFT 2016-07-22 15:30:19 -04:00
Jean-Marc Valin
f396c08f77 Adds SIG2WORD16() to fixed_debug.h 2014-06-18 00:52:16 -04:00
Jean-Marc Valin
17b197837f Speed up the comb filter on ARM by using MAC16_32_Q16() 2014-01-21 11:07:57 -05:00
Jean-Marc Valin
530198f955 Adds SATURATE16() to the fixed-point debug build too 2013-11-17 22:44:53 -05:00
Gregory Maxwell
7830cf1bd2 Replace "inline" with OPUS_INLINE.
Newer versions of MSVC are unhappy with the strategy of the build
 environment redefining "inline" (even though they don't support the
 actual keyword). Instead we define OPUS_INLINE to the right thing
 in opus_defines.h.

This is the same approach we use for restrict.
2013-10-28 10:18:54 -07:00
Gregory Maxwell
5685bd31a6 Replace long long in celt/ with opus_int64. 2012-08-21 10:45:58 -04:00
Gregory Maxwell
e2e1fe922e Use 64-bits in fixed point debug for _P16, fixes spurious failures. 2012-08-19 03:55:23 -04:00
Gregory Maxwell
28b41ae5ae Add OPUS_{GET|SET}_GAIN CTLs for adjusting output gain.
This CTL was requested by Nicolas George for FFmpeg.
2012-07-11 00:04:24 -04:00
Gregory Maxwell
4ea14918f4 When FIXED_DEBUG_ASSERT CELT will assert on fixed-debug error. 2012-05-15 09:18:06 -04:00
Jean-Marc Valin
ab5a049705 Merge commit '390c89225d' 2012-04-24 13:39:22 -04:00
Jean-Marc Valin
cb05e7cd96 s/FOUNDATION/COPYRIGHT OWNER/ in CELT code and "glue code"
Also added 3rd clause to "master" COPYING file
2012-04-20 16:41:42 -04:00
Jean-Marc Valin
367c394866 Fixes several overflows in the CELT fixed-point
These were all mostly benign and would at worst result in (rare)
suboptimal encoder decisions rather than signal corruption.
2012-04-12 11:09:09 -04:00
Ralph Giles
a855a1f0ff Check for underflow in the debug USUB32. 2012-03-05 17:09:54 -08:00
Ralph Giles
9620cf7718 Print the actual arguments to the debug UADD/SUB32 routines.
The versions of UADD32 and USUB32 in fixed_debug.h take
unsigned long long (ideally 64 bit) inputs, and range
check the arguments. However, the printed warnings cast
them to (unsigned), which is confusing. Instead, print
the full value passed in.

NB this will make negative values print has huge,
rather than negative, values.
2012-03-05 17:09:54 -08:00
Ralph Giles
9f7d17bd11 Uncomment the reporting for UADD32 and USUB32 in fixed_debug.h. 2012-03-05 17:09:54 -08:00
Ralph Giles
5c06f8c585 Used unsigned intermediates with unsigned arguments in fixed_debug.h.
Corrects a signed-compare warning.
2012-03-05 17:09:53 -08:00
Ralph Giles
cb3cc53014 Fix --enable-fixed-point-debug.
Use the celt_mips defined in fixed_debug.h from the unit tests
by defining CELT_C earlier. We must export celt_mips so it can
be used by clients calling the library, like opus_custom_demo.
2012-03-05 17:09:53 -08:00
Ralph Giles
120800f8fa Rename '_FOO' to avoid potentional collisions with reserved identifiers.
C reserves identifiers of the from _[A-Z]+ and we have a number of
those in the code. This patch renames the various function arguments,
MACROS and preprocessor symbols to avoid the reserved form.

It also removes the CHANNELS() macro altogether. This was a
minor optimization for TI DSP to force a mono-only build,
as were the associated local 'const' versions. Since stereo
support is manditory, it wasn't worth keeping.

Thanks to John Ridges for raising the issue, and Jean-Marc Valin
and Greg Maxwell for reviewing the changes.
2011-12-02 12:31:36 -05:00
Jean-Marc Valin
c37499090b renames the libcelt/ directory to celt/ 2011-09-13 18:21:18 -07:00
Renamed from libcelt/fixed_debug.h (Browse further)