Commit graph

159 commits

Author SHA1 Message Date
Jean-Marc Valin
0fb0fd715c Moves opus_packet_parse_impl() from opus_decoder.c to opus.c
Because it's indirectly used in the encoder (through the repackerizer).
2013-10-28 16:41:26 -04:00
Gregory Maxwell
5484a28063 Add a little missive when compiling without optimization.
The library really depends on all the little fixed point math functions
 being inlined in order to get acceptable performance. It turns out that
 it's very easy for someone to compile with optimization disable when
 twiddling cflags or cooking up their own build system.
2013-10-28 11:08:04 -07: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
Jean-Marc Valin
dabdb32ce6 Oops, thanks to Mark Harris for spotting this! 2013-10-14 13:58:51 -04:00
Jean-Marc Valin
58042adc19 opus_packet_parse_impl() now computes the packet size with padding
This should fix decoding of padded multistream packets and (hopefully)
multistream fec.
2013-10-14 13:45:58 -04:00
Mark Harris
2a82908062 Rejects bad multistream frame length
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2013-10-13 01:25:32 -04:00
Mark Harris
101c8c874e Fixes PLC for sizes that don't match basic Opus frame sizes.
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2013-10-13 01:16:00 -04:00
Mark Harris
b88a3ad396 Fix 40/60ms zero-length frame decode failure
Decoding failed with OPUS_BAD_ARG on a packet containing a 40ms or
60ms zero-length frame when it followed a hybrid or MDCT frame.
It now invokes the PLC for the duration of the packet as expected.

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2013-10-11 23:43:21 -04:00
Jean-Marc Valin
ed4632345e Do up-front validation of multistream packets
Prevents the decoder from being out-of-sync on an invalid packet. Also
returns OPUS_INVALID_PACKET on a corrupted FEC packet.
2013-10-11 18:13:01 -04:00
Gregory Maxwell
a0d096f18f Braces go on the next line. 2013-06-29 20:33:32 -07:00
Gregory Maxwell
b271dae70c Brace a number of if statements instead of one-lining them. 2013-06-29 20:25:55 -07:00
Gregory Maxwell
dd7b0dac3b Fixes some return without va_end in the api, adds tests.
Also makes the CTL bad argument handling more consistent to avoid mistakes
 like that in the future.  Also updates the variable duration docs.
2013-06-29 20:06:07 -07:00
Aurélien Zanelli
cd4c8249bc Add run-time CPU detection and support for ARM architecture
Run-time CPU detection (RTCD) is enabled by default if target platform support
it.
It can be disable at compile time with --disable-rtcd option.

Add RTCD support for ARM architecture.

Thanks to Timothy B. Terriberry for help and code review

Signed-off-by: Timothy B. Terriberry <tterribe@xiph.org>
2013-06-04 16:23:22 -07:00
Jean-Marc Valin
359306985b Change few remaining instances of short to opus_int16 2013-05-18 02:50:40 -04:00
Jean-Marc Valin
1bf32bb5ac Fixes FEC issues introduced in 7fcd66c
This left FEC disabled on the decoder side for all cases except concatenated
packets. Also fixes a FEC bug in opus_demo (wrong output buffer size
calculation).
2013-04-23 02:41:28 -04:00
Jean-Marc Valin
32c4a0c96e Applies soft-clipping to the int decoder API.
opus_decode() and opus_multistream_decode() now apply soft clipping
before converting to 16-bit int. This should produce better a higher
quality result than hard clipping like we were doing before. The _float()
API isn't affected, but the clipping function is exported so users can
manually apply the soft clipping.
2013-03-01 15:23:01 -05:00
Jean-Marc Valin
a0737d1fcf Fixes OPUS_GET_LAST_PACKET_DURATION
Calling PLC/FEC with a different size was not updating it
2012-12-05 21:48:45 -05:00
Jean-Marc Valin
2c1a11ff8a Adds assert to catch bug from previous commit 2012-12-05 00:54:21 -05:00
Jean-Marc Valin
8c9c9b280d Fixes a multi-frame FEC issue that was caught by valgrind 2012-12-05 00:53:05 -05:00
Jean-Marc Valin
9283114fa1 Adds explicit valgrind checks when ENABLE_VALGRIND is defined 2012-12-05 00:50:53 -05:00
Jean-Marc Valin
d0fd9d4baa Implements opus_packet_get_nb_samples() 2012-12-04 15:45:31 -05:00
Jean-Marc Valin
512d849c24 Implements OPUS_GET_LAST_FRAME_DURATION decoder ctl() 2012-12-04 15:17:43 -05:00
Jean-Marc Valin
a5bd440931 Don't update the internal decoder state until we know the packet is valid 2012-12-04 15:16:54 -05:00
Jean-Marc Valin
7fcd66c40d Changes the PLC behaviour and fixes the FEC behaviour on concatenated packets
PLC and FEC now return exactly the number of samples specified for the
buffer rather than (usually) returning the size of the last packet.
Doc and tests are updated accordingly.
2012-12-04 15:07:45 -05:00
Jean-Marc Valin
259e166648 Fix packet length handling for 16-bit machines (makes no difference on 32-bit) 2012-12-03 13:05:24 -05:00
Jean-Marc Valin
9345aaa5ca Fixes an out-of-bounds read issue with the padding handling code
This was reported by Juri Aedla and is limited to reading memory up
to about 60 kB beyond the compressed buffer. This can only be triggered
by a compressed packet more than about 16 MB long, so it's not a problem
for RTP. In theory, it *could* crash an Ogg decoder if the memory just after
the incoming packet is out-of-range.
2012-11-30 17:36:36 -05:00
Ralph Giles
799b1700a5 Improve the !OPUS_BUILD #error.
The README doesn't say anything about this particular define.
Refer people to config.h and the other build files for examples.
2012-11-29 11:46:14 -08:00
Jean-Marc Valin
cc83f6b875 Reduces decoder stack usage
Delays stack allocations as much as possible, and makes some of these
allocations conditional.
2012-11-05 10:25:20 -05:00
Koen Vos
0b00b31967 Attenuates the HF in hybrid mode to match what SILK does below the cutoff
Conflicts:

	src/opus_multistream.c
	src/opus_private.h
2012-10-10 13:41:07 -04:00
Timothy B. Terriberry
a40689e6ef Remove large multistream stack buffers.
This avoids allocating any buffers on the stack that depend on the
 total channel count.
Such buffers could easily exceed the size of the
 NONTHREADSAFE_PSEUDOSTACK.
It also checks the frame_size argument in both the encoder and
 decoder to avoid allocating large stack buffers for opus_encode()
 calls that would fail anyway or opus_decode() calls that would
 never use all that space anyway.
2012-09-08 02:17:53 -04:00
Gregory Maxwell
37f56593a2 Convert some double constants to float. 2012-07-17 17:42:00 -04:00
Gregory Maxwell
03105f5b70 Make OPUS_SET_GAIN survive decode reset.
This is the less-surprising behavior and will hopefully
result in fewer corner case bugs (e.g. losing gain
after seeking). This commit also updates the documentation.
2012-07-11 02:33:55 -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
Jean-Marc Valin
14d63d1879 Fixes the stereo_analysis() fixed-point overflow issue properly 2012-05-16 17:50:17 -04:00
Gregory Maxwell
936f52ca0e Add #errors when !OPUS_BUILD or !(VAR_ARRAYS||USE_ALLOCA||NONTHREADSAFE_PSEUDOSTACK).
This will help prevent people using non-standard build environments from
footgunning themselves and becoming a support burden.
2012-05-15 09:18:39 -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
72273000ec Misc changes to address Robert Sparks' comments
See http://www.ietf.org/mail-archive/web/codec/current/msg02833.html
Still more changes to come
2012-04-20 10:26:08 -04:00
Jean-Marc Valin
c792108829 Adds missing RESTORE_STACK statements on error paths
Thanks to Vincent Penquerc'h
2012-03-05 19:56:13 -05:00
Jean-Marc Valin
c0387ff237 More consistent types for 16-bit architectures 2012-03-05 19:19:59 -05:00
Gregory Maxwell
e7028175af 40/60ms MDCT/Hybrid were not able to reach maximum bitrate. Now they can.
Also change the packet length in the API from int to opus_int32
because repacketized frames are able to go beyond 32767 bytes
in size.
2012-03-05 17:59:50 -05:00
Jean-Marc Valin
17c5966045 Last updates for draft -11
- Draft updates
- Updated code to produce and check test vectors
- Making sure that the test vectors pass at all rates as well as for mono and stereo
2012-02-17 16:18:08 -05:00
Jean-Marc Valin
ee8adbe701 Fixes a few minor issues (no bit-stream change)
- Safer gain clamping for PLC
- Makes opus_decoder_get_nb_samples() report an error on invalid ToC
- Giving a free license to the text ofthe draft (not just the code)
2012-01-24 14:47:54 +13:00
Jean-Marc Valin
5609cec9a5 Fixes two minor issues found in random testing at ridiculously low rate.
- When it cannot produce the rate it's being asked, the encoder now
  returns a "PLC packet"
- Makes it possible to use the CELT PLC for more than 20 ms
2011-12-13 14:52:43 -05:00
Gregory Maxwell
e699c1989c Testing tools improvements (no impact on draft) 2011-11-25 23:53:15 -05:00
Ralph Giles
da025d5632 Convert tabs to spaces in the opus and celt code.
Also reformat some, but by no means all, of the opus
code for line length and three-character indents.
2011-10-26 20:24:49 -07:00
Jean-Marc Valin
294bfec27b Implements hard CBR for SILK
This is achieved by running the encoding process in a loop and
padding when we don't reach the exact rate. It also implements
VBR-with-cap, which means we no longer need to artificially decrease
the SILK bandwidth when it's close to the cap.
2011-10-20 00:39:41 -04:00
Jean-Marc Valin
e6a4ece78f Simplfies the condition for resetting the CELT state 2011-10-19 01:56:38 -04:00
Jean-Marc Valin
26451fef9a Improved test for fishy redundancy length 2011-10-13 20:12:05 -04:00
Jean-Marc Valin
e9b53212f2 Tim says it's safe 2011-10-13 16:24:11 -04:00