Repository navigation
tools/xm-isp-tuning: a Xiongmai GK7206 camera's ISP tuning, as an SDK PQ bin - #344
Conversation
… as an SDK PQ bin Xiongmai's firmware for GK7206V1 cameras tunes the ISP from per-sensor tables compiled into its App; the XMedia SDK publishes no tuning for most sensors, so firmware running the SDK alone gets the ISP library's generic defaults -- on an IVG-K8 (GK7206V11 + SC465SL) a far noisier, bluer picture than the stock firmware's on the same board. xm-isp-capture.py runs the stock App's ISP monitor thread under Unicorn (libc stubbed, the statically linked SDK returning 0, the SDK's attribute setters and getters caught) and records what the App puts in force, block by block, as the SDK's own structures. xm-isp-finish drops what the App sets at run time instead of from tables; on the camera attrtool applies the set, ae-ainr the AE curve and AINR switch points, and pqexport writes the PQ bin xmedia_isp_import() loads. The addresses for one App build (V1.10.T02.20261103) are a JSON profile. Measured: applied to an OpenIPC IVG-K8 beside a stock one in low light (ISO ~20000, 125 ms), the same picture; re-running the capture reproduces the set behind the SC465SL profile in OpenIPC/firmware#2905 byte for byte; the camera tools run on the board as built.
…e in the twin Booting the stock GK7206V11 firmware in gk7206v11a and dumping the ISP there gives the App's runtime tables, which the Unicorn capture misses for STNR, BNR temporal, sharpen and LCE. Checked against a stock camera's /proc/umap/isp at two ISOs.
PR Summary by QodoExtract Xiongmai GK7206 ISP tuning as XMedia PQ bins
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
- attrtool: creates the dump directory, writes no block for a failed getter, checks its writes, exits non-zero on any failed get, set or missing file, and logs line by line (a crashing getter -- smart_info under the stock App -- no longer swallows the log). - ae-ainr: reports the AE and AINR results separately and fails if either did; no uninitialised AINR fields on a failed read. - xm-isp-finish: creates its output directory. - build.sh: a failed compile fails the build instead of keeping an old binary; with SDK_STATIC it also builds the static tools the twin route types in (camera/sdkshim_static.c, the uClibc gaps of the SDK's static objects). - xm-twin-export.py: writes <block>.bin as xm-isp-finish reads them; checks each command's exit status; verifies every file against hexout's length and checksum, re-requesting damaged ones (the App's log can cut a hex line); requires the PQ export and the NR/sharpen blocks; lists the dump with a shell loop (this busybox colours ls); sets xmuart=0 in a copy of the flash itself, keeping every other saved variable. Two full twin runs give byte-identical ISP blocks, and the README's route (export, AWB from the capture, finish) reproduces the shipped sc465sl set exactly.
|
Review fixes in a0c65ff and 49b3dfb, all ten findings:
Also fixed along the way:
Two full twin runs gave byte-identical ISP blocks. The rebuilt camera tools were checked on an IVG-K8. |
Tools that take a Xiongmai GK7206 camera's ISP tuning out of its stock firmware and turn it into the XMedia SDK's own format, a PQ bin that
xmedia_isp_import()loads. The SDK ships no tuning for most sensors, SC465SL included.Two ways to read the tuning, both under
tools/xm-isp-tuning/:xm-isp-capture.py): runs the stock App's ISP monitor thread in emulation and records the SDK attribute setters it calls. It takes under a second, but only sees the App's init path.twin/xm-twin-export.py): boots the whole stock firmware ingk7206v11a, lets the App bring the ISP up, then dumps the attribute blocks and exports a PQ bin from inside the twin. Static camera tools go in typed at the shell, and results come out as hex over the console, because the busybox has no network fetcher and an SD card gets formatted by the App's recorder.For SC465SL the twin export is the correct one. Interpolated to the ISO a stock camera was at, its noise-reduction and sharpening tables give the values that camera reports live in
/proc/umap/isp:The static blocks and the AWB calibration are byte-identical between the two methods. The README documents the use and the limits: night/IR mode is untested, daylight is untested, and the addresses are specific to this App build.
The exported bin is in OpenIPC/firmware#2905.