7#include "TinyJPEGDecoder.h"
8#include "TinyJPEGEncoder.h"
71 return len >= 2 && data[0] == 0xFF && data[1] == 0xD8;
84 LOGW(
"MJPEGDecoder: unsupported VideoFormat %d - only RGB565",
116 bool begin()
override {
return true; }
142 if (
pos == 0)
return;
147 uint16_t w = 0, h = 0;
150 LOGE(
"MJPEGDecoder: could not determine JPEG size");
160 LOGE(
"MJPEGDecoder: frame buffer allocation failed");
199 int16_t y, uint16_t w, uint16_t h, uint16_t *data) {
200 return static_cast<MJPEGDecoder *
>(decoder.getUserData())
212 if (x < 0 || y < 0)
return true;
219 for (
uint32_t row = 0; row < win_h; row++) {
221 data + row * w, win_w *
sizeof(uint16_t));
279 LOGW(
"MJPEGEncoder: unsupported VideoFormat %d", (
int)format);
311 LOGE(
"MJPEGEncoder: setSize() was not called");
327 if (expected == 0 || len < expected) {
328 LOGE(
"MJPEGEncoder: %u bytes, expected %u", (
unsigned)len,
334 JERESULT rc =
encode(data, size);
340 LOGE(
"MJPEGEncoder: buffer allocation failed");
346 LOGE(
"MJPEGEncoder: encoding failed (%d)", (
int)rc);
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define LOGE(...)
Definition AudioLoggerIDF.h:30
virtual size_t write(const uint8_t *data, size_t len)
Definition Arduino.h:120
VideoFormat
Video codec/pixel-format identifier, shared by two unrelated uses: the (single) video stream of a con...
Definition VideoOutput.h:29
size_t videoFrameSizeBytes(VideoFormat format, uint16_t width, uint16_t height)
Fixed per-frame size (bytes) for a raw/uncompressed VideoFormat at the given resolution - 0 for compr...
Definition Video.h:27