Skip to content

osdrv: ship the VQE engines the microphone path loads by dlopen - #2361

Merged
openipc-ai merged 1 commit into
masterfrom
audio-vqe-engines
Sep 4, 2026
Merged

osdrv: ship the VQE engines the microphone path loads by dlopen#2361
openipc-ai merged 1 commit into
masterfrom
audio-vqe-engines

Conversation

@openipc-ai

@openipc-ai openipc-ai commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Companion to a majestic change that turns on the SoC's noise reduction, AGC and high-pass filter on the microphone channel.

Scope narrowed after review: this is now HiSilicon only. The Goke half moved to #2362 as a draft — see the bottom of this description.

The problem

Our images ship libupvqe.so, libdnvqe.so and libVoiceEngine.so, so the VQE feature looks present. But libupvqe.so is only the framework — it dlopens one shared object per DSP stage when HI_MPI_AI_EnableVqe() runs, and none of those objects are installed:

  • hisilicon-osdrv-hi3516ev200 — the libhive_*.so install lines are all commented out
  • hisilicon-osdrv-hi3516cv500 — never had them

In both cases the files are already in the package tree. This PR adds no binaries; only install lines change.

On a stock image the enable call fails and the microphone is passed through unprocessed:

dlopen libsecurec.so or libhive_HPF.so failed
[Func]:HI_MPI_AI_EnableVqe [Line]:3535 [Info]:Ai dev: 0, ai chn:0, create vqe fail.
returned 0xa0158041

Confirmed on hi3516ev300 (3516E200) and hi3516av300 (3516C500) — it fails cleanly, no crash, audio keeps flowing. So this has only ever cost the feature, never stability.

What this installs

Only the stages majestic can switch on: libhive_HPF, libhive_ANR, libhive_AGC for the 8/16 kHz talk engine, libhive_common (a NEEDED of ANR and AGC, not a stage), and libhive_record for the 48 kHz path.

Echo cancellation and the equaliser are not exposed by majestic, and the resampler is compiled into libupvqe.so itself (RES_ReSampler_* are defined there), so libhive_RES.so is never loaded and is left out.

Gating

ifeq ($(OPENIPC_MAJESTIC),ultimate), matching the only flavour majestic compiles VQE into — 268 KB that nothing in a lite image would ever dlopen. Verified the expansion is empty for lite and installs all five for ultimate.

Note hi3516cv500 has no ultimate defconfig today (every config in that family is lite), so this changes nothing for the images that exist. It is wired up so the libraries arrive with the first ultimate config rather than being missed.

Verification

Not by inspection — the libraries were placed on both lab cameras and majestic run against them. The enable call succeeds with no dlopen diagnostic, and six seconds of the same quiet room at 8 kHz, VQE off then on, comparing the high-pass filter's stopband against the speech band it must leave alone:

board 20–80 Hz (stopband) 300–1000 Hz (speech)
hi3516ev300 (3516E200) 0.03x 0.98x
hi3516av300 (3516C500) 0.01x 1.38x

A 30x–100x cut in the stopband with the passband untouched is the filter's own shape; it cannot come from the room drifting.

Goke

Originally in this PR, now #2362, held as a draft. Review was right that it is a different risk: it is the only part that would add binaries to the tree, and there is no GK7205V200 on the bench to show they run. That PR carries the provenance evidence and the exact test someone with the hardware should run.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Ship microphone VQE engines in ultimate OSDRV images

🐞 Bug fix ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Installs required VQE engines so microphone enhancement initializes instead of silently bypassing
 processing.
• Limits engine libraries to Majestic ultimate images, avoiding unnecessary lite-image growth.
• Supports HiSilicon and Goke naming differences with platform-specific library selections.
Diagram

graph TD
  A["Build config"] --> B{"Majestic ultimate?"}
  B -- ultimate --> C["OSDRV recipes"] --> D["VQE engines"] --> E["Target usr/lib"] --> H["Mic DSP stages"]
  B -- lite --> F["Engines omitted"]
  G["libupvqe runtime"] -->|dlopen| E
Loading
High-Level Assessment

The package-local conditional lists are the best fit: they preserve each vendor's naming and source layout while excluding unused binaries from lite images. Unconditional installation would waste image space, while a separate cross-platform VQE package would add wiring and ownership complexity for only five vendor-specific runtime objects per platform.

Files changed (3) +68 / -8

Bug fix (3) +68 / -8
goke-osdrv-gk7205v200.mkConditionally package Goke microphone VQE engines +21/-0

Conditionally package Goke microphone VQE engines

• Defines the five Goke VQE runtime libraries required by Majestic and installs them only for ultimate builds. The engines remain under files/vqe so the existing files/lib wildcard does not include them in lite images.

general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk

hisilicon-osdrv-hi3516cv500.mkPrepare conditional VQE packaging for HI3516CV500 +22/-0

Prepare conditional VQE packaging for HI3516CV500

• Adds the five required HiSilicon VQE libraries to the common target installation when Majestic ultimate is selected. Existing lite-only configurations remain unchanged while future ultimate configurations receive functional microphone processing.

general/package/hisilicon-osdrv-hi3516cv500/hisilicon-osdrv-hi3516cv500.mk

hisilicon-osdrv-hi3516ev200.mkEnable required HI3516EV200 VQE engines +25/-8

Enable required HI3516EV200 VQE engines

• Replaces inactive per-library examples with an ultimate-only list containing the microphone DSP stages and their common dependency. The selected engines are installed beside libupvqe for runtime loading, while unsupported AEC, EQ, and resampler objects remain excluded.

general/package/hisilicon-osdrv-hi3516ev200/hisilicon-osdrv-hi3516ev200.mk

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (2) 📜 Skill insights (0)

Grey Divider


Action required

1. Goke VQE lacks hardware evidence 📘 Rule violation ☼ Reliability
Description
The PR installs five VQE engines into shipping GK7205V200 ultimate images while explicitly stating
that no Goke hardware was available for verification. SDK provenance and matching dlopen behavior
do not establish runtime or ABI compatibility or replace the required before/after evidence from an
affected camera.
Code

general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk[R86-88]

+	$(foreach lib,$(GOKE_OSDRV_GK7205V200_VQE_LIBS), \
+		$(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib $(GOKE_OSDRV_GK7205V200_PKGDIR)/files/vqe/$(lib) ; \
+	)
Evidence
PR Compliance ID 1 requires real-camera evidence for firmware behavior changes and treats an
explicit statement that affected hardware was not tested as a failure. The package condition selects
all five new engines for OPENIPC_MAJESTIC=ultimate, and the install loop copies them into
/usr/lib; the existing ultimate defconfig selects both that Majestic flavor and this driver
package, proving the untested payload reaches a real shipping image. The PR description expressly
states that no Goke hardware was available in the lab and provides measurements only for HiSilicon
cameras.

Rule 1: Hardware evidence is present and honest
general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk[86-88]
general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk[25-29]
general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk[84-88]
br-ext-chip-goke/configs/gk7205v200_ultimate_defconfig[43-55]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Five new binary VQE engines are shipped in the GK7205V200 ultimate image without validation on Goke hardware. This image-affecting change requires before/after evidence from a real GK7205V200 camera to establish runtime and ABI compatibility before it can safely ship.

## Issue Context
Build and install the ultimate image on representative GK7205V200 hardware, invoke the VQE paths used by Majestic at the supported sample rates, and capture the enable result plus audio-processing evidence. SDK provenance and matching `dlopen` behavior are not substitutes for this on-device validation; if any engine is ABI-incompatible, replace it with binaries from the SDK matching the existing Goke userspace stack.

## Fix Focus Areas
- general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk[25-28]
- general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk[86-88]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. VQE blobs lack buildable source 📘 Rule violation ⚙ Maintainability
Description
The added rule copies five committed .so files directly from files/vqe into the image without a
source-fetch or compilation path. Naming a vendor SDK drop establishes provenance but does not
satisfy the checklist requirement for accessible, buildable source and reproducible generation.
Code

general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk[R86-88]

+	$(foreach lib,$(GOKE_OSDRV_GK7205V200_VQE_LIBS), \
+		$(INSTALL) -m 644 -t $(TARGET_DIR)/usr/lib $(GOKE_OSDRV_GK7205V200_PKGDIR)/files/vqe/$(lib) ; \
+	)
Evidence
PR Compliance ID 21 rejects checked-in binaries without buildable source. The changed package rule
installs the five files/vqe/*.so artifacts directly and contains no compilation step for them.

CLAUDE.md: Do Not Ship Binaries Without Buildable Source
general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk[86-88]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Goke VQE libraries are installed as committed binary artifacts without a buildable source path.

## Issue Context
PR Compliance ID 21 requires every added binary to have accessible, buildable source and a reproducible package build path. Add an appropriately pinned source package and compile the libraries, or remove the binary installation if rebuildable source is unavailable.

## Fix Focus Areas
- general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk[86-88]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can route each action level your way: inline, summary, both, or drop

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk Outdated
Comment thread general/package/goke-osdrv-gk7205v200/goke-osdrv-gk7205v200.mk Outdated
OpenIPC/majestic#287 turns on the SoC's noise reduction, automatic gain
control and high-pass filter on the audio input channel. Every image we build
has libupvqe.so, libdnvqe.so and libVoiceEngine.so, so the feature looks
present -- but libupvqe.so is only the framework. It loads one shared object
per DSP stage with dlopen at HI_MPI_AI_EnableVqe time, resolving the name from
a "lib%s_%s.so" template, and none of those objects are installed: the lines
are commented out in the hi3516ev200 package and were never written for
hi3516cv500, though the files sit in both package trees already.

The result is a call that fails with 0xa0158041 and prints

  dlopen libsecurec.so or libhive_HPF.so failed
  [Info]:ai dev: 0, ai chn:0, create vqe fail.

on the console, after which the microphone is passed through unprocessed
however the attributes were set. Confirmed on hi3516ev300 (3516E200) and
hi3516av300 (3516C500): it fails cleanly rather than crashing, so this has
only ever cost the feature, never stability.

Only the stages majestic can actually switch on are installed. The talk engine
it uses at 8 and 16 kHz needs the high-pass filter, noise reduction and
automatic gain control, plus libhive_common.so, which is not a stage but is a
NEEDED of the last two; the 48 kHz path needs the record engine. Echo
cancellation and the equaliser are not exposed, and the resampler is compiled
into libupvqe.so itself (RES_ReSampler_* are defined there), so libhive_RES.so
is never loaded and is left out.

No new binaries: every file installed here is already in the package tree and
already carried in the repository. Only the install lines change.

Ultimate only, matching the flavour majestic compiles VQE into at all: 268 KB
that nothing in a lite image would dlopen. hi3516cv500 has no ultimate
defconfig today -- every config in that family is lite -- so nothing changes
for the images that exist; it is wired up so the libraries arrive with the
first ultimate config rather than being missed.

Verified end to end rather than by inspection: with these five libraries
present, majestic's enable call succeeds with no dlopen diagnostic, and six
seconds of the same quiet room at 8 kHz with VQE off then on gives

  hi3516ev300 (3516E200)   20-80 Hz 0.03x   300-1000 Hz 0.98x
  hi3516av300 (3516C500)   20-80 Hz 0.01x   300-1000 Hz 1.38x

a 30x to 100x cut in the high-pass filter's stopband with the speech band it
must leave alone untouched.

Goke 7205200 needs the same treatment and is held back to its own change: its
engines are not in the tree at all, so it would add binaries, and there is no
GK7205V200 on the bench to show they run.
@openipc-ai
openipc-ai merged commit 39ea1b9 into master Sep 4, 2026
38 of 40 checks passed
@openipc-ai
openipc-ai deleted the audio-vqe-engines branch September 4, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant