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
pangea_survey::JpegStream Class Reference

Convert one baseline JPEG into a row-major BGRA working raster. More...

#include <jpeg_stream.h>

Collaboration diagram for pangea_survey::JpegStream:

Data Structures

struct  Error
struct  Operation
struct  Image
 Decoded preview and its scale relative to the source camera image. More...

Public Member Functions

 JpegStream ()=default
 Construct an idle decoder; files are opened per operation.
 ~JpegStream ()
 Release any remaining codec and stream resources.
 JpegStream (const JpegStream &)=delete
 Noncopyable: the decoder and streams have a single owner.
JpegStream & operator= (const JpegStream &)=delete
 Nonassignable: active streams and recovery state cannot be copied.
Image read (const std::filesystem::path &source, int width, int height, int maxSide)
 Read a JPEG preview without retaining the compressed file in memory.
void decode (const std::filesystem::path &source, const std::filesystem::path &target, int width, int height, const std::function< bool()> &stopped)
 Stream a source JPEG into a new, atomically published raster file.

Private Member Functions

void reset () noexcept
 Release per-decode state while retaining reusable pixel storage.

Static Private Member Functions

static void failure (j_common_ptr state)
 Preserve the codec diagnostic and jump to the decode recovery point.
static void message (j_common_ptr state, int level)
 Check markers before forwarding the codec diagnostic.

Private Attributes

struct pangea_survey::JpegStream::Error error_
jpeg_decompress_struct decoder_ {}
FILE * input_ = nullptr
bool created_ = false
std::vector< unsigned char > row_
std::unique_ptr< std::ofstream > output_
Image image_

Detailed Description

Convert one baseline JPEG into a row-major BGRA working raster.

Instances own decoder state and a reusable scanline buffer and must not be shared across concurrent decodes.

Definition at line 52 of file jpeg_stream.h.

Constructor & Destructor Documentation

◆ JpegStream() [1/2]

pangea_survey::JpegStream::JpegStream ( )
default

Construct an idle decoder; files are opened per operation.

◆ ~JpegStream()

pangea_survey::JpegStream::~JpegStream ( )
inline

Release any remaining codec and stream resources.

Definition at line 109 of file jpeg_stream.h.

◆ JpegStream() [2/2]

pangea_survey::JpegStream::JpegStream ( const JpegStream & )
delete

Noncopyable: the decoder and streams have a single owner.

Member Function Documentation

◆ decode()

void pangea_survey::JpegStream::decode ( const std::filesystem::path & source,
const std::filesystem::path & target,
int width,
int height,
const std::function< bool()> & stopped )
inline

Stream a source JPEG into a new, atomically published raster file.

Parameters
[in]sourceInput baseline JPEG path.
[in]targetDestination raster path; existing files are not replaced.
[in]widthExpected source width in pixels.
[in]heightExpected source height in pixels.
[in]stoppedCooperative cancellation predicate.
Exceptions
std::runtime_errorFor invalid dimensions, decode/write errors, damaged JPEG data, or cancellation.

Definition at line 182 of file jpeg_stream.h.

◆ failure()

void pangea_survey::JpegStream::failure ( j_common_ptr state)
inlinestaticprivate

Preserve the codec diagnostic and jump to the decode recovery point.

Parameters
stateDecoder carrying this instance's error manager.

The outer operation owns cleanup and C++ exception translation.

Definition at line 67 of file jpeg_stream.h.

◆ message()

void pangea_survey::JpegStream::message ( j_common_ptr state,
int level )
inlinestaticprivate

Check markers before forwarding the codec diagnostic.

Parameters
stateDecoder carrying the saved diagnostic handler.
levellibjpeg diagnostic level.

Definition at line 75 of file jpeg_stream.h.

◆ operator=()

JpegStream & pangea_survey::JpegStream::operator= ( const JpegStream & )
delete

Nonassignable: active streams and recovery state cannot be copied.

◆ read()

Image pangea_survey::JpegStream::read ( const std::filesystem::path & source,
int width,
int height,
int maxSide )
inline

Read a JPEG preview without retaining the compressed file in memory.

Parameters
sourceJPEG path with dimensions matching its capture metadata.
widthExpected full-resolution width.
heightExpected full-resolution height.
maxSidePreferred longest decoded side, or zero for full resolution.
Returns
Owned BGRA pixels and the decoder's intrinsic scaling ratio.
Exceptions
std::runtime_errorFor damaged JPEGs, invalid dimensions or I/O errors.

Definition at line 121 of file jpeg_stream.h.

◆ reset()

void pangea_survey::JpegStream::reset ( )
inlineprivatenoexcept

Release per-decode state while retaining reusable pixel storage.

Clear the creation flag and stream pointers so repeated cleanup after an error is safe.

Definition at line 82 of file jpeg_stream.h.

Field Documentation

◆ created_

bool pangea_survey::JpegStream::created_ = false
private

Definition at line 61 of file jpeg_stream.h.

◆ decoder_

jpeg_decompress_struct pangea_survey::JpegStream::decoder_ {}
private

Definition at line 59 of file jpeg_stream.h.

◆ error_

struct pangea_survey::JpegStream::Error pangea_survey::JpegStream::error_
private

◆ image_

Image pangea_survey::JpegStream::image_
private

Definition at line 104 of file jpeg_stream.h.

◆ input_

FILE* pangea_survey::JpegStream::input_ = nullptr
private

Definition at line 60 of file jpeg_stream.h.

◆ output_

std::unique_ptr<std::ofstream> pangea_survey::JpegStream::output_
private

Definition at line 63 of file jpeg_stream.h.

◆ row_

std::vector<unsigned char> pangea_survey::JpegStream::row_
private

Definition at line 62 of file jpeg_stream.h.


The documentation for this class was generated from the following file: