demo3 迁移到 mag160c_render 抽象库(v6);render 库加手动 FFC/NUC 访问器/钩子

- mag160c_demo3.c 从内联管线重写为 render API 调用:删除 DDT 加载/NUC/
  LUT/gray/2x/FFC 状态机实现(~700 行),保留 USB 取帧/GDI/探针/附加环节
- 附加环节(0x230 帧差/0x41fe8 隔行平滑/0x30 gray 覆盖)经 render 的
  post_nuc/post_gray 钩子挂接,编译开关与运行时按键 0/8/9 不变
- mag160c_render 新增 mag160c_render_request_ffc / get_nuc 访问器
- 实测无回归:FFC 时序 init@20→FFC(1)@28→漂移触发,与 v5 一致;
  stats 正常,auto BMP 生成正常;全开关版本编译通过
- linux_demo 修帧组装(38400px+28B 尾),快门=31492 sel=2 正常
This commit is contained in:
ZXCLI
2026-08-19 15:41:34 +08:00
parent 5c22bfe78c
commit 9db940a615
4 changed files with 235 additions and 867 deletions
+22
View File
@@ -29,6 +29,16 @@ extern "C" {
/* FFC command callback: param 0 = FFC(0), 1 = FFC(1). */
typedef void (*mag160c_render_ffc_cb_t)(void *user, int param);
/* Optional post-NUC hook (called after NUC+blind, before stats/window).
* Lets the app run the official extra paths (frame-diff 0x230, interlace
* smoothing 0x41fe8) on the NUC buffer. */
typedef void (*mag160c_render_post_nuc_cb_t)(void *user, unsigned short *nuc);
/* Optional post-gray hook (called after the 160x120 gray is mapped,
* before the 2x upscale). Lets the app run the official 0x30 gray
* overlay paths (0x17770 auto / 0x17c40 manual) on the gray buffer. */
typedef void (*mag160c_render_post_gray_cb_t)(void *user, unsigned char *gray160);
typedef struct mag160c_render_t mag160c_render_t;
typedef struct mag160c_render_cfg_t {
@@ -42,6 +52,10 @@ typedef struct mag160c_render_cfg_t {
int cdf_pivot_75; /* 0x8c: CDF pivot at 75% cumulative, 1 = on */
mag160c_render_ffc_cb_t ffc_cb;
void *ffc_user;
mag160c_render_post_nuc_cb_t post_nuc_cb;
void *post_nuc_user;
mag160c_render_post_gray_cb_t post_gray_cb;
void *post_gray_user;
} mag160c_render_cfg_t;
MAG160C_API mag160c_error_t
@@ -74,6 +88,14 @@ MAG160C_API int mag160c_render_get_endpoint(mag160c_render_t *r);
MAG160C_API int mag160c_render_get_frame_index(mag160c_render_t *r);
MAG160C_API int mag160c_render_has_reference(mag160c_render_t *r);
/* Manual FFC trigger (official FFC button / recenter): forces FFC(0) at
* the next rendered frame. */
MAG160C_API void mag160c_render_request_ffc(mag160c_render_t *r);
/* NUC-domain pixel read (valid when mag160c_render_has_reference()).
* Returns 0 when no reference yet. Used for hot-spot scan / overlay. */
MAG160C_API uint32_t mag160c_render_get_nuc(mag160c_render_t *r, uint32_t idx);
/* Temperature probe on the current NUC output (millidegrees C). */
MAG160C_API mag160c_error_t
mag160c_render_probe_temp(mag160c_render_t *r, uint32_t x, uint32_t y,