Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
loom_features.h File Reference

LOOM-owned bounded feature validation and evidence serialization. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for loom_features.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LOOM_FEATURES_TAG   0xc7a2U
 LOOM-owned camera-directory tag; its value is a LOOMNN02 opaque record.
#define LOOM_ONNX_FEATURES_TAG   0xc7a3U
#define LOOM_ONNX_FEATURE_CAPACITY   32768U

Functions

bool loom_features_valid (const float *values, size_t count, const uint8_t *information, size_t information_size)
 Validate finite features against the shared IMX500 shape metadata.
size_t loom_features_size (size_t count)
 Required bytes for 1..4096 floats, or zero for unsupported counts.
bool loom_features_pack (unsigned char *record, size_t capacity, const float *values, size_t count, const uint8_t *information, size_t information_size, uint64_t sequence, uint64_t sensor_timestamp_ns)
 Pack validated same-exposure shapes, exact uint64 identities and float bits.
bool loom_features_unpack (const unsigned char *record, size_t size, float *values, size_t capacity, uint8_t *information, size_t information_size, size_t *count, uint64_t *sequence, uint64_t *sensor_timestamp_ns)
 Validate and decode an exact-sized binary record into bounded output.
size_t loom_onnx_features_pack (unsigned char *record, size_t capacity, const struct inference_model *model, uint64_t sequence, uint64_t sensor_timestamp_ns)
 Encode a complete LOOMOX01 record without fabricating an IMX500 metadata header.
bool loom_onnx_features_valid (const unsigned char *record, size_t size, const char *model_sha256, const char *descriptor_sha256)
 Validate the exact binary layout and optionally require the same trained feature space.
bool loom_onnx_return_vector (const unsigned char *record, size_t size, const char *model_sha256, const char *descriptor_sha256, float values[3])
 Decode an explicitly declared two/three-value return-vector record.

Detailed Description

LOOM-owned bounded feature validation and evidence serialization.

Raw immutable buffers keep this core independent of libcamera and USHER process ownership. Valid feature transport is never navigation evidence.

Definition in file loom_features.h.

Macro Definition Documentation

◆ LOOM_FEATURES_TAG

#define LOOM_FEATURES_TAG   0xc7a2U

LOOM-owned camera-directory tag; its value is a LOOMNN02 opaque record.

Definition at line 30 of file loom_features.h.

◆ LOOM_ONNX_FEATURE_CAPACITY

#define LOOM_ONNX_FEATURE_CAPACITY   32768U

Definition at line 32 of file loom_features.h.

◆ LOOM_ONNX_FEATURES_TAG

#define LOOM_ONNX_FEATURES_TAG   0xc7a3U

Definition at line 31 of file loom_features.h.

Function Documentation

◆ loom_features_pack()

bool loom_features_pack ( unsigned char * record,
size_t capacity,
const float * values,
size_t count,
const uint8_t * information,
size_t information_size,
uint64_t sequence,
uint64_t sensor_timestamp_ns )

Pack validated same-exposure shapes, exact uint64 identities and float bits.

Precondition
Inputs remain immutable and do not overlap the destination.

Writes the LOOMNN02 format described in docs/exif.md. Invalid inputs leave output unchanged. The caller reserves this value in the JPEG's EXIF document; there is no filesystem access or feature-sized allocation here.

Definition at line 116 of file loom_features.c.

◆ loom_features_size()

size_t loom_features_size ( size_t count)

Required bytes for 1..4096 floats, or zero for unsupported counts.

Definition at line 100 of file loom_features.c.

◆ loom_features_unpack()

bool loom_features_unpack ( const unsigned char * record,
size_t size,
float * values,
size_t capacity,
uint8_t * information,
size_t information_size,
size_t * count,
uint64_t * sequence,
uint64_t * sensor_timestamp_ns )

Validate and decode an exact-sized binary record into bounded output.

Precondition
Inputs and writable outputs do not overlap; capacity is a float count.

On failure count is zero; other outputs must be discarded. Structural validity is not a model match. Check identity against the JPEG capture record before consuming features. No buffer is retained or allocated.

Definition at line 136 of file loom_features.c.

◆ loom_features_valid()

bool loom_features_valid ( const float * values,
size_t count,
const uint8_t * information,
size_t information_size )

Validate finite features against the shared IMX500 shape metadata.

Parameters
valuesBorrowed immutable float array for one exposure.
countAccessible float count.
informationBorrowed tensor-info bytes from that same exposure.
information_sizeAccessible metadata bytes.
Returns
True for bounded, consistent shapes and finite values; false otherwise.

Check shape products and cumulative length before reading values; rank/count limits bound both work and metadata access. No buffer is retained.

Note
This does not validate model semantics, feature similarity or a route.

Definition at line 47 of file loom_features.c.

◆ loom_onnx_features_pack()

size_t loom_onnx_features_pack ( unsigned char * record,
size_t capacity,
const struct inference_model * model,
uint64_t sequence,
uint64_t sensor_timestamp_ns )

Encode a complete LOOMOX01 record without fabricating an IMX500 metadata header.

Parameters
recordWritable destination, unchanged when validation rejects the input.
capacityAvailable bytes; records cannot exceed LOOM_ONNX_FEATURE_CAPACITY.
modelCompleted immutable float outputs and their exact graph/descriptor identities.
sequenceSource correlation, retained separately from any flight-controller shot number.
sensor_timestamp_nsPhysical sensor time when available; zero explicitly means unavailable.
Returns
Encoded byte count, or zero for invalid/nonfinite/oversized features.
Precondition
Input tensors and destination do not overlap. This transport does not establish a visual match.

Definition at line 39 of file loom_onnx_features.c.

◆ loom_onnx_features_valid()

bool loom_onnx_features_valid ( const unsigned char * record,
size_t size,
const char * model_sha256,
const char * descriptor_sha256 )

Validate the exact binary layout and optionally require the same trained feature space.

Parameters
recordImmutable LOOMOX01 bytes.
sizeExact record length; truncation and trailing bytes are rejected.
model_sha256Required graph digest, or NULL for structural validation only.
descriptor_sha256Required preprocessing digest, or NULL for structural validation only.
Returns
True for bounded finite features and matching supplied identities, not navigation validity.

Definition at line 102 of file loom_onnx_features.c.

◆ loom_onnx_return_vector()

bool loom_onnx_return_vector ( const unsigned char * record,
size_t size,
const char * model_sha256,
const char * descriptor_sha256,
float values[3] )

Decode an explicitly declared two/three-value return-vector record.

Parameters
recordRetained LOOMOX01 bytes from this JPEG.
sizeExact record length.
model_sha256Required graph identity, or NULL.
descriptor_sha256Required descriptor identity, or NULL.
valuesThree floats: first component, second component, confidence.
Returns
False unless exactly one finite two/three-value tensor is present.

A two-value model has no confidence output; 1 then means valid computation, not a measured probability. Frame semantics remain caller-owned.

Definition at line 142 of file loom_onnx_features.c.