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

Streaming JPEG input for the same preprocessing used by live frames. More...

#include "inference_jpeg.h"
#include "jpeg_marker_guard.h"
#include <stdio.h>
#include <jpeglib.h>
#include <math.h>
#include <setjmp.h>
#include <string.h>
#include <sys/stat.h>
Include dependency graph for inference_jpeg.c:

Go to the source code of this file.

Data Structures

struct  jpeg_reader
 Caller-owned codec/error state that remains valid across decoder longjmp exits. More...

Functions

static void jpeg_failure (j_common_ptr codec)
 Convert libjpeg's fatal callback into a failed input instead of terminating the CAM worker.
static void jpeg_message (j_common_ptr codec, int level)
 Check JPEG marker bounds ahead of normal codec diagnostics.
static bool decode_jpeg (struct jpeg_reader *reader, struct inference_context *context)
 Fill a bound input tensor; ignore partial tensor/transform contents after any failure.
bool inference_jpeg_prepare (struct inference_context *context, const char *filename, char *error, size_t capacity)
 Stream a JPEG into an open context's single declared image input.

Detailed Description

Streaming JPEG input for the same preprocessing used by live frames.

Application scratch is two rows, not a decoded full-resolution RGB image; libjpeg's internal allocations remain separate from this bounded workspace.

Definition in file inference_jpeg.c.

Function Documentation

◆ decode_jpeg()

bool decode_jpeg ( struct jpeg_reader * reader,
struct inference_context * context )
static

Fill a bound input tensor; ignore partial tensor/transform contents after any failure.

Definition at line 66 of file inference_jpeg.c.

◆ inference_jpeg_prepare()

bool inference_jpeg_prepare ( struct inference_context * context,
const char * filename,
char * error,
size_t capacity )

Stream a JPEG into an open context's single declared image input.

Parameters
contextExclusive model owner; input storage and transform are written in place.
filenameReadable regular JPEG, immutable throughout decoding.
errorCaller-owned diagnostic buffer, cleared on success.
capacityAvailable bytes in error, including its terminator.
Returns
True for complete, warning-free decoding and supported preprocessing.
Warning
On failure discard the partially written tensor and transform; do not run inference.

Definition at line 167 of file inference_jpeg.c.

◆ jpeg_failure()

void jpeg_failure ( j_common_ptr codec)
static

Convert libjpeg's fatal callback into a failed input instead of terminating the CAM worker.

Definition at line 47 of file inference_jpeg.c.

◆ jpeg_message()

void jpeg_message ( j_common_ptr codec,
int level )
static

Check JPEG marker bounds ahead of normal codec diagnostics.

Parameters
codecDecoder carrying the borrowed jpeg_reader in client_data.
levellibjpeg diagnostic level.

Preserve the original handler for accepted messages so the inference wrapper can still observe codec warnings.

Definition at line 58 of file inference_jpeg.c.