├── src
├── silk
│ ├── debug.rs
│ ├── mathops.rs
│ ├── float
│ │ ├── bwexpander_FLP.rs
│ │ ├── energy_FLP.rs
│ │ ├── k2a_FLP.rs
│ │ ├── autocorrelation_FLP.rs
│ │ ├── scale_copy_vector_FLP.rs
│ │ ├── SigProc_FLP.rs
│ │ ├── apply_sine_window_FLP.rs
│ │ ├── schur_FLP.rs
│ │ ├── sort_FLP.rs
│ │ ├── LTP_scale_ctrl_FLP.rs
│ │ ├── warped_autocorrelation_FLP.rs
│ │ ├── structs_FLP.rs
│ │ ├── LTP_analysis_filter_FLP.rs
│ │ ├── residual_energy_FLP.rs
│ │ └── find_LTP_FLP.rs
│ ├── tables_gain.rs
│ ├── inner_prod_aligned.rs
│ ├── lin2log.rs
│ ├── resampler
│ │ ├── ar2.rs
│ │ ├── down2.rs
│ │ └── rom.rs
│ ├── interpolate.rs
│ ├── bwexpander_32.rs
│ ├── tables_pitch_lag.rs
│ ├── sigm_Q15.rs
│ ├── bwexpander.rs
│ ├── table_LSF_cos.rs
│ ├── NLSF_unpack.rs
│ ├── init_encoder.rs
│ ├── macros.rs
│ ├── log2lin.rs
│ ├── stereo_encode_pred.rs
│ ├── init_decoder.rs
│ ├── sort.rs
│ ├── LPC_analysis_filter.rs
│ ├── NLSF_VQ.rs
│ ├── sum_sqr_shift.rs
│ ├── biquad_alt.rs
│ ├── NLSF_VQ_weights_laroia.rs
│ ├── decode_pitch.rs
│ ├── LPC_fit.rs
│ ├── stereo_decode_pred.rs
│ ├── tables_other.rs
│ ├── stereo_quant_pred.rs
│ ├── pitch_est_tables.rs
│ └── ana_filt_bank_1.rs
├── util
│ ├── mod.rs
│ └── nalgebra.rs
├── src
│ ├── mlp
│ │ └── mod.rs
│ └── opus_private.rs
└── celt
│ ├── float_cast.rs
│ └── tests
│ └── test_unit_types.rs
├── upstream-libopus
├── opus
│ ├── NEWS
│ ├── ChangeLog
│ ├── config.h.cmake.in
│ ├── tests
│ │ └── opus_decode_fuzzer.options
│ ├── opus_headers.mk
│ ├── AUTHORS
│ ├── training
│ │ ├── txt2hdf5.py
│ │ └── rnn_dump.py
│ ├── opus-uninstalled.pc.in
│ ├── opus_sources.mk
│ ├── opus.pc.in
│ ├── .travis.yml
│ ├── autogen.sh
│ ├── win32
│ │ ├── VS2015
│ │ │ ├── test_opus_api.vcxproj.filters
│ │ │ ├── test_opus_decode.vcxproj.filters
│ │ │ ├── test_opus_encode.vcxproj.filters
│ │ │ └── opus_demo.vcxproj.filters
│ │ └── genversion.bat
│ ├── OpusConfig.cmake.in
│ ├── LICENSE_PLEASE_READ.txt
│ ├── doc
│ │ ├── footer.html
│ │ ├── Makefile.am
│ │ ├── release.txt
│ │ ├── opus_in_isobmff.css
│ │ ├── header.html
│ │ ├── build_isobmff.sh
│ │ └── build_oggdraft.sh
│ ├── opus_buildtype.cmake
│ ├── .appveyor.yml
│ ├── m4
│ │ ├── opus-intrinsics.m4
│ │ └── ax_add_fortify_source.m4
│ ├── celt_sources.mk
│ ├── silk_headers.mk
│ ├── celt_headers.mk
│ ├── opus_config.cmake
│ ├── celt
│ │ ├── arm
│ │ │ ├── fixed_arm64.h
│ │ │ ├── armopts.s.in
│ │ │ ├── fft_arm.h
│ │ │ └── armcpu.h
│ │ ├── dump_modes
│ │ │ └── dump_modes_arch.h
│ │ ├── tests
│ │ │ └── test_unit_types.c
│ │ ├── cwrs.h
│ │ ├── x86
│ │ │ ├── vq_sse.h
│ │ │ └── celt_lpc_sse.h
│ │ ├── laplace.h
│ │ ├── mfrngcod.h
│ │ ├── fixed_c6x.h
│ │ ├── celt_lpc.h
│ │ ├── cpu_support.h
│ │ └── modes.h
│ ├── silk
│ │ ├── arm
│ │ │ ├── macros_arm64.h
│ │ │ ├── SigProc_FIX_armv4.h
│ │ │ └── SigProc_FIX_armv5e.h
│ │ ├── lin2log.c
│ │ ├── mips
│ │ │ └── sigproc_fix_mipsr1.h
│ │ ├── float
│ │ │ ├── scale_vector_FLP.c
│ │ │ ├── bwexpander_FLP.c
│ │ │ ├── regularize_correlations_FLP.c
│ │ │ ├── scale_copy_vector_FLP.c
│ │ │ ├── energy_FLP.c
│ │ │ ├── inner_product_FLP.c
│ │ │ ├── k2a_FLP.c
│ │ │ └── autocorrelation_FLP.c
│ │ ├── init_decoder.c
│ │ ├── inner_prod_aligned.c
│ │ ├── bwexpander_32.c
│ │ ├── tables_gain.c
│ │ ├── interpolate.c
│ │ └── fixed
│ │ │ └── regularize_correlations_FIX.c
│ ├── COPYING
│ ├── scripts
│ │ ├── dump_rnn.py
│ │ └── rnn_train.py
│ ├── opus_sources.cmake
│ ├── src
│ │ ├── mlp.h
│ │ └── tansig_table.h
│ └── README.draft
├── src
│ └── wrapper.h
├── README.md
└── Cargo.toml
├── .gitignore
├── unsafe-libopus-tools
├── src
│ ├── lib.rs
│ └── bin
│ │ ├── opus_compare.rs
│ │ └── opus_demo
│ │ └── main.rs
└── Cargo.toml
├── Cargo.toml
├── LICENSE
└── .github
└── workflows
└── test.yml
/src/silk/debug.rs:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/NEWS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/ChangeLog:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/util/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod nalgebra;
2 |
--------------------------------------------------------------------------------
/upstream-libopus/src/wrapper.h:
--------------------------------------------------------------------------------
1 | #include "../opus/include/opus_multistream.h"
2 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/config.h.cmake.in:
--------------------------------------------------------------------------------
1 | #cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
--------------------------------------------------------------------------------
/upstream-libopus/opus/tests/opus_decode_fuzzer.options:
--------------------------------------------------------------------------------
1 | [libfuzzer]
2 | max_len = 1000000
3 |
--------------------------------------------------------------------------------
/src/silk/mathops.rs:
--------------------------------------------------------------------------------
1 | pub fn silk_exp2(x: f32) -> f32 {
2 | 2f64.powf(x as f64) as f32
3 | }
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /Cargo.lock
3 | .idea
4 |
5 | logs_*.txt
6 | tmp.out
7 | aboba.tmp
8 | dump
9 |
--------------------------------------------------------------------------------
/upstream-libopus/README.md:
--------------------------------------------------------------------------------
1 | This crate builds and provides bindings to opus 1.3.1 with the same configuration as the translated library
2 |
--------------------------------------------------------------------------------
/src/src/mlp/mod.rs:
--------------------------------------------------------------------------------
1 | #![forbid(
2 | unsafe_code,
3 | non_camel_case_types,
4 | non_snake_case,
5 | non_upper_case_globals,
6 | unused_assignments
7 | )]
8 |
9 | pub mod analysis_mlp;
10 | mod layers;
11 | mod tansig;
12 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/opus_headers.mk:
--------------------------------------------------------------------------------
1 | OPUS_HEAD = \
2 | include/opus.h \
3 | include/opus_multistream.h \
4 | include/opus_projection.h \
5 | src/opus_private.h \
6 | src/analysis.h \
7 | src/mapping_matrix.h \
8 | src/mlp.h \
9 | src/tansig_table.h
10 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/AUTHORS:
--------------------------------------------------------------------------------
1 | Jean-Marc Valin (jmvalin@jmvalin.ca)
2 | Koen Vos (koenvos74@gmail.com)
3 | Timothy Terriberry (tterribe@xiph.org)
4 | Karsten Vandborg Sorensen (karsten.vandborg.sorensen@skype.net)
5 | Soren Skak Jensen (ssjensen@gn.com)
6 | Gregory Maxwell (greg@xiph.org)
7 |
--------------------------------------------------------------------------------
/unsafe-libopus-tools/src/lib.rs:
--------------------------------------------------------------------------------
1 | //! Utilities for testing opus
2 | //!
3 | //! This crate contains opus test utilities converted to functions
4 | //! Binaries are also available
5 |
6 | mod compare;
7 | pub mod demo;
8 |
9 | pub use compare::{opus_compare, CompareParams, CompareResult};
10 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/training/txt2hdf5.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | from __future__ import print_function
4 |
5 | import numpy as np
6 | import h5py
7 | import sys
8 |
9 | data = np.loadtxt(sys.argv[1], dtype='float32')
10 | h5f = h5py.File(sys.argv[2], 'w');
11 | h5f.create_dataset('data', data=data)
12 | h5f.close()
13 |
--------------------------------------------------------------------------------
/upstream-libopus/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "upstream-libopus"
3 | version = "0.1.0"
4 | edition = "2021"
5 | publish = false
6 |
7 | [dependencies]
8 |
9 | [build-dependencies]
10 | cc = "1.0.99"
11 | bindgen = { version = "0.69.4", optional = true }
12 |
13 | [features]
14 | default = []
15 | generate_binding = ["bindgen"]
16 |
--------------------------------------------------------------------------------
/src/celt/float_cast.rs:
--------------------------------------------------------------------------------
1 | pub const CELT_SIG_SCALE: f32 = 32768.0f32;
2 |
3 | #[inline]
4 | pub fn FLOAT2INT16(x: f32) -> i16 {
5 | let x = x * CELT_SIG_SCALE;
6 | let x = x.max(-32768.0);
7 | let x = x.min(32767.0);
8 | float2int(x) as i16
9 | }
10 | #[inline]
11 | pub fn float2int(x: f32) -> i32 {
12 | (x + 0.5).floor() as i32
13 | }
14 |
--------------------------------------------------------------------------------
/src/silk/float/bwexpander_FLP.rs:
--------------------------------------------------------------------------------
1 | pub unsafe fn silk_bwexpander_FLP(ar: *mut f32, d: i32, chirp: f32) {
2 | let mut i: i32 = 0;
3 | let mut cfac: f32 = chirp;
4 | i = 0;
5 | while i < d - 1 {
6 | *ar.offset(i as isize) *= cfac;
7 | cfac *= chirp;
8 | i += 1;
9 | }
10 | *ar.offset((d - 1) as isize) *= cfac;
11 | }
12 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/opus-uninstalled.pc.in:
--------------------------------------------------------------------------------
1 | # Opus codec reference implementation uninstalled pkg-config file
2 |
3 | libdir=${pcfiledir}/.libs
4 | includedir=${pcfiledir}
5 |
6 | Name: opus uninstalled
7 | Description: Opus IETF audio codec (not installed, @PC_BUILD@)
8 | Version: @VERSION@
9 | Requires:
10 | Conflicts:
11 | Libs: ${libdir}/libopus.la @LIBM@
12 | Cflags: -I${pcfiledir}/@top_srcdir@/include
13 |
--------------------------------------------------------------------------------
/src/silk/float/energy_FLP.rs:
--------------------------------------------------------------------------------
1 | use ndarray::aview1;
2 |
3 | /// Sum of squares of a float array, with result as a double
4 | pub fn silk_energy_FLP(data: &[f32]) -> f64 {
5 | let data_view = aview1(data);
6 |
7 | // opus sources unfold it manually, but LLVM seems to be able to 4x unfold it by itself
8 | // SIMD might still be nice idk
9 | data_view.fold(0.0f64, |acc, &x| acc + x as f64 * x as f64)
10 | }
11 |
--------------------------------------------------------------------------------
/src/silk/tables_gain.rs:
--------------------------------------------------------------------------------
1 | pub static silk_gain_iCDF: [[u8; 8]; 3] = [
2 | [224, 112, 44, 15, 3, 2, 1, 0],
3 | [254, 237, 192, 132, 70, 23, 4, 0],
4 | [255, 252, 226, 155, 61, 11, 2, 0],
5 | ];
6 | pub static silk_delta_gain_iCDF: [u8; 41] = [
7 | 250, 245, 234, 203, 71, 50, 42, 38, 35, 33, 31, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18,
8 | 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
9 | ];
10 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/opus_sources.mk:
--------------------------------------------------------------------------------
1 | OPUS_SOURCES = \
2 | src/opus.c \
3 | src/opus_decoder.c \
4 | src/opus_encoder.c \
5 | src/opus_multistream.c \
6 | src/opus_multistream_encoder.c \
7 | src/opus_multistream_decoder.c \
8 | src/repacketizer.c \
9 | src/opus_projection_encoder.c \
10 | src/opus_projection_decoder.c \
11 | src/mapping_matrix.c
12 |
13 | OPUS_SOURCES_FLOAT = \
14 | src/analysis.c \
15 | src/mlp.c \
16 | src/mlp_data.c
17 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/opus.pc.in:
--------------------------------------------------------------------------------
1 | # Opus codec reference implementation pkg-config file
2 |
3 | prefix=@prefix@
4 | exec_prefix=@exec_prefix@
5 | libdir=@libdir@
6 | includedir=@includedir@
7 |
8 | Name: Opus
9 | Description: Opus IETF audio codec (@PC_BUILD@ build)
10 | URL: https://opus-codec.org/
11 | Version: @VERSION@
12 | Requires:
13 | Conflicts:
14 | Libs: -L${libdir} -lopus
15 | Libs.private: @LIBM@
16 | Cflags: -I${includedir}/opus
17 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/.travis.yml:
--------------------------------------------------------------------------------
1 | language: c
2 |
3 | compiler:
4 | - gcc
5 | - clang
6 |
7 | os:
8 | - linux
9 | - osx
10 |
11 | env:
12 | - CONFIG=""
13 | - CONFIG="--enable-assertions"
14 | - CONFIG="--enable-fixed-point"
15 | - CONFIG="--enable-fixed-point --disable-float-api"
16 | - CONFIG="--enable-fixed-point --enable-assertions"
17 |
18 | script:
19 | - ./autogen.sh
20 | - ./configure $CONFIG
21 | - make distcheck
22 |
--------------------------------------------------------------------------------
/src/silk/inner_prod_aligned.rs:
--------------------------------------------------------------------------------
1 | pub unsafe fn silk_inner_prod_aligned_scale(
2 | inVec1: *const i16,
3 | inVec2: *const i16,
4 | scale: i32,
5 | len: i32,
6 | ) -> i32 {
7 | let mut i: i32 = 0;
8 | let mut sum: i32 = 0;
9 | i = 0;
10 | while i < len {
11 | sum =
12 | sum + (*inVec1.offset(i as isize) as i32 * *inVec2.offset(i as isize) as i32 >> scale);
13 | i += 1;
14 | }
15 | return sum;
16 | }
17 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/autogen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Copyright (c) 2010-2015 Xiph.Org Foundation and contributors.
3 | # Use of this source code is governed by a BSD-style license that can be
4 | # found in the COPYING file.
5 |
6 | # Run this to set up the build system: configure, makefiles, etc.
7 | set -e
8 |
9 | srcdir=`dirname $0`
10 | test -n "$srcdir" && cd "$srcdir"
11 |
12 | echo "Updating build configuration files, please wait...."
13 |
14 | autoreconf -isf
15 |
--------------------------------------------------------------------------------
/src/silk/lin2log.rs:
--------------------------------------------------------------------------------
1 | use crate::silk::Inlines::silk_CLZ_FRAC;
2 |
3 | // Approximation of 128 * log2() (very close inverse of silk_log2lin())
4 | // Convert input to a log scale
5 | pub fn silk_lin2log(inLin: i32) -> i32 {
6 | let mut lz: i32 = 0;
7 | let mut frac_Q7: i32 = 0;
8 | silk_CLZ_FRAC(inLin, &mut lz, &mut frac_Q7);
9 | /* Piece-wise parabolic approximation */
10 | (frac_Q7 as i64 + ((frac_Q7 * (128 - frac_Q7)) as i64 * 179 as i64 >> 16)) as i32
11 | + (((31 - lz) as u32) << 7) as i32
12 | }
13 |
--------------------------------------------------------------------------------
/src/src/opus_private.rs:
--------------------------------------------------------------------------------
1 | pub const MODE_SILK_ONLY: i32 = 1000;
2 | pub const MODE_HYBRID: i32 = 1001;
3 | pub const MODE_CELT_ONLY: i32 = 1002;
4 |
5 | pub const OPUS_SET_VOICE_RATIO_REQUEST: i32 = 11018;
6 | pub const OPUS_GET_VOICE_RATIO_REQUEST: i32 = 11019;
7 | pub const OPUS_SET_FORCE_MODE_REQUEST: i32 = 11002;
8 |
9 | #[inline]
10 | pub fn align(i: i32) -> i32 {
11 | let alignment: u32 = 8 as u64 as u32;
12 | return (i as u32)
13 | .wrapping_add(alignment)
14 | .wrapping_sub(1)
15 | .wrapping_div(alignment)
16 | .wrapping_mul(alignment) as i32;
17 | }
18 |
--------------------------------------------------------------------------------
/upstream-libopus/opus/win32/VS2015/test_opus_api.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
$doxygenversion | 14 | For more information visit the Opus Website. 15 | | 16 |17 | 18 | Generated by 19 | doxygen 20 | $doxygenversion 21 | 22 | | 23 |