Loading...
Searching...
No Matches
Guarded retained-vector return processing and transactional T1 policy.
More...
#include "camera_backend.h"
#include "loom_return.h"
#include "loom_features.h"
#include "../../src/inference_settings.h"
#include "../../src/inference_model.h"
#include "../../src/inference_jpeg.h"
#include "../../src/exifite.h"
#include "../../src/imx500_tensor.h"
#include <errno.h>
#include <inttypes.h>
#include <math.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
Go to the source code of this file.
|
| struct | loom_frame |
| | Borrowed per-invocation input; no member owns or acquires a camera. More...
|
|
| static bool | return_settings (const char *path, struct inference_settings *settings, struct loom_return_options *options) |
| | Reuse common path/INI policy without opening a model or camera.
|
| static bool | description_lookup (const struct exif_value *description, const char *key, char value[64], bool *found) |
| | Read one bounded observation field from an already-fetched EXIF description.
|
| static bool | description_field (const struct exif_value *description, const char *key, char value[64]) |
| | Require a uniquely identified flight-description value.
|
| static bool | description_number (const struct exif_value *description, const char *key, double *number) |
| | Read a required finite numeric metadata field.
|
| static bool | description_optional_number (const struct exif_value *description, const char *key, double default_value, double *number) |
| | Read numeric metadata with a default for absence only.
|
| static bool | read_onnx_descriptor_identity (const struct inference_settings *settings, char graph[65], char descriptor[65]) |
| | Read the graph and descriptor identities declared by the model metadata.
|
| static uint64_t | feature_u64 (const unsigned char *bytes) |
| | Decode an unsigned field from LOOM's little-endian record.
|
| static bool | run_onnx_in_memory (const struct inference_settings *settings, const struct loom_return_options *options, const char *image, uint64_t sequence, uint64_t timestamp_ns, unsigned char *record, size_t capacity, size_t *record_size) |
| | Generate bounded LOOM feature evidence for an existing JPEG.
|
| static bool | match_previous_photos (const struct loom_frame *frame, struct camera_point_result *point) |
| | Interpret retained same-photo neural vectors under the declared return contract.
|
| static bool | parse_sequence (const char *text, uint32_t *sequence) |
| | Parse a nonzero correlation sequence without truncation or signed input.
|
| static int | simulation_mode (int argc, char **argv) |
| | Describe whether PC imagery can run a selected ONNX graph.
|
| static int | return_line (char *line, size_t capacity, unsigned timeout_ms) |
| | Split one bounded ASCII command, rejecting binary/trailing/oversized input.
|
| static int | return_server (int argc, char **argv) |
| | Keep bounded T1 state separate from the waypoint transport transaction.
|
| static int | self_test (void) |
| | Hardware-free check that the empty matcher cannot manufacture a waypoint.
|
| int | main (int argc, char **argv) |
| | Parse one saved-photo request and emit exactly one correlated result line.
|
Guarded retained-vector return processing and transactional T1 policy.
Declared model vectors, aligned observation metadata and configured HOME produce bounded point proposals from explicitly declared model vectors. Outbound references are archived; reference-image matching is not implemented.
Definition in file loomcam.c.
◆ LOOM_DECIMAL_RADIX
| #define LOOM_DECIMAL_RADIX 10 |
The CLI accepts decimal photo numbers, never signed or truncated IDs.
Definition at line 46 of file loomcam.c.
◆ LOOM_SELF_TEST_LATITUDE
| #define LOOM_SELF_TEST_LATITUDE INT32_C(1) |
Nonzero latitude fixture checks that no-match clears stale evidence.
Definition at line 53 of file loomcam.c.
◆ LOOM_SELF_TEST_SEQUENCE
| #define LOOM_SELF_TEST_SEQUENCE UINT32_C(1) |
Nonzero fixtures deliberately expose failure to clear previous state.
Definition at line 51 of file loomcam.c.
◆ LOOM_SELF_TEST_SEQUENCE_OVERFLOW
| #define LOOM_SELF_TEST_SEQUENCE_OVERFLOW "4294967296" |
First integer outside the accepted uint32_t correlation range.
Definition at line 55 of file loomcam.c.
◆ anonymous enum
| Enumerator |
|---|
| LOOM_CONFIRMATION_TIMEOUT_MS | |
Definition at line 49 of file loomcam.c.
◆ loom_cli_layout
argv[0] is the program name; a sole flag gives two total arguments.
| Enumerator |
|---|
| LOOM_FIRST_OPTION_INDEX | |
| LOOM_SINGLE_OPTION_ARGC | |
Definition at line 48 of file loomcam.c.
◆ description_field()
| bool description_field |
( |
const struct exif_value * | description, |
|
|
const char * | key, |
|
|
char | value[64] ) |
|
static |
Require a uniquely identified flight-description value.
- Parameters
-
| description | EXIF description to scan. |
| key | Exact field prefix including the equals sign. |
| [out] | value | Buffer for up to 63 characters and the terminator. |
- Returns
- True only if a well-formed matching field was found.
Use the duplicate-aware lookup even when absence is an error.
Definition at line 110 of file loomcam.c.
◆ description_lookup()
| bool description_lookup |
( |
const struct exif_value * | description, |
|
|
const char * | key, |
|
|
char | value[64], |
|
|
bool * | found ) |
|
static |
Read one bounded observation field from an already-fetched EXIF description.
Definition at line 75 of file loomcam.c.
◆ description_number()
| bool description_number |
( |
const struct exif_value * | description, |
|
|
const char * | key, |
|
|
double * | number ) |
|
static |
Read a required finite numeric metadata field.
- Parameters
-
| description | EXIF description to scan. |
| key | Exact field prefix including the equals sign. |
| [out] | number | Parsed value, written on success. |
- Returns
- True for a present, fully parsed number.
Reject missing and malformed fields alike when no default is allowed.
Definition at line 122 of file loomcam.c.
◆ description_optional_number()
| bool description_optional_number |
( |
const struct exif_value * | description, |
|
|
const char * | key, |
|
|
double | default_value, |
|
|
double * | number ) |
|
static |
Read numeric metadata with a default for absence only.
- Parameters
-
| description | EXIF description to scan. |
| key | Exact field prefix including the equals sign. |
| default_value | Result if the key is absent. |
| [out] | number | Parsed or default value on success. |
- Returns
- False for malformed or duplicate evidence, even if a default exists.
Keep corrupt evidence distinct from older records missing an optional field.
Definition at line 135 of file loomcam.c.
◆ feature_u64()
| uint64_t feature_u64 |
( |
const unsigned char * | bytes | ) |
|
|
static |
Decode an unsigned field from LOOM's little-endian record.
- Parameters
-
| bytes | At least eight readable bytes. |
- Returns
- Decoded unsigned value.
Assemble bytes rather than reading a native word at a potentially unaligned record offset.
Definition at line 180 of file loomcam.c.
◆ main()
| int main |
( |
int | argc, |
|
|
char ** | argv ) |
Parse one saved-photo request and emit exactly one correlated result line.
- Parameters
-
| argc | Number of program-name and option/value arguments. |
| argv | Borrowed command-line tokens; paths are passed without a shell. |
- Returns
- EXIT_SUCCESS for a processed photo, including no-match; EXIT_FAILURE for invalid input or output failure. Diagnostics use stderr, results stdout.
The embedded entry point shares the C++ capture executable but does not acquire the sensor. A syntactically successful reply is not a valid match.
Definition at line 592 of file loomcam.c.
◆ match_previous_photos()
Interpret retained same-photo neural vectors under the declared return contract.
- Parameters
-
| frame | Current saved AIcam photo and reference/model configuration. |
| point | Required destination in camera-point wire units. |
- Returns
- False when model/pose/identity/direction validation rejects the photo.
- Warning
- Never replace no-match with the current pose, home position or guessed direction: those would look like valid navigation evidence on the FC.
Generic embeddings are never guessed to be return directions. Only the PC simulation harness may turn them into an explicitly marked mock vector. The persistent owner subsequently limits movement and suppresses stale phases.
Definition at line 240 of file loomcam.c.
◆ parse_sequence()
| bool parse_sequence |
( |
const char * | text, |
|
|
uint32_t * | sequence ) |
|
static |
Parse a nonzero correlation sequence without truncation or signed input.
- Parameters
-
| text | Entire decimal token; no whitespace, sign or suffix is accepted. |
| [out] | sequence | Destination, written only on successful validation. |
- Returns
- True for a positive uint32_t photo number; false otherwise.
Definition at line 384 of file loomcam.c.
◆ read_onnx_descriptor_identity()
| bool read_onnx_descriptor_identity |
( |
const struct inference_settings * | settings, |
|
|
char | graph[65], |
|
|
char | descriptor[65] ) |
|
static |
Read the graph and descriptor identities declared by the model metadata.
- Parameters
-
| settings | Selected model and descriptor paths. |
| [out] | graph | Buffer for the declared graph digest. |
| [out] | descriptor | Buffer for the descriptor digest. |
- Returns
- True after parsing the bounded descriptor and checking model readability.
Read descriptor identity without creating a runtime session. This helper does not hash the graph file itself.
Definition at line 155 of file loomcam.c.
◆ return_line()
| int return_line |
( |
char * | line, |
|
|
size_t | capacity, |
|
|
unsigned | timeout_ms ) |
|
static |
Split one bounded ASCII command, rejecting binary/trailing/oversized input.
Definition at line 452 of file loomcam.c.
◆ return_server()
| int return_server |
( |
int | argc, |
|
|
char ** | argv ) |
|
static |
Keep bounded T1 state separate from the waypoint transport transaction.
Definition at line 478 of file loomcam.c.
◆ return_settings()
Reuse common path/INI policy without opening a model or camera.
Definition at line 396 of file loomcam.c.
◆ run_onnx_in_memory()
| bool run_onnx_in_memory |
( |
const struct inference_settings * | settings, |
|
|
const struct loom_return_options * | options, |
|
|
const char * | image, |
|
|
uint64_t | sequence, |
|
|
uint64_t | timestamp_ns, |
|
|
unsigned char * | record, |
|
|
size_t | capacity, |
|
|
size_t * | record_size ) |
|
static |
Generate bounded LOOM feature evidence for an existing JPEG.
- Parameters
-
| settings | ONNX model assignment and runtime configuration. |
| options | Contract that governs acceptable output shape. |
| image | Input JPEG path. |
| sequence | Frame identity to embed. |
| timestamp_ns | Sensor timestamp in nanoseconds to embed. |
| [out] | record | Destination for packed feature evidence. |
| capacity | Available bytes in record. |
| [out] | record_size | Packed length; use only on success. |
- Returns
- True after successful inference and packing.
Validate tensor shape before inference, enforce the stricter direction-vector shape when required, and serialize before closing the session. Calls must not overlap because the context is shared.
Definition at line 200 of file loomcam.c.
◆ self_test()
Hardware-free check that the empty matcher cannot manufacture a waypoint.
- Returns
- EXIT_SUCCESS when clearing, correlation and invalid-ID rejection hold.
- Note
- The image is not opened here; this tests the stub contract, not capture.
Definition at line 567 of file loomcam.c.
◆ simulation_mode()
| int simulation_mode |
( |
int | argc, |
|
|
char ** | argv ) |
|
static |
Describe whether PC imagery can run a selected ONNX graph.
Definition at line 417 of file loomcam.c.