修复调色板 BGR/RGB 顺序:render 输出标准 RGB24(官方 palette 为 BGR 存储)

- mag160c_render_frame 之前把 palette[gv][0]=B 直接写入 out_rgb[0],
  导致 R/B 互换,高温区域显示为蓝色
- 改为 out_rgb = {palette[2], palette[1], palette[0]} 标准 RGB24
- linux_demo 的 BMP 输出相应改为写回 BGR(BMP 原生顺序)
- 实测:最热像素 (255,255,150) 亮黄白,低温区域蓝黑,色温方向正确
This commit is contained in:
ZXCLI
2026-08-19 15:46:21 +08:00
parent 70bde0fa86
commit 0dcb2830c6
3 changed files with 11 additions and 6 deletions
+7 -2
View File
@@ -102,8 +102,13 @@ static void save_bmp(const char *path, const uint8_t *rgb, int w, int h) {
FILE *f = fopen(path, "wb");
if (!f) return;
fwrite(bmp, 1, 54, f);
for (int y = h - 1; y >= 0; --y)
fwrite(rgb + (size_t)y * w * 3, 1, (size_t)w * 3, f);
for (int y = h - 1; y >= 0; --y) {
const uint8_t *row = rgb + (size_t)y * w * 3;
for (int x = 0; x < w; ++x) {
uint8_t bgr[3] = { row[x * 3 + 2], row[x * 3 + 1], row[x * 3] };
fwrite(bgr, 1, 3, f);
}
}
fclose(f);
}