60 fl::size bytes_read =
input_stream_->read(chunk,
sizeof(chunk));
61 if (bytes_read == 0)
break;
63 fl::size old_size = temp_buffer.
size();
64 temp_buffer.
resize(old_size + bytes_read);
90 fl::size jdec_size =
sizeof(
JDEC);
99 fl::snprintf(err_str,
sizeof(err_str),
"jd_prepare failed: %d", (
int)res);
153 fl::u8 more_data_needed = 0;
154 fl::u8 processing_complete = 0;
165 if (processing_complete) {
183 fl::snprintf(err_str,
sizeof(err_str),
"Progressive decode error: %d", (
int)res);
198 fl::u8 first_pixel_sum = 0;
200 first_pixel_sum = pixels[0].r + pixels[0].g + pixels[0].b;
204 fl::snprintf(debug_str,
sizeof(debug_str),
"JPEG decode OK, first_pixel_sum=%d", first_pixel_sum);
207 if (first_pixel_sum == 0) {
208 setError(
"JPEG decode succeeded but output callback was not called");
217 fl::snprintf(err_str,
sizeof(err_str),
"Decode error: %d", (
int)res);
305 fl::size remaining =
state->array_size -
state->array_index;
306 fl::size to_read = (nbyte < remaining) ? nbyte : remaining;
312 state->array_index += to_read;
335 fl::u16
x =
rect->left;
336 fl::u16
y =
rect->top;
337 fl::u16 w =
rect->right -
rect->left + 1;
338 fl::u16 h =
rect->bottom -
rect->top + 1;
342 if (w == 0 && h == 0 && frame_width <= 8 && frame_height <= 8) {
350 if (
x >= frame_width ||
y >= frame_height ||
351 x + w > frame_width ||
y + h > frame_height) {
364 for (fl::u16 row = 0; row < h; ++row) {
365 for (fl::u16 col = 0; col < w; ++col) {
366 fl::u16 src_idx = (row * w + col) * 3;
369 int pixel_x =
x + col;
370 int pixel_y =
y + row;
371 int frame_idx = pixel_y * frame_width + pixel_x;
374 fl::u8 r = rgb_data[src_idx + 0];
375 fl::u8 g = rgb_data[src_idx + 1];
376 fl::u8 b = rgb_data[src_idx + 2];
379 frame_pixels[frame_idx] =
CRGB(r, g, b);
FastLED chrono implementation - duration types for time measurements.
fl::size getBytesPerPixel() const FL_NOEXCEPT
bool beginDecodingStream(fl::filebuf_ptr stream, PixelFormat format) FL_NOEXCEPT
fl::size frame_buffer_size_
static fl::size inputCallback(JDEC *jd, fl::u8 *buff, fl::size nbyte) FL_NOEXCEPT
struct fl::third_party::TJpgInstanceDecoder::EmbeddedTJpgState embedded_tjpg_
JDEC_Progressive progressive_state_
void endDecoding() FL_NOEXCEPT
fl::unique_ptr< fl::u8[]> frame_buffer_
fl::unique_ptr< fl::u8[]> input_buffer_
Frame getCurrentFrame() const FL_NOEXCEPT
fl::u16 getDecodedRows() const FL_NOEXCEPT
Frame getPartialFrame() const FL_NOEXCEPT
fl::shared_ptr< Frame > current_frame_
bool hasPartialImage() const FL_NOEXCEPT
bool processChunk() FL_NOEXCEPT
bool readStreamData() FL_NOEXCEPT
fl::size getBytesProcessed() const FL_NOEXCEPT
bool hasError(fl::string *msg=nullptr) const FL_NOEXCEPT
PixelFormat pixel_format_
TJpgInstanceDecoder() FL_NOEXCEPT
bool shouldYield() const FL_NOEXCEPT
TJpgProgressiveConfig progressive_config_
fl::u16 operations_this_tick_
void startTick() FL_NOEXCEPT
fl::string error_message_
void allocateFrameBuffer(fl::u16 width, fl::u16 height) FL_NOEXCEPT
void setError(const fl::string &msg) FL_NOEXCEPT
bool initializeDecoder() FL_NOEXCEPT
static int outputCallback(JDEC *jd, void *bitmap, JRECT *rect) FL_NOEXCEPT
fl::filebuf_ptr input_stream_
fl::size size() const FL_NOEXCEPT
void reserve(fl::size n) FL_NOEXCEPT
void resize(fl::size n) FL_NOEXCEPT
Centralized logging categories for FastLED hardware interfaces and subsystems.
JRESULT jd_decomp(JDEC *jd, int(*outfunc)(JDEC *, void *, JRECT *), uint8_t scale) FL_NOEXCEPT
fl::shared_ptr< TJpgInstanceDecoder > TJpgInstanceDecoderPtr
TJpgInstanceDecoderPtr createTJpgInstanceDecoder() FL_NOEXCEPT
JRESULT jd_prepare(JDEC *jd, size_t(*infunc)(JDEC *, uint8_t *, size_t), void *pool, size_t sz_pool, void *dev) FL_NOEXCEPT
JRESULT jd_decomp_progressive(JDEC_Progressive *jpd, int(*outfunc)(JDEC *, void *, JRECT *), uint8_t scale, uint16_t max_mcus_per_call, uint8_t *more_data_needed, uint8_t *processing_complete) FL_NOEXCEPT
void * memcpy(void *dest, const void *src, size_t n) FL_NOEXCEPT
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.
void * memset(void *s, int c, size_t n) FL_NOEXCEPT
int snprintf(char *buffer, fl::size size, const char *format, const Args &... args) FL_NOEXCEPT
Snprintf-like formatting function that writes to a buffer.
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
fl::shared_ptr< filebuf > filebuf_ptr
fl::u8 getBytesPerPixel(PixelFormat format)
fl::string format(const char *fmt)
Format with no arguments.
Base definition for an LED controller.
Representation of an 8-bit RGB pixel (Red, Green, Blue)