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_camera.cpp File Reference

Shared IMX500 capture, frame ownership and JPEG publication mechanics. More...

#include "imx500_camera.hpp"
#include "usher_frame_timing.h"
#include <algorithm>
#include <cerrno>
#include <chrono>
#include <condition_variable>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <filesystem>
#include <limits.h>
#include <mutex>
#include <setjmp.h>
#include <stdexcept>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <time.h>
#include <unistd.h>
#include <vector>
#include <fcntl.h>
#include <linux/dma-buf.h>
#include <linux/videodev2.h>
#include <jpeglib.h>
#include <libcamera/control_ids.h>
#include <libcamera/libcamera.h>
#include <libcamera/property_ids.h>
Include dependency graph for imx500_camera.cpp:

Go to the source code of this file.

Data Structures

struct  imx500::Camera::Impl
 Capture resources and the callback-to-owner handoff, not model results. More...

Namespaces

namespace  imx500

Functions

static bool imx500::encode_frame_jpeg (const char *path, const std::array< const uint8_t *, 3 > &planes, unsigned width, unsigned height, unsigned stride, const FrameView *view, const FrameProcessor *processor)
 Encode one YUV420 frame with optional same-exposure EXIF metadata.
bool imx500::encode_jpeg (const char *path, const std::array< const uint8_t *, 3 > &planes, unsigned width, unsigned height, unsigned stride)
 Encode validated YUV420 planes directly, without full-frame RGB staging.
bool imx500::publish_frame (const FrameView &frame, const std::array< const uint8_t *, 3 > &planes, unsigned stride, const char *filename, const FrameProcessor &processor)
 Publish caller-validated YUV420 planes and same-exposure evidence.
int imx500::run_worker (int argc, char **argv, const FrameProcessor &processor, const char *application)
 Run the shared probe/capture/READY-SHOT-OK worker with supplied model policy.
int imx500::run_photo_worker (int argc, char **argv, const char *application)
 Run photo-only probe, capture or serve without model loading or inference.

Detailed Description

Shared IMX500 capture, frame ownership and JPEG publication mechanics.

Camera ownership and model interpretation deliberately have separate lifetimes. Retaining one request keeps its pixels, crop, tensors and timestamps together without another image queue. Application callbacks decide what those tensors mean; this implementation only captures and publishes their evidence. The owner serializes camera operations and lease destruction; libcamera's completion callback uses a mutex only for the handoff, not for image processing.

Definition in file imx500_camera.cpp.