Commit graph

37 commits

Author SHA1 Message Date
Jean-Marc Valin
ae0e2ca89f Splits out the Opus multi-stream encoder and decoder 2012-11-07 20:00:22 -05:00
Gregory Maxwell
de95da9bf1 Fix several issues with multistream argument validation.
As reported by Mark Warner opus_multistream_*_create were depending on
 the behavior of malloc(0) in order to correctly report some kinds of
 argument errors. Bad arguments could be incorrectly reported as
 allocation failures. This changes multistream to explicitly check the
 arguments like the single stream _create functions. The unit tests were
 enough to catch this on systems where malloc(0) returns NULL but didn't
 catch it on other systems because the later _init call would catch the
 bad arguments and trigger the correct error if and only if the malloc
 didn't return a null pointer.

In multistream_encoder_init failures of the internal non-multistream
 init calls were not being caught and propagated. Decode didn't have
 this problem. This propagates the errors and adds additional tests
 (the multistream encoder api is sill under tested) that would have
 detected this error.

Plus add some stronger tests for things like error==NULL for the _create
 functions that take a pointer for error output.
2012-10-27 13:42:48 -04:00
Jean-Marc Valin
ea7c9869cd Adds OPUS_{G,S}ET_FORCE_CHANNELS requests to multistream API 2012-10-10 16:03:36 -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
Timothy B. Terriberry
84dd1cf9b7 Balance parentheses in opus_multistream.c.
This makes simple syntax highlighters (e.g., vim) stop complaining
 because they don't parse the #ifdef's.
2012-09-06 09:30:06 -07:00
Gregory Maxwell
582eba6f4f Additional multistream tests and reject channels<1 in MS API. 2012-08-21 16:08:35 -04:00
Gregory Maxwell
bb389c67f9 OPUS_{GET,SET}_LSB_DEPTH for multichannel. 2012-08-06 18:20:03 -04:00
Gregory Maxwell
37f56593a2 Convert some double constants to float. 2012-07-17 17:42:00 -04:00
Gregory Maxwell
d060dd7cbd Opus_multistream API hardening. 2012-07-14 15:50:30 -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
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
Vincent Penquerc'h
ab0b5f5ff3 Make input mapping parameter const in multistream API 2012-03-05 19:58:19 -05:00
Gregory Maxwell
9cca20aaaf Various multistream fixes.
Fixes the encoder bitrate CTLs to correctly apply to all streams,
prevents the MS encoder from starving the latter streams by not
reserving a reasonable minimum amount of space for them.
2012-03-05 17:59:55 -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
Gregory Maxwell
92c896e880 Fixes the code for optional self-delimited packing to make it fit the draft
This has no impact on opus_demo, test vectors, or "normal" codec operation
2011-12-02 12:41:31 -05:00
Jean-Marc Valin
27592c3e49 Multi-stream now checks that each stream at least contains a ToC. 2011-10-31 13:18:43 -04:00
Gregory Maxwell
afd05aca0c Fix multistream packet corruption, implement GET_FINAL_RANGE for multistream, and add many tests.
Multistream encode was failing to add the length of the extra length for
self-delimited packets causing corrupted output. Multistream decode was
not properly handling lost frames (and potentially reading out of bounds
as a result).

GET_FINAL_RANGE has been implemented as the xor of the final range of all
the streams in the packet.

test_opus_encode now does the mono narrowband tests using dual-mono
multistream.
2011-10-30 19:57:22 -04:00
Gregory Maxwell
c81b510239 Fix a number of multistream decoder bugs; add some very basic multistream decoder tests. 2011-10-30 02:20:41 -04:00
Jean-Marc Valin
c8649d0e0b Gives the Opus code direct access to (non-opaque) OpusRepacketizer
This avoids potential alignment issues with allocating a char
array on the stack.
2011-10-27 22:25:33 -04: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
Ralph Giles
bceb8e1532 Remove redundant API parameter comments from opus_multistream.c.
The parameters for public API calls are already documented
in opus_multistream.h. It's better not to have separate
copies of those comments in the implementation.
2011-09-14 00:07:33 -07:00
Jean-Marc Valin
af50ce9200 Implements OPUS_MULTISTREAM_{EN|DE}CODER_GET_STATE
Untested
2011-09-11 20:13:47 -04:00
Jean-Marc Valin
c63cc12232 Implements multi-stream encoder requests the best we can 2011-09-11 19:51:44 -04:00
Jean-Marc Valin
e448df8301 Properly implementing the multistream decoder ctl()s
Not tested
2011-09-11 18:12:31 -04:00
Jean-Marc Valin
131d888234 Makes multi-stream encoding code use the repacketizer 2011-09-09 13:56:09 -04:00
Jean-Marc Valin
0ca076d527 Fixes multi-stream bug exposed in e335065a1b 2011-09-09 13:49:43 -04:00
Jean-Marc Valin
d9438da52c Making the sampling rate an int32 in the multi-stream API 2011-09-07 14:47:48 -04:00
Jean-Marc Valin
331e9fe0fd s/OPUS_CORRUPTED_DATA/OPUS_INVALID_PACKET/ 2011-09-06 14:30:19 -04:00
Jean-Marc Valin
be89c39587 Using OPUS_ macros for <string.h> operations
Removes a bunch of system #include <...> in the process
2011-08-30 12:39:51 -04:00
Jean-Marc Valin
0abd1b0dea Makes the allocation more C++-friendly 2011-08-29 16:31:52 -04:00
Jean-Marc Valin
85b8e62065 Fixes minor issues from the previous allocation wrapper patch 2011-08-29 16:10:08 -04:00
Jean-Marc Valin
07f884042e Wrapping all allocation within opus_alloc() and opus_free() 2011-08-29 15:08:51 -04:00
Jean-Marc Valin
9d48deb899 Adds error code to multistream API 2011-08-29 09:56:14 -04:00
Jean-Marc Valin
69abbf4662 Fixes a trivial multistream fixed-point bug 2011-08-28 02:12:31 -04:00
Jean-Marc Valin
8a21386d83 more multistream ctl()s 2011-08-27 01:38:54 -04:00
Jean-Marc Valin
d4e9340591 Adds support for multi-stream encoding/decoding
Only tested for the single-stream case!
2011-08-27 01:15:43 -04:00