A pure-Rust implementation of the Opus audio codec (RFC 6716), ported from the reference C implementation, libopus. It tracks libopus main at f1afc4222a (after 1.6.1) and is tested bit for bit against it: CELT and SILK against the scalar float build, and the fixed-point SILK encoder of the silk-fixed feature against the fixed-point build. With SIMD, its output follows libopus's SIMD build at the same CPU level (fuzz/DIFFERENTIAL.md).
- Pure Rust — no C dependencies
- No
unsafe: the crate is#![forbid(unsafe_code)]; its SIMD kernels use fearless_simd's safe API. The C library incapi/usesunsafefor the C ABI only. - SIMD like libopus: on x86 the codec state holds a CPU level (scalar, SSE2, SSE4.1, AVX2) chosen at run time like libopus's, and the kernels at each level reproduce libopus's x86 kernels, so the output equals libopus's SIMD build on the same CPU. NEON and wasm simd128 kernels give the scalar results.
- Fast: as fast as libopus with its SIMD kernels or faster in almost every case measured (Performance).
#![no_std]+ noalloc: fully heap-free — runs on bare metal, RTOS, and WebAssembly with no global allocator
use opus_rs::{OpusEncoder, OpusDecoder, Application};
// Encode
let mut encoder = OpusEncoder::new(16000, 1, Application::Voip).unwrap();
encoder.bitrate_bps = 16000;
encoder.use_cbr = true;
let input = vec![0.0f32; 320]; // 20ms frame at 16kHz
let mut output = vec![0u8; 256];
let bytes = encoder.encode(&input, 320, &mut output).unwrap();
// Encode PCM16 directly (issue #28): skip the f32 round-trip in the
// SILK/VoIP path. Output is byte-for-byte identical to `encode()` called
// with the same audio converted via `sample as f32 / 32768.0`.
let input_i16 = vec![0i16; 320]; // 20ms frame at 16kHz
let bytes = encoder.encode_i16(&input_i16, 320, &mut output).unwrap();
// Decode
let mut decoder = OpusDecoder::new(16000, 1).unwrap();
let mut pcm = vec![0.0f32; 320];
let samples = decoder.decode(&output[..bytes], 320, &mut pcm).unwrap();# Rust encoder/decoder
cargo run --example wav_testEach libopus function or control maps to an opus-rs method or function and
is tested against libopus (fuzz/opusref, fuzz/DIFFERENTIAL.md).
Constructors (*_create, *_init) are new (and init where a struct is
built in place), *_get_size is size_of, and *_destroy is Drop. The
setters with a range return libopus's error for values outside it; the
public fields they set keep working, and are clamped when a frame is coded.
Functions that mirror a libopus function return libopus's errors as the
constants of opus_rs::error (Err(error::BAD_ARG) for OPUS_BAD_ARG,
and so on); error::code gives the libopus number and error::strerror
its text. The multistream and projection codecs keep their stream codecs
in a Vec and need std; everything else builds without std and
alloc. MultistreamDecoderView, MultistreamEncoderView and
ProjectionDecoderView run them over a MultistreamLayout or
MultistreamEncoderHeader and stream codecs held elsewhere, as the C
library's flat states do.
| libopus | opus-rs |
|---|---|
opus_encoder_create, opus_decoder_create, opus_decoder_init |
OpusEncoder::new, OpusDecoder::new, OpusDecoder::init |
opus_decode_float |
OpusDecoder::decode, decode_fec |
OPUS_SET_BANDWIDTH, OPUS_SET_MAX_BANDWIDTH, OPUS_SET_VBR_CONSTRAINT, OPUS_SET_DTX, OPUS_SET_SIGNAL and their queries |
OpusEncoder::set_bandwidth, set_max_bandwidth, set_vbr_constraint, set_dtx, set_signal, bandwidth, max_bandwidth, vbr_constraint, dtx, signal |
OPUS_GET_LOOKAHEAD, OPUS_GET_FINAL_RANGE, OPUS_GET_IN_DTX |
OpusEncoder::lookahead, final_range, in_dtx; OpusDecoder::final_range |
OPUS_SET_COMPLEXITY, OPUS_SET_OSCE_BWE (decoder) |
OpusDecoder::set_complexity, complexity, set_osce_bwe, osce_bwe |
OPUS_SET_DRED_DURATION, opus_dred_decoder_create, opus_dred_parse, opus_dred_process (feature dred) |
OpusEncoder::set_dred_duration, dred::OpusDredDecoder::new, parse, process |
opus_encoder_ctl(OPUS_RESET_STATE) |
OpusEncoder::reset |
OPUS_SET_FORCE_MODE (private) |
OpusEncoder::set_force_mode (OpusMode) |
OPUS_APPLICATION_VOIP, _AUDIO, _RESTRICTED_LOWDELAY, _RESTRICTED_SILK, _RESTRICTED_CELT |
Application::Voip, Audio, RestrictedLowDelay, RestrictedSilk, RestrictedCelt |
OPUS_SET_APPLICATION, OPUS_GET_APPLICATION |
OpusEncoder::set_application, application |
OPUS_SET_BITRATE, OPUS_GET_BITRATE |
OpusEncoder::set_bitrate, bitrate (the field bitrate_bps holds the set value) |
OPUS_SET_COMPLEXITY, OPUS_SET_PACKET_LOSS_PERC |
OpusEncoder::set_complexity, set_packet_loss_perc (the fields complexity, packet_loss_perc hold the values) |
OPUS_SET_INBAND_FEC, OPUS_GET_INBAND_FEC |
OpusEncoder::set_inband_fec, inband_fec (0, 1 or 2; the field use_inband_fec is on for 1 and 2) |
OPUS_SET_VBR, OPUS_GET_VBR |
OpusEncoder::set_vbr, vbr (the field use_cbr is the opposite) |
OPUS_GET_SAMPLE_RATE (encoder) |
OpusEncoder::sample_rate |
OPUS_SET_LSB_DEPTH, OPUS_GET_LSB_DEPTH |
OpusEncoder::set_lsb_depth, lsb_depth |
OPUS_SET_FORCE_CHANNELS, OPUS_GET_FORCE_CHANNELS |
OpusEncoder::set_force_channels, force_channels (None for OPUS_AUTO) |
OPUS_SET_PREDICTION_DISABLED, OPUS_GET_PREDICTION_DISABLED |
OpusEncoder::set_prediction_disabled, prediction_disabled |
OPUS_SET_EXPERT_FRAME_DURATION, OPUS_GET_EXPERT_FRAME_DURATION |
OpusEncoder::set_expert_frame_duration, expert_frame_duration (FrameDuration) |
opus_decoder_ctl(OPUS_RESET_STATE) |
OpusDecoder::reset |
OPUS_SET_GAIN, OPUS_GET_GAIN |
OpusDecoder::set_gain, gain |
OPUS_SET_PHASE_INVERSION_DISABLED, OPUS_GET_PHASE_INVERSION_DISABLED |
OpusEncoder::set_phase_inversion_disabled, phase_inversion_disabled; OpusDecoder::set_phase_inversion_disabled, phase_inversion_disabled |
OPUS_GET_SAMPLE_RATE, OPUS_GET_BANDWIDTH, OPUS_GET_PITCH, OPUS_GET_LAST_PACKET_DURATION (decoder) |
OpusDecoder::sample_rate, bandwidth, pitch, last_packet_duration |
OPUS_SET_IGNORE_EXTENSIONS, OPUS_GET_IGNORE_EXTENSIONS |
OpusDecoder::set_ignore_extensions, ignore_extensions |
opus_encode, opus_encode_float, opus_encode24 |
OpusEncoder::encode_i16, encode, encode24 |
opus_decode, opus_decode24 |
OpusDecoder::decode_i16, decode_fec_i16, decode24, decode_fec24 |
opus_multistream_encoder_create, opus_multistream_encode_float, opus_multistream_encode, opus_multistream_encode24 |
multistream_encoder::MultistreamEncoder::new, encode, encode_i16, encode24 |
opus_multistream_surround_encoder_create |
MultistreamEncoder::new_surround (families 0, 1 with surround masking and the LFE stream, 2 ambisonics, 255; streams, coupled_streams, mapping give the layout) |
opus_multistream_encoder_ctl |
MultistreamEncoder::set_bitrate, bitrate, set_expert_frame_duration, reset, final_range, the controls libopus forwards to every stream (set_complexity, set_vbr, ...), first_stream for the queries libopus answers from the first stream, and encoder_state (OPUS_MULTISTREAM_GET_ENCODER_STATE) |
opus_projection_ambisonics_encoder_create, opus_projection_encode_float, opus_projection_encode, opus_projection_encode24 |
projection::ProjectionEncoder::new, encode, encode_i16, encode24 (streams, coupled_streams return the layout) |
OPUS_PROJECTION_GET_DEMIXING_MATRIX_GAIN, _SIZE, OPUS_PROJECTION_GET_DEMIXING_MATRIX |
ProjectionEncoder::demixing_matrix_gain, demixing_matrix_size, demixing_matrix; the other controls through ProjectionEncoder::multistream |
opus_projection_decoder_create, opus_projection_decode_float, opus_projection_decode, opus_projection_decode24 |
projection::ProjectionDecoder::new, decode, decode_i16, decode24 and their FEC variants; the controls through ProjectionDecoder::multistream |
opus_multistream_decoder_create, opus_multistream_decode_float |
multistream::MultistreamDecoder::new, decode, decode_fec |
opus_multistream_decode, opus_multistream_decode24 |
MultistreamDecoder::decode_i16, decode_fec_i16, decode24, decode_fec24 |
opus_multistream_decoder_ctl |
MultistreamDecoder::reset, set_gain, set_complexity, set_phase_inversion_disabled, the queries (gain, complexity, phase_inversion_disabled, bandwidth, sample_rate, last_packet_duration, final_range) and decoder_state (OPUS_MULTISTREAM_GET_DECODER_STATE) |
opus_packet_parse |
packet::parse |
opus_packet_get_bandwidth, opus_packet_get_nb_channels, opus_packet_get_samples_per_frame |
packet::bandwidth, nb_channels, samples_per_frame (of the ToC byte) |
opus_packet_get_nb_frames, opus_packet_get_nb_samples, opus_packet_has_lbrr |
packet::nb_frames, nb_samples, has_lbrr |
opus_decoder_get_nb_samples |
OpusDecoder::nb_samples |
opus_pcm_soft_clip |
packet::soft_clip |
opus_repacketizer_create, _init, _cat, _get_nb_frames, _out_range, _out |
repacketizer::Repacketizer::new, init, cat, nb_frames, out_range, out (the repacketizer borrows the packets it holds and writes into another buffer) |
opus_packet_pad, opus_multistream_packet_pad |
repacketizer::pad, multistream_pad (from the packet into a buffer of the padded length) |
opus_packet_unpad, opus_multistream_packet_unpad |
repacketizer::unpad, multistream_unpad (in place) |
opus_decoder_dred_decode, _decode24, _decode_float (feature dred) |
OpusDecoder::dred_decode, dred_decode24, dred_decode_float |
opus_strerror |
error::strerror |
opus_get_version_string |
error::version_string |
The repacketizer and the padding functions keep the extensions of the
frames they write, up to repacketizer::MAX_EXTENSIONS (256) per packet;
more are error::ALLOC_FAIL, where libopus allocates them on its stack.
Left out: OPUS_SET_QEXT (libopus builds it only with --enable-qext),
OPUS_SET_DNN_BLOB (only with USE_WEIGHTS_FILE; the models are built in,
and OpusDredDecoder::with_model takes others), and libopus's private
encoder controls OPUS_SET_LFE and OPUS_SET_ENERGY_MASK, which the
multistream encoder uses inside the crate. opus_custom.h is left out too: libopus exports it only with
--enable-custom-modes, its modes need run-time tables for other frame
sizes and rates, and its streams carry no ToC. The standard 48 kHz mode is
CeltEncoder/CeltDecoder.
capi/ builds libopus.so.0 and libopus.a with libopus's C API over
opus-rs, from PR #115 by Object905: nix build .#libopus gives a package
laid out as libopus's (headers, opus.pc), and an overlay
libopus = opus-rs.packages.${system}.libopus puts it under every package
of a nixpkgs set. libopus's own test programs (all but the encoder size
check of test_opus_api) and the RFC 8251 vectors pass against it;
capi/README.md has the details and the differences from
libopus.
By default opus-rs runs on std with the heap feature: the large codec state
(OpusEncoder/OpusDecoder working buffers) is allocated with Box, so the public
structs are small (about 3 KB for the encoder, under 0.1 KB for the decoder) and
constructing them uses almost no stack.
For #![no_std], disable the default features. The crate then builds as
#![no_std] with no alloc — fully heap-free, no global allocator required —
and every working buffer is an inline, fixed-size array (sized to the Opus worst
case); growable state uses an internal FixedVec<T, N> (a tiny Vec-like type over
[MaybeUninit<T>; N]). In that configuration the structs are large, so place them
in a static (wrap init in your own Once-like guard) or a dedicated buffer.
[dependencies.opus-rs]
version = "0.1"
default-features = false
features = ["libm"]The public API (OpusEncoder/OpusDecoder with encode/decode writing into caller-provided buffers) is identical in both configurations.
| Feature | Default | Description |
|---|---|---|
std |
yes | Links std for float math. Without it the crate is #![no_std]. |
heap |
yes | Allocates the large codec state on the heap (Box), shrinking OpusEncoder/OpusDecoder to about 3 KB and 0.1 KB so they can live on ordinary stacks. Requires std. |
libm |
no | Required for #![no_std] builds — provides float math via a pure-Rust port of musl libm. Not needed when std is on. |
silk-fixed |
no | Encodes SILK with libopus's fixed-point encoder (SILK encoder). |
portable-atomic |
no | No effect; kept for compatibility. The mode table is a compile-time static, so the crate uses no atomics and builds on targets without compare-and-swap like thumbv6m-none-eabi (Cortex-M0/M0+) or riscv32imc-unknown-none-elf (ESP32-C3). |
Runtime dependencies:
libm(pure Rust) inno_stdbuilds, andfearless_simd(no dependencies of its own) on x86, x86-64, aarch64 and wasm32.
The SILK encoder is libopus's float encoder (silk/float/), the one of
libopus's default and SIMD builds. The feature silk-fixed (off by
default) selects the encoder of fixed-point libopus (silk/fixed/, a
FIXED_POINT build) with its 16-bit SILK input for VoIP; its packets
follow fixed-point libopus's with the fix of
fuzz/opusref/patches/silk-fixed-min-inv-gain.patch, a Q-format slip in
the fixed-point limit on the LPC prediction gain, which the fixed-point
reference build applies too.
The neural network features of libopus are ported to safe Rust and
off by default, as in libopus. They follow its generic C kernels
operation for operation and are tested bit for bit against a libopus
built with them (fuzz/opusref, feature dnn).
| Feature | libopus option | What it adds |
|---|---|---|
dnn |
(the shared sources) | Layer kernels, weight blobs, the built-in 1.6.1 models, LPCNet features, PitchDNN, FARGAN. No codec change alone. |
deep-plc |
--enable-deep-plc |
Deep packet loss concealment at decoder complexity 5 and above (OpusDecoder::set_complexity). |
osce |
--enable-osce |
LACE (complexity 6) and NoLACE (7+) SILK enhancement, and the BBWENet bandwidth extension (OpusDecoder::set_osce_bwe, complexity 4+). Turns on deep-plc, as the configure option does. |
dred |
--enable-dred |
Deep redundancy: OpusEncoder::set_dred_duration, the DRED packet extension, OpusDredDecoder and OpusDecoder::dred_decode[_float]. Turns on deep-plc. |
The weights (dnn-weights/, about 4.3 MB, SHA-256 in
dnn-weights/SHA256SUMS) are embedded and read in place, so the features
need no allocator and build without std (with libm). Their states make
the codec larger: without heap, OpusDecoder grows from about 64 KB to
about 256 KB and OpusEncoder from about 305 KB to about 384 KB with
deep-plc, osce and dred, and setting the decoder up builds the deep
PLC state (about 70 KB) on the stack. As in libopus, compiling deep-plc or osce changes
SILK output at every complexity in small ways (no fade-in after a 16 kHz
loss; a clamp to ±32767 for 20 ms 16 kHz frames); the affected comparisons
with a libopus without these options are ignored under the features.
-
Large structs: without
heap, every working buffer is inline, soOpusEncoder/OpusDecoderare large (about 305 KB and 64 KB). Place them in astatic(wrap init in your ownOnce-like guard) or a dedicated buffer rather than on the stack.OpusDecoder::newstill returns the decoder through the stack, so useOpusDecoder::initto build it directly in that memory:static mut DECODER: MaybeUninit<OpusDecoder> = MaybeUninit::uninit(); let decoder = OpusDecoder::init(unsafe { &mut *(&raw mut DECODER) }, 48000, 2)?;
initcopies a constant image of an empty decoder into the slot, so the image (about 64 KB) is part of the binary's read-only data.Test threads use a 16 MB stack (see
.cargo/config.toml). -
Packets are capped at the RFC 6716 maximum of 1276 bytes (the heap-free range-coder buffer is sized accordingly); standalone
RangeCoder/CELT use supports up to 2048 bytes. -
Verified targets:
thumbv7em-none-eabi(Cortex-M),wasm32-unknown-unknown, and any Linux no_std target, and targets without compare-and-swap such asthumbv6m-none-eabiandriscv32imc-unknown-none-elf. Check withscripts/check_no_std.sh.
opus-rs is faster than libopus with its SIMD kernels in almost every case measured. The numbers are opus-rs's time divided by libopus's time for the same work, so below 1.0 means opus-rs is faster (0.5 would be twice as fast). Each row is the geometric mean over its cases, with a 95% confidence interval for measurement noise (bootstrap over 10 rounds per case; each round takes the minimum of 20 interleaved runs). Measured on an idle AMD Zen 5 against libopus 1.6.1 from nixpkgs (run-time CPU detection), both at their AVX2 level, over 57 encode and decode cases (mono and stereo, 8–48 kHz, 2.5–60 ms frames, VoIP and audio, complexity 0–10, CBR/VBR, DTX, FEC, losses):
| opus-rs time / libopus time | |
|---|---|
| Encoding, all cases | 0.805 (0.805–0.805) |
| Encoding, CELT/Hybrid at complexity 9/10 | 0.773 (0.773–0.773) |
| Decoding, all cases | 0.911 (0.910–0.911) |
| Decoding, high-bitrate CELT (256–510 kbit/s) | 1.005 (1.004–1.007) |
| Deep PLC, per concealed frame | 0.878 (0.877–0.878) |
The deep PLC row compares with libopus main built as its configure builds it with the neural options (intrinsics and run-time CPU detection), since nixpkgs' libopus has no deep PLC.
On aarch64 and wasm32, opus-rs runs its scalar code plus NEON or simd128
kernels for the SILK quantizer; these targets were not measured in this
round. cargo bench --bench opus_vs_c_bench compares opus-rs with the libopus that the opus crate
links.
This release merges the libopus-parity encoder series (28 PRs: signal
analysis, mode/bandwidth/DTX decisions, frame sizes, VBR control, PLC and
framing fixes) and four parity fixes from a pre-merge review of the whole
series. Every merged path is covered against the libopus 1.6.1 oracle
(opusic-sys): per-frame final-range equality, whole-packet byte hashes
against fixed-point libopus for SILK CBR, mode-sequence equality against the
C encoder, and packet framing against the C repacketizer.
- New: signal analysis, ported from libopus's
src/analysis.c— the 480-point tonality FFT, the MLP music/speech probabilities (weights bit-identical tomlp_data.c), the bandwidth estimate, andfast_atan2f. CELT now adds libopus's trim slope,signalBandwidthand temporal VBR terms, and the encoder's noise floor follows the input's real depth (16 forencode_i16, 24 for float), as the two libopus entry points do. The analysis runs at complexity 7 and up, like libopus. - New:
set_bandwidth/set_max_bandwidth— forced or capped coded bandwidth withOPUS_SET_BANDWIDTH/OPUS_SET_MAX_BANDWIDTHsemantics, plus libopus's automatic bandwidth decision (the threshold tables, the detected-bandwidth floor and the SILK switch gating). - Fix: the SILK/Hybrid/CELT mode decision matches libopus term for term
— the voice-activity threshold interpolation, the
voice_estestimate (set_signaladded), the ±4000 hysteresis, and the width-aware stereo threshold (compute_stereo_widthported in exact float order). - New: discontinuous transmission —
set_dtx/dtx/in_dtx, ported from libopus: SILK VAD DTX with its 20-frame cadence, and the ms-based digital-silence DTX (200 ms lead-in, one coded frame per 400 ms). Digital silence and the peak-energy tracking are now detected at every complexity and rate, and where no analysis runs, SILK's own VAD decides activity (VAD_NO_DECISION, resolved fromsignalType), likeopus_encoder.c:1246,1311,1916-2241. - New: 2.5/5 ms frames in every application (as CELT), 40/60 ms CELT/Hybrid packets built from their frames, and 80/100/120 ms frames, with the bandwidth and FEC decided once per packet, like libopus's multiframe path.
- Fix: multiframe packets are framed exactly like libopus's repacketizer — code 1 for two equal frames, code 2 for two different ones, code 3 for more, with the VBR flag and per-frame size bytes only when the frames differ in size, and CBR padding up to the nominal size. Previously every CBR 40/60 ms packet carried a code 3 VBR header; it decoded fine but was not byte-exact. A new test pins the framing against the libopus encoder.
- New:
set_vbr_constraint, and unconstrained VBR capped at 510 kb/s; the CELT VBR target now carries libopus's stereo saving, floor depth, temporal VBR, trim-rate and prefilter terms, and hybrid VBR splits its rate between SILK and CELT throughcompute_silk_rate_for_hybrid. - Fix: mode switches carry libopus's 5 ms CELT redundancy — written
only where decoders read the flag, coded and faded like
opus_encoder.c, with CELT and SILK restarted on switches, a SILK rate switch waiting foropusCanSwitch, and a switch into CELT bridged from the old state without redundancy.final_range()reportsrangeFinal(encoder and decoder), matchingOPUS_GET_FINAL_RANGEincluding the redundant-frame XOR. - Fix: SILK parity — CBR's rate control (the LBRR budget, the switch room, byte-exact busted-packet padding), hybrid's CELT VBR share, NLSFs weighted before stabilization, and the SILK VBR rate split of hybrid packets matching libopus.
- Fix: CELT and decoder edge cases — CELT frames coded without a transient flag read as not transient, the intensity band clamps to the coded bands, the hybrid redundancy flag is written only where decoders read it, the mode of SILK-only VBR packets is recorded, and 12 kHz CELT frames code as wideband.
- Fix: the CELT tf analysis skips strongly tonal frames (
toneishness < 0.98,celt_encoder.c:2242), like libopus — it coded a differenttf_select/tf_reson tonal input and paid the analysis cost where libopus skips it. - Tests: a fuzz target for encoder call sequences (frame sizes
2.5-120 ms, bitrate/complexity/CBR/DTX/FEC churn,
final_rangeround-trip); packet framing comparisons against libopus for multiframe packets;final_rangeequality tests for the merged paths.
- New:
OpusEncoder::lookahead()returns the encoder's lookahead, like libopusOPUS_GET_LOOKAHEAD. The value is in samples at the encoder's sampling rate and is the pre-skip an Ogg OpusOpusHeadneeds:Fs/400 + Fs/250(312 samples at 48 kHz), onlyFs/400forRestrictedLowDelay. A test checks it against libopus for every rate, channel count and application. - Fix: the encoder allocates with the default trim when it is not
coded, like libopus. When the dynalloc boosts left no room for the
allocation trim symbol, the encoder used to allocate with the analysed
trim it could not code, while every conforming decoder assumes the
default of 5, so those frames were decoded with a different allocation.
It now starts from 5 and only analyses and codes the trim when it fits
(
celt_encoder.c:2408-2421). This shows at complexity 8 and up, where the second MDCT makes dynalloc boost the top bands of short-block frames until the trim no longer fits: short transients are no longer smeared, and the worst-case click level now matches libopus 1.6. - Fix: the encoder no longer panics with in-band FEC at 24/48 kHz and 20-28 kb/s. With a packet-loss rate above 5%, the FEC decision walks the frame's bandwidth down until FEC fits the rate, and the hybrid → SILK-only mode fixup has to re-run on that post-FEC bandwidth. It only ran before the walk, so the frame stayed hybrid at wideband: CELT was entered with start band 17 == end band 17 — zero coded bands — and the bit allocation divided by zero on the very first frame, any signal, release builds included. The equivalent rate fed to the FEC decision is also recomputed with the decided mode now (full SILK packet-loss term, none for CELT); the pre-decision half-loss variant flipped FEC decisions near the thresholds. The issue's whole matrix — mono and stereo, 10 and 20 ms, 12-32 kb/s, FEC on and off — encodes and decodes, the hybrid/SILK mode decision matches libopus across it, CBR packet sizes are bit-identical on real speech, and VBR lands within 2% for the frames the fix rescued (issue #71).
- Fix:
compute_thetatakes its bands as&mut [f32]. The stereo encoder wrote through&[f32]cast to*mut f32, which is undefined behaviour; release builds were optimized on that assumption and coded some stereo CELT and Hybrid frames differently from debug builds. With mutable slices, release output matches the debug build. - Fix: the AVX2 pulse search no longer puts pulses past the band. On
an all-zero band (K > 4, N not a multiple of 8) every score ties at 0,
and the zero-filled padding lanes won the tie, so each pulse was written
past the end of
yand the band kept none. Padding lanes now score negative infinity. - Fix: packet-loss concealment like libopus. SILK carries the LTP decay
from one lost frame to the next, uses libopus's
BWE_AFTER_LOSSand exact energy, resetsLastGainIndexand adds comfort noise (silk_CNG): lost SILK and Hybrid frames, and the frames after them, are bit-exact with libopus 1.6, where a second lost frame used to fall 10-45 dB too quiet. CELT losses run a port ofcelt_decode_lost(pitch-based and noise-based concealment, with its decay) instead of fading to silence from the second lost frame, and Hybrid conceals its CELT high band from band 17: 74-100 dB against libopus (floating point, so close rather than bit-exact). This also liftsdecode_fec's Hybrid full band from the 28-32 dB below to 146-149 dB. - New:
OpusDecoder::decode_fec(input, frame_size, output)decodes in-band FEC, like libopus'sopus_decode(..., decode_fec = 1). With a packet lost, pass the packet after it: its first frame's LBRR (the encoder'suse_inband_fec) rebuilds the lost audio, thendecodethat packet as usual. As in libopus (opus_decode_native), a request longer than the packet's frame conceals the head and takes the LBRR for the tail; a SILK frame without LBRR is concealed (silk_decode_frame); stereo decodes the mid and side LBRR with their own predictor and mid-only flag (dec_API.c); Hybrid takes only its SILK layer's LBRR and conceals the CELT layer; and CELT-only packets, packets after CELT, and packets longer than the request conceal everything. SILK-only recoveries, 10/20/40/60 ms, mono and stereo, from libopus's encoder and from opus-rs's, are bit-exact with libopus 1.6 (~274 dB), and so is the packet decoded after them; Hybrid is 110+ dB in the SILK band, while its concealed CELT layer differs from libopus's CELT concealment (28-32 dB full band). - Fix: 10 ms SILK frames decode like libopus.
silk_decoder_set_fsforced four subframes before picking the pitch contour table, so 10 ms frames read their contour with the 20 ms table: the first voiced 10 ms frame desynced the range decoder, and 10 ms SILK streams decoded to noise (-7 dB against libopus). The caller's subframe count now picks the table, as in libopus; 10 ms NB/MB/WB, mono and stereo, decode bit-exact (~274 dB). - Fix: the PLC pitch search is bit-faithful to libopus on every
architecture.
pitch_downsamplewhitened its output only on aarch64 (the NEON path ended with the whitening FIR, the scalar path did not), the PLC search whitened a second time,find_best_pitchskipped libopus's1e-12scaling and accumulated its normalization with SIMD tree reductions, the mono downsample fused its multiply-adds, and the inner-product reduction paired its sums differently: each pushed the search's input a few ulps away from libopus's, enough to flip the period (or twice it) that concealment extrapolates on a harmonic signal. A stereo decoder and a mono decoder agree again after a concealed CELT loss (issue-62 scenario), the first concealed frame regains ~30 dB against libopus 1.6.1, and the x86_64 encoder's pitch analysis matches libopus's rounding. - Tests: the PLC oracle moved to libopus 1.6.1 (
opusic-sys): the concealment above is 1.6's, and the previous oracle predates the 1.6 PLC rework, so consecutive-loss frames diverge from it by design. Float CELT concealment - chaotic at octave near-ties, where libopus 1.6.1's own x86 and aarch64 builds agree only to ~74 dB - is asserted as the same energy scale (SNR ≥ 0 dB) plus correlation ≥ 0.7 with libopus's concealment; SILK and Hybrid stay bit-exact / near-exact.
- Fix: a SILK-only frame's trailing redundancy now decodes, like libopus
(issue #66). A SILK-only frame signals no redundancy flag — when bits are
left for it, redundancy is on,
celt_to_silkreads as one bit, and the frame's whole tail is a 5 ms redundant CELT frame (opus_decoder.c452-479). Going to CELT it decodes from a reset CELT state, which the next CELT frame carries on, and fades into the frame's last 2.5 ms (595-603); coming from CELT it opens the frame and fades into its first 5 ms (608-617). Only the SILK-to-CELT direction setsprev_redundancy(657), which now spares the next frame its transition bridge and CELT reset. The packet-start CELT reset narrows to switches into CELT, matching libopus's reset insidemode != MODE_SILK_ONLY(551-553). SILK-only↔CELT switches (NB/MB low-bitrate streams) decoded 4-5 dB from libopus at the switch; now 132 dB both ways.
- Fix: a Hybrid frame's mode-switch redundancy now decodes as libopus's
does. The 5 ms redundant CELT frame (RFC 6716 §4.5.1) used to be read
but never decoded, and the frame's own CELT layer was skipped: every
Hybrid↔CELT switch glitched for 40–60 ms. The main layer now decodes from
the bytes before the redundant frame, the redundant frame decodes with all
bands (from the old CELT state going to SILK, from a reset state going to
CELT) and crossfades in with the CELT window; only a SILK-to-CELT frame's
redundancy sets
prev_redundancy(PR #58). Worst switch window vs libopus: 2 dB → 129 dB. - Fix: CELT's energy history starts at −28 dB, as libopus's reset sets it, and the bands a frame doesn't code forget their energies (PR #59). Starting at 0 made anti-collapse inject extra noise into the first two transient frames: CELT's first packets decoded 25–45 dB from libopus. Now 119 dB at the onset.
- Fix: a super-wideband Hybrid frame's CELT layer ends at band 19, from the packet's bandwidth as in libopus (PR #60). It read two bands its encoder never coded and sat 10–15 dB from libopus throughout. Now 143 dB.
- Fix: switches out of CELT reset SILK and bridge with 5 ms of the old CELT state concealed forward, as libopus does (PR #61). opus-rs kept the SILK state (and resampler) from before the CELT run and bridged with the previous frame's last 5 ms, which had already played: a ~25 ms click at every CELT→SILK/Hybrid switch. Now 132 dB at the switch.
- New:
OpusDecoder::init(slot, sampling_rate, channels)builds the decoder in place (PR #65, issue #62 item 1). Withoutheap,OpusDecoder::newreturns ~175 KB by value through the stack, which no MCU has;initwrites it straight into astatic.newgoes throughinit, so the two cannot drift.init's stack frame is 44 bytes. - New: build on targets without compare-and-swap atomics via the
optional
portable-atomicfeature (PR #64, issue #62 item 2). Enablesthumbv6m-none-eabi(Cortex-M0/M0+) andriscv32imc-unknown-none-elf(ESP32-C3); there you also pick how portable-atomic emulates CAS (itscritical-sectionfeature, or--cfg portable_atomic_unsafe_assume_single_coreon single-core chips). Nothing changes when the feature is off. - Fix: SILK CBR with in-band FEC busted packets into concealed frames
(issue #51). SILK's frame target now leaves room for the packet's LBRR
section, as libopus's does. This ports
enc_API.c's per-frame target, for mono and stereo: the moving average of LBRR bits (nBitsUsedLBRR), the bit reservoir across packets (nBitsExceeded) and the balance within a multi-frame packet (bitsBalance). The frame cap no longer takes the LBRR bits off a second time, since the rate control already counts them. At 16-48 kb/s, 20 ms and 40% loss, mono busts 0-1 packets in 50 (was up to 8; libopus 0-2) and stereo 0-2 (was up to 15). Stereo carries LBRR in 22-31 packets (was 5-20; libopus 29-30). Mono's main frame codes as well as without FEC (worst window 4.6 dB, was 0.3). Hybrid's SILK layer also pays back its overshoot of the target rate, as libopus's does. - Stereo SILK/Hybrid codes the side, as libopus does (issue #48). L and R
are resampled separately and converted to mid/side at the internal rate by
a bit-exact port of libopus's
silk_stereo_LR_to_MS: predictor estimation and quantization, stereo-width smoothing, the panned-mono and reduced-width decisions, and the mid/side bit split. A second SILK channel codes the side, with its own VAD, LBRR (in-band FEC) and rate control, and libopus's side reset after mid-only frames. On the #42 signal each channel now measures within 0.3 dB of libopus (R: +3.8 → +5.1 dB, libopus +5.1). Anti-phase input, which decoded as silence, measures +7.0 dB per channel, as libopus does. Two unrelated voices go from +1.9/+2.8 to +6.0/+9.3 dB (libopus +5.4/+8.0). Hybrid splits its SILK rate per channel, as libopus'scompute_silk_rate_for_hybriddoes. Mono output is unchanged, byte for byte. Under CBR with in-band FEC the side's LBRR at first crowded LBRR out of many packets; #51 (above) fixes that. - Fix: stereo SILK/Hybrid decoded as L ≈ −0.63·mid, R ≈ 2.63·mid (issue
#42). The encoder codes stereo SILK as the mid only, but wrote stereo
predictor index 0, which dequantizes to
pred_Q13 = (0, −13364). The decoder applies the predictor to mid-only frames too, so the left channel came out phase-inverted and the right ~8 dB hot. It now writes the zero predictor, joint symbol 12, as libopus does for itstoMonoframes. Hybrid also fed SILK the interleaved L,R input as if it were mono; it is now downmixed like SILK-only, which lifts the 24/48 kHz Hybrid mid from −2.4 dB to +5.8 dB SNR (libopus +5.9 dB). Both channels now carry the mid (L = R ≈ 0.85·mid, SNR +5.2/+3.8 dB, libopus +5.1/+5.1 dB with real side coding), until #48 (above) adds the side. - Fix: the SILK decoder's stereo predictor levels match libopus. The
half-step constant was
(1 << 16) / 10= 6553 instead of libopus'sSILK_FIX_CONST(0.1, 16)= 6554, so 45 of the 75 levels came out a few Q13 units off and libopus stereo streams decoded at ~65 dB against libopus instead of bit-exactly. The stereo state is no longer cleared on frames whose predictor is zero (libopus clears it only on a mono→stereo switch), and a lost frame keeps the last mid-only flag and conceals the side only if the last good frame coded one (dec_API.c). - Fix: SILK-only VBR ignored
bitrate_bps(issue #43). The SILK target rate came from the packet budget, which under VBR is the caller's output buffer: a 1500-byte buffer asked SILK for ~510 kb/s, so every bitrate coded the same ~87-byte packets (16 kHz, 20 ms). The rate now follows libopus 1.6'sbits_target/total_bitRate(opus_encoder.c): the requested bitrate, capped by the buffer, less the TOC byte. The buffer stays the hard cap (maxBits). At 12-64 kb/s, 16 kHz VBR now codes 21-69 bytes a packet, against libopus's 27-73. CBR and Hybrid streams are byte-identical to before. Known gap: at wideband, opus-rs codes fewer excitation bits than libopus at the same gains (0.78x libopus's size at 12 kb/s, 1.01x at narrowband). That is a separate SILK encoder divergence, tracked for follow-up. - Fix: mediumband (12 kHz) SILK decoded to noise (issue #53). The decoder
gave 12 kHz the NB/MB NLSF codebook (order 10) but the wideband LPC order
(16), so it built a 16-tap synthesis filter from ten decoded NLSFs. Every
mediumband packet, from libopus or from opus-rs, decoded to loud noise at
every output rate (-14 to -18 dB against libopus). The order and the
codebook now come from one branch, as in libopus's
decoder_set_fs.c: mono mediumband decodes bit-exactly against libopus, and stereo matches it as far as the stereo predictor allows (issue #42). - Fix: a stereo decoder rejected mono packets, and a mono decoder rejected
stereo ones (issue #62, item 3).
OpusDecoder::decodereturned "Channel count mismatch between packet and decoder" whenever a packet's ToC disagreed with the decoder, and libopus stereo encoders send mono packets at low bitrates. Both now decode as in libopus. A stereo decoder plays a mono packet on both channels. A mono decoder plays a stereo packet's mid (SILK) or the average of its channels' spectra (CELT). Channel switches mid-stream followsilk/dec_API.c, which starts the side channel and the right resampler afresh when a stream turns stereo. SILK decodes bit-exactly against libopus in every case, switches included. CELT and Hybrid agree with libopus as closely as when the channel counts match (47-62 dB). Streams whose channel count matches the decoder's decode exactly as before. CELT's clearing of the bands a frame doesn't code (#59) now covers both halves of the energy state, as libopus's does. A mono stream keeps the second half, and stale energies there made a wider frame decode its new bands as noise (-0.9 dB against libopus).
- Fix: starved CBR budgets (issues #45, #46). Budgets below 3 bytes per
frame (and other starved budgets) now emit libopus's TOC-only "PLC" packet
— padded under CBR, with the 40/60 ms multiframe TOC rules — instead of
failing with a range-coder error (debug builds panicked in
RangeCoder::shrink). Budgets below ~6 kb/s (9 kb/s above 20 ms) switch to CELT-only mode and code small valid packets, as libopus does (opus_encoder.c:1226-1286, 1525-1527). Known gap: at 5-6 byte CELT packets the payload's tail bits differ from libopus's, costing some SNR — tracked for follow-up. - Fix: 60 ms SILK packets cap the first two frames at 2/5 and 3/4 of the packet (enc_API.c parity, from PR #44). Without the caps a 60 ms packet's early frames could leave the last one under its no-pulse fallback cost.
- CELT transients are analysed on unfiltered history (PR #47). The tone/transient analysis saw a prefiltered overlap head against an unfiltered body, reading a comb-filter step as a transient on steady pitched input; 48 kHz Audio at 20-24 kbps lost its first ~200 ms. Now lag 0, correlation 1.00 from the first window, and only the onset frame is coded with short blocks.
- Fix: CELT from 24 kHz input stuck at ~20 dB SNR (issue #54). When
run_prefiltercancelled the pitch pre-filter for a frame (libopus 1.6'scancel_pitch), it restored the unfiltered input over the whole frame. libopus still fades the previous frame's comb filter out over the overlap (celt_encoder.c:1572-1584), and the decoder's post-filter always applies that fade. So every cancel right after an "on" frame left 120 samples the decoder post-filtered but the encoder never pre-filtered. From 24 kHz the zero-stuffed input is dominated by its image above 12 kHz, so the filter was cancelled whenever the pitch period was odd, in 18 of 66 frames on the issue's chirp. The SNR was 20.1 / 20.9 / 21.1 dB at 32 / 64 / 128 kbps and is now 29.4 / 36.2 / 41.9 dB. libopus 1.6.1 scores 38.8 / 41.9 dB at 64 / 128 kbps (35.2 / 41.1 with its tonality analysis off, which opus-rs does not port). The 48 kHz chirp packets are byte-identical. - Fix: CELT flagged transients on steady pitched input (issue #38). The
encoder ran
tone_detectandtransient_analysison a buffer whose overlap head was the previous frame's prefiltered signal while the body was unfiltered; libopus 1.6 analyses the unfilteredprefilter_memtail (celt_encoder.c:2017). Wherever the comb filter was active, the step at the head read as a transient: on the issue's chirp, 30 of 65 frames were coded with short blocks at every bitrate (libopus: only the onset frame). With bits to spare this was inaudible, but 48 kHzAudioat 20-24 kbps (CELT-only) lost its first ~200 ms (correlation 0.56-0.66); it is now lag 0 and correlation 1.00 from the first window, like libopus's CELT.prefilter_memis also kept current while the comb filter is off (stereo, hybrid, complexity < 5), as libopus's always-runrun_prefilterdoes.
- Fix: in-band FEC emitted no LBRR at CBR (issue #36). The LBRR payload
reused the main frame's quantized pulses with only the first gain index
raised, so it cost as many bits as the main frame and never fit a CBR
packet.
silk_LBRR_encodeis now ported faithfully: the excitation is re-quantized through the noise-shaping quantizer at the raised LBRR gain with its own NSQ state and gain chain, gated on speech activity, withsilk_setup_LBRR(gain increase 7, thenmax(7 − 0.2·loss, 2)) and opus_encoder.c'sdecide_fec(rate thresholds + hysteresis + bandwidth reduction). CBR mono now recovers the previous packet through libopusdecode_fecat 3.8 dB median (previously 0.0 dB: no LBRR at all). - Fix: 48 kHz SILK/hybrid encoder delay and startup (issue #38). The
encoder input was resampled with the stateless
down2/down2_3decimators plus an internal-rate delay buffer, lagging libopus's pre-skip by up to 17 samples. The encoder now runs the libopussilk_resampler(encoder direction:delay_matrix_enc+ private down-FIR, ported with thesilk_Resampler_*_COEFStables) on the API-rate input, and prefills the SILK encoder on CELT→SILK restarts. Measured with the issue's harness: Voip 32 kbps lag −5..−2 (libopus's own encoder: identical), Audio 24 kbps startup correlation 0.56 → ≥ 0.77. - Fix: panics found by fuzzing. 2.5 ms CELT frames aborted in the encoder's lm search (off-by-one: lm=0 was excluded from the valid set); 2.5/5 ms frames reached the SILK encoder, whose VAD band split is only valid for ≥ 10 ms frames — SILK-only now rejects sub-10 ms frame sizes (they are CELT-only durations in libopus) and the VAD bails out on non-multiple-of-8 lengths.
- no_std: the crate builds and the full test suite runs with
--no-default-features --features libm(RUST_MIN_STACK=33554432, seescripts/check_no_std.sh). 13 fuzz targets run clean.
- Fix: SIGILL on AVX-without-FMA CPUs (issue #30, PR #31). Nine kernels
compiled with
#[target_feature(enable = "avx,fma")]/"avx2,fma"were dispatched after checking only AVX/AVX2. Newcompat::x86_has_avx_fma()/x86_has_avx2_fma()probes gate them, so Sandy/Ivy Bridge and VMs that mask FMA no longer fault on the firstvfmadd. - Fix: frame-loss concealment (issue #15, PR #32). Packets of 0 or 1 bytes
were decoded using the placeholder byte's ToC, which switched the decoder's
mode/bandwidth/SILK rate and could panic in the resampler. Losses now conceal
in the previous mode, as libopus does; an empty packet conceals
frame_sizesamples instead of erroring, and a mono marker no longer errors on a stereo decoder. - Fix: in-band FEC LBRR desync (issue #27, PR #33). LBRR frames were coded
with
CODE_INDEPENDENTLY_NO_LTP_SCALINGwhile every decoder readsCODE_INDEPENDENTLY, so a voiced LBRR frame desynced the main frame that followed it. The LBRR gain bump now raises only index 0 of independently coded frames, as libopus does. - Fix: SILK decoder alignment with libopus (issue #34). Mono SILK output
read from
w_silk_buf[0][2..]instead of libopus's[1..], running one internal-rate sample early, and equal API/SILK-internal rates bypassedsilk_resampler, dropping itsinputDelay. Mono SILK now matches libopus at lag 0 at 16 kHz and 48 kHz. - Fix: 40/60 ms frames (issue #35). Frame sizes were validated by
sampling_rate % frame_size == 0, which rejected 60 ms (16.67 frames/s) before encoding. Validation is now duration-based. SILK-only carries a 60 ms frame directly (3 internal SILK frames); CELT and Hybrid, which cap a frame at 20 ms, repacketize 20 ms sub-frames into one code 1/2/3 packet, as libopus does. This also fixes the code-3 VBR packet parser, which read frame lengths and frame data interleaved instead of all lengths first (libopus layout) — a latent bug that only surfaced once the encoder emitted code 3. - Fix: 24 kHz CELT decoded to garbage (issue #37). The CELT encoder always
coded all 21 bands, while the decoder derives its end band from the TOC
(SWB = 19 at 24 kHz); coding one band more than the decoder reads
desynchronised the range coder, turning every 24 kHz CELT packet into noise.
The encoder now takes
end_bandfrom the Opus bandwidth (CELT_SET_END_BAND). It also zero-stuffs the API-rate input byresampling_factor(Fs)and scales/zeroes the MDCT output for non-48 kHz rates, as libopuscelt_preemphasis/compute_mdctsdo. 24 kHzAudionow matches libopus (per-window correlation ~1.0, was ~0.04). - Tests: new libopus-oracle suites for SILK multi-frame/FEC (#27), frame-loss concealment (#15), mono alignment (#34), 40/60 ms frames (#35) and 24 kHz encoding (#37).
- New:
OpusEncoder::encode_i16()— native PCM16 entry point (issue #28). Callers holding PCM16 audio no longer need to convert to f32 before encoding. In the SILK/VoIP path the integer high-pass biquad (hp_cutoff_i16) is fed directly from the input — no f32 round-trip, no[i16; 11520]temporary conversion buffer. Output is byte-for-byte identical toencode()called with the same audio converted viasample as f32 / 32768.0(SILK-only, Hybrid and CELT-only modes; verified by a parity test matrix across 8/12/16/24/48 kHz, mono/stereo, complexity 0-10, CBR/VBR, in-band FEC). The floatencode()API is unchanged. - Fix:
no_stdbuilds (--no-default-features --features libm) compile again. Themultistreamdecode module (added in 0.1.33) usesVec-based plumbing and is now gated behind the defaultstdfeature; the core codec remains heap-freeno_std. - Zero warnings:
cargo checkandcargo clippy --all-targetsare clean for the default andno_stdfeature sets (dead CELT state fields removed, tests/examples/benches lint-clean).
- Default build is now heap-backed (issue #12). A new
heapfeature (on by default, requiresstd) allocates the large codec state withBox, shrinkingOpusEncoder/OpusDecoderfrom ~250 KB / ~175 KB to ~1 KB each. Constructing, encoding and decoding now fit on a 768 KiB stack (previouslyOpusEncoder::newalone needed ~850 KiB in release / ~2 MiB in debug, overflowing small-stack threads such as Windows' 1 MiB main thread). Disable default features for the heap-free#![no_std]build, which keeps the inline layout. - Tests: add
tests/stack_usage_test.rsasserting the structs stay <4 KiB withheap, >100 KiB without it, and that a full construct + encode + decode round-trip fits in a 768 KiB stack thread.
- Fix: high-bitrate bitstream interop with libopus (issue #11). The ported
BAND_ALLOCATIONtable was missing one200in its final row (7 entries instead of 8), shifting the whole row. That row is only selected by the allocator at high bitrates, so encoded stereo streams above ~160 kbps decoded to garbage in libopus (and the crate decoder mis-decoded libopus streams at the same rates). Table now byte-identical to libopus. - Fix:
celt_pvq_u/celt_pvq_vpanic fork >= 129.compute_u's fixed-size buffer is now domain-checked (k <= MAX_PVQ_K = 128); out-of-domain calls returnu32::MAXinstead of panicking or silently wrapping. - Fix: silent u32 overflow in PVQ codebook sizes.
compute_u/unext/celt_pvq_vuse saturating arithmetic, so an out-of-domain(n, k)can never produce a plausible-but-wrong codebook size. - Fix:
celt_pvq_u_lookuprow-extent aliasing. Lookups whosemax(n, k)exceeds a row's actual coverage now compute instead of reading the next row's block. - Fix:
OpusEncoder::encodenow returns an error when the range coder overflows its packet budget (previously bytes were silently dropped). - Tests: add full-domain PVQ table verification vs exact big-int recurrence, out-of-domain saturation checks, and a high-bitrate (128–192 kbps) stereo interop test that cross-checks against libopus.
#![no_std]with noalloc: the crate is now fully heap-free — no global allocator is required. AllVec/Boxworking buffers were replaced with an internalFixedVec<T, N>(inline[MaybeUninit<T>; N]);std::sync::LazyLockwas replaced with a heap-freeOnceCell; no_std float math (sin/cos/sqrt/…) is routed through an optionallibmfeature (pure-Rust musl port).- Verified on
thumbv7em-none-eabi(Cortex-M),wasm32-unknown-unknown, and Linux no_std.scripts/check_no_std.shreproduces. - Feature flags:
std(default) → 0 runtime deps;default-features = false, features = ["libm"]→ 1 dep (libm). - Encoder/decoder structs are inline and large (~250 KB / ~175 KB); place them in a
staticor dedicated buffer on constrained targets.
- Verified on
- Performance: unchanged vs 0.1.26 (measured within ±0.5% on
opus_real; no per-frame allocation overhead). - Conformance: RFC 6716 1276-byte packet cap enforced on the Opus path; the standalone
RangeCoder/CELT buffer supports up to 2048 bytes. wav_testexample now tags output files by build (_std/_nostd) for A/B listening across build modes.
Much of opus-rs's code, tests and documentation was written by LLMs. This
includes the libopus conformance fixes, the port to libopus main, the neural
features (Deep PLC, DRED, OSCE, BWE), the fuzzing harnesses and the
optimisations, which were written by Claude (Anthropic). They are checked
against libopus with differential tests and fuzzing
(fuzz/DIFFERENTIAL.md, scripts/test-all.sh);
fuzz/REGRESSIONS.md lists every fix and the test that
guards it. opus-rs has not had an independent security audit.
See COPYING for the original Opus license (BSD-3-Clause).