86 mDriver->setProgressiveConfig(mDriverconfig);
93 if (mDriver->hasError(&err)) {
96 setError(
"Failed to begin JPEG decoding");
134 if (should_yield && (*should_yield)()) {
155 mDriver->setProgressiveConfig(mDriverconfig);
173 bool more_work =
mDriver->processChunk();
175 auto mDriverstate =
mDriver->getState();
176 switch (mDriverstate) {
221 return mImpl->begin(stream);
229 return mImpl->isReady();
233 return mImpl->hasError(msg);
241 return mImpl->decode(should_yield);
245 return mImpl->getCurrentFrame();
249 return mImpl->hasMoreFrames();
253 mImpl->setProgressiveConfig(config);
257 return mImpl->getProgressiveConfig();
261 return mImpl->getProgress();
265 return mImpl->hasPartialImage();
269 return mImpl->getPartialFrame();
273 return mImpl->getDecodedRows();
277 return mImpl->feedData(data);
281 return mImpl->needsMoreData();
285 return mImpl->getBytesProcessed();
289 return mImpl->getState();
299 *error_message =
"Frame pointer is null";
304 if (!frame->isFromCodec() || frame->getWidth() == 0 || frame->getHeight() == 0) {
306 *error_message =
"Target frame must be created with proper dimensions for in-place decoding";
315 if (!decoder->begin(stream)) {
317 decoder->hasError(error_message);
325 decoder->hasError(error_message);
330 Frame decoded = decoder->getCurrentFrame();
332 if (frame->getWidth() != decoded.
getWidth() || frame->getHeight() != decoded.
getHeight()) {
334 *error_message =
"Target frame dimensions do not match decoded image dimensions";
339 frame->
copy(decoded);
348 if (!decoder->begin(stream)) {
350 decoder->hasError(error_message);
358 decoder->hasError(error_message);
363 Frame frame = decoder->getCurrentFrame();
369 return decode(config, data, error_message);
390 *error_message =
"Frame pointer is null";
399 if (!decoder->begin(stream)) {
401 decoder->hasError(error_message);
407 fl::u32 deadline = start_time + timeout_ms;
412 *mProgressout = decoder->getProgress();
418 Frame decoded = decoder->getCurrentFrame();
420 if (frame->getWidth() != decoded.
getWidth() || frame->getHeight() != decoded.
getHeight()) {
422 *error_message =
"Target frame dimensions do not match decoded image dimensions";
427 frame->
copy(decoded);
431 decoder->hasError(error_message);
438 *mProgressout = decoder->getProgress();
447 fl::u32 max_time_per_chunk_ms,
450 if (!frame || !input_stream) {
458 decoder->setProgressiveConfig(prog_config);
460 if (!decoder->begin(input_stream)) {
466 if (mProgresscallback) {
468 float progress = decoder->getProgress();
469 return !mProgresscallback(progress);
475 Frame decoded = decoder->getCurrentFrame();
481 frame->
copy(decoded);
FastLED chrono implementation - duration types for time measurements.
void copy(const Frame &other) FL_NO_EXCEPT
bool isValid() const FL_NO_EXCEPT
fl::u16 getHeight() const FL_NO_EXCEPT
fl::u16 getWidth() const FL_NO_EXCEPT
static bool decodeWithTimeout(const JpegConfig &config, fl::span< const fl::u8 > data, Frame *frame, fl::u32 timeout_ms, float *progress_out=nullptr, fl::string *error_message=nullptr) FL_NO_EXCEPT
static bool decode(const JpegConfig &config, fl::span< const fl::u8 > data, Frame *frame, fl::string *error_message=nullptr) FL_NO_EXCEPT
static bool isSupported() FL_NO_EXCEPT
static bool decodeStream(const JpegConfig &config, fl::filebuf_ptr input_stream, Frame *frame, fl::u32 max_time_per_chunk_ms=4, fl::function< bool(float)> progress_callback={}) FL_NO_EXCEPT
static JpegInfo parseInfo(fl::span< const fl::u8 > data, fl::string *error_message=nullptr) FL_NO_EXCEPT
static JpegDecoderPtr createDecoder(const JpegConfig &config) FL_NO_EXCEPT
bool begin(fl::filebuf_ptr stream) FL_NO_EXCEPT
~Impl() FL_NO_EXCEPT=default
bool feedData(fl::span< const fl::u8 > data) FL_NO_EXCEPT
fl::u8 getScale() const FL_NO_EXCEPT
DecodeResult decode(fl::optional< fl::function< bool()> > should_yield) FL_NO_EXCEPT
Frame getCurrentFrame() FL_NO_EXCEPT
bool processChunk() FL_NO_EXCEPT
fl::size getBytesProcessed() const FL_NO_EXCEPT
fl::u16 getDecodedRows() const FL_NO_EXCEPT
Frame getPartialFrame() FL_NO_EXCEPT
bool hasMoreFrames() const FL_NO_EXCEPT
bool needsMoreData() const FL_NO_EXCEPT
void setProgressiveConfig(const ProgressiveConfig &config) FL_NO_EXCEPT
float getProgress() const FL_NO_EXCEPT
JpegDecoder::State mState
Impl(const JpegConfig &config) FL_NO_EXCEPT
ProgressiveConfig getProgressiveConfig() const FL_NO_EXCEPT
void setError(const fl::string &message) FL_NO_EXCEPT
bool hasError(fl::string *msg=nullptr) const FL_NO_EXCEPT
ProgressiveConfig progressive_mConfig
fl::third_party::TJpgInstanceDecoderPtr mDriver
JpegDecoder::State getState() const FL_NO_EXCEPT
bool hasPartialImage() const FL_NO_EXCEPT
bool isReady() const FL_NO_EXCEPT
bool needsMoreData() const FL_NO_EXCEPT
fl::unique_ptr< Impl > mImpl
fl::u16 getDecodedRows() const FL_NO_EXCEPT
bool isReady() const FL_NO_EXCEPT override
JpegDecoder(const JpegConfig &config) FL_NO_EXCEPT
Frame getPartialFrame() FL_NO_EXCEPT
void end() FL_NO_EXCEPT override
fl::size getBytesProcessed() const FL_NO_EXCEPT
DecodeResult decode() FL_NO_EXCEPT override
bool begin(fl::filebuf_ptr stream) FL_NO_EXCEPT override
ProgressiveConfig getProgressiveConfig() const FL_NO_EXCEPT
void setProgressiveConfig(const ProgressiveConfig &config) FL_NO_EXCEPT
Frame getCurrentFrame() FL_NO_EXCEPT override
State getState() const FL_NO_EXCEPT
bool feedData(fl::span< const fl::u8 > data) FL_NO_EXCEPT
bool hasMoreFrames() const FL_NO_EXCEPT override
float getProgress() const FL_NO_EXCEPT
~JpegDecoder() FL_NO_EXCEPT override
bool hasError(fl::string *msg=nullptr) const FL_NO_EXCEPT override
bool hasPartialImage() const FL_NO_EXCEPT
Centralized logging categories for FastLED hardware interfaces and subsystems.
fl::enable_if<!fl::is_array< T >::value, unique_ptr< T > >::type make_unique(Args &&... args) FL_NO_EXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
fl::shared_ptr< TJpgInstanceDecoder > TJpgInstanceDecoderPtr
TJpgInstanceDecoderPtr createTJpgInstanceDecoder() FL_NO_EXCEPT
fl::u32 max_time_per_tick_ms
fl::u16 max_mcus_per_tick
u8 u8 fract8 blur_amount FL_NO_EXCEPT
fl::u32 millis() FL_NO_EXCEPT
Universal millisecond timer - returns milliseconds since system startup.
fl::string format(const char *fmt) FL_NO_EXCEPT
Format with no arguments.
expected< T, E > result
Alias for expected (Rust-style naming)
fl::shared_ptr< filebuf > filebuf_ptr
constexpr nullopt_t nullopt
fl::shared_ptr< JpegDecoder > JpegDecoderPtr
Base definition for an LED controller.
JpegConfig() FL_NO_EXCEPT=default
JpegInfo() FL_NO_EXCEPT=default
fl::u32 max_time_per_tick_ms