Conversation
…tion The frame sync hunt loop copied the symbol amplitude window into lbuf2 and ran a full qsort over it on every iteration, only to read three ranked values off each end for lmin/lmax. Replace that with a single pass maintaining the five smallest and five largest values in two fixed 5-slot arrays; the same ranked endpoints are read from those, so output is bit-identical. The datascope histogram now bins the unsorted window (order does not affect bin counts). The unused lbuf2 scratch buffer is removed; comp() stays as dsd_dibit.c still uses it. Ref: lwvmobile#142
xdab
force-pushed
the
dsd-sync-hunt-topn
branch
from
September 21, 2026 18:48
5cce1a1 to
c134101
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As announced in #142 -
getFrameSync()indsd_frame_sync.ccopies the symbol amplitude window intolbuf2and runs a fullqsortover it on every iteration of the hunt loop - per symbol, for as long as no sync is found, just to read a couple of values off each end for thelmin/lmaxlevel tracking.An idle decoder on a quiet channel pays for this continuously. I was fixing this on a local fork, along with other perf-related improvements - now decided to share some back with the public repos; the dsd-fme equivalent already went in via lwvmobile#362.
This PR replaces the copy + sort with a single pass that keeps the five smallest and five largest values in two fixed 5-slot arrays and reads the same ranked endpoints from those.
Output is bit-identical, the idle hunt loop just stops paying for a full sort per symbol.
The datascope histogram now bins the unsorted window directly (bin counts don't depend on ordering), the unused
lbuf2scratch buffer is dropped;comp()indsd_main.cstays, as the symbol timing sort indsd_dibit.cstill uses it.Verified byte-identical console output (timestamps stripped) on DMR and D-Star sample captures, including runs with a 10 s no-carrier lead-in to exercise the hunt path, plus datascope mode. The sample-file testing was performed by AI as part of this PR's preparation.
Clean build, no new warnings.