Commit graph

81 commits

Author SHA1 Message Date
Andrew Allen
65f11d326d
Fix memory issues in Projection API.
Modified by Jean-Marc Valin

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2017-12-07 13:04:19 -05:00
Andrew Allen
f643c03fba
Support for Channel Mapping 253
OpusProjection* classes
MixingMatrix class
Projection tests

Change-Id: I98644466abf4ffd36e48bdecad1204d69e1539b9
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2017-11-07 17:44:36 -05:00
Linfeng Zhang
a1ae821c96
Replace call of celt_inner_prod_c() (step 1)
Should call celt_inner_prod().

This change is bit exact as original, except for x86 floating-point.
In x86 floating-point, it calls celt_inner_prod_sse() which may have
different output with the change of floating-point operations' orders.

Change-Id: Ia2381e2e198a84296ac28305183f15be842b3454

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2017-06-06 17:12:20 -04:00
Jean-Marc Valin
0d2ba55ab1
Fixes a surround bug on loud signal
The constant was copied from the analysis code which uses +/-1 as float
scaling, but surround_analysis() uses +/-32767.
2017-05-23 03:32:18 -04:00
Jean-Marc Valin
a31e9fd24c
oops, fix build broken by previous patch 2017-04-28 17:41:54 -04:00
Drew Allen
17e14fb3e1
Non-diegetic support for Ambisonics Mapping 254.
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2017-04-28 17:25:10 -04:00
Mark Harris
d73c5a9618
Remove redundant code
frame_size_select() ensures that frame_size is a valid size or -1,
!st->variable_duration is always false, and delay_compensation is
no longer needed to choose the frame size.
2016-11-05 22:18:33 -07:00
Jean-Marc Valin
132ed59464
Removes OPUS_FRAMESIZE_VARIABLE
That experiment never actually worked
2016-11-04 21:25:20 -04:00
Felicia Lim
8fec416b7d
Fix amount of extra bytes reserved for 100 ms
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2016-10-31 15:42:12 -04:00
Felicia Lim
bcfe0f68e3
Multistream encoder: allocate an extra byte per stream for 100 ms
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2016-10-28 15:54:05 -04:00
Felicia Lim
0962cbe2ae
Support encoding 80/100/120 ms frame lengths
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2016-10-27 23:36:57 -04:00
Jean-Marc Valin
8ac5d89918
Consider per-channel energy bits in surround_rate_allocation()
This should also avoid cases where stereo streams receive fewer
bits than mono streams.
2016-09-19 22:10:09 -04:00
Jean-Marc Valin
a3fadcb9f4
Fixes surround_analysis() for frame size > 20 ms 2016-09-16 17:48:44 -04:00
Michael Graczyk
fa2578bf47
Fix ambisonics bitrate when bitrate_bps is OPUS_AUTO
Change-Id: I16bd4cd990d8ad5888c9e30016218ac25242ecb5

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2016-09-08 11:34:42 -04:00
Jean-Marc Valin
f4f5a6a099
Prevents an overflow in multi-stream encoder rate computation
Also avoids stupidly high/low rates
2016-09-06 22:32:22 -04:00
Mark Harris
691d49355f
Allow disabling phase inversion for multistream
Also clarify in doc that conformance issue relates to decoder only.
2016-09-03 10:42:19 -07:00
Mark Harris
7d0e33f7f1 Correct multistream variable frame size stride
The multistream encoder input has st->layout.nb_channels channels.
The number of channels actually encoded is st->layout.nb_streams +
st->layout.nb_coupled_streams, which may be fewer, so ideally it
would only analyze those when computing the optimal frame size, but
there is no code to do that currently.
2016-08-27 07:10:15 -07:00
Jean-Marc Valin
9203565fa8 Forgot to call RESTORE_STACK in 328953e189 2016-07-04 10:45:15 -04:00
Jean-Marc Valin
328953e189 Making calls to opus_packet_pad() on a bad packet return OPUS_INVALID_PACKET
We were previously returning OPUS_BAD_ARG because the failure was
only detected in opus_repacketizer_out_range_impl() rather than in
opus_repacketizer_cat(). Checking the return value from opus_repacketizer_cat()
also addresses the last outstanding Coverity defect.
2016-07-04 01:29:23 -04:00
Michael Graczyk
d6642d6943 Fix build error from comma at end of enum
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2016-06-29 23:55:08 -04:00
Michael Graczyk
1ac3a5630a Add static bitrate allocation and force CELT-only for ambisonics encoding
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2016-06-29 14:25:39 -04:00
Michael Graczyk
3925668bbb Add experimental support for ambisonic encoding
The implementation currently only codes each channel independently with no
special allocation rules.

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2016-06-29 14:25:30 -04:00
Viswanath Puttagunta
f48abe8308 armv7(float): Optimize encode usecase using NE10 library
Optimize opus encode (float only) usecase using ARM NE10
library. Mainly effects opus_fft and ctl_mdct_forward
and related functions.

This optimization can be used for ARM CPUs that have NEON
VFP unit. This patch only enables optimizations for ARMv7.

Official ARM NE10 library page available at
http://projectne10.github.io/Ne10/

To enable this optimization, use
--enable-intrinsics --with-NE10=<install_prefix>
or
--enable-intrinsics --with-NE10-libraries=<NE10_lib_dir> --with-NE10-includes=<NE10_includes_dir>

Compile time checks made during configure process to make sure
optimization option available only when compiler supports NEON
instrinsics.

Runtime checks made to make sure optimized functions only called
on appropriate hardware.

Signed-off-by: Timothy B. Terriberry <tterribe@xiph.org>
2015-10-07 18:09:20 -04:00
Mark Harris
a6595e6201 Extra safety against NaNs in surround_analysis()
Fix out-of-bounds memory read in multichannel surround analysis
with float input that contains NaNs.  Found by afl-fuzz.

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2015-10-07 09:23:33 -04:00
Jean-Marc Valin
7c49ad0c5b Preventing NaNs from crashing surround_analysis() 2015-10-07 09:23:33 -04:00
Mark Harris
4feb0dff99 Silence clang -Wcast-align warnings 2015-08-07 13:25:02 -04:00
Mark Harris
25b27a9c16 multistream: improve arg check
Avoid undefined behavior (signed arithmetic overflow) or
implementation-defined behavior (malloc(0)) on out-of-range arguments,
e.g. opus_multistream_encoder_create(48000, 2, 2147483647, 1, ...)
or opus_multistream_surround_encoder_create(48000, 3, 0, ...).

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2014-11-27 12:04:14 -05:00
Jean-Marc Valin
da97db1ca1 Fixes comments 2014-09-04 02:48:21 -04:00
Jean-Marc Valin
648eb9adff Takes into account a corner case with the multistream encoder
Considers the case where one stream would eat up all the remaining bytes,
including a 2-byte size that would then not leave enough for the even a PLC
packet in the next streams.
2014-09-04 02:44:09 -04:00
Jean-Marc Valin
e1326fe6c8 Lowered the smallest packet that the multi-stream encoder can encode
Limit now at 2*streams-1 and anything below that returns OPUS_BUFFER_TOO_SMALL
rather than OPUS_BAD_ARG
2014-09-04 01:48:46 -04:00
Jean-Marc Valin
8dc91de172 multi-stream fix when setting bitrate to AUTO, MAX, or small values
OPUS_AUTO should now work fine, while using OPUS_BITRATE_MAX would still
be a bad idea for controlling CBR rate for multistream. The encoder should
now throw an error early on if max_data_bytes is just too small to do anything.
2014-06-21 01:16:46 -04:00
Mark Harris
58107d8968 Fix surround encoding
Broken by 306d7f5a30
2014-01-26 22:54:19 -05:00
Jean-Marc Valin
c94e4bb103 Optimizes encoder NaN detection and clipping by only running them when needed
NaN detection should now be able to catch values that would create NaNs
further down.
2013-12-09 15:26:03 -05:00
Jean-Marc Valin
ccf7d9b18c Surround low-passing thresholds set to much lower bitrates 2013-11-24 01:57:52 -05:00
Jean-Marc Valin
cbe93e23be Adds OPUS_SET_PREDICTION_DISABLED() ctl to force "independent" frames
Works by turning off pitch and energy prediction in CELT, while
setting first_frame_after_reset in SILK to disable pitch and LSF interpolation
and reduce LPC gain.
2013-11-15 13:50:38 -05:00
Jean-Marc Valin
c5635d284b Adds packet padding that works for all codes and fixes 40/60 ms CBR.
Padding is now handled by the repacketizer.
2013-11-13 23:22:37 -05:00
Jean-Marc Valin
2dc27dfa13 Rename preemphasis() to celt_preemphasis() to avoid amrnb symbol clash
http://lists.xiph.org/pipermail/opus/2013-November/002372.html
2013-11-13 23:18:26 -05:00
Jean-Marc Valin
ab86a9cca7 Fixes more warnings 2013-11-13 23:06:25 -05:00
Jean-Marc Valin
87ca6c08ea Increase surround allocation offset for smaller frame sizes 2013-11-13 22:58:10 -05:00
Jean-Marc Valin
a71c9adf52 Fixes MSVC conversion warnings 2013-11-13 12:07:01 -05:00
Jean-Marc Valin
420231ab19 Makes surround bandwidth decision based on the number of channels (duh!) 2013-11-08 19:53:27 -05:00
Jean-Marc Valin
c2b3441211 Fixes DISABLE_FLOAT_API build 2013-10-28 21:48:50 -04:00
Jean-Marc Valin
811db62ead Implements OPUS_RESET_STATE for multi-stream encoder 2013-10-28 16:12:24 -04:00
Jean-Marc Valin
2e653a7b47 Fixes multistream CBR encoding and multistream surround for >20 ms 2013-10-14 17:47:18 -04:00
Jean-Marc Valin
eab134c813 Surround encoder can now produce hard CBR streams again.
Even when using SILK/hybrid.
2013-10-14 15:01:36 -04:00
Jean-Marc Valin
aee4d80576 Removes useless VARDECL() of "out" 2013-10-01 19:46:48 -04:00
Jean-Marc Valin
942fc816d1 Replaces log2() with celt_log2() and fixes a potential divide-by-zero 2013-10-01 19:27:30 -04:00
Jean-Marc Valin
e8e5ecb3f8 Fixes missing VARDECL() 2013-10-01 17:16:59 -04:00
Jean-Marc Valin
b90e63b5ba Moves frame size selection back out of opus_encode_native()
Should fix delayed decision on surround, but not well tested.
2013-09-16 13:08:52 -04:00
Jean-Marc Valin
6fbfed6a0b Allowing surround to use lower bandwidth than fullband 2013-09-13 17:16:38 -04:00