osdrv: ship the VQE engines the microphone path loads by dlopen - #2361
Conversation
PR Summary by QodoShip microphone VQE engines in ultimate OSDRV images
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1. Goke VQE lacks hardware evidence
|
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.
786980f to
265402c
Compare
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.soandlibVoiceEngine.so, so the VQE feature looks present. Butlibupvqe.sois only the framework — itdlopens one shared object per DSP stage whenHI_MPI_AI_EnableVqe()runs, and none of those objects are installed:hisilicon-osdrv-hi3516ev200— thelibhive_*.soinstall lines are all commented outhisilicon-osdrv-hi3516cv500— never had themIn 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:
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_AGCfor the 8/16 kHz talk engine,libhive_common(aNEEDEDof ANR and AGC, not a stage), andlibhive_recordfor the 48 kHz path.Echo cancellation and the equaliser are not exposed by majestic, and the resampler is compiled into
libupvqe.soitself (RES_ReSampler_*are defined there), solibhive_RES.sois 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 everdlopen. 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
dlopendiagnostic, 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: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.