Give the real-audio quality test a corpus - #212
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #212 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 58 58
Lines 10481 10481
=======================================
Hits 9765 9765
Misses 505 505
Partials 211 211
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JoTurk
approved these changes
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
TestEncoderQualityRealCorpushas been in the repository since the quality assurance system was implemented, but it has never been run: it is skipped unlessOPUS_QUALITY_CORPUSpoints to a directory of clips, and there was no way to obtain one. The baseline against which it is compared was also never confirmed, so even a developer with their own clips would not get any regression checks; only a number was displayed once.This script adds the missing piece.
.github/scripts/fetch-quality-corpus.shcreates the corpus from a manifest of 12 live recordings from the Internet Archive's Live Music Archive, one artist per recording, verifying a SHA-1 for each source file. Only the URLs and checksums are in the repository, never the audio, which prevents licensing issues from being affectedby
testdata/; This is what EBU SQAM ruled out when the control system was written.The confirmed baseline was measured precisely with that corpus.
Clip Selection
Material that has already been processed by a perceptive codec is useless as a quality reference: re-encoding it aligned to the 20 ms grid it already contains causes quantization noise to overlap and the score to increase by approximately 1 dB.
Each clip was verified in two ways, as each verification method has a blind spot.
Frame sweeping—encoding at various sample offsets and looking for a periodic peak—
does not detect material with a very strong low-pass filter because there is no fine structure left to resonate with the grid.
Attempting to adopt clips from the 2011 HydrogenAudio listening test confirmed this:
the sweep ranked the most damaged half of that set as the cleanest, and the spectra showed an abrupt wall at 9 kHz. Thus, the second check is spectral and doesn't care about the block size used by the codec: a codec zeroes out everything above its cutoff frequency and leaves a plateau at the diming level, while the lossless material continues to descend to Nyquist.
The Live Music Archive was chosen because its elements document their provenance, so the provenance can be filtered before downloading and confirmed afterward.
Playability
The masters are 44.1 kHz, so the script sets
soxr:precision=28instead of using the default value from ffmpeg; a different resampler would change the baseline for reasons unrelated to the encoder. Everything else in the chain is already fixed: the source files using SHA-1,opus_compareusing the SHA-1 published in the RFC, and the encoder is deterministic. Therefore, the committed values should be reproducible everywhere, and the 15% safety margin absorbs any variation that might occur in a different soxr compilation.At 96 kbps, the twelve clips exhibit a weighted error between 0.28 and 1.15, with a maximum of one defective window out of 2999 in any one of them.
Not integrated into CI
The script is deliberately kept as a local tool. Downloading the corpus is approximately 240 MB, which is a considerable expense per run for a check whose objective is to detect perceptual regressions during encoder work, and CI's quality assurance task already covers synthetic levels. The execution would look like this:
Reference Problem
Part of the encoder quality work; not a separate problem.