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
imx500_tensor.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 OpenUAS
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/** @file imx500_tensor.h
19 * @brief Shared IMX500 tensor-info wire layout and bounded decoding policy.
20 * @details The object detector and LOOM interpret the same driver metadata.
21 * Keeping the offsets here prevents their camera ABI definitions drifting apart;
22 * model-specific interpretation remains with each consumer. */
23#ifndef SENSORAIA_IMX500_TENSOR_H
24#define SENSORAIA_IMX500_TENSOR_H
25
26#include <stdint.h>
27
28/** @brief Driver metadata header preceding the tensor count; not an RPK feature schema. */
29#define IMX500_TENSOR_HEADER_BYTES 64U
30/** @brief Little-endian 32-bit tensor count starts after the fixed header. */
31#define IMX500_TENSOR_COUNT_OFFSET IMX500_TENSOR_HEADER_BYTES
32/** @brief First record starts after the count, keeping offset arithmetic in one place. */
33#define IMX500_TENSOR_FIRST_RECORD_OFFSET (IMX500_TENSOR_COUNT_OFFSET + sizeof(uint32_t))
34/** @brief One record contains length, rank and sixteen 16-bit shape extents. */
35#define IMX500_TENSOR_RECORD_BYTES 40U
36/** @brief Element count offset within a record, distinct from its byte length. */
37#define IMX500_TENSOR_LENGTH_OFFSET 0U
38/** @brief Shape rank offset within a record. */
39#define IMX500_TENSOR_RANK_OFFSET 4U
40/** @brief First shape extent follows the two 32-bit fields. */
41#define IMX500_TENSOR_DIMENSIONS_OFFSET 8U
42/** @brief Each extent is a little-endian unsigned 16-bit value. */
43#define IMX500_TENSOR_DIMENSION_BYTES 2U
44/** @brief Fixed shape capacity in the driver ABI; reject greater ranks before indexing. */
45#define IMX500_TENSOR_MAX_RANK 16U
46/** @brief Metadata reserves sixteen records even when a model uses fewer outputs. */
47#define IMX500_TENSOR_MAX_COUNT 16U
48/** @brief Full accessible metadata required before following record offsets. */
49#define IMX500_TENSOR_INFO_BYTES \
50 (IMX500_TENSOR_FIRST_RECORD_OFFSET + IMX500_TENSOR_MAX_COUNT * IMX500_TENSOR_RECORD_BYTES)
51/** @brief Sensoraia's accepted element budget, not a claim about every RPK model. */
52#define IMX500_TENSOR_ELEMENT_LIMIT 4096U
53
54#endif