csdk: 撤回第29轮'关 pivot'的取值(依据已被真机反汇编推翻),C 参考保持 PC 语义;README 记录 Android 版 LUT 与 fpaTempFix 的待移植规格

This commit is contained in:
ZXCLI
2026-10-06 07:57:01 +08:00
parent 6392bd89ee
commit bf03e852ca
3 changed files with 24 additions and 16 deletions
+14 -6
View File
@@ -217,7 +217,7 @@ gray→2x→调色板),FFC 命令通过回调发给调用方(调用方持
```c
mag160c_render_cfg_t cfg = { .width = 160, .height = 120,
.ddt_path = "mag160c_official.ddt", .ffc_period = 1800,
.ffc_drift = 250, .startup_force_ffc = 1, .cdf_pivot_75 = 0, /* 官方手机 App 的取值 */
.ffc_drift = 250, .startup_force_ffc = 1, .cdf_pivot_75 = 1, /* PC 参考实现自身取值 */
.ffc_cb = my_ffc_sender, .ffc_user = NULL };
mag160c_render_init(&r, &cfg);
/* 每帧: */
@@ -288,11 +288,19 @@ build-artifacts\csdk_test_display.exe
## 与官方手机 App 的对齐(2026-10-06,从安卓侧验证后同步)
1. **灰度 CDF 的 75% pivot:工具已改为关闭(`cdf_pivot_75 = 0`)**。
实测(同一静止场景、同刻截图、调色板反解灰度):pivot 开时我们的灰度中位 33 / 均值 60,
官方手机 App 是 61 / 82;关掉后为 50–54 / 80–81(与官方重合)。库保留该开关,
`analysis/render_offline.c` 生成黄金夹具时仍用 1(Kotlin 对齐测试用同一配置)。
证据与数据:`docs/android_app/rendering_diff_phone_20261006.md`。
1. **灰度 LUT:手机对齐移植在 Android 管线,不在本 C 参考里**(2026-10-06 复核修正)。
第 29 轮曾把 `cdf_pivot_75` 改成 0 去凑官方手机 App,那个判断已作废:真机
libcxsdk 反汇编显示官方**开着** pivot,而且它的 `HistDeRedundance` 与本 C 参考
用的(PC 版)**结构不同**——固定基值 `16*(448+447*b/200)`、步进上限
`max(1,(0x1800+4j)·k>>13)`(`k=min(0x200,16·span/range)`)、反向 CDF 从
`hist[pivot]` 起、pivot=`max(center_idx,(meanBelow+meanAbove)/2)`。
该变体已逐指令移植进 Android 管线(`RenderPipeline.androidLutOf`,含黄金向量单测);
本 C 参考**保持 PC 语义**(`cdf_pivot_75 = 1`,与 `analysis/render_offline.c`
黄金夹具一致)。Android 版 LUT 的 C 侧移植待办,规格见
`docs/android_app/rendering_diff_phone_20261006.md` §10.3。
- 顺带(同一条链):**曲线插值温度要加 `BasePara2.fpaTempFix`**。官方 App 传给 SDK 的是
`帧尾 FPA + fpaTempFix`(真机 1699),`SelectCaliCurve`/`GenerateVolatileLens`
用它选/插值每像素标定表;温度换算链路仍用帧尾原值。C 侧移植时不要漏。
2. **温度换算待移植**:官方对这台设备走的是"放射学分支"(每波段线性映射 + 环境温度误差修正
+ 发射率/透过率 revise),不是本 SDK 现在用的 T2E 表分支。完整反编译结论、伪代码与
参数来源见 `docs/android_app/temperature_chain_re_20261006.md`(§4d 可直接落地,
+7 -5
View File
@@ -605,11 +605,13 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmd, int show) {
cfg.ffc_drift = 250;
cfg.startup_force_ffc = 1;
cfg.warm_frames = 20;
/* Official PHONE app runs the gray CDF WITHOUT the 75% pivot: with it on the
rendering is measurably darker than the official app (gray median 33 vs 61,
mean 60 vs 82 in a same-moment on-device comparison); off matches (50-54 vs 61,
80-81 vs 82). See docs/android_app/rendering_diff_phone_20261006.md. */
cfg.cdf_pivot_75 = 0;
/* Keep the PC/Linux reference LUT: this toggle is the PC variant's 75% pivot.
The round-29 change to 0 was based on a mis-derived pivot in the Android build
and is retracted - the official PHONE app has the pivot ON, and its LUT is a
structurally different function (fixed base, step cap, mean-of-partials pivot)
that is ported in the Android pipeline, not here. See
docs/android_app/rendering_diff_phone_20261006.md section 10. */
cfg.cdf_pivot_75 = 1;
cfg.ffc_cb = ffc_cb;
cfg.post_nuc_cb = post_nuc_cb;
cfg.post_gray_cb = post_gray_cb;
+3 -5
View File
@@ -125,11 +125,9 @@ int main(int argc, char **argv) {
cfg.ffc_drift = 250;
cfg.startup_force_ffc = 1;
cfg.warm_frames = 20;
/* Official PHONE app runs the gray CDF WITHOUT the 75% pivot: with it on the
rendering is measurably darker than the official app (gray median 33 vs 61,
mean 60 vs 82 in a same-moment on-device comparison); off matches (50-54 vs 61,
80-81 vs 82). See docs/android_app/rendering_diff_phone_20261006.md. */
cfg.cdf_pivot_75 = 0;
/* PC/Linux reference LUT keeps its own pivot (see the same note in
mag160c_demo3.c); the Android-parity LUT lives in the Android pipeline. */
cfg.cdf_pivot_75 = 1;
cfg.ffc_cb = ffc_cb;
mag160c_render_t *render = NULL;
if (mag160c_render_init(&render, &cfg) != MAG160C_OK) {