diff options
| author | OreoFR <29048345+OreoFR@users.noreply.github.com> | 2026-11-29 13:51:28 +0100 |
|---|---|---|
| committer | OreoFR <29048345+OreoFR@users.noreply.github.com> | 2026-11-29 13:51:28 +0100 |
| commit | 3beeb56bfb3dc99f60e85e85211ba3c2d88223bc (patch) | |
| tree | 5f563496290a7775a669864fbf61d85b9161cfd8 /runtime/src/bcpack.cpp | |
| parent | ed34b996ce2aef1ae2800b0f0840ca6878b89b73 (diff) | |
| parent | cc0f662a70b6e6e561692f56342b5a7df3831bd7 (diff) | |
Merge origin/main into carry/pr-2031
submit_phases: main's nested-phase Scope kept; the PR's skip now applies only when nothing reads the times (timing_wanted(): period 0 and LEONIDA_DEV_OVERLAY not 1).
Co-authored-by: Ilyass Roussi <76879547+IlyassRS3@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/bcpack.cpp')
| -rw-r--r-- | runtime/src/bcpack.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/src/bcpack.cpp b/runtime/src/bcpack.cpp index bb4646787..8a6049d73 100644 --- a/runtime/src/bcpack.cpp +++ b/runtime/src/bcpack.cpp | |||
| @@ -263,7 +263,7 @@ bool bc7(const Symbols &a, const Symbols &b, const BptcState &ep, | |||
| 263 | // earlier uses of the slot. | 263 | // earlier uses of the slot. |
| 264 | struct Coverage { | 264 | struct Coverage { |
| 265 | array<bool, 256> missing_ep{}, missing_ix{}; | 265 | array<bool, 256> missing_ep{}, missing_ix{}; |
| 266 | size_t lost{}, inconsistent{}, limit{}; | 266 | size_t lost{}, inconsistent{}, limit{}, lost_limit{}; |
| 267 | bool lost_endpoints{}, lost_indices{}; | 267 | bool lost_endpoints{}, lost_indices{}; |
| 268 | void note_missing(const BptcState &block) { | 268 | void note_missing(const BptcState &block) { |
| 269 | const bool ep = block.ep_root >= 0 && missing_ep[block.ep_root]; | 269 | const bool ep = block.ep_root >= 0 && missing_ep[block.ep_root]; |
| @@ -382,7 +382,7 @@ bool rebuild_bptc(unsigned codec, size_t i, size_t blocks, const Symbols &a, | |||
| 382 | } else if (i >= 256) | 382 | } else if (i >= 256) |
| 383 | coverage.note_missing(next); | 383 | coverage.note_missing(next); |
| 384 | if (!valid) return false; | 384 | if (!valid) return false; |
| 385 | if (coverage.lost > coverage.limit) { | 385 | if (coverage.lost > coverage.lost_limit) { |
| 386 | reason = coverage.lost_endpoints && coverage.lost_indices ? "missing-endpoint-and-index" : | 386 | reason = coverage.lost_endpoints && coverage.lost_indices ? "missing-endpoint-and-index" : |
| 387 | coverage.lost_endpoints ? "missing-endpoint" : "missing-index"; | 387 | coverage.lost_endpoints ? "missing-endpoint" : "missing-index"; |
| 388 | return false; | 388 | return false; |
| @@ -394,7 +394,8 @@ bool rebuild_bptc(unsigned codec, size_t i, size_t blocks, const Symbols &a, | |||
| 394 | 394 | ||
| 395 | Quality decode(unsigned codec, std::span<const uint8_t> source, | 395 | Quality decode(unsigned codec, std::span<const uint8_t> source, |
| 396 | std::span<uint8_t> output, bool allow_fitted, | 396 | std::span<uint8_t> output, bool allow_fitted, |
| 397 | const Calibration *history, const char** failure, bool fast_entropy) { | 397 | const Calibration *history, const char** failure, bool fast_entropy, size_t lost_divisor, |
| 398 | Report *report) { | ||
| 398 | const char* reason = "bcpack-stream"; | 399 | const char* reason = "bcpack-stream"; |
| 399 | if (failure) *failure = reason; | 400 | if (failure) *failure = reason; |
| 400 | Quality quality = Quality::confirmed; | 401 | Quality quality = Quality::confirmed; |
| @@ -410,12 +411,17 @@ Quality decode(unsigned codec, std::span<const uint8_t> source, | |||
| 410 | coverage.limit = allow_fitted && history | 411 | coverage.limit = allow_fitted && history |
| 411 | ? max<size_t>(2, output.size() / block_size / 1024) | 412 | ? max<size_t>(2, output.size() / block_size / 1024) |
| 412 | : 0; | 413 | : 0; |
| 414 | coverage.lost_limit = allow_fitted && history | ||
| 415 | ? max<size_t>(2, output.size() / block_size / max<size_t>(1, lost_divisor)) | ||
| 416 | : 0; | ||
| 417 | if (report) *report = {output.size() / block_size, 0}; | ||
| 413 | const bool valid = visit_blocks(codec, source, output.size(), [&](size_t i, const Symbols &first, const Symbols &tuple) { | 418 | const bool valid = visit_blocks(codec, source, output.size(), [&](size_t i, const Symbols &first, const Symbols &tuple) { |
| 414 | auto *dst = output.data() + i * block_size; | 419 | auto *dst = output.data() + i * block_size; |
| 415 | if (codec >= 6) | 420 | if (codec >= 6) |
| 416 | return rebuild_bptc(codec, i, output.size() / block_size, first, tuple, bptc, dst, history, allow_fitted, quality, coverage, reason); | 421 | return rebuild_bptc(codec, i, output.size() / block_size, first, tuple, bptc, dst, history, allow_fitted, quality, coverage, reason); |
| 417 | return rebuild_classic(codec, i, first, tuple, classic, dst, allow_fitted, quality); | 422 | return rebuild_classic(codec, i, first, tuple, classic, dst, allow_fitted, quality); |
| 418 | }, fast_entropy); | 423 | }, fast_entropy); |
| 424 | if (report) report->lost = coverage.lost; | ||
| 419 | if (valid && (!coverage.inconsistent || quality == Quality::fitted)) return quality; | 425 | if (valid && (!coverage.inconsistent || quality == Quality::fitted)) return quality; |
| 420 | if (failure) *failure = coverage.inconsistent && valid ? "anchor-or-pbit" : reason; | 426 | if (failure) *failure = coverage.inconsistent && valid ? "anchor-or-pbit" : reason; |
| 421 | return Quality::failed; | 427 | return Quality::failed; |