feat(sv56): variable bit-width support (8-32 bit) for speech voltmeter#181
Open
jr2804 wants to merge 10 commits into
Open
feat(sv56): variable bit-width support (8-32 bit) for speech voltmeter#181jr2804 wants to merge 10 commits into
jr2804 wants to merge 10 commits into
Conversation
Add bitno parameter to init_speech_voltmeter() to allow the P.56 Method B speech voltmeter to operate correctly with 24-bit and 32-bit A/D converters instead of being limited to 16-bit (approx. 90 dB dynamic range). Changes: - sv-p56.h: SVP56_state now stores bitno and thres_no (bitno-1); arrays expanded to 31 elements to support 32-bit; init_speech_voltmeter prototype updated to accept bitno parameter - sv-p56.c: init_speech_voltmeter() derives threshold count from bitno (N-1); maxP/maxN are now computed as ±2^(bitno-1) instead of hard-coded ±32768; speech_voltmeter() uses state->thres_no instead of THRES_NO macro - actlevel.c: passes bitno to init_speech_voltmeter() - sv56demo.c: passes bitno to init_speech_voltmeter() Backward compatible: 16-bit input produces identical results to the original implementation (THRES_NO=15, maxP=-32768, maxN=32767). Note: No C compiler available in this environment to verify compilation. Build should be verified with 'cmake --build build && ctest' before merging.
* Set minimum CMake version to 3.1...3.25 in CMakeLists.txt * Remove unnecessary entries from .gitignore * Add .vscode/ to .gitignore for IDE configuration
* Update LongTermLevel and Delta array size to support SVP56_MAX_THRESHOLDS. * Modify threshold-related structures to accommodate dynamic bit depth. * Add new entries to .gitignore for build artifacts and output files.
* Update sv56.tex to include new parameters for bit depth. * Modify CMakeLists.txt to add new executables for testing. * Enhance actlevel.c to support variable bit-width input files. * Introduce sv56-convert.c for converting PCM files with different bit depths. * Create sv56-util.h for utility functions related to bit-width handling. * Add sv56test.c for testing the speech voltmeter with variable bit widths.
ludomal
reviewed
May 29, 2026
ludomal
reviewed
May 29, 2026
Member
|
@jr2804 - Thanks for the great contribution. Would you mind committing the test reference files? |
added 2 commits
May 29, 2026 17:59
* Add voice_16bit.ref with audio level data * Add voice_24bit.ref with audio level data * Add voice_32bit.ref with audio level data * Add voice_24.src and voice_32.src as binary files
Author
|
Thanks for the review! All feedback addressed in the latest two commits:
|
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.
Summary
Extends the P.56 speech voltmeter (sv56) module to support variable bit-width input files from 8 to 32 bits per sample, up from the previous 16-bit limitation.
Changes
Core algorithm (
sv-p56.c,sv-p56.h)int bitnoparameter toinit_speech_voltmeter()controlling threshold count and peak detectorsSVP56_MAX_NO_BITS(32) andSVP56_MAX_THRESHOLDS(31) for array sizingthres_noandbitnofields; arrays expanded accordinglyVariable-width I/O (
sv56-util.h— new)sv56_bytes_per_sample(bitno)— returns 1/2/3/4 bytes based on bit depthsv56_raw2fl()— converts raw bytes to normalized float (-1..+1) in native byte ordersv56_fl2raw()— converts normalized float back to raw bytes with truncation and clippingCLI tools (
sv56demo.c,actlevel.c)short buffer[]withunsigned char raw_buf[]for variable-width I/Osh2fl()/fl2sh()withsv56_raw2fl()/sv56_fl2raw()mask[]array access for bitno > 16bitnoparameter now controls both P.56 algorithm AND file formatNew utilities
sv56test.c— minimal non-interactive test program for automated verificationsv56-convert.c— utility to convert between bit-width formats (used for test data generation)Tests
Documentation (
doc/manual/sv56.tex)init_speech_voltmetersignature and parameter docsBuild system
sv56testandsv56-convertbuild targetsBackward compatibility