Faster autofocus in dim light on the Ricoh GR IIIx
I found two firmware settings that make the GR IIIx focus faster in dim light without making it less reliable. In every dim-light comparison, autofocus took 23–39 % less time. In good light nothing changed.
Median time from half-press to focus in a dim room, 28 presses each
- Dim light, all scenes
- 23–39 % faster in every comparison
- Good light
- No slower (−9 to +2 %)
- Failed or wrong focus
- 0 in 180 patched presses (stock: 1 in 165)
- Presses logged
- About 2,500, most of them hands-free
The two changes: the camera accepts a sharpness peak with a somewhat lower safety margin, and in the darkest mode it measures 49 instead of 29 frames per second. Neither helped on its own; together they cut the slowest part of a press, the focus sweep, by about a third.
This is research, not a release. For the tests, the changes were written into the running firmware's memory through the camera's own Linux side, so each one was gone after a power cycle. Since then I have flashed the setting into my own camera's firmware, so it is active from power-on. The modified firmware is not offered for download: it is unofficial, specific to firmware 1.60, and tested on one camera, on a tripod, in a handful of indoor scenes. Real-world shooting and the sharpness of the resulting photos have not been checked yet.
How the AF decides
The GR IIIx combines phase detection with contrast AF, and the final focus comes from a contrast sweep: the lens moves through focus while the camera measures sharpness on each live-view frame, and stops once it has seen the contrast rise to a peak and fall again. In dim light the phase pixels become unreliable and the sweep does all the work. Two things set the speed:
- The acceptance margin. A peak only counts if the rise and the fall both exceed a margin. In dim light the firmware grows that margin with 1/brightness, so it quickly asks for much more contrast change than the actual noise needs. Clear peaks get rejected, and the lens sweeps on, reverses, and tries again.
- The frame rate. The sweep advances a fixed number of lens pulses per frame, so it is frame-bound. The camera picks one of four rates from the light: 200, 100, 49 or 29 fps. In dim light it falls to 29 fps.
A typical dim-light press of about 600 ms splits into roughly 210 ms of lens travel to the start position, 335 ms of sweep (9–10 frames at 29 fps) and 70 ms to settle. Only the sweep can be shortened by software, and only by faster frames or fewer of them. With both changes it drops to about 210 ms:
Median dim-light press, split into its phases from the camera's AF state trace.
What helps
Two changes, which only pay off together:
- A lower margin in dim light. The six per-mode base values of the margin (around 570–600) scaled by 0.32, the dim-light scaling softened from (b/y) to (b/y)0.875, two falling samples instead of three before a peak is accepted, and a slightly lower rise floor.
- NO29: 49 fps instead of 29 fps. One instruction in the frame-rate choice: where the camera would pick 29 fps it now picks 49. Brighter light, which already runs 49, 100 or 200 fps, is unaffected.
Each 49 fps frame gets about half the light, so with the stock margin NO29 alone needs twice as many frames and gains nothing. With the lower margin the sweep stays short and runs at the faster rate.
Results
Blind A/B runs: stock and patched presses interleaved in shuffled order, on a tripod, the ND filter used as a remote dimmer, in several scenes on different days. The light is given by the frame rate the camera chose, because its exposure reading did not track the light the AF sees. Change in median AF time:
Square: change in median AF time; bar: 95 % bootstrap interval. Right: medians and number of presses (stock / patched).
Where the camera already runs 100 or 200 fps the patch changes nothing that matters. Where stock drops to 29 fps it is consistently faster, and the slow presses that needed a second pass mostly disappear. None of the patched presses in these runs failed or focused on the wrong thing; stock had one wrong lock. An earlier session in different dim light, with 49 fps forced, gave the same picture: 622 → 486 ms.
Where it does not help
Scenes without a clear target: a hard, low-detail target, a blank wall and a room too dark to focus. Both settings fail most of the time there. What matters is that the lower margin does not make the camera claim focus on nothing more often:
Outcome per half-press. On the blank wall any confirmed lock is a false one: stock 0, patched 1 of 20. The hard-target lock positions could not be scored.
The changes
| Change | Where (firmware 1.60) | Stock → patched |
|---|---|---|
| Margin bases | 0x53c16bb0, 6 floats | about 570–600 → × 0.32 |
| Dim-light scaling | margin helper 0x5340c590 | (b/y) → (b/y)0.875 |
| Falls before accept | 0x53c16cc0 | 3 → 2 |
| Rise floor (mode 0) | 0x53c16d14 | 0.02 → 0.014 |
| NO29 | 0x533f4b10 | movhi r3,#3 → #2 |
What it costs, as far as I can tell
- Occasionally the wrong object. In a bright scene with two objects in the AF area, the lower margin locked on the second one in 3 of 85 presses; stock did not in 73. That difference isn't statistically significant (p = 0.15), but it's the plausible trade-off of a lower margin and needs more presses to settle.
- A wider spread at 49 fps. 90 % of patched locks landed within 35–56 lens pulses of the reference, against 12–24 for stock. Whether that is visible in a photo hasn't been measured yet; it is the next test.
- Somewhere darker, 49 fps will lose. One press at the darkest usable level failed at 49 fps. A better rule would fall back to 29 fps below a measured brightness instead of always using 49.
What didn't help
- Forcing a frame rate everywhere. 49 fps forced in bright light costs about 140 ms there; 100 fps in dim light fails and misses focus by up to 127 pulses.
- Shortening the pre-sweep wait. The two frame counters that look responsible aren't active in this mode; the wait is the lens physically travelling.
- Turning off the 3-frame smoothing of the sharpness signal: much worse, up to 3 s and far off.
- The peak-shape tests in the accept code: they never fired in about 290 recorded sweeps.
- The phase-detection threshold lives in RAM and is rewritten at every AF start, so it can't be patched there.
- A larger or smaller lens step per frame than the stock 8 pulses: 7–8 is the optimum at 49 fps; coarser steps lose accuracy, finer ones time.
How it was measured
The camera runs a small web endpoint from the memory card next to Ricoh's own Wi-Fi API. From a laptop, a script defocuses the lens, triggers AF through the API, and reads the result from a tracer that samples the AF state every 4 ms. Patches are uploaded and switched over Wi-Fi between presses, and the ND filter is switched through the camera's engineering shell to dim the scene on demand. Every comparison interleaves the settings in shuffled order, so drifting daylight affects all of them alike.
On top of that I ran three parameter searches with Optuna, about 1,500 presses over 105 trials, each trial a different patch scored on AF time and accuracy.
Was the parameter search worth it?
Partly. It settled the margin question cleanly: the margin's base factor and its rise floor carry about 90 % of the effect, the exponent I had been tuning by hand under 10 %. It also found the best lens step at 49 fps and showed 100 fps to be unreliable, all while running unattended. But the biggest gain, the frame rate, came from reading the firmware and splitting a press's time into phases; the optimiser can only tune the knobs it's given. With 4–5 presses per trial it also can't rank settings within the good plateau, so every number on this page comes from separate confirmation runs. In hindsight, a one-dimensional sweep of the margin base would have got there with fewer presses. I'd keep it as the tool for tuning newly found knobs, not as a replacement for understanding the firmware.