Skip to content

LV2 measurers: dB readings use omx-dsp's omx_lin_to_db_d (#87) - #88

Closed
linuxnow wants to merge 5 commits into
mainfrom
fix/87-lib-db
Closed

linuxnow wants to merge 5 commits into
mainfrom
fix/87-lib-db

Conversation

@linuxnow

@linuxnow linuxnow commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #87 (the dB conversions; the one pow stays, see below).

The LV2 measurer and the host probe wrote 20 * log10(x) by hand. omx-dsp has it as omx_lin_to_db_d, whose body is 20 * log10(lin > floor ? lin : floor). Three commits, in the order they must land: the omx-dsp floor (0.21.0: spec, debian/control, the version make deps fetches), the six sites in native/lv2-measure.c, and the one in native/lv2-host-probe.c. The Makefile gives the two programs omx-dsp's include path.

Checked on r1 in the worker image with omx-dsp at the 0.21.0 release commit (omx-dsp#166): everything under native/ builds. lv2_measure was run old and new on four installed plugins, soak (2 s) and the normal run: the printed records are identical once timings and memory figures are left out, including the -999 guard values. For the host probe, 20 million drawn magnitudes and the floor's neighbours give 0 differing bit patterns between the old expression and omx_lin_to_db_d(mag, 1e-12).

A NaN magnitude in the host probe stays NaN: handed to omx_lin_to_db_d it would read as the floor, -240 dB, which is silence, and silence passes "the engaged plugin is measurably quieter" whenever the positive control still counts enough changed samples. level_db_at keeps a NaN as NaN and a new claim names it ("every level measured is a number"). Checked with a harness over level_db_at: a sine window with one NaN sample reads NaN (the previous head read -240.000000, red), 2 million drawn magnitudes give 0 differing bit patterns against the hand-written form. The measurer's sites are inside > 0 guards and never see one.

Left alone: native/lv2-host-probe.c:67, pow(10.0, HOT_EXCESS_DB / 20.0). The library only has omx_db_to_lin in float; it is not bit-identical. It needs either an omx_db_to_lin_d in omx-dsp or an allowlist entry.

The deps fetch needed the v0.21.0 tag of omx-dsp, which now exists; rebased on main b737c41. Not merged, no release.

The spec's BuildRequires, debian/control and the version make deps fetches. Paired with the commit that switches the LV2
measurer's dB readings to omx-dsp's omx_lin_to_db_d and the one after it for the host probe.
The six 20.0 * log10(...) of the measurer (the soak's silent-window test and its four readings, the sweep's
rms_out) become omx_lin_to_db_d(x, 0.0), the library's 20.0 * log10(lin > floor ? lin : floor), inside the same
> 0 guards, so nothing the guard rejects reaches it. The Makefile gives the measurer omx-dsp's include path
(installed, else the headers make deps fetches). Paired with the floor commit before it.
20.0 * log10(mag < 1e-12 ? 1e-12 : mag) is omx_lin_to_db_d(mag, 1e-12), bit for bit for every finite magnitude (20 million
drawn magnitudes plus the floor's neighbours, 0 differing bit patterns). A NaN magnitude is the one case that differs: it
would read the floor, -240 dB; the next commit keeps it NaN. The line-67 pow(10, x / 20) stays: the library has no
double-precision twin. The probe's build gets omx-dsp's and omx-contract's include paths.
…e -240 dB floor (#87)

Handed to omx_lin_to_db_d, a NaN magnitude reads as the floor: silence, and silence passes 'the engaged
plugin is measurably quieter' whenever the positive control still counts enough changed samples.
level_db_at returns a NaN magnitude as it is, the finite path untouched, and a new claim says every
level measured is a number. Checked over level_db_at: a sine window with one NaN sample reads NaN; at
the commit before it read -240.000000.
…med line (#87)

The grep proof #87 asks for, as a test: every log10/powf(10, ...) call in native/*.c fails unless it is
allowlisted with its reason, and an allowlisted line that is gone fails too. The one entry is
lv2-host-probe.c's pow(10.0, HOT_EXCESS_DB / 20.0): omx-dsp has omx_db_to_lin in float only, which is
not bit-identical. A positive control shows the pattern sees both forms and skips a comment. Red with
lv2-measure.c from before the omx_lin_to_db_d commit (two hits), red with the pow line rewritten (stale
entry).
This was referenced Oct 18, 2026
@linuxnow
linuxnow deleted the fix/87-lib-db branch October 19, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use omx-dsp 0.21.0 instead of private copies of omx_lin_to_db_d and omx_db_to_lin

1 participant