修复调色板 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
+3 -3
View File
@@ -626,12 +626,12 @@ mag160c_error_t mag160c_render_frame(mag160c_render_t *r, const uint8_t *frame,
if (r->post_gray_cb)
r->post_gray_cb(r->post_gray_user, r->gray160);
upscale2x(r);
/* palette colorize 320x240 */
/* palette colorize 320x240 (palette is B,G,R -> swap to RGB24 out) */
for (int i = 0; i < r->npix * 4; ++i) {
unsigned char gv = r->gray320[i];
out_rgb[i * 3 + 0] = mag160c_official_palette256[gv][0];
out_rgb[i * 3 + 0] = mag160c_official_palette256[gv][2];
out_rgb[i * 3 + 1] = mag160c_official_palette256[gv][1];
out_rgb[i * 3 + 2] = mag160c_official_palette256[gv][2];
out_rgb[i * 3 + 2] = mag160c_official_palette256[gv][0];
}
return MAG160C_OK;
}