Authenticate: one matcher run per frame, on a settled image

Two changes to the verify loop, both from measurement on the daemon.

The rising edge sent events 5 and 7 from the same capture and got two verdicts
back from one image -- rej rej, -11 -11, MATCH MATCH. Event 5 reaches the
matcher here as well as event 7, so the second REPORT_EVENT was 250 to 300 ms
of redundant work on every press, on the frame where speed matters most.
Authentication now sends only event 7. Enrolment keeps event 5, where it is the
sample trigger rather than a duplicate.

And the frame that detects the finger is the finger landing: partial contact,
and the frame that rejects most often -- across the real runs matches came at
frame 3, 5 and 8 of a press, and a quick tap is one frame. So on the rising
edge the daemon captures once more, about 50 ms later, before reporting, and
the matcher's first look is at a settled finger.

The rescan-budget experiment is reverted. At the stock budget every
non-matching frame answered -11, for the enrolled finger and the wrong one
alike, while matches landed exactly where they did at rescan=0. The budget
relabels a non-match; it does not make the trustlet try harder. Under the press
rule the two are functionally identical, and rescan=0's terminal rejection is
the cleaner label.
This commit is contained in:
Jorijn van der Graaf 2026-09-02 22:59:31 +02:00
commit 9790381e72
3 changed files with 28 additions and 11 deletions

View file

@ -88,8 +88,14 @@ export namespace fingerprintd::engine {
// trace. Sending event 7 on every held frame instead feeds the algorithm
// near-duplicate images from a single press.
//
// Authentication does want event 7, which reaches the matcher
// unconditionally; event 5 only reaches it when device+0x10a8 is 1 or 2.
// Authentication wants event 7, which reaches the matcher unconditionally,
// and ONLY event 7. Event 5 reaches it too (when device+0x10a8 is 1 or 2,
// which it is here): measured on the daemon, the rising-edge frame sent
// both and got two verdicts back from one image -- `rej rej`, `-11 -11`,
// `MATCH MATCH`. Each REPORT_EVENT that runs the matcher costs 250-300 ms,
// so the second one is a third of a second of redundant work on every
// press, on the frame where speed matters most. Enrolment keeps event 5:
// there it is the sample trigger, not a duplicate.
class TouchTracker {
public:
// Returns the events to report for this frame, in order.
@ -97,7 +103,7 @@ export namespace fingerprintd::engine {
std::vector<Event> out;
bool rising = finger && !prev_;
bool falling = !finger && prev_;
if (rising)
if (rising && mode == Mode::Enrol)
out.push_back(Event::FingerTouched);
if (finger && mode == Mode::Authenticate)
out.push_back(Event::ImageReady);