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.c File Reference

Bounded LOOM feature validation and exact binary EXIF transport. More...

#include "loom_features.h"
#include "imx500_tensor.h"
#include <float.h>
#include <math.h>
Include dependency graph for loom_features.c:

Go to the source code of this file.

Functions

static uint32_t feature_u32 (const uint8_t *data)
 Read four checked little-endian bytes without an unaligned cast.
static uint32_t feature_extent (const uint8_t *record, uint32_t dimension)
 Read a bounded shape extent from one driver tensor record.
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.
static void feature_put (unsigned char *data, uint64_t value, size_t bytes)
 Encode one little-endian field in a LOOM evidence record.
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.

Detailed Description

Bounded LOOM feature validation and exact binary EXIF transport.

The capture owner supplies immutable same-exposure buffers; this core neither acquires a camera nor decides whether a navigation match exists.

Definition in file loom_features.c.

Function Documentation

◆ feature_extent()

uint32_t feature_extent ( const uint8_t * record,
uint32_t dimension )
static

Read a bounded shape extent from one driver tensor record.

Parameters
recordFull accessible tensor-info record.
dimensionValidated zero-based dimension below the rank limit.
Returns
The little-endian unsigned 16-bit extent, widened for checked arithmetic.

Definition at line 41 of file loom_features.c.

◆ feature_put()

void feature_put ( unsigned char * data,
uint64_t value,
size_t bytes )
static

Encode one little-endian field in a LOOM evidence record.

Parameters
[out]dataStorage validated by the caller for bytes octets.
valueUnsigned bits to write.
bytesField width, at most eight.

Pack explicit bytes so persisted data does not depend on host byte order or alignment.

Definition at line 111 of file loom_features.c.

◆ feature_u32()

uint32_t feature_u32 ( const uint8_t * data)
static

Read four checked little-endian bytes without an unaligned cast.

Parameters
dataAt least four bytes inside validated tensor metadata.
Returns
Unsigned component value in host representation.

Definition at line 31 of file loom_features.c.

◆ 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.