Fix LFE low-pass filter using a hardcoded 48 kHz sample rate - #15
Merged
Conversation
The 120 Hz LFE low-pass applied when rendering HOA to an LFE-bearing loudspeaker layout computed its biquad coefficients for a hardcoded 48 kHz rate regardless of oar_config_t.sampling_rate, so the effective cutoff scaled with the output rate (~240 Hz at 96 kHz, rendering the LFE 2.7x too loud for content near the cutoff and with ~4 dB less stopband attenuation; ~110 Hz at 44.1 kHz). Plumb the context sample rate into IAMF_element_renderer_render_H2M so the lazy init uses the actual rate, and fix the eager init in ear.c, which referenced an undeclared identifier (out_info) and prevented the DISABLE_LFE_HOA=0 configuration from compiling at all. Since no build defined DISABLE_LFE_HOA, the LFE path was unreachable in every configuration; add an OAR_ENABLE_HOA_LFE CMake option (default OFF, preserving current behavior) so it can be built and tested. Adds test_hoa_lfe_rendering (built when the option is ON): renders a 1OA W-channel tone to 5.1 at 44.1/48/96 kHz through the public API and verifies the LFE level is rate-invariant (the hardcoded-48k bug fails this at 2.697x for 96 kHz) and that the low-pass attenuates a 1 kHz tone by more than 25 dB at every rate. Fixes #1.
trsonic
requested review from
felicialim,
jingbo-marquis,
trevorknight,
yeroro and
yilun-zhangs
July 27, 2026 08:01
yilun-zhangs
approved these changes
Jul 28, 2026
Collaborator
Author
|
Thanks @jingbo-marquis and @yilun-zhangs ! |
trsonic
added a commit
that referenced
this pull request
Aug 20, 2026
Dropping these includes was correct against the base this branch started from, but the LFE filter added in #15 uses tanf(), M_PI, sqrt() and memset() in this file, so a build with -DOAR_ENABLE_HOA_LFE=ON no longer compiles without them. It also left `#define _USE_MATH_DEFINES` with no <math.h> following it, which is what that define exists for on MSVC.
trsonic
added a commit
that referenced
this pull request
Aug 20, 2026
#15 added the OAR_ENABLE_HOA_LFE CMake option and a test that exercises the 120 Hz LFE low-pass, neither of which the Bazel build knew about. `--define OAR_ENABLE_HOA_LFE=1` now sets DISABLE_LFE_HOA=0 on ae_rdr, whose header defaults it to 1, matching what the CMake option does globally. The test target is gated with target_compatible_with, so `bazel build //...` skips it instead of building a test whose subject was compiled out.
trsonic
added a commit
that referenced
this pull request
Aug 20, 2026
Dropping these includes was correct against the base this branch started from, but the LFE filter added in #15 uses tanf(), M_PI, sqrt() and memset() in this file, so a build with -DOAR_ENABLE_HOA_LFE=ON no longer compiles without them. It also left `#define _USE_MATH_DEFINES` with no <math.h> following it, which is what that define exists for on MSVC.
trsonic
added a commit
that referenced
this pull request
Aug 20, 2026
#15 added the OAR_ENABLE_HOA_LFE CMake option and a test that exercises the 120 Hz LFE low-pass, neither of which the Bazel build knew about. `--define OAR_ENABLE_HOA_LFE=1` now sets DISABLE_LFE_HOA=0 on ae_rdr, whose header defaults it to 1, matching what the CMake option does globally. The test target is gated with target_compatible_with, so `bazel build //...` skips it instead of building a test whose subject was compiled out.
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.
The 120 Hz LFE low-pass applied when rendering HOA to an LFE-bearing loudspeaker layout computed its biquad coefficients for a hardcoded 48 kHz rate (
DEFAULT_SAMPLERATEinh2m_rdr.c) regardless ofoar_config_t.sampling_rate. The effective cutoff therefore scaled with the output rate: ~240 Hz at 96 kHz (LFE ~2.7× too loud for content near the cutoff, with ~4 dB less stopband attenuation) and ~110 Hz at 44.1 kHz.Changes:
IAMF_element_renderer_render_H2Mso the lazy filter init uses the actual rate.ear.c, which referenced an undeclared identifier (out_info) and prevented theDISABLE_LFE_HOA=0configuration from compiling at all.DISABLE_LFE_HOA, the LFE path was unreachable in every configuration; add anOAR_ENABLE_HOA_LFECMake option (default OFF, preserving current behavior) so it can be built and tested.Testing
New
test_hoa_lfe_rendering(built when the option is ON) renders a 1OA W-channel tone to 5.1 at 44.1/48/96 kHz through the public API and verifies:Default builds (option OFF) are unchanged.