Loading...
Searching...
No Matches
Convert one baseline JPEG into a row-major BGRA working raster.
More...
#include <jpeg_stream.h>
|
| | 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.
|
|
| void | reset () noexcept |
| | Release per-decode state while retaining reusable pixel storage.
|
|
| 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.
|
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.
◆ 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.
◆ 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] | source | Input baseline JPEG path. |
| [in] | target | Destination raster path; existing files are not replaced. |
| [in] | width | Expected source width in pixels. |
| [in] | height | Expected source height in pixels. |
| [in] | stopped | Cooperative cancellation predicate. |
- Exceptions
-
| std::runtime_error | For 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
-
| state | Decoder 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
-
| state | Decoder carrying the saved diagnostic handler. |
| level | libjpeg diagnostic level. |
Definition at line 75 of file jpeg_stream.h.
◆ operator=()
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
-
| source | JPEG path with dimensions matching its capture metadata. |
| width | Expected full-resolution width. |
| height | Expected full-resolution height. |
| maxSide | Preferred longest decoded side, or zero for full resolution. |
- Returns
- Owned BGRA pixels and the decoder's intrinsic scaling ratio.
- Exceptions
-
| std::runtime_error | For 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.
◆ created_
| bool pangea_survey::JpegStream::created_ = false |
|
private |
◆ decoder_
| jpeg_decompress_struct pangea_survey::JpegStream::decoder_ {} |
|
private |
◆ error_
◆ image_
| Image pangea_survey::JpegStream::image_ |
|
private |
◆ input_
| FILE* pangea_survey::JpegStream::input_ = nullptr |
|
private |
◆ output_
| std::unique_ptr<std::ofstream> pangea_survey::JpegStream::output_ |
|
private |
◆ row_
| std::vector<unsigned char> pangea_survey::JpegStream::row_ |
|
private |
The documentation for this class was generated from the following file: