Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c85499757c | ||
|
|
c913dc38fd | ||
|
|
101a71e03b | ||
|
|
9fc8fc4cf4 | ||
|
|
5023249b5c | ||
|
|
69b31099c6 | ||
|
|
558a3c2a3f | ||
|
|
20c032d27c | ||
|
|
f3de7ca743 | ||
|
|
82ac57d9f1 | ||
|
|
9efa0eac04 | ||
|
|
09f7f82ca6 | ||
|
|
8cf872a186 | ||
|
|
757c53f775 | ||
|
|
bce1f39235 | ||
|
|
997fdf54e7 |
@ -1,22 +1,65 @@
|
||||
include:
|
||||
- template: 'Workflows/Branch-Pipelines.gitlab-ci.yml'
|
||||
|
||||
# https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
|
||||
workflow:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
|
||||
when: never
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
- if: $CI_COMMIT_TAG
|
||||
|
||||
default:
|
||||
tags:
|
||||
- docker
|
||||
# Image from https://hub.docker.com/_/gcc/ based on Debian
|
||||
image: gcc:9
|
||||
image: 'debian:bookworm-slim'
|
||||
|
||||
# https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#reference-tags
|
||||
.snippets:
|
||||
git_prep:
|
||||
# Make sure we have a recent annotated tag, otherwise meson/get-version.py
|
||||
# might fail later (e.g. shallow clone without enough history) or return
|
||||
# a bogus version based on a much older tag. This can happen in merge request
|
||||
# pipelines from a personal fork, as the fork might not have the latest
|
||||
# upstream tags if it has been forked a long time ago. Also affects the
|
||||
# git version picked up by autotools and cmake, not just meson.
|
||||
- git fetch https://gitlab.xiph.org/xiph/opus.git refs/tags/v1.4:refs/tags/v1.4
|
||||
- git describe
|
||||
|
||||
whitespace:
|
||||
stage: test
|
||||
before_script:
|
||||
- apt-get update &&
|
||||
apt-get install -y git
|
||||
script:
|
||||
- git diff-tree --check origin/master HEAD
|
||||
|
||||
# Make sure commits are GPG signed
|
||||
ci-fairy:
|
||||
stage: test
|
||||
script:
|
||||
- apt update
|
||||
- apt install -y python3-pip git
|
||||
- pip3 install --break-system-packages git+https://gitlab.freedesktop.org/freedesktop/ci-templates@7811ba9814a3bad379377241c6c6b62d78b20eac
|
||||
- echo Checking commits $CI_FAIRY_BASE_COMMIT..HEAD
|
||||
- ci-fairy check-commits --gpg-signed-commit $CI_FAIRY_BASE_COMMIT..HEAD
|
||||
tags:
|
||||
- 'docker'
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
variables:
|
||||
CI_FAIRY_BASE_COMMIT: $CI_MERGE_REQUEST_DIFF_BASE_SHA
|
||||
- if: $CI_PIPELINE_SOURCE != "merge_request_event"
|
||||
variables:
|
||||
CI_FAIRY_BASE_COMMIT: 'HEAD^1'
|
||||
|
||||
autoconf:
|
||||
stage: build
|
||||
before_script:
|
||||
- apt-get update &&
|
||||
apt-get install -y zip doxygen
|
||||
apt-get install -y zip doxygen git automake libtool make
|
||||
- !reference [.snippets, git_prep]
|
||||
script:
|
||||
- ./autogen.sh
|
||||
- ./configure
|
||||
@ -35,27 +78,37 @@ cmake:
|
||||
stage: build
|
||||
before_script:
|
||||
- apt-get update &&
|
||||
apt-get install -y cmake ninja-build
|
||||
apt-get install -y cmake ninja-build git
|
||||
- !reference [.snippets, git_prep]
|
||||
script:
|
||||
- mkdir build
|
||||
- cmake -S . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DOPUS_BUILD_TESTING=ON -DOPUS_BUILD_PROGRAMS=ON
|
||||
- cmake --build build
|
||||
- cd build && ctest --output-on-failure
|
||||
|
||||
meson:
|
||||
.meson:
|
||||
image: 'debian:bookworm-slim'
|
||||
stage: build
|
||||
before_script:
|
||||
- apt-get update &&
|
||||
apt-get install -y python3-pip ninja-build doxygen
|
||||
- export XDG_CACHE_HOME=$PWD/pip-cache
|
||||
- pip3 install --user meson
|
||||
apt-get install -y ninja-build doxygen meson git
|
||||
- !reference [.snippets, git_prep]
|
||||
script:
|
||||
- export PATH=$PATH:$HOME/.local/bin
|
||||
- mkdir builddir
|
||||
- meson setup --werror -Dtests=enabled -Ddocs=enabled -Dbuildtype=release builddir
|
||||
- meson setup -Dtests=enabled -Ddocs=enabled -Dbuildtype=release builddir ${MESON_EXTRA_ARGS}
|
||||
- meson compile -C builddir
|
||||
- meson test -C builddir
|
||||
#- meson dist --no-tests -C builddir
|
||||
cache:
|
||||
paths:
|
||||
- 'pip-cache/*'
|
||||
|
||||
meson x86_64:
|
||||
extends: '.meson'
|
||||
variables:
|
||||
MESON_EXTRA_ARGS: '--werror'
|
||||
|
||||
meson arm64:
|
||||
extends: '.meson'
|
||||
tags:
|
||||
- 'gstreamer-arm64-linux-docker'
|
||||
variables:
|
||||
# arm64 build has a compiler warning still, so let's not use --werror for now
|
||||
MESON_EXTRA_ARGS: '-Dwerror=false'
|
||||
|
||||
@ -1450,7 +1450,7 @@ void quant_all_bands(int encode, const CELTMode *m, int start, int end,
|
||||
if (encode && resynth)
|
||||
lowband_scratch = _lowband_scratch;
|
||||
else
|
||||
lowband_scratch = X_+M*eBands[m->nbEBands-1];
|
||||
lowband_scratch = X_+M*eBands[m->effEBands-1];
|
||||
ALLOC(X_save, resynth_alloc, celt_norm);
|
||||
ALLOC(Y_save, resynth_alloc, celt_norm);
|
||||
ALLOC(X_save2, resynth_alloc, celt_norm);
|
||||
|
||||
@ -52,6 +52,10 @@ extern "C" {
|
||||
# define kiss_fft_scalar opus_int32
|
||||
# define kiss_twiddle_scalar opus_int16
|
||||
|
||||
/* Some 32-bit CPUs would load/store a kiss_twiddle_cpx with a single memory
|
||||
* access, and could benefit from additional alignment.
|
||||
*/
|
||||
# define KISS_TWIDDLE_CPX_ALIGNMENT (sizeof(opus_int32))
|
||||
|
||||
#else
|
||||
# ifndef kiss_fft_scalar
|
||||
@ -62,6 +66,12 @@ extern "C" {
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(KISS_TWIDDLE_CPX_ALIGNMENT)
|
||||
#define KISS_TWIDDLE_CPX_ALIGNED __attribute__((aligned(KISS_TWIDDLE_CPX_ALIGNMENT)))
|
||||
#else
|
||||
#define KISS_TWIDDLE_CPX_ALIGNED
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
kiss_fft_scalar r;
|
||||
kiss_fft_scalar i;
|
||||
@ -70,7 +80,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
kiss_twiddle_scalar r;
|
||||
kiss_twiddle_scalar i;
|
||||
}kiss_twiddle_cpx;
|
||||
} KISS_TWIDDLE_CPX_ALIGNED kiss_twiddle_cpx;
|
||||
|
||||
#define MAXFACTORS 8
|
||||
/* e.g. an fft of length 128 has 4 factors
|
||||
|
||||
132
cmake/README.md
Normal file
132
cmake/README.md
Normal file
@ -0,0 +1,132 @@
|
||||
# Using CMake for the Opus Project
|
||||
|
||||
This guide provides instructions for using CMake to build the Opus project with various configuration options. CMake is a widely used build system generator that helps manage the build process across different platforms.
|
||||
|
||||
Note: Please keep in mind that software documentation can sometimes go out of date as new versions are released. It is always recommended to refer to the official CMake documentation for the most up-to-date and accurate information. You can find the official CMake documentation at [cmake.org/documentation](https://cmake.org/documentation/).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before proceeding, make sure you have the following prerequisites installed:
|
||||
|
||||
- CMake
|
||||
- Git (optional, but recommended for version control integration)
|
||||
- Working C compiler
|
||||
|
||||
## Build Instructions
|
||||
|
||||
Follow the steps below to build the Opus project using CMake:
|
||||
|
||||
1. Clone the Opus repository using Git:
|
||||
|
||||
```shell
|
||||
git clone https://gitlab.xiph.org/xiph/opus
|
||||
```
|
||||
|
||||
2. Create a build directory within the Opus repository:
|
||||
|
||||
```shell
|
||||
cd opus
|
||||
mkdir build
|
||||
cd build
|
||||
```
|
||||
|
||||
3. Configure the build with CMake. You can set the desired configuration options using CMake's `-D` flag. Here are some available options:
|
||||
|
||||
- `OPUS_BUILD_SHARED_LIBRARY`: build shared library.
|
||||
- `OPUS_BUILD_TESTING`: build tests.
|
||||
- `OPUS_BUILD_PROGRAMS`: build programs.
|
||||
- `OPUS_CUSTOM_MODES`, enable non-Opus modes, e.g. 44.1 kHz & 2^n frames.
|
||||
|
||||
For example, to enable the custom modes and build programs, use the following command:
|
||||
|
||||
```shell
|
||||
cmake .. -DOPUS_BUILD_PROGRAMS=ON -DOPUS_BUILD_TESTING=ON
|
||||
```
|
||||
|
||||
4. Build the Opus project:
|
||||
|
||||
```shell
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
5. After a successful build, you can find the compiled Opus library and associated files in the build directory.
|
||||
|
||||
## Testing with CTest
|
||||
|
||||
Opus provides a comprehensive test suite to ensure the functionality and correctness of the project. You can execute the tests using CTest, a part of the CMake build system. CTest allows for automated testing and provides useful features for managing and evaluating the test results.
|
||||
|
||||
To run the Opus tests using CTest, follow these steps:
|
||||
|
||||
1. Navigate to the build directory after configuring and building the project with CMake:
|
||||
|
||||
```shell
|
||||
cd build
|
||||
```
|
||||
|
||||
2. Execute the tests using CTest:
|
||||
|
||||
```shell
|
||||
ctest
|
||||
```
|
||||
|
||||
Note: For Windows you need to specify which configuration to test
|
||||
|
||||
```shell
|
||||
ctest -C Debug
|
||||
```
|
||||
|
||||
## Platform Support and Bug Reporting
|
||||
|
||||
CMake aims to provide broad platform support, allowing the Opus project to be built and used on major operating systems and platforms. The supported platforms include:
|
||||
|
||||
- Windows
|
||||
- macOS
|
||||
- Linux
|
||||
- Android
|
||||
- iOS
|
||||
|
||||
CMake achieves platform support by generating platform-specific build files (e.g., Makefiles, Visual Studio projects) based on the target platform. This allows developers to build and configure the Opus project consistently across different operating systems and environments.
|
||||
|
||||
While CMake strives to ensure compatibility and stability across platforms, bugs or issues may still arise in specific configurations. If you encounter any problems during the configuration process or while building the Opus project, we encourage you to file an issue in the [project's issue tracker](https://gitlab.xiph.org/xiph/opus/-/issues).
|
||||
|
||||
When reporting an issue, please provide the following information to help us understand and reproduce the configuration problem effectively:
|
||||
|
||||
1. Detailed description of the issue, including any error messages or unexpected behavior observed.
|
||||
2. Steps to reproduce the problem, including the CMake command and any specific configuration options used.
|
||||
3. Operating system and version (e.g., Windows 10, macOS Big Sur, Ubuntu 20.04).
|
||||
4. CMake version (e.g., CMake 3.21.1).
|
||||
5. Any relevant information about the platform, toolchain, or dependencies used.
|
||||
6. Additional context or details that might assist in troubleshooting the issue.
|
||||
|
||||
By providing thorough information when reporting configuration issues, you contribute to improving the Opus project's compatibility and reliability across different platforms.
|
||||
|
||||
We appreciate your help in identifying and addressing any configuration-related problems, ensuring a better experience for all users of the Opus project.
|
||||
|
||||
## Platform Specific Examples
|
||||
|
||||
Note: Examples can go out of date. Always refer to documentation for latest reference.
|
||||
|
||||
### Cross compiling for Android
|
||||
|
||||
```shell
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=${ANDROID_HOME}/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a
|
||||
```
|
||||
|
||||
For more information about cross compiling for android, you can refer to the [Cross compiling for Android documentation](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-android).
|
||||
|
||||
### Cross compiling for iOS
|
||||
|
||||
```shell
|
||||
cmake .. -G "Unix Makefiles" -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64
|
||||
```
|
||||
|
||||
For more information about cross compilation for iOS, you can refer to the [Cross compiling for iOS documentation](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos).
|
||||
|
||||
|
||||
### Windows Visual Studio
|
||||
|
||||
```shell
|
||||
cmake .. -G "Visual Studio 17 2022" -A x64
|
||||
```
|
||||
|
||||
For more information about the Visual Studio generator options and additional customization, you can refer to the [Visual Studio Generator documentation](https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html).
|
||||
@ -22,9 +22,9 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
# For libtool.
|
||||
dnl Please update these for releases.
|
||||
OPUS_LT_CURRENT=8
|
||||
OPUS_LT_CURRENT=9
|
||||
OPUS_LT_REVISION=0
|
||||
OPUS_LT_AGE=8
|
||||
OPUS_LT_AGE=9
|
||||
|
||||
AC_SUBST(OPUS_LT_CURRENT)
|
||||
AC_SUBST(OPUS_LT_REVISION)
|
||||
|
||||
@ -46,5 +46,5 @@ cat ${HTML} | sed -e 's/ *$//g' > ${HTML}+ && mv ${HTML}+ ${HTML}
|
||||
cat ${CSS} | sed -e 's/ *$//g' > ${CSS}+ && mv ${CSS}+ ${CSS}
|
||||
|
||||
|
||||
VERSION=$(fgrep Version ${HTML} | sed 's/.*Version \([0-9]\.[0-9]\.[0-9]\).*/\1/')
|
||||
VERSION=$(grep -F Version ${HTML} | sed 's/.*Version \([0-9]\.[0-9]\.[0-9]\).*/\1/')
|
||||
echo Now at version ${VERSION}
|
||||
|
||||
@ -574,8 +574,8 @@ foreach l : lines
|
||||
endforeach
|
||||
|
||||
subdir('include')
|
||||
subdir('silk')
|
||||
subdir('celt')
|
||||
subdir('silk')
|
||||
subdir('src')
|
||||
|
||||
configure_file(output: 'config.h', configuration: opus_conf)
|
||||
|
||||
2
opus.m4
2
opus.m4
@ -63,7 +63,7 @@ dnl
|
||||
#include <string.h>
|
||||
#include <opus.h>
|
||||
|
||||
int main ()
|
||||
int main (void)
|
||||
{
|
||||
system("touch conf.opustest");
|
||||
return 0;
|
||||
|
||||
@ -829,7 +829,7 @@ static OPUS_INLINE opus_int32 silk_SUB_RSHIFT32_(opus_int32 a, opus_int32 b, opu
|
||||
static OPUS_INLINE opus_int32 silk_RSHIFT_ROUND_(opus_int32 a, opus_int32 shift, char *file, int line){
|
||||
opus_int32 ret;
|
||||
ret = shift == 1 ? (a >> 1) + (a & 1) : ((a >> (shift - 1)) + 1) >> 1;
|
||||
/* the marco definition can't handle a shift of zero */
|
||||
/* the macro definition can't handle a shift of zero */
|
||||
if ( (shift <= 0) || (shift>31) || ((opus_int64)ret != ((opus_int64)a + ((opus_int64)1 << (shift - 1))) >> shift) )
|
||||
{
|
||||
fprintf (stderr, "silk_RSHIFT_ROUND(%d, %d) in %s: line %d\n", a, shift, file, line);
|
||||
@ -844,7 +844,7 @@ static OPUS_INLINE opus_int32 silk_RSHIFT_ROUND_(opus_int32 a, opus_int32 shift,
|
||||
#define silk_RSHIFT_ROUND64(a,b) silk_RSHIFT_ROUND64_((a), (b), __FILE__, __LINE__)
|
||||
static OPUS_INLINE opus_int64 silk_RSHIFT_ROUND64_(opus_int64 a, opus_int32 shift, char *file, int line){
|
||||
opus_int64 ret;
|
||||
/* the marco definition can't handle a shift of zero */
|
||||
/* the macro definition can't handle a shift of zero */
|
||||
if ( (shift <= 0) || (shift>=64) )
|
||||
{
|
||||
fprintf (stderr, "silk_RSHIFT_ROUND64(%lld, %d) in %s: line %d\n", (long long)a, shift, file, line);
|
||||
|
||||
12
silk/NSQ.c
12
silk/NSQ.c
@ -258,8 +258,8 @@ void silk_noise_shape_quantizer(
|
||||
celt_assert( lag > 0 || signalType != TYPE_VOICED );
|
||||
|
||||
/* Combine prediction and noise shaping signals */
|
||||
tmp1 = silk_SUB32( silk_LSHIFT32( LPC_pred_Q10, 2 ), n_AR_Q12 ); /* Q12 */
|
||||
tmp1 = silk_SUB32( tmp1, n_LF_Q12 ); /* Q12 */
|
||||
tmp1 = silk_SUB32_ovflw( silk_LSHIFT32( LPC_pred_Q10, 2 ), n_AR_Q12 ); /* Q12 */
|
||||
tmp1 = silk_SUB32_ovflw( tmp1, n_LF_Q12 ); /* Q12 */
|
||||
if( lag > 0 ) {
|
||||
/* Symmetric, packed FIR coefficients */
|
||||
n_LTP_Q13 = silk_SMULWB( silk_ADD_SAT32( shp_lag_ptr[ 0 ], shp_lag_ptr[ -2 ] ), HarmShapeFIRPacked_Q14 );
|
||||
@ -268,7 +268,7 @@ void silk_noise_shape_quantizer(
|
||||
shp_lag_ptr++;
|
||||
|
||||
tmp2 = silk_SUB32( LTP_pred_Q13, n_LTP_Q13 ); /* Q13 */
|
||||
tmp1 = silk_ADD_LSHIFT32( tmp2, tmp1, 1 ); /* Q13 */
|
||||
tmp1 = silk_ADD32_ovflw( tmp2, silk_LSHIFT32( tmp1, 1 ) ); /* Q13 */
|
||||
tmp1 = silk_RSHIFT_ROUND( tmp1, 3 ); /* Q10 */
|
||||
} else {
|
||||
tmp1 = silk_RSHIFT_ROUND( tmp1, 2 ); /* Q10 */
|
||||
@ -340,7 +340,7 @@ void silk_noise_shape_quantizer(
|
||||
|
||||
/* Add predictions */
|
||||
LPC_exc_Q14 = silk_ADD_LSHIFT32( exc_Q14, LTP_pred_Q13, 1 );
|
||||
xq_Q14 = silk_ADD_LSHIFT32( LPC_exc_Q14, LPC_pred_Q10, 4 );
|
||||
xq_Q14 = silk_ADD32_ovflw( LPC_exc_Q14, silk_LSHIFT32( LPC_pred_Q10, 4 ) );
|
||||
|
||||
/* Scale XQ back to normal level before saving */
|
||||
xq[ i ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( silk_SMULWW( xq_Q14, Gain_Q10 ), 8 ) );
|
||||
@ -349,10 +349,10 @@ void silk_noise_shape_quantizer(
|
||||
psLPC_Q14++;
|
||||
*psLPC_Q14 = xq_Q14;
|
||||
NSQ->sDiff_shp_Q14 = silk_SUB_LSHIFT32( xq_Q14, x_sc_Q10[ i ], 4 );
|
||||
sLF_AR_shp_Q14 = silk_SUB_LSHIFT32( NSQ->sDiff_shp_Q14, n_AR_Q12, 2 );
|
||||
sLF_AR_shp_Q14 = silk_SUB32_ovflw( NSQ->sDiff_shp_Q14, silk_LSHIFT32( n_AR_Q12, 2 ) );
|
||||
NSQ->sLF_AR_shp_Q14 = sLF_AR_shp_Q14;
|
||||
|
||||
NSQ->sLTP_shp_Q14[ NSQ->sLTP_shp_buf_idx ] = silk_SUB_LSHIFT32( sLF_AR_shp_Q14, n_LF_Q12, 2 );
|
||||
NSQ->sLTP_shp_Q14[ NSQ->sLTP_shp_buf_idx ] = silk_SUB32_ovflw(sLF_AR_shp_Q14, silk_LSHIFT32(n_LF_Q12, 2));
|
||||
sLTP_Q15[ NSQ->sLTP_buf_idx ] = silk_LSHIFT( LPC_exc_Q14, 1 );
|
||||
NSQ->sLTP_shp_buf_idx++;
|
||||
NSQ->sLTP_buf_idx++;
|
||||
|
||||
@ -423,18 +423,18 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec(
|
||||
/* Output of lowpass section */
|
||||
tmp2 = silk_SMLAWB( psDD->Diff_Q14, psDD->sAR2_Q14[ 0 ], warping_Q16 );
|
||||
/* Output of allpass section */
|
||||
tmp1 = silk_SMLAWB( psDD->sAR2_Q14[ 0 ], psDD->sAR2_Q14[ 1 ] - tmp2, warping_Q16 );
|
||||
tmp1 = silk_SMLAWB( psDD->sAR2_Q14[ 0 ], silk_SUB32_ovflw(psDD->sAR2_Q14[ 1 ], tmp2), warping_Q16 );
|
||||
psDD->sAR2_Q14[ 0 ] = tmp2;
|
||||
n_AR_Q14 = silk_RSHIFT( shapingLPCOrder, 1 );
|
||||
n_AR_Q14 = silk_SMLAWB( n_AR_Q14, tmp2, AR_shp_Q13[ 0 ] );
|
||||
/* Loop over allpass sections */
|
||||
for( j = 2; j < shapingLPCOrder; j += 2 ) {
|
||||
/* Output of allpass section */
|
||||
tmp2 = silk_SMLAWB( psDD->sAR2_Q14[ j - 1 ], psDD->sAR2_Q14[ j + 0 ] - tmp1, warping_Q16 );
|
||||
tmp2 = silk_SMLAWB( psDD->sAR2_Q14[ j - 1 ], silk_SUB32_ovflw(psDD->sAR2_Q14[ j + 0 ], tmp1), warping_Q16 );
|
||||
psDD->sAR2_Q14[ j - 1 ] = tmp1;
|
||||
n_AR_Q14 = silk_SMLAWB( n_AR_Q14, tmp1, AR_shp_Q13[ j - 1 ] );
|
||||
/* Output of allpass section */
|
||||
tmp1 = silk_SMLAWB( psDD->sAR2_Q14[ j + 0 ], psDD->sAR2_Q14[ j + 1 ] - tmp2, warping_Q16 );
|
||||
tmp1 = silk_SMLAWB( psDD->sAR2_Q14[ j + 0 ], silk_SUB32_ovflw(psDD->sAR2_Q14[ j + 1 ], tmp2), warping_Q16 );
|
||||
psDD->sAR2_Q14[ j + 0 ] = tmp2;
|
||||
n_AR_Q14 = silk_SMLAWB( n_AR_Q14, tmp2, AR_shp_Q13[ j ] );
|
||||
}
|
||||
@ -452,7 +452,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec(
|
||||
/* Input minus prediction plus noise feedback */
|
||||
/* r = x[ i ] - LTP_pred - LPC_pred + n_AR + n_Tilt + n_LF + n_LTP */
|
||||
tmp1 = silk_ADD_SAT32( n_AR_Q14, n_LF_Q14 ); /* Q14 */
|
||||
tmp2 = silk_ADD32( n_LTP_Q14, LPC_pred_Q14 ); /* Q13 */
|
||||
tmp2 = silk_ADD32_ovflw( n_LTP_Q14, LPC_pred_Q14 ); /* Q13 */
|
||||
tmp1 = silk_SUB_SAT32( tmp2, tmp1 ); /* Q13 */
|
||||
tmp1 = silk_RSHIFT_ROUND( tmp1, 4 ); /* Q10 */
|
||||
|
||||
@ -530,11 +530,11 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec(
|
||||
|
||||
/* Add predictions */
|
||||
LPC_exc_Q14 = silk_ADD32( exc_Q14, LTP_pred_Q14 );
|
||||
xq_Q14 = silk_ADD32( LPC_exc_Q14, LPC_pred_Q14 );
|
||||
xq_Q14 = silk_ADD32_ovflw( LPC_exc_Q14, LPC_pred_Q14 );
|
||||
|
||||
/* Update states */
|
||||
psSS[ 0 ].Diff_Q14 = silk_SUB_LSHIFT32( xq_Q14, x_Q10[ i ], 4 );
|
||||
sLF_AR_shp_Q14 = silk_SUB32( psSS[ 0 ].Diff_Q14, n_AR_Q14 );
|
||||
psSS[ 0 ].Diff_Q14 = silk_SUB32_ovflw( xq_Q14, silk_LSHIFT32( x_Q10[ i ], 4 ) );
|
||||
sLF_AR_shp_Q14 = silk_SUB32_ovflw( psSS[ 0 ].Diff_Q14, n_AR_Q14 );
|
||||
psSS[ 0 ].sLTP_shp_Q14 = silk_SUB_SAT32( sLF_AR_shp_Q14, n_LF_Q14 );
|
||||
psSS[ 0 ].LF_AR_Q14 = sLF_AR_shp_Q14;
|
||||
psSS[ 0 ].LPC_exc_Q14 = LPC_exc_Q14;
|
||||
@ -550,11 +550,11 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec(
|
||||
|
||||
/* Add predictions */
|
||||
LPC_exc_Q14 = silk_ADD32( exc_Q14, LTP_pred_Q14 );
|
||||
xq_Q14 = silk_ADD32( LPC_exc_Q14, LPC_pred_Q14 );
|
||||
xq_Q14 = silk_ADD32_ovflw( LPC_exc_Q14, LPC_pred_Q14 );
|
||||
|
||||
/* Update states */
|
||||
psSS[ 1 ].Diff_Q14 = silk_SUB_LSHIFT32( xq_Q14, x_Q10[ i ], 4 );
|
||||
sLF_AR_shp_Q14 = silk_SUB32( psSS[ 1 ].Diff_Q14, n_AR_Q14 );
|
||||
psSS[ 1 ].Diff_Q14 = silk_SUB32_ovflw( xq_Q14, silk_LSHIFT32( x_Q10[ i ], 4 ) );
|
||||
sLF_AR_shp_Q14 = silk_SUB32_ovflw( psSS[ 1 ].Diff_Q14, n_AR_Q14 );
|
||||
psSS[ 1 ].sLTP_shp_Q14 = silk_SUB_SAT32( sLF_AR_shp_Q14, n_LF_Q14 );
|
||||
psSS[ 1 ].LF_AR_Q14 = sLF_AR_shp_Q14;
|
||||
psSS[ 1 ].LPC_exc_Q14 = LPC_exc_Q14;
|
||||
|
||||
@ -29,6 +29,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
typedef int prevent_empty_translation_unit_warning;
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#if SILK_DEBUG || SILK_TIC_TOC
|
||||
|
||||
@ -42,7 +42,7 @@ void silk_LTP_scale_ctrl_FIX(
|
||||
|
||||
if( condCoding == CODE_INDEPENDENTLY ) {
|
||||
/* Only scale if first frame in packet */
|
||||
round_loss = psEnc->sCmn.PacketLoss_perc + psEnc->sCmn.nFramesPerPacket;
|
||||
round_loss = psEnc->sCmn.PacketLoss_perc * psEnc->sCmn.nFramesPerPacket;
|
||||
if ( psEnc->sCmn.LBRR_flag ) {
|
||||
/* LBRR reduces the effective loss. In practice, it does not square the loss because
|
||||
losses aren't independent, but that still seems to work best. We also never go below 2%. */
|
||||
|
||||
@ -41,7 +41,7 @@ void silk_LTP_scale_ctrl_FLP(
|
||||
|
||||
if( condCoding == CODE_INDEPENDENTLY ) {
|
||||
/* Only scale if first frame in packet */
|
||||
round_loss = psEnc->sCmn.PacketLoss_perc + psEnc->sCmn.nFramesPerPacket;
|
||||
round_loss = psEnc->sCmn.PacketLoss_perc * psEnc->sCmn.nFramesPerPacket;
|
||||
if ( psEnc->sCmn.LBRR_flag ) {
|
||||
/* LBRR reduces the effective loss. In practice, it does not square the loss because
|
||||
losses aren't independent, but that still seems to work best. We also never go below 2%. */
|
||||
|
||||
@ -561,18 +561,18 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1(
|
||||
/* Output of lowpass section */
|
||||
tmp2 = silk_SMLAWB( psDD->Diff_Q14, psDD->sAR2_Q14[ 0 ], warping_Q16 );
|
||||
/* Output of allpass section */
|
||||
tmp1 = silk_SMLAWB( psDD->sAR2_Q14[ 0 ], psDD->sAR2_Q14[ 1 ] - tmp2, warping_Q16 );
|
||||
tmp1 = silk_SMLAWB( psDD->sAR2_Q14[ 0 ], silk_SUB32_ovflw(psDD->sAR2_Q14[ 1 ], tmp2), warping_Q16 );
|
||||
psDD->sAR2_Q14[ 0 ] = tmp2;
|
||||
n_AR_Q14 = silk_RSHIFT( shapingLPCOrder, 1 );
|
||||
n_AR_Q14 = silk_SMLAWB( n_AR_Q14, tmp2, AR_shp_Q13[ 0 ] );
|
||||
/* Loop over allpass sections */
|
||||
for( j = 2; j < shapingLPCOrder; j += 2 ) {
|
||||
/* Output of allpass section */
|
||||
tmp2 = silk_SMLAWB( psDD->sAR2_Q14[ j - 1 ], psDD->sAR2_Q14[ j + 0 ] - tmp1, warping_Q16 );
|
||||
tmp2 = silk_SMLAWB( psDD->sAR2_Q14[ j - 1 ], silk_SUB32_ovflw(psDD->sAR2_Q14[ j + 0 ], tmp1), warping_Q16 );
|
||||
psDD->sAR2_Q14[ j - 1 ] = tmp1;
|
||||
n_AR_Q14 = silk_SMLAWB( n_AR_Q14, tmp1, AR_shp_Q13[ j - 1 ] );
|
||||
/* Output of allpass section */
|
||||
tmp1 = silk_SMLAWB( psDD->sAR2_Q14[ j + 0 ], psDD->sAR2_Q14[ j + 1 ] - tmp2, warping_Q16 );
|
||||
tmp1 = silk_SMLAWB( psDD->sAR2_Q14[ j + 0 ], silk_SUB32_ovflw(psDD->sAR2_Q14[ j + 1 ], tmp2), warping_Q16 );
|
||||
psDD->sAR2_Q14[ j + 0 ] = tmp2;
|
||||
n_AR_Q14 = silk_SMLAWB( n_AR_Q14, tmp2, AR_shp_Q13[ j ] );
|
||||
}
|
||||
@ -590,7 +590,7 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1(
|
||||
/* Input minus prediction plus noise feedback */
|
||||
/* r = x[ i ] - LTP_pred - LPC_pred + n_AR + n_Tilt + n_LF + n_LTP */
|
||||
tmp1 = silk_ADD_SAT32( n_AR_Q14, n_LF_Q14 ); /* Q14 */
|
||||
tmp2 = silk_ADD32( n_LTP_Q14, LPC_pred_Q14 ); /* Q13 */
|
||||
tmp2 = silk_ADD32_ovflw( n_LTP_Q14, LPC_pred_Q14 ); /* Q13 */
|
||||
tmp1 = silk_SUB_SAT32( tmp2, tmp1 ); /* Q13 */
|
||||
tmp1 = silk_RSHIFT_ROUND( tmp1, 4 ); /* Q10 */
|
||||
|
||||
@ -667,11 +667,11 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1(
|
||||
|
||||
/* Add predictions */
|
||||
LPC_exc_Q14 = silk_ADD32( exc_Q14, LTP_pred_Q14 );
|
||||
xq_Q14 = silk_ADD32( LPC_exc_Q14, LPC_pred_Q14 );
|
||||
xq_Q14 = silk_ADD32_ovflw( LPC_exc_Q14, LPC_pred_Q14 );
|
||||
|
||||
/* Update states */
|
||||
psSS[ 0 ].Diff_Q14 = silk_SUB_LSHIFT32( xq_Q14, x_Q10[ i ], 4 );
|
||||
sLF_AR_shp_Q14 = silk_SUB32( psSS[ 0 ].Diff_Q14, n_AR_Q14 );
|
||||
psSS[ 0 ].Diff_Q14 = silk_SUB32_ovflw( xq_Q14, silk_LSHIFT32( x_Q10[ i ], 4 ) );
|
||||
sLF_AR_shp_Q14 = silk_SUB32_ovflw( psSS[ 0 ].Diff_Q14, n_AR_Q14 );
|
||||
psSS[ 0 ].sLTP_shp_Q14 = silk_SUB_SAT32( sLF_AR_shp_Q14, n_LF_Q14 );
|
||||
psSS[ 0 ].LF_AR_Q14 = sLF_AR_shp_Q14;
|
||||
psSS[ 0 ].LPC_exc_Q14 = LPC_exc_Q14;
|
||||
@ -687,11 +687,11 @@ static OPUS_INLINE void silk_noise_shape_quantizer_del_dec_sse4_1(
|
||||
|
||||
/* Add predictions */
|
||||
LPC_exc_Q14 = silk_ADD32( exc_Q14, LTP_pred_Q14 );
|
||||
xq_Q14 = silk_ADD32( LPC_exc_Q14, LPC_pred_Q14 );
|
||||
xq_Q14 = silk_ADD32_ovflw( LPC_exc_Q14, LPC_pred_Q14 );
|
||||
|
||||
/* Update states */
|
||||
psSS[ 1 ].Diff_Q14 = silk_SUB_LSHIFT32( xq_Q14, x_Q10[ i ], 4 );
|
||||
sLF_AR_shp_Q14 = silk_SUB32( psSS[ 1 ].Diff_Q14, n_AR_Q14 );
|
||||
psSS[ 1 ].Diff_Q14 = silk_SUB32_ovflw( xq_Q14, silk_LSHIFT32( x_Q10[ i ], 4 ) );
|
||||
sLF_AR_shp_Q14 = silk_SUB32_ovflw( psSS[ 1 ].Diff_Q14, n_AR_Q14 );
|
||||
psSS[ 1 ].sLTP_shp_Q14 = silk_SUB_SAT32( sLF_AR_shp_Q14, n_LF_Q14 );
|
||||
psSS[ 1 ].LF_AR_Q14 = sLF_AR_shp_Q14;
|
||||
psSS[ 1 ].LPC_exc_Q14 = LPC_exc_Q14;
|
||||
|
||||
@ -941,7 +941,6 @@ static opus_int32 encode_multiframe_packet(OpusEncoder *st,
|
||||
opus_int32 bytes_per_frame;
|
||||
opus_int32 cbr_bytes;
|
||||
opus_int32 repacketize_len;
|
||||
int dtx_count = 0;
|
||||
int tmp_len;
|
||||
ALLOC_STACK;
|
||||
|
||||
@ -993,8 +992,7 @@ static opus_int32 encode_multiframe_packet(OpusEncoder *st,
|
||||
{
|
||||
RESTORE_STACK;
|
||||
return OPUS_INTERNAL_ERROR;
|
||||
} else if (tmp_len==1)
|
||||
dtx_count++;
|
||||
}
|
||||
|
||||
ret = opus_repacketizer_cat(rp, tmp_data+i*bytes_per_frame, tmp_len);
|
||||
|
||||
@ -1005,7 +1003,7 @@ static opus_int32 encode_multiframe_packet(OpusEncoder *st,
|
||||
}
|
||||
}
|
||||
|
||||
ret = opus_repacketizer_out_range_impl(rp, 0, nb_frames, data, repacketize_len, 0, !st->use_vbr && (dtx_count==0));
|
||||
ret = opus_repacketizer_out_range_impl(rp, 0, nb_frames, data, repacketize_len, 0, !st->use_vbr);
|
||||
|
||||
if (ret<0)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user