Commit graph

144 commits

Author SHA1 Message Date
Hector Martin
4d40636748
fix equivalent bitrate calculation for <20ms frame sizes
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Mark Harris <mark.hsj@gmail.com>
2020-05-25 21:45:31 -07:00
Jean-Marc Valin
aebc9046f9
Renaming compute_allocation to clt_compute_allocation() to avoid symbol clashes
As suggested in https://github.com/xiph/opus/pull/83
2018-10-16 15:57:04 -04:00
Mark Harris
38fca4a203
Work around VS2015 internal compiler error
The error was:
c:\projects\opus\celt\celt_encoder.c(1019): fatal error C1001: An internal error has occurred in the compiler. [C:\projects\opus\win32\VS2015\opus.vcxproj]
  (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 255)
   To work around this problem, try simplifying or changing the program near the locations listed above.
  Please choose the Technical Support command on the Visual C++
   Help menu, or open the Technical Support help file for more information

  Internal Compiler Error in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe.  You will be prompted to send an error report to Microsoft later.
2018-07-28 13:07:15 -07:00
Mark Harris
01b035f8ba
Silence compiler warnings
clang -Wcast-align warnings with ambisonics enabled
clang -Wnull-pointer-arithmetic warnings in test_opus_api.c
gcc -Wimplicit-fallthrough warnings on arm
msvc warning C4244 in celt_encoder.c with fixed point
2018-07-21 21:35:39 -07:00
Mark Harris
d6ae25a8be
Fix DISABLE_FLOAT_API unused parameter warning 2018-05-28 01:09:09 -07:00
Jean-Marc Valin
004ef8b9b1
Oops, fix NaN test 2018-05-17 15:26:19 -04:00
Jean-Marc Valin
652c4559f5
Aborting on NaN in CELT
NaNs should be filtered at the Opus layer, so if there are any in the CELT
encoder, then it's likely something went horribly wrong (e.g. corrupted state).
In that case, better abort than have something bad happen.
2018-05-15 15:36:33 -04:00
Jean-Marc Valin
cdcb2f7d2b
Disabling weak transients and 5ms resolution on voiced frames 2018-02-15 14:58:53 -05:00
Jean-Marc Valin
e04e86e0e7
Add a simple masking model to the spreading decision
This improves cases where a whole region is dominated by a handful of tones
2018-02-13 14:11:07 -05:00
Jean-Marc Valin
3b90ff8a33
Making sure importance[] is initialized even when we don't use dynalloc 2018-02-13 14:09:40 -05:00
Jean-Marc Valin
5edcfaf6b1
oops 2018-02-13 13:39:06 -05:00
Jean-Marc Valin
3e3a2ff127
Improve TF analysis RDO to take into account how important each band is
Also adds the error terms for band 0 that were previously omitted
2018-02-13 13:14:19 -05:00
Jean-Marc Valin
8299edfc0c
Scaling back the pitch filter when most of the energy is above 3.2 kHz
That corresponds to the fundamental for the shortest pitch period allowed
2018-01-26 15:52:20 -05:00
Roman Kalashnikov
e12df85a62
Fix unnecessary assignment.
Fixes a warning from PVS-Studio. This was a cut-and-paste error
from the stanza above and had no effect.

Signed-off-by: Ralph Giles <giles@thaumas.net>
2017-10-30 13:44:07 -07: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
f26afaa60d
Recalibrate VBR to hit target bitrate on average 2017-06-02 15:16:24 -04:00
Jean-Marc Valin
c2d32337ec
Update dynalloc VBR calibration 2017-06-02 14:01:36 -04:00
Jean-Marc Valin
0cc4d9659a
Adding leakage modelling to boost bands
We boost bands that either cause leakage or are filled with leakage
2017-06-01 03:14:13 -04:00
Jean-Marc Valin
454330873e
Let CBR use more bits for dynalloc
It seems like letting CBR use up to 2/3 of the bit is still a win
2017-06-01 03:08:58 -04:00
Jean-Marc Valin
59b907cbf6
Fixes a double->float conversion warning 2017-05-24 14:21:08 -04:00
Jean-Marc Valin
3609a2218e
Fixes some fixed-point 16-bit int overflows
The code would have run fine on 32-bit archs, but would have overflowed
on a 16-bit arch
2017-05-24 01:21:51 -04:00
Jean-Marc Valin
a671ac5582
Reducing trim at low bitrate
Some informal tests seem to confirm that reducing the trim at 32-64 kbps
improves quality (better HF). It's not clear whether it's also the case
at 96 kb/s and above, so we're leaving it as is for those rates.

This corresponds to buildC in this thread:
https://hydrogenaud.io/index.php/topic,113985.0.html

Also see:
https://hydrogenaud.io/index.php/topic,111798.0.html
2017-05-24 01:07:20 -04: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
Jean-Marc Valin
132ed59464
Removes OPUS_FRAMESIZE_VARIABLE
That experiment never actually worked
2016-11-04 21:25:20 -04:00
Jean-Marc Valin
7e122394e6
Don't use hybrid "weak transients" on vowels 2016-10-29 17:02:36 -04:00
Jean-Marc Valin
90f20c6260
Define "weak transients" for low bitrate hybrid
These rely on TF rather than short windows to avoid partial collapse.
2016-10-28 16:44:38 -04:00
Jean-Marc Valin
2af92cd99f
Fixes an unstable energy issue for low-bitrate hybrid
The transient detector would trigger on low-pitch vowels, but we didn't have
enough bits to properly code the high bands as a transient, resulting in
partial collapse and unstable energy.
2016-10-27 14:18:28 -04:00
Jean-Marc Valin
18a380a7c2
Make it possible to ignore inverted phase stereo for downmix purposes 2016-09-01 01:23:06 -04:00
Jean-Marc Valin
35cf18e9d7 Making stereo theta decision based on minimizing distortion
No point in minimizing the rate too since it's almost constant.
2016-07-28 15:16:13 -04:00
Jean-Marc Valin
84043f7cf7 Fixes a shift<0 issue in transient_analysis()
Fixes a potential overflow in high-passed signal for transient detection
and ensures that the shift can never go negative
2016-07-24 21:36:06 -04:00
Jean-Marc Valin
6fccb4b615 Adds some smoothing to the energy quantization
When the energy is stable, we slightly bias energy quantization towards
the previous error to make the gain more stable (a constant offset is
better than fluctuations).

We reduce the bitrate by about 0.2% to 1% at low bitrate for the same quality.
2016-07-19 16:11:50 -04:00
Jean-Marc Valin
7780d4a6b1 Retuning the tf_analysis() lambda
Increasing the value at low rate seems to help a bit.
2016-07-19 16:11:50 -04:00
Jean-Marc Valin
1484591656 Fixes equiv_rate for CBR 2016-07-19 16:11:50 -04:00
Jean-Marc Valin
2ca6df03df Minor TF cleanup (tf_sum was useless), plus comments 2016-07-19 16:11:50 -04:00
Jean-Marc Valin
f705e9b5bd Use SPREAD_AGGRESSIVE on non-transient hybrid frames 2016-07-19 16:11:50 -04:00
Jean-Marc Valin
8229f07d3b Don't use too much temporal resolution on hybrid frames at low rate
Otherwise, we risk having "temporal holes" in the HF that anti-collapse
can't always fill in.
2016-07-19 16:11:50 -04:00
Jean-Marc Valin
92d2492bfd Disable patch_transient_decision() on hybrid since it's causing artifacts
It would trigger on the second frame of "S"s, causing holes in the spectrum
2016-07-19 16:11:50 -04:00
Jean-Marc Valin
78fc664c0c Boosting the high-band bitrate on transients for hybrid mode 2016-07-17 15:05:54 -04:00
Jean-Marc Valin
61714e9edb Quality: Increase CELT rate for voiced frames in hybrid mode 2016-07-17 15:05:54 -04:00
Jean-Marc Valin
7e0ca4337f Using "hybrid" flag instead of "start!=0" 2016-07-15 17:51:45 -04:00
Jean-Marc Valin
bcd6abad43 Quality: Makes real CELT VBR work for hybrid too 2016-07-15 17:51:45 -04:00
Jean-Marc Valin
0247d34d6a Quality: Forces trim to 5 on hybrid mode
This saves bits and makes more sense since alloc_trim_analysis()
mostly looks at the lower bands that are coded with SILK
2016-07-15 17:51:45 -04:00
Jean-Marc Valin
59618a5fa2 Quality: removes VBR attenuation at low bitrate
Turns out that even low bitrates benefit from VBR
2016-07-15 17:51:45 -04:00
Jean-Marc Valin
b66080a879 Fixes minor code quality issues in CELT
Reported by Durandal.
2016-06-20 12:11:05 -04:00
Jean-Marc Valin
b370a938ca Fixes an overflow in the constrained VBR code for bitrate>64000 2016-06-17 20:58:30 -04:00
Jean-Marc Valin
99618099ab Fixes patch_transient_decision() for hybrid mode
...and also make it not ignore the right channel
2015-12-23 16:14:11 -05:00
Jean-Marc Valin
eda57aa386 Fixes the transient detector on silence
Previously silence would cause the divide approximation on 0/0 to return a
very large value, which would be interpreted as a transient
2015-12-04 13:45:57 -05:00
Viswanath Puttagunta
19c5406cde armv7(float): Optimize decode usecase using NE10 library
Optimize opus decode (float only) use case using ARM NE10.
Mainly effects opus_ifft and ctl_mdct_backward and related
functions.

Work based on previous Encode optimization using ARM NE10
library. See previous commit for details on how to enable
this.

Signed-off-by: Timothy B. Terriberry <tterribe@xiph.org>
2015-10-07 18:09:20 -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
Jonathan Lennox
43120f0075 Reorganize x86 SSE intrinsics code.
Enable x86 intrinsics when building in floating-point mode.
Support SSE as an arch value.
Use RTCD to conditionally enable existing floating-point Celt SSE code.
Call functions directly (without RTCD) when their architecture can be presumed.
Use SSE4.1 intrinsics optimized code for Silk even in floating-point mode.
2015-09-01 17:21:31 -04:00