Files

20 lines
917 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* mp_jpeg.h — 最小 baseline JPEG 编码器(自包含,零第三方依赖,无 libm)。
*
* 供 MeowPanel 实时画面端点(GET /api/screen.jpeg)把 fb0 的 RGB565 帧编码为 JPEG。
* 仅实现顺序 DCT + 4:2:0 色度抽样 + 标准 Huffman 表(Annex K),8-bit,输出到内存。
*/
#ifndef MP_JPEG_H
#define MP_JPEG_H
#include <stddef.h>
#include <stdint.h>
/* 把 16bpp RGB565 帧(row-major,每行 w*2 字节)编码为内存中的 baseline JPEG。
* quality ∈ [1,100](近似 libjpeg 语义:50 ≈ 标准质量;<50 更小更糊,>50 更大更好)。
* 成功返回 0,*out 置为 malloc 的 JPEG 缓冲(调用方 free),*outlen 为其字节数。
* 失败(参数非法 / 分配失败)返回 -1,*out=NULL。 */
int mp_jpeg_encode_rgb565(const uint8_t *rgb565, int w, int h, int quality,
uint8_t **out, size_t *outlen);
#endif