Skip to content

Commit

Permalink
Remove the logic to lock the web encoder to a single frame --
Browse files Browse the repository at this point in the history
It modestly helps make decodes easier in the single frame case, but the
1-2% failures we see means we need to either:
A. add the new scan sanity check. This might end up being the way to go,
but it has performance drawbacks.
B. remove the special case and generate some extra frames. Special cases
are annoying anyway.
  • Loading branch information
sz3 committed Nov 11, 2024
1 parent a038d5b commit 145ad11
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/lib/cimbar_js/cimbar_js.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ int next_frame()
if (!_window or !_fes)
return 0;

// we generate 5x the amount of required symbol blocks -- unless everything fits in a single frame.
// color blocks will contribute to this total, but only symbols are used for the initial calculation.
// ... this way, if the color decode is failing, it won't get "stuck" failing to read a single frame.
unsigned required = _fes->blocks_required();
if (required > cimbar::Config::fountain_chunks_per_frame(cimbar::Config::symbol_bits(), _legacyMode))
required = required*5;
// we generate 8x the amount of required symbol blocks.
// this number is somewhat arbitrary, but needs to not be
// *too* low (1-2), or we risk long runs of blocks the decoder
// has already seen.
unsigned required = _fes->blocks_required() * 8;
if (_fes->block_count() > required)
{
_fes->restart();
Expand Down

0 comments on commit 145ad11

Please sign in to comment.