Compare commits

..
2 Commits
5 changed files with 45 additions and 12 deletions
+10 -7
View File
@@ -36,7 +36,10 @@ csdk/
## 构建
### 方式 A:直接 GCC(当前 Windows 环境)
### 方式 A:直接 GCC(Windows + MinGW-w64)
编译器:WinLibs MinGW-w64(gcc 16.2.0,UCRT),`winget install BrechtSanders.WinLibs.POSIX.UCRT`。
2026-10-08 已用该编译器完成全部程序与测试的编译验证(见各节"验证状态")。
```powershell
# CLI 工具
@@ -46,10 +49,10 @@ gcc -O2 -w -DMAG160C_STATIC -I"csdk\third_party\libusb\win64" -I"csdk\include" -
csdk\src\mag160c_tcm.c csdk\src\mag160c_error.c csdk\src\mag160c_display.c `
csdk\third_party\libusb\win64\libusb-1.0.x64.a
# 主程序 demo3(官方管线复刻)
# 主程序 demo3(官方管线复刻;demo3 调用 render API,必须链接 mag160c_render.c)
gcc -O2 -w -DMAG160C_STATIC -I"csdk\third_party\libusb\win64" -I"csdk\include" -I"csdk\src" `
-o build-artifacts\mag160c_demo3.exe csdk\tools\mag160c_demo3.c `
csdk\src\mag160c_display.c csdk\src\mag160c_error.c `
csdk\src\mag160c_render.c csdk\src\mag160c_display.c csdk\src\mag160c_error.c `
csdk\third_party\libusb\win64\libusb-1.0.x64.a -lgdi32 -luser32
# 官方抓帧工具
@@ -299,8 +302,8 @@ build-artifacts\csdk_test_display.exe
`RenderPipeline.androidLutOf` 的逐行转写,两边同一套 golden 向量;0 = 保持 PC 语义,
与 `analysis/render_offline.c` 的黄金夹具一致),两个 demo 默认打开(真机验证:
同场景照片逐像素平均差 4.5/255、逐计数中位差 2 级,见 §10/§11)。
⚠️ **本机没有 C 编译器**(gcc/clang/NDK 都没有),所以这段 C **未编译**——
算法本身由 Kotlin golden 测试锁定,合入前请在带编译器的环境编译 + 跑回归。
✅ **编译验证(2026-10-08)**:`mag160c_render.c`(含 `android_lut_rebuild`)与
`mag160c_linux_demo.c` 全链接通过(gcc 16.2.0 / WinLibs UCRT)。
- 同一节还有个 `upscale_nearest`:官方**安卓**路径没有 160→320 的插值级
(SDK 给 App 的位图就是 160×120,App 用 `new Paint(1)`(无 FILTER_BITMAP)最近邻放大),
而 PC 版的双线性会展出一层"全幅/半幅"交错细纹(暗/低温区最明显)。
@@ -329,5 +332,5 @@ build-artifacts\csdk_test_display.exe
- DDT 尾部辐射标定记录的解析(阈值/gain/offset/shift/±500/eps,偏移表见该文档 §4d);
- BasePara2 的 `ATZeroErrorPoint`/`ATErrorSlope`/`fpaTempFix`(线上偏移同样见该文档);
- 曲线 A 与本 SDK 的 `T2E` 表相同(646 项,已验证逐项一致)。
注:本机当前**没有 C 编译器**(gcc/clang 均缺失),以上 C 改动需在有编译器的环境里
编译 + 跑 csdk 测试后再提交。
注:C 侧改动已随 2026-10-08 的编译验证一并覆盖(gcc 16.2.0 全部源文件
编译 + csdk 测试套件通过)。
+12 -2
View File
@@ -16,6 +16,7 @@
#include <windows.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#include <libusb.h>
@@ -340,7 +341,16 @@ static int init_camera(void) {
int WINAPI WinMain(HINSTANCE inst, HINSTANCE hprev, LPSTR cmd, int show) {
(void)hprev; (void)cmd; (void)show;
g_log = fopen("%TEMP%/opencode/demo_log.txt", "w");
/* Log/snapshot under %TEMP%, resolved at runtime (the original archived
version hard-coded a per-machine absolute path that breaks elsewhere). */
static char logpath[MAX_PATH], bmppath[MAX_PATH];
const char *tmp = getenv("TEMP");
if (!tmp || !*tmp) tmp = ".";
snprintf(logpath, sizeof(logpath) - 1, "%s\\mag160c_demo_log.txt", tmp);
logpath[sizeof(logpath) - 1] = 0;
snprintf(bmppath, sizeof(bmppath) - 1, "%s\\mag160c_render_test.bmp", tmp);
bmppath[sizeof(bmppath) - 1] = 0;
g_log = fopen(logpath, "w");
if (g_log) { fprintf(g_log, "demo start\n"); fflush(g_log); }
libusb_init(&g_usb);
@@ -468,7 +478,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE hprev, LPSTR cmd, int show) {
}
render(g_frame);
if ((g_frame_count % 200) == 0) {
FILE *tf = fopen("%TEMP%/opencode/render_test.bmp", "wb");
FILE *tf = fopen(bmppath, "wb");
if (tf) { fwrite(g_bmp, 1, sizeof(g_bmp), tf); fclose(tf); }
}
DWORD now = GetTickCount();
+7 -1
View File
@@ -10,6 +10,7 @@
#include <windows.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
/* ---- libusb-win32 (libusb0) API ---------------------------------------- */
typedef struct usb_bus {
@@ -319,7 +320,12 @@ static int init_camera(void) {
int WINAPI WinMain(HINSTANCE inst, HINSTANCE hprev, LPSTR cmd, int show) {
(void)hprev; (void)cmd; (void)show;
g_log = fopen("%TEMP%/opencode/demo_usb0_log.txt", "w");
static char logpath[MAX_PATH];
const char *tmp = getenv("TEMP");
if (!tmp || !*tmp) tmp = ".";
snprintf(logpath, sizeof(logpath) - 1, "%s\\mag160c_demo_usb0_log.txt", tmp);
logpath[sizeof(logpath) - 1] = 0;
g_log = fopen(logpath, "w");
if (g_log) { fprintf(g_log, "demo start\n"); fflush(g_log); }
HMODULE l0 = LoadLibraryA("libusb0.dll");
+9 -1
View File
@@ -9,7 +9,15 @@ Write-Host "Gradle: 工程wrapper android\gradlew.bat (JDK 21: C:\Tools\jdk-21)"
Write-Host "SDK: $(Test-Path "$env:LOCALAPPDATA\Android\Sdk\platform-tools\adb.exe")"
Write-Host "=== 2. 设备 ==="
adb devices
# adb: PATH first, then the known SDK install locations
$adb = Get-Command adb -ErrorAction SilentlyContinue
if (-not $adb) {
foreach ($cand in @("C:\Tools\android-sdk\platform-tools\adb.exe",
"$env:LOCALAPPDATA\Android\Sdk\platform-tools\adb.exe")) {
if (Test-Path $cand) { $adb = $cand; break }
}
}
if ($adb) { & $adb devices } else { Write-Host "!!! adb 未找到(确认 Android SDK platform-tools 已安装)" }
Write-Host "=== 3. 构建 ==="
Push-Location $andr
+7 -1
View File
@@ -56,6 +56,12 @@ if (-not (Test-Path "$pairsDir\pair_000.raw")) {
} else { Write-Host "官方数据已存在, 跳过" }
Write-Host "=== 8. 对比 ==="
python "%TEMP%\compare_live.py"
# compare_live.py was an ad-hoc analysis helper of the original session and is
# not shipped with the repo (临时分析脚本不入库); the step is skipped gracefully.
if (Test-Path "$env:TEMP\compare_live.py") {
python "$env:TEMP\compare_live.py"
} else {
Write-Host "跳过: %TEMP%\compare_live.py 不存在(一次性分析脚本,重新生成后再跑)"
}
Write-Host "=== 完成。下一步见 analysis\session_state.md ==="