ref: 4bd112d827d7c75add17d512929ea6b0a258d86a
parent: 101a71e03bbf860aaafb7090a0e440675cb27660
parent: 21bf12e142e661f18d1a0f47e20c67daee43fc36
author: qwx <[email protected]>
date: Sat Oct 14 23:35:58 EDT 2023
sync upstream
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,65 +1,22 @@
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: 'debian:bookworm-slim'
+ # Image from https://hub.docker.com/_/gcc/ based on Debian
+ image: gcc:9
-# 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 git automake libtool make
- - !reference [.snippets, git_prep]
+ apt-get install -y zip doxygen
script:
- ./autogen.sh
- ./configure
@@ -78,8 +35,7 @@
stage: build
before_script:
- apt-get update &&
- apt-get install -y cmake ninja-build git
- - !reference [.snippets, git_prep]
+ apt-get install -y cmake ninja-build
script:
- mkdir build
- cmake -S . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DOPUS_BUILD_TESTING=ON -DOPUS_BUILD_PROGRAMS=ON
@@ -86,29 +42,20 @@
- cmake --build build
- cd build && ctest --output-on-failure
-.meson:
- image: 'debian:bookworm-slim'
+meson:
stage: build
before_script:
- apt-get update &&
- apt-get install -y ninja-build doxygen meson git
- - !reference [.snippets, git_prep]
+ apt-get install -y python3-pip ninja-build doxygen
+ - export XDG_CACHE_HOME=$PWD/pip-cache
+ - pip3 install --user meson
script:
+ - export PATH=$PATH:$HOME/.local/bin
- mkdir builddir
- - meson setup -Dtests=enabled -Ddocs=enabled -Dbuildtype=release builddir ${MESON_EXTRA_ARGS}
+ - meson setup --werror -Dtests=enabled -Ddocs=enabled -Dbuildtype=release builddir
- meson compile -C builddir
- meson test -C builddir
#- meson dist --no-tests -C builddir
-
-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'
+ cache:
+ paths:
+ - 'pip-cache/*'
--- a/celt/stack_alloc.h
+++ b/celt/stack_alloc.h
@@ -140,7 +140,7 @@
#else
-#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
+#define ALIGN(stack, size) ((stack) += ((size) - (_intptr_t)(stack)) & ((size) - 1))
#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)/sizeof(char)),(stack)+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeof(char))))
#if 0 /* Set this to 1 to instrument pseudostack usage */
#define RESTORE_STACK (printf("%ld %s:%d\n", global_stack-scratch_ptr, __FILE__, __LINE__),global_stack = _saved_stack)
--- a/cmake/README.md
+++ /dev/null
@@ -1,132 +1,0 @@
-# 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).
--- a/configure.ac
+++ b/configure.ac
@@ -22,9 +22,9 @@
# For libtool.
dnl Please update these for releases.
-OPUS_LT_CURRENT=9
+OPUS_LT_CURRENT=8
OPUS_LT_REVISION=0
-OPUS_LT_AGE=9
+OPUS_LT_AGE=8
AC_SUBST(OPUS_LT_CURRENT)
AC_SUBST(OPUS_LT_REVISION)
--- a/doc/build_isobmff.sh
+++ b/doc/build_isobmff.sh
@@ -46,5 +46,5 @@
cat ${CSS} | sed -e 's/ *$//g' > ${CSS}+ && mv ${CSS}+ ${CSS}
-VERSION=$(grep -F Version ${HTML} | sed 's/.*Version \([0-9]\.[0-9]\.[0-9]\).*/\1/')
+VERSION=$(fgrep Version ${HTML} | sed 's/.*Version \([0-9]\.[0-9]\.[0-9]\).*/\1/')
echo Now at version ${VERSION}
--- a/meson.build
+++ b/meson.build
@@ -574,8 +574,8 @@
endforeach
subdir('include')
-subdir('celt')
subdir('silk')
+subdir('celt')
subdir('src')
configure_file(output: 'config.h', configuration: opus_conf)
--- /dev/null
+++ b/mkfile
@@ -1,0 +1,187 @@
+APE=/sys/src/ape
+<$APE/config
+
+LIB=/$objtype/lib/ape/libopus.a
+
+OFILES=\
+# silk \
+ CNG.$O \
+ code_signs.$O \
+ init_decoder.$O \
+ decode_core.$O \
+ decode_frame.$O \
+ decode_parameters.$O \
+ decode_indices.$O \
+ decode_pulses.$O \
+ decoder_set_fs.$O \
+ dec_API.$O \
+ enc_API.$O \
+ encode_indices.$O \
+ encode_pulses.$O \
+ gain_quant.$O \
+ interpolate.$O \
+ LP_variable_cutoff.$O \
+ NLSF_decode.$O \
+ NSQ.$O \
+ NSQ_del_dec.$O \
+ PLC.$O \
+ shell_coder.$O \
+ tables_gain.$O \
+ tables_LTP.$O \
+ tables_NLSF_CB_NB_MB.$O \
+ tables_NLSF_CB_WB.$O \
+ tables_other.$O \
+ tables_pitch_lag.$O \
+ tables_pulses_per_block.$O \
+ VAD.$O \
+ control_audio_bandwidth.$O \
+ quant_LTP_gains.$O \
+ VQ_WMat_EC.$O \
+ HP_variable_cutoff.$O \
+ NLSF_encode.$O \
+ NLSF_VQ.$O \
+ NLSF_unpack.$O \
+ NLSF_del_dec_quant.$O \
+ process_NLSFs.$O \
+ stereo_LR_to_MS.$O \
+ stereo_MS_to_LR.$O \
+ check_control_input.$O \
+ control_SNR.$O \
+ init_encoder.$O \
+ control_codec.$O \
+ A2NLSF.$O \
+ ana_filt_bank_1.$O \
+ biquad_alt.$O \
+ bwexpander_32.$O \
+ bwexpander.$O \
+ debug.$O \
+ decode_pitch.$O \
+ inner_prod_aligned.$O \
+ lin2log.$O \
+ log2lin.$O \
+ LPC_analysis_filter.$O \
+ LPC_inv_pred_gain.$O \
+ table_LSF_cos.$O \
+ NLSF2A.$O \
+ NLSF_stabilize.$O \
+ NLSF_VQ_weights_laroia.$O \
+ pitch_est_tables.$O \
+ resampler.$O \
+ resampler_down2_3.$O \
+ resampler_down2.$O \
+ resampler_private_AR2.$O \
+ resampler_private_down_FIR.$O \
+ resampler_private_IIR_FIR.$O \
+ resampler_private_up2_HQ.$O \
+ resampler_rom.$O \
+ sigm_Q15.$O \
+ sort.$O \
+ sum_sqr_shift.$O \
+ stereo_decode_pred.$O \
+ stereo_encode_pred.$O \
+ stereo_find_predictor.$O \
+ stereo_quant_pred.$O \
+ LPC_fit.$O \
+# silk/float \
+ apply_sine_window_FLP.$O \
+ corrMatrix_FLP.$O \
+ encode_frame_FLP.$O \
+ find_LPC_FLP.$O \
+ find_LTP_FLP.$O \
+ find_pitch_lags_FLP.$O \
+ find_pred_coefs_FLP.$O \
+ LPC_analysis_filter_FLP.$O \
+ LTP_analysis_filter_FLP.$O \
+ LTP_scale_ctrl_FLP.$O \
+ noise_shape_analysis_FLP.$O \
+ process_gains_FLP.$O \
+ regularize_correlations_FLP.$O \
+ residual_energy_FLP.$O \
+ warped_autocorrelation_FLP.$O \
+ wrappers_FLP.$O \
+ autocorrelation_FLP.$O \
+ burg_modified_FLP.$O \
+ bwexpander_FLP.$O \
+ energy_FLP.$O \
+ inner_product_FLP.$O \
+ k2a_FLP.$O \
+ LPC_inv_pred_gain_FLP.$O \
+ pitch_analysis_core_FLP.$O \
+ scale_copy_vector_FLP.$O \
+ scale_vector_FLP.$O \
+ schur_FLP.$O \
+ sort_FLP.$O \
+# celt \
+ bands.$O \
+ celt.$O \
+ celt_encoder.$O \
+ celt_decoder.$O \
+ cwrs.$O \
+ entcode.$O \
+ entdec.$O \
+ entenc.$O \
+ kiss_fft.$O \
+ laplace.$O \
+ mathops.$O \
+ mdct.$O \
+ modes.$O \
+ pitch.$O \
+ celt_lpc.$O \
+ quant_bands.$O \
+ rate.$O \
+ vq.$O \
+# src \
+ analysis.$O \
+ mlp.$O \
+ mlp_data.$O \
+ opus.$O \
+ opus_decoder.$O \
+ opus_encoder.$O \
+ opus_multistream.$O \
+ opus_multistream_encoder.$O \
+ opus_multistream_decoder.$O \
+ repacketizer.$O \
+ opus_projection_encoder.$O \
+ opus_projection_decoder.$O \
+ mapping_matrix.$O
+
+HFILES=\
+ /sys/include/ape/opus/opus.h \
+ /sys/include/ape/opus/opus_custom.h \
+ /sys/include/ape/opus/opus_defines.h \
+ /sys/include/ape/opus/opus_multistream.h \
+ /sys/include/ape/opus/opus_projection.h \
+ /sys/include/ape/opus/opus_types.h \
+
+UPDATE=\
+ mkfile\
+ $HFILES\
+ ${OFILES:%.$O=%.c}\
+
+</sys/src/cmd/mksyslib
+
+CFLAGS=$CFLAGS -c -Iinclude -Isilk -Isilk/fixed -Isilk/float -Icelt \
+ -DPACKAGE_VERSION="$VERSION" \
+ -DOPUS_BUILD \
+ -DCUSTOM_MODES \
+ -DNONTHREADSAFE_PSEUDOSTACK \
+ -DHAVE_STDINT_H
+
+%.$O: silk/%.c
+ $CC $CFLAGS silk/$stem.c
+
+%.$O: silk/fixed/%.c
+ $CC $CFLAGS silk/fixed/$stem.c
+
+%.$O: silk/float/%.c
+ $CC $CFLAGS silk/float/$stem.c
+
+%.$O: celt/%.c
+ $CC $CFLAGS celt/$stem.c
+
+%.$O: src/%.c
+ $CC $CFLAGS src/$stem.c
+
+$HFILES:
+ mkdir -p /sys/include/ape/opus
+ dircp include /sys/include/ape/opus
--- a/silk/LPC_inv_pred_gain.c
+++ b/silk/LPC_inv_pred_gain.c
@@ -45,7 +45,7 @@
)
{
opus_int k, n, mult2Q;
- opus_int32 invGain_Q30, rc_Q31, rc_mult1_Q30, rc_mult2, tmp1, tmp2;
+ opus_int32 invGain_Q30, rc_Q31, rc_mult1_Q30, rc_mult2, tmp1, tmp2, tmp3;
invGain_Q30 = SILK_FIX_CONST( 1, 30 );
for( k = order - 1; k > 0; k-- ) {
@@ -80,14 +80,14 @@
opus_int64 tmp64;
tmp1 = A_QA[ n ];
tmp2 = A_QA[ k - n - 1 ];
- tmp64 = silk_RSHIFT_ROUND64( silk_SMULL( silk_SUB_SAT32(tmp1,
- MUL32_FRAC_Q( tmp2, rc_Q31, 31 ) ), rc_mult2 ), mult2Q);
+ tmp3 = silk_SUB_SAT32(tmp1, MUL32_FRAC_Q( tmp2, rc_Q31, 31 ) );
+ tmp64 = silk_RSHIFT_ROUND64( silk_SMULL(tmp3, rc_mult2 ), mult2Q);
if( tmp64 > silk_int32_MAX || tmp64 < silk_int32_MIN ) {
return 0;
}
A_QA[ n ] = ( opus_int32 )tmp64;
- tmp64 = silk_RSHIFT_ROUND64( silk_SMULL( silk_SUB_SAT32(tmp2,
- MUL32_FRAC_Q( tmp1, rc_Q31, 31 ) ), rc_mult2), mult2Q);
+ tmp3 = silk_SUB_SAT32(tmp2, MUL32_FRAC_Q( tmp1, rc_Q31, 31 ) );
+ tmp64 = silk_RSHIFT_ROUND64( silk_SMULL(tmp3, rc_mult2), mult2Q);
if( tmp64 > silk_int32_MAX || tmp64 < silk_int32_MIN ) {
return 0;
}
--- a/silk/debug.c
+++ b/silk/debug.c
@@ -29,8 +29,6 @@
#include "config.h"
#endif
-typedef int prevent_empty_translation_unit_warning;
-
#include "debug.h"
#if SILK_DEBUG || SILK_TIC_TOC