Skip to content

CMRT 26: Worker: Port FingerprintMatcher from PR #15585 POC - #35

Open
Swarnadip-Kar wants to merge 1 commit into
cmrt-quality-scoringfrom
cmrt-matcher-core
Open

CMRT 26: Worker: Port FingerprintMatcher from PR #15585 POC#35
Swarnadip-Kar wants to merge 1 commit into
cmrt-quality-scoringfrom
cmrt-matcher-core

Conversation

@Swarnadip-Kar

Copy link
Copy Markdown
Owner

Turns Daniel's matchFingerprints() POC (PR mixxxdj#15585) into a real,
non-debug-gated class: FingerprintMatcher. This is the comparison engine
CMRT 27's grouping pipeline calls -- nothing wires it up yet, this PR is
just the algorithm itself plus its own constants.

Public API

  • simHashCandidatesMatch(hashA, hashB, maxHammingBits) -- O(1) pre-filter
  • compare(a, b) -> MatchResult{isMatch, score, offsetItems}
  • kItemDurationSeconds (~0.1238s/item) and kSimHashMaxHammingBits (8) as
    public constants, since CmrtGroupingService needs the same values

Algorithm, split into two phases (private)

  • findTopOffset() -- bucket-vote coarse alignment search (POC's first loop)
  • scoreFingerprints() -- calls findTopOffset(), then fine-offset refinement
    (the sin() correction term), the 2%-of-unique-size uniqueness guard, and
    the XOR/popcount bit-error score with diversity correction for
    repetitive audio

Ported as-is, not fixed (commented, not silently changed)

  • UNIQ_BITS/UNIQ_MASK/UNIQ_STRIP in the POC reference MATCH_BITS instead of
    the UNIQ_BITS they declare -- kept the same bucket width rather than
    changing what "duplicate item" means without a deliberate decision to.
  • The bit-error pass's reinterpret_cast to quint64* assumes 8-byte
    alignment, same as the POC. Works in practice; flagged with TODO(XXX)
    rather than adding an aligned-copy step this PR doesn't otherwise need.

Fixed, not ported as-is

  • The POC's memset(seen, 0, UNIQ_MASK) only clears half of the backing
    array (wrong byte count for a uint16_t[]). QVector::fill(0) here clears
    correctly.

Notes for reviewers

  • kMaxOffsetSearchItems = 120 is the value the POC's own test calls used.
    No other guidance exists yet for what the production search window
    should be -- flagging this as the one constant most likely to need
    re-tuning once this runs against a real library.
  • findTopOffset() is exposed as a separate private method (not just inlined
    into scoreFingerprints()) so it can get its own unit test later without
    needing fixture fingerprints large enough to exercise the full scoring
    pass.

Depends on: cmrt-quality-scoring (#34)

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 27872408352

Coverage remained the same at 30.438%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 116230
Covered Lines: 35378
Line Coverage: 30.44%
Coverage Strength: 59300.22 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants