Skip to content

Test Pattern

Lu-Fi edited this page Oct 27, 2026 · 2 revisions

Test pattern

OpenIMP can feed a synthetic picture of known content into the pipeline (or switch the sensor's own test pattern on), so encoder, scaler, rotation, JPEG, IVS and ISP can be checked against an ideal picture without a scene. Extension beyond the vendor IMP API, default off, all SoCs.

Logo preview (synthetic)

Mode Picture Covers
0 off -
1 ramp, checkerboard, colour bars, logo after the ISP: scaler, rotation, OSD, encoder, JPEG
2 mode 1 + moving square + frame counter drops, duplicates, reordering, smearing, rate control
3 grey, noise, counter, objects of given size/contrast/speed motion detection (IVS input)
4 the sensor's own test pattern through the whole ISP (AE/AWB hold optional)
5 pattern written into the ISP (T23 only, beyond vendor) behind the ISP front half: MDNS, BCSH, scaler, encoder, OSD

Use: OpenIMP_TestPattern_Set(mode, &params) / _Get from openimp_testpattern.h (ABI 1, detect with OpenIMP_Cap_TestPattern), from outside with OPENIMP_TEST_PATTERN_CTL=<socket> and tpctl set <mode> key=value ... (e.g. tpctl set 4 ae_hold=1 awb_hold=1), start value OPENIMP_TEST_PATTERN. timps 1.10.3+ offers it as /control testpattern and WebUI buttons. OpenIMP_TestPattern_Supported(mode) answers 1/0 without switching (modes 0-3 always, mode 4 with a sensor table entry, mode 5 on T23), so a UI can grey out switches. Other start variables: OPENIMP_TEST_PATTERN_STEP, _NOISE, _EVENTS (script for mode 3), OPENIMP_TP_LOGO (0/1). Host tools compare decoded streams with the ideal picture (PSNR, SSIM, colour bars, counter, position).

Mode 5 (T23): picture inside the ISP

OpenIMP_TestPattern_Set(OPENIMP_TP_ISP_MID, NULL) or tpctl set 5 writes the mode 1 pattern into the ISP's temporal-denoise reference frame once per frame and holds the reference weight at 1.0, so the picture runs through MDNS, BCSH, scaler and encoder with no driver change beyond the optional parameter mdns_ref_hold (set to 1 while mode 5 is active, so the driver itself keeps the weights; without it OpenIMP writes the weight registers every frame). Sensor frames keep flowing. Leaving the mode restores the weights. Device-tested on T23 (luma SSIM mean 0.967 against the ideal picture over 100 frames, chroma only partly); other SoCs return ENOTSUP. The vendor library has no equivalent.

Mode 4 on T20/T21 with the jxf23 sensor: the SDK sensor driver clears the test bit when the gain changes, so OpenIMP re-asserts it until it has held for 4 polls (up to 4 s).

Status per SoC

✅ device-tested, 🔧 implemented, untested, ⏳ in progress, ❌ not possible per hardware test, ❓ open

Function T10 T20 T21 T23 T30 T31 T40 T41
Mode 1 pattern ✅ ✅ ✅ ✅ 🔧 ✅ ✅ ✅
Mode 2 moving ✅ 🔧 ✅ ✅ 🔧 ✅ ✅ 🔧
Mode 3 motion test ✅ (objects shown) 🔧 ✅ ✅ 🔧 ✅ ✅ 🔧
Mode 4 sensor pattern 🔧 (jxh42) ✅ ✅ (sensor exposure hold) ✅ 🔧 🔧 (register by hand ✅) ⏳ 🔧 sc5336 / ❓ gc5603
Mode 5 ISP-middle not supported not supported not supported ✅ (luma; chroma partly) not supported not supported not supported not supported
Own picture before the ISP 🔧 Apical TPG ✅ Apical TPG + VIC colour bars (register level) ❌ ❌ 🔧 Apical TPG ❌ ❓ ⏳ RAW from DDR

Known limits: static appearing objects in mode 3 are not detected by design (motion v2 ignores them), objects larger than a grid cell (> 60 px at 640x360) are not drawn, jxf23 needs the AE hold, gc5603 has no known pattern register, the motion test has no real sensor noise. Cost: about +8 KB xz on libimp.

Full description: docs/TESTPATTERN.md.

Clone this wiki locally