An engine's model has always been a path to a password-protected zip:
ANSODBase inflates it into a folder, and every engine then picks out
train_last.onnx, classes.names and model_config.json. A .ansmodel
package replaces all four with one sealed file, and this is the part
that turns it back into what the engines already understand.
ANSODBase::LoadModel and ::Initialize now recognise a .ansmodel path and
take a second route: the package is opened with the process keyring, the
model is decrypted into memory, and the classes, task and input geometry
come out of the manifest instead of loose files. Nothing is extracted,
so the unprotected model never touches the disk — which is the reason
the format exists, and it is one function's job to keep.
The engines follow it down. BasicOrtHandler gains a constructor that
takes the bytes rather than a path; it keeps a view of them, not a copy,
because the weights are in RAM either way once a session exists and a
copy would only double what every loaded model costs. The owner of the
plaintext is ANSODBase, which holds it for as long as the engine object
lives — that is what lets the DirectML recovery path rebuild a session
after a driver fault — and wipes it on teardown.
Wired through ANSONNXYOLO (and so the classification facade), ANSONNXOBB,
ANSONNXPOSE, ANSONNXSEG and YOLO12OD. YOLOOD is left alone: it loads
darknet weights and OpenCV DNN graphs, neither of which the writer
produces. A zip still loads exactly as before, on every engine.
Keys come from SetProcessModelKeys, as in ANSMINDCORE, with the same
development fallback from the environment. With none set, a package is
refused with a sentence saying so and every zip still works, so a build
made before the key ceremony runs everything except packages.
The engine layer needs CUDA to compile, so the contract it depends on is
checked where it can be: ANSModelPackage-UnitTest now opens the fixture
ANSMINDCORE wrote through the same glue ANSODBase uses, and covers the
refusal a keyless build gives. 32 checks, no failures.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The second reader. A package is one encrypted file — cleartext header,
sealed manifest, model bytes sealed in chunks — and this opens it: the
content key unwrapped with X25519 against the base key, the header
verified as Ed25519 signed by a release key the root vouches for, the
model decrypted into memory and handed to ANSModelSource, which the
engines already take.
It is a new library rather than code inside the engine layer, and
deliberately free of the heavy dependencies around it: no CUDA, no
OpenCV, no LabVIEW. That is what lets it build and be tested on every
platform, including the ones where the engine layer does not build.
THE TWO IMPLEMENTATIONS MUST AGREE, so this does not merely claim to:
tests/ANSModelPackage-UnitTest/data/interop.ansmodel was written by
ANSMINDCORE's packer, and the test opens it here — manifest, classes and
a chunked payload, byte for byte. A change to either wire format shows
up as this failing. The fixture's keys are derived by published rules,
recorded beside it, so anyone can rebuild it.
The AEAD and the small primitives are copies of ANSMINDCORE's, not
reimplementations, for the same reason. Monocypher 4.0.2 is vendored
here as it is there, including the RFC 8032 pair — its default EdDSA
signs with BLAKE2b and would not interoperate.
Verified by compiling and running the test directly: 19 checks, RFC
8439, RFC 7748 and RFC 8032 vectors, the interop fixture, a round trip,
a flipped bit, an unknown root, a revoked signer, and rubbish bytes.
ANSCORE's own CMake configure fails on this machine for reasons that
predate this change — eight errors with or without it, all missing
dependencies — so the new CMake targets still need a real build box.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
hwinfo::getAllGPUs() is an OpenCL device list -- the prebuilt HWiNFO.lib has no
Win32_VideoController path, only clGetPlatformIDs/clGetDeviceIDs/clGetDeviceInfo.
A machine whose driver never registered an OpenCL ICD therefore reported no GPU
at all, even with a healthy WDDM driver driving the display. Two consequences:
the system-info JSON emitted "GPU":"", and CheckHardwareInformation() silently
fell back to the CPU engine on a box holding a perfectly good CUDA card.
DXGI needs only a WDDM display driver, so it sees the adapter either way.
CheckHardwareInformation() now classifies adapters by PCI vendor id. Exact ids
also retire the substring matching and its "ATI" inside "CORPORATION" workaround.
It falls back to the OpenCL list when DXGI returns nothing.
GetSystemHardwareInformation() keeps its OpenCL loop untouched and merely appends
DXGI adapters that OpenCL did not already report, so the JSON stays byte-identical
-- same keys, order, indices and values -- on any machine that already worked.
Appended entries reuse OpenCL's vendor spelling (OpenClStyleVendor) and read the
driver version from the display-adapter class key, since DXGI exposes neither.
Verified on a dual-adapter box: the GPU node matches the pre-change output
exactly, and forcing the append path yields the same shape with values sourced
from DXGI plus the registry.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The id is built from up to 6 enumerated MACs. On Linux getifaddrs() also
returns virtual interfaces — docker0 and the veth* pairs each container
creates, tun*/wg* from a VPN, br-*/virbr* bridges. Container veths carry
RANDOM MACs and appear/disappear with the containers, so the enumerated set
can differ between calls: the hardware id changes and an activated licence
silently stops matching its machine. Boxes running Docker (the Coder feature)
would hit this routinely.
This matters more on Linux than elsewhere because two of the four id
components are already constant there: the system-UUID slot is a literal and
GetHDDPropertyList is an empty function on non-Windows. The id rests on CPU id
+ MACs, so unstable MACs are most of the instability.
Filter mirrors what the Windows branch already does via WMI (PNPDeviceId LIKE
%PCI% — physical adapters only). The test is /sys/class/net/<name>/device,
the kernel's own record of a hardware-backed interface, so it stays correct as
new virtual-interface flavours appear; a name-prefix denylist is kept only for
environments without /sys. MACs are bucketed during the walk and chosen after
it, so a veth appearing earlier in the list cannot consume a slot and push a
real NIC out.
FAIL-SAFE: if no physical NIC is found, fall back to the unfiltered set. An
empty list would drop all MAC entropy and — with the UUID and disk slots
already constant — leave near-identical ids across different machines.
Windows and macOS/BSD paths are untouched (both #else branches preserve the
existing behaviour exactly). Logic verified against a simulated Docker host:
enp3s0/wlp2s0 accepted; lo, docker0, veth*, br-*, tun0 rejected.
ORDERING: this CHANGES the id on any Linux box that has virtual interfaces, so
it must land BEFORE the first Linux licences are issued — afterwards it would
invalidate them.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GetCurrentHardwareId sized its bit stream at 125 bits (16 bytes) but
writes 147 (3 version + 9 x 16-bit hashes), so the last two hash slots
overflowed the heap block by 3 bytes on every id computation. The
Windows heap absorbed it silently for years; it SIGSEGVs under macOS
malloc — found when ANSGateway enabled this code on POSIX (fixed there
in ANSGateway 3a34c68/6c3cdfd; this is the upstream port).
Two parts, both id-preserving (only the first 16 bytes feed the base32
encode — verified byte-identical ids before/after in the gateway):
- hwid.cpp: size the stream to the 147 bits actually written.
- BitStream3: bounds-safe byteAt/setByte accessors on every Write/Read,
Attach records the real buffer size, default ctor zero-inits — an
under-sized stream can no longer corrupt the heap, and out-of-range
reads return 0 (identical to the base32 padding zeros the Match path
always read there).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- hwid.cpp: BitStream3 buffer 125 -> 160 bits (writes totalled 147 bits
and overflowed the old allocation; encoded HWID bytes unchanged).
Log component availability (uuid/cpu/mac/hdd) once per distinct HWID,
and warn when WMI yields no components at all.
- Matcher widened only, generation untouched: exact-string match
short-circuits, UUID match accepts any WMI list entry (generator
hashes the last valid one), fuzzy-match point breakdown is logged so
field status-12 rejections are diagnosable.
- ANSLicense.cpp: fix inverted delete condition (!p != NULL) at 6 sites;
detect the shared "empty fingerprint" HWID of WMI-broken PCs and warn
with repair steps; mask activation keys in error strings.
- licensingclient.h: explain SetKey/validation/NTP failures on stderr.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1. core/ANSLicensingSystem/ANSLicense.h:268 — added default initializers to ModelConfig POD members (inpWidth = 0, inpHeight = 0, etc.). This was the actual bug: CreateANSODHandle declares a local ModelConfig and only sets a few fields, leaving inpWidth/inpHeight as indeterminate stack memory. On your machine that memory consistently held ~80, slipping past the <=0 → 640 guard and driving the ORT session at 80×80 — which crashes YOLOv11's /model.12/Concat because 2·ceil(80/32)=6 ≠ ceil(80/16)=5.
2. modules/ANSODEngine/ANSONNXYOLO.h:75 — ONNXYOLO::setInputShape() now snaps width/height up to the next multiple of 32 (with a 64-pixel floor). Defense in depth: even if a future caller hands in a non-stride-32 size, the FPN concat alignment is preserved.
3. modules/ANSODEngine/ANSONNXYOLO.cpp — two diagnostic additions:
WarmUpEngine bails with a clear log line if the warm-up dims aren't a multiple of 32, instead of letting the model.12 error fire and mask the real cause.
transform() logs the input shape, canvas shape, source size, and dynamic flag once per session in DebugView — so any future shape-mismatch crash points at the offending HxW directly.
Thread-local staging Mat (video_player.cpp:1400-1407) — single biggest win. Eliminates the 12 MB per-call malloc/free cycle.
Contiguous get_buffer2 allocator (video_decoder.cpp:35-102) — keeps the 3 bulk memcpys cache-friendly. Would also enable FAST/zero-copy for resolutions where visible_h % 64 == 0.
SW-decoder thread config (video_decoder.cpp:528-540) — thread_count=0, thread_type=FRAME|SLICE. FRAME is downgraded to SLICE-only by AV_CODEC_FLAG_LOW_DELAY, but decode throughput is sufficient for your input rate.
SetTargetFPS(100) delivery throttle (already there) — caps onVideoFrame post-decode work at 10 FPS. Keeps the caller path warm-cached.
Instrumentation — [MEDIA_DecInit] / [MEDIA_Convert] / [MEDIA_SWDec] / [MEDIA_Timing] / [MEDIA_JpegTiming] — always-on regression detector, zero cost when ANSCORE_DEBUGVIEW=OFF.