3#include <TinyGPU/DisplayDriver.h>
4#include <TinyGPU/Boards.h>
60 if (!
p_board->begin())
return false;
121 size_t write(
const uint8_t* data,
size_t len)
override {
128 LOGE(
"OutputTinyGPU: invalid video size: %d x %d", (
int)
info_.
width,
139 LOGE(
"OutputTinyGPU: frame too small: %d < %d bytes", (
int)len,
167 SurfaceWithExternalBuffer<RGB565> frame;
168 frame.setExternalBuffer(
const_cast<uint8_t*
>(data), len);
191 size_t pixels = (size_t)width * height;
193 for (
int y = 0; y < height; y++) {
194 const RGB565* srcRow = src + (size_t)yLut[y] * srcW;
196 for (
int x = 0; x < width; x++) {
197 dstRow[x] = srcRow[xLut[x]];
200 SurfaceWithExternalBuffer<RGB565> frame;
203 frame.resize(width, height);
214 for (
int y = 0; y < height; y++) {
215 const RGB565* srcRow = src + (size_t)yLut[y] * srcW;
216 for (
int x = 0; x < width; x++) {
219 SurfaceWithExternalBuffer<RGB565> row;
221 (size_t)width *
sizeof(
RGB565));
238 for (
int x = 0; x < width; x++) {
242 for (
int y = 0; y < height; y++) {
260 void writeI420(
const uint8_t* data,
int srcW,
int srcH) {
261 const uint8_t* yPlane = data;
262 const uint8_t* uPlane = yPlane + (size_t)srcW * srcH;
263 const uint8_t* vPlane = uPlane + (size_t)(srcW / 2) * (srcH / 2);
264 size_t srcPixels = (size_t)srcW * srcH;
266 for (
int y = 0; y < srcH; y++) {
267 const uint8_t* yRow = yPlane + (size_t)y * srcW;
268 const uint8_t* uRow = uPlane + (size_t)(y / 2) * (srcW / 2);
269 const uint8_t* vRow = vPlane + (size_t)(y / 2) * (srcW / 2);
271 for (
int x = 0; x < srcW; x++) {
272 dstRow[x] =
yuvToRgb565(yRow[x], uRow[x / 2], vRow[x / 2]);
281 SurfaceWithExternalBuffer<RGB565> frame;
283 srcPixels *
sizeof(
RGB565));
284 frame.resize(srcW, srcH);
293 int d = (int)U - 128;
294 int e = (int)V - 128;
295 int r = (298 * c + 409 * e + 128) >> 8;
296 int g = (298 * c - 100 * d - 208 * e + 128) >> 8;
297 int b = (298 * c + 516 * d + 128) >> 8;
298 r = r < 0 ? 0 : (r > 255 ? 255 : r);
299 g = g < 0 ? 0 : (g > 255 ? 255 : g);
300 b = b < 0 ? 0 : (b > 255 ? 255 : b);
301 return RGB565((uint8_t)r, (uint8_t)g, (uint8_t)b);
307 SurfaceRGB565 band(width,
kBandHeight, FontRGB565);
309 band.clear(
RGB565(0, 0, 0));
#define HIGH
Definition Arduino.h:46
#define OUTPUT
Definition Arduino.h:38
#define LOGE(...)
Definition AudioLoggerIDF.h:30