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
camera_speedtest.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#ifndef DIGITAL_CAM_USHER_CAMERA_SPEEDTEST_H
19#define DIGITAL_CAM_USHER_CAMERA_SPEEDTEST_H
20
21/**
22 * @file camera_speedtest.h
23 * @brief Standalone, backend-neutral still-camera throughput benchmark.
24 */
25
26#include <signal.h>
27#include <stdbool.h>
28#include <stddef.h>
29
30#define CAMERA_SPEEDTEST_SAMPLE_COUNT 10
31#define CAMERA_SPEEDTEST_FIRST_IMAGE 900000
32#define CAMERA_SPEEDTEST_LAST_IMAGE 999999
33
34/**
35 * @brief Immutable dependencies for one selected and initialized camera backend.
36 * @details The benchmark deliberately receives only the synchronous capture operation
37 * and output naming information. It does not own backend initialization, UART traffic,
38 * EXIF processing, or SODA; including them would turn a camera measurement into a
39 * system-load measurement.
40 */
42 /** Human-readable backend name included in the final report. */
43 const char *backend_name;
44 /** Directory receiving the private benchmark subdirectory and retained JPEGs. */
45 const char *photo_directory;
46 /** Backend-specific filename prefix, such as @c a for AIcam or @c l for LWIRcam. */
48 /** Capture returns a staged path requiring publication outside the timed adapter call. */
50 /** Synchronous backend capture operation; returns its actual output path in @p filename. */
51 int (*shoot)(char *filename, size_t filename_size, int image_number);
52 /** Shared shutdown flag set by signal handling; checked between bounded captures. */
53 volatile sig_atomic_t *keep_running;
54};
55
56/**
57 * @brief Atomically create a private directory for one benchmark run.
58 * @param base_directory Configured backend photo root.
59 * @param output Receives the new directory path.
60 * @param output_size Capacity of @p output.
61 * @return 0 on success, otherwise -1 with errno set.
62 * @details A private mode-0700 directory prevents benchmark backends, which normally
63 * replace same-number files, from racing with or overwriting mission photographs.
64 */
65int camera_speedtest_create_output_directory(const char *base_directory,
66 char *output, size_t output_size);
67
68/**
69 * @brief Find an unused consecutive image-number block for warm-up and samples.
70 * @param config Backend filename information.
71 * @param first_image Receives the warm-up image number.
72 * @return 0 on success, -1 on invalid input, filesystem error, or exhausted range.
73 * @details USHER camera backends replace an existing same-number image. Preflighting
74 * the complete block before camera initialization keeps benchmark evidence separate
75 * from mission captures and prevents accidental replacement of an existing photo.
76 */
78 int *first_image);
79
80/**
81 * @brief Capture one untimed warm-up image and ten timed images sequentially.
82 * @param config Selected and initialized camera backend.
83 * @param first_image Warm-up image number returned by camera_speedtest_find_image_block().
84 * @return 0 only when every requested image was captured and validated.
85 * @details Only synchronous shoot time is used for camera throughput. Progress records
86 * are written through bounded nonblocking I/O by a separate reporter thread, so a slow
87 * terminal cannot delay capture requests or inflate measured camera latency. Images
88 * are retained for review.
89 */
90int camera_speedtest_run(const struct camera_speedtest_config *config, int first_image);
91
92#endif /* DIGITAL_CAM_USHER_CAMERA_SPEEDTEST_H */
int camera_speedtest_create_output_directory(const char *base_directory, char *output, size_t output_size)
Atomically create a private directory for one benchmark run.
int camera_speedtest_run(const struct camera_speedtest_config *config, int first_image)
Capture one untimed warm-up image and ten timed images sequentially.
int camera_speedtest_find_image_block(const struct camera_speedtest_config *config, int *first_image)
Find an unused consecutive image-number block for warm-up and samples.
static FILE * output
Definition pose_log.c:77
Immutable dependencies for one selected and initialized camera backend.
volatile sig_atomic_t * keep_running
int(* shoot)(char *filename, size_t filename_size, int image_number)