Loading...
Searching...
No Matches
lwir_mock.c
Go to the documentation of this file.
49/** @brief Static workspace: maximum-size buffers would be too large for the stack and the heap is avoided.
110 /* Every libjpeg failure lands here; only static state is touched afterwards, so no volatile is needed. */
119 if (embedded && (decoder->image_width != *width || decoder->image_height != *height)) valid = false;
220 /* Stays true unless a sensor (LWIRRAW1) layer is found, so absent provenance defaults to synthetic. */
226 bool success = layer >= 0 && fseeko(input, 0, SEEK_SET) == 0 && decode_mock(input, &width, &height, layer == 1);
229 /* Out-of-place output must not exist yet; any lstat error other than ENOENT is also a refusal. */
246 success = attach_layer(input, output, width, height) && fflush(output) == 0 && fsync(fileno(output)) == 0;
249 /* The renderer creates its file by path, so release the reserved name; it is briefly unclaimed. */
260 if (success && exif_read_jpeg(input_path, mock_workspace.exif, sizeof(mock_workspace.exif), &exif_size) == 0) {
262 success = output && exif_update_jpeg(output, mock_workspace.exif, exif_size) == 0 && fsync(fileno(output)) == 0;
270 original.st_mtim.tv_sec != current.st_mtim.tv_sec || original.st_mtim.tv_nsec != current.st_mtim.tv_nsec) success = false;
Bounded C11 EXIF metadata and JPEG streaming interfaces.
int exif_read_jpeg(const char *filename, unsigned char *payload, size_t capacity, size_t *size)
Read the single EXIF APP1 segment before the first JPEG scan.
Definition exifite.c:1022
#define EXIF_MAX_PAYLOAD
APP1 payload ceiling: the JPEG length includes its own two bytes.
Definition exifite.h:51
int exif_update_jpeg(FILE *file, const unsigned char *payload, size_t size)
Replace EXIF in a regular JPEG file without a temporary file.
Definition exifite.c:1649
int lwir_read_temperature_stream(FILE *input, uint8_t *destination, size_t capacity, unsigned *width, unsigned *height, bool *synthetic)
Public stream reader without geometry; see lwir_container.h.
Definition lwir_container.c:239
Exact thermal evidence in JPEG containers, independent of analysis.
size_t lwir_frame_bytes(unsigned width, unsigned height)
Combined frame size for supported geometry.
Definition lwir_frame.c:56
Native frame arithmetic and camera measurements; no codec or flight dependencies.
#define LWIR_MAX_FRAME_BYTES
Largest combined frame: two planes of 2 bytes per pixel.
Definition lwir_frame.h:51
bool lwir_write_jpeg_rendered(const char *path, const uint8_t *frame, size_t bytes, unsigned width, unsigned height, bool synthetic, const struct lwir_evidence *evidence, const struct lwir_render_options *render)
Publish a rendered view with provenance; see lwir_image.h.
Definition lwir_image.c:522
uint8_t marker[LWIR_THERMAL_HEADER_BYTES+LWIR_THERMAL_CHUNK_CAPACITY]
Definition lwir_image.c:62
JPEG encoding and durable no-overwrite publication of LWIR frames.
static void write_u32(uint8_t *output, uint32_t number)
Store a 32-bit value little-endian.
Definition lwir_mock.c:154
static uint16_t synthetic_raw(uint8_t luminance)
Map display luminance to a synthetic Kelvin*64 sample.
Definition lwir_mock.c:85
int lwir_process_mock(const char *input_path, const char *output_path, bool layer_only)
Produce mock LWIR evidence from input_path at output_path.
Definition lwir_mock.c:208
static bool decode_mock(FILE *input, unsigned *width, unsigned *height, bool embedded)
Decode a JPEG into the combined workspace frame.
Definition lwir_mock.c:104
static struct @327164226255333372052267047366105116027344330166 mock_workspace
Static workspace: maximum-size buffers would be too large for the stack and the heap is avoided.
static bool attach_layer(FILE *input, FILE *output, unsigned width, unsigned height)
Copy a JPEG while inserting the workspace temperature plane as LWIRSIM1 APP15 chunks.
Definition lwir_mock.c:171
Optional development replay adapter, independent of geographic analysis.
Display rendering of Tiny1-C frames into JPEG-ready Y/Cb/Cr scanlines.
Display policy for one rendering request; never affects stored samples.
Definition lwir_render.h:103