Commit graph

3269 commits

Author SHA1 Message Date
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
Stefan Beller
2891d852a3 Remove dead code
The compiler warned:
silk/float/pitch_analysis_core_FLP.c: In function 'silk_P_Ana_calc_corr_st3':
silk/float/pitch_analysis_core_FLP.c:499:36: warning: variable 'basis_ptr' set but not used [-Wunused-but-set-variable]
     const silk_float *target_ptr, *basis_ptr;

This means we can safely remove it.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2013-10-23 16:18:32 -04:00
Jean-Marc Valin
d6b56793d8 Fixes a potential crash when encoding NaNs
This fixes tansig_approx() to avoid crashing when the input is NaN.
The problem could only be triggered when calling the float API with
a float build at a complexity of 7 or more (i.e. analysis called).
Since the crash was due to an out-of-bound read (typically the index
is INT_MIN), it's unlikely to be exploitable in any other way than
causing a crash.
2013-10-21 17:58:03 -04:00
Ralph Giles
e8f18c403c Remove restrict definition from the unix Makefile.
This define was replaces by OPUS_RESTRICT in opus_defines.h
in de0b5324b6 and subsequent commits. It is no longer necessary
to include it.
2013-10-17 14:52:56 -07: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
c6d0c43df7 Fixes weird LFE bug
The LFE encoder would first decide to switch to SILK, and allocated
redundancy bytes. Then, it would force CELT because of LFE, but keep
the redundancy allocation, and end up with too few bytes, that would
end up being padded to the desired size for CBR.
2013-10-14 17:33:53 -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
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
98a8baa4ef Make -loss valid for opus_demo -e
In addition to its decoding use, it is the value used for
OPUS_SET_PACKET_LOSS_PERC.

Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2013-10-12 00:01:08 -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
dbc83d316c Cleaning up multistream packet validation 2013-10-11 20:41:53 -04:00
Mark Harris
970d0529ee Correct opus_packet_parse code 0 packet tests. 2013-10-11 17:27:49 -07: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
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
1ad6f6d557 Fixes scaling of downmix_float() for fixed-point.
The previous version simply produced zeros for fixed-point.
2013-10-01 19:25:40 -04:00
Jean-Marc Valin
e8e5ecb3f8 Fixes missing VARDECL() 2013-10-01 17:16:59 -04:00
Ralph Giles
c9e2014f4b Don't use --dirty in genversion.bat.
This script updates version.mk, which is under version control,
so the tree is always dirty. Until the script is updated to write
package_version instead, incorporating version.mk as a fallback
the way update_version does, it's better not to use --dirty.
2013-10-01 14:09:07 -07:00
Jean-Marc Valin
7c60625f80 Merge branch 'exp_surround1' 2013-10-01 17:06:09 -04:00
Ralph Giles
c435f06b30 Pass --always to git describe.
This generates a useful version string even for --depth=1 checkouts.
The option was added in git v1.6.6.
2013-10-01 13:05:33 -07:00
Stefan Hacker
a32fa319d3 Avoid using C++ keyword 'new'
Signed-off-by: Jean-Marc Valin <jmvalin@jmvalin.ca>
2013-09-29 00:07:52 -04:00
Jean-Marc Valin
6b9087aa6e Avoids unnecessary copying in opus_encode for delayed decision 2013-09-28 23:51:11 -04:00
Jean-Marc Valin
292544453f Makes analysis work when encoding more than 20 ms at a time 2013-09-28 23:50:30 -04:00
Jean-Marc Valin
a4c2512aa4 run_analysis() doesn't need to return the frame size anymore 2013-09-28 17:22:41 -04:00
Ralph Giles
f2446c25c6 Remove trailing whitespace from the license headers. 2013-09-16 14:40:04 -07:00
Ralph Giles
d517586141 Remove trailing whitespace. 2013-09-16 14:29:24 -07:00
Jean-Marc Valin
f5645f5c72 Makes the fixed-point build only run the float analysis at complexity 10
Default complexity is now 9.
2013-09-16 14:36:53 -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
36a21ed536 Very basic surround rate calibration 2013-09-14 15:46:09 -04:00
Jean-Marc Valin
6fbfed6a0b Allowing surround to use lower bandwidth than fullband 2013-09-13 17:16:38 -04:00
Jean-Marc Valin
ae7dc8a13f More surround masking tuning 2013-09-13 15:05:50 -04:00
Jean-Marc Valin
039e9ab155 Tuning the surround masking
We're now a bit more conservative and only take into account the bands
that are being codec. Also weighting the rate saving by the band width.
2013-09-12 03:05:43 -04:00
Jean-Marc Valin
54bddf0f1a Surround analysis should now work for non-20ms frame sizes.
Not well tested.
2013-09-11 23:34:51 -04:00
Jean-Marc Valin
978e4cb507 Code for handling upsampling in surround_analysis()
Still untested.
2013-09-11 00:51:22 -04:00
Jean-Marc Valin
8824fdb1c2 Adds surround masking to SILK 2013-09-10 01:15:19 -04:00
Jean-Marc Valin
7317de4fbb Fixes delayed decision for fixed-point 2013-09-09 17:11:25 -04:00
Jean-Marc Valin
ba7dbb365e Analysis scaling fixes
This should make the scaling the same for fixed and float. It changes the float
scaling too by normalizing by the number of channels, which matters for
bandwidth detection.
2013-09-09 16:39:19 -04:00
Jean-Marc Valin
fc1b1f9b44 Makes speech/music detection work with FIXED_POINT (code still float) 2013-09-06 16:32:50 -04:00
Jean-Marc Valin
3ab03e0556 First pass at making the analysis code run with FIXED_POINT
Code is still float, but at least tonality esitmation seems to work.
Speech/music analysis is still disabled.
2013-09-06 16:00:39 -04:00
Jean-Marc Valin
91904a4c91 Moves the analysis back to opus_encode_native() to it runs for all streams.
I checked that it's not *completely* busted, but it probably needs more testing.
2013-09-05 21:37:08 -04:00
Jean-Marc Valin
0f68696a97 Adds trim and dynalloc control to surround masking 2013-09-05 12:49:55 -04:00
Jean-Marc Valin
a714ae98a8 Makes surround_analysis() work in fixed-point 2013-08-31 02:05:32 -04:00
Jean-Marc Valin
fdceae89bf Surround masking rewrite
The channel energy is now computed using an MDCT in the multi-stream
encoder rather than computing the energy of the stereo downmix.
2013-08-30 21:58:02 -04:00
Jean-Marc Valin
02fed471a4 Implements fixed-point silk_LPC_analysis_filter() in terms of celt_fir()
Saves 2.5% on ARM without any asm. The float build still uses the old
code because celt_fir() then becomes a float function.
2013-08-29 15:29:02 -04:00
Jean-Marc Valin
00a1b3e0da Converts the fixed-point silk_burg_modified() to use celt_pitch_xcorr()
bit-exact with original version
2013-08-28 21:38:52 -04:00
Jean-Marc Valin
6a7ee7fb55 Share auto-correlation code between SILK and CELT 2013-08-28 17:55:34 -04:00