textures: decode bounded multi-lane BCPack rANS streams #607

Merged
Joacoorandom merged 3 commits from upstream-pr/613 into main 2026-11-23 01:41:00 +00:00
Joacoorandom commented 2026-11-22 15:50:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Joacoorandom on 2026-11-22T15:50:41Z.


Change

Add a bounded, standard-library-only MDU rANS symbol decoder alongside the existing fixed-symbol prefix probe. Contributors can supply known lane widths and a symbol count to recover full per-lane symbol arrays, byte consumption and fragment/end-state diagnostics.

The command accepts 1–16 lanes with 1–9-bit symbols, at most 1,048,576 total output symbols and 2 MiB of input. It rejects malformed headers, truncated inputs, illegal terminal states, mismatched output shapes and non-zero trailing data.

The entropy engine is extracted from bcpack-rs by Ahmet Dedeler, with exact generated tables, source revision, original credits, dual-license files and Microsoft's MIT notice preserved. Most added lines are these vendored tables and reference code. The public wrapper, integration and additional controls are in this change.

One decoder extension restores at most two omitted low zero bytes when a flushed fragment exhausts its physical budget. Without it, the existing 16-lane synthetic packet from #442 stalls after consuming its input. The extension makes that packet reproduce all 32 expected symbols without extra physical reads; trimmed and untrimmed reverse-encoded controls also pass.

Refs #15, #442. This completes an entropy-layer step, not either issue's full BC7 block reconstruction goal. No other PR is required.

Verification

Commit: 6c905a22fc.

Linux, Python 3.14.4:

python3 -B tests/bcpack_symbols_check.py -v
python3 -B tests/bcpack_check.py
python3 -B tests/bc7_tiles_check.py
python3 -B tests/bc7_blocks_check.py -v
python3 -B tests/docs_links_check.py
python3 -B tests/bidi_controls_check.py
git diff --cached --check

Results:

  • New entropy controls: 8/8 test methods passed, including all 144 models, inverse interval boundaries, narrowed alphabets, long headers, fragment changes, CLI output/errors and rejection controls.
  • Unchanged Rust-generated vectors: all 9,168 symbols matched exactly, with complete byte consumption.
  • Existing #442 packet: all 32 symbols matched the independently checked expectation, consuming all 104 bytes.
  • Existing prefix/tail controls: 8/8 passed; BC7 tile controls: 6/6 passed.
  • BC7 block checks: 8 passed, 2 optional comparisons skipped (Leonida decoder environment variable and texture2ddecoder package were not configured for that invocation).
  • Documentation: 12 Markdown files / 127 links passed. Bidi check: 561 tracked source/configuration files passed. Staged whitespace check passed.

Windows 11 build 26300.9974, Python 3.12.8, configured with MSVC 19.44.35230 and INTAKE_PYTHON pointing to that interpreter:

ctest --test-dir out/native --no-tests=error -R "^bcpack_(rans_symbols|prefix_and_mip_tail)$" --output-on-failure

2/2 tests passed. These are Python tests; no GPU or full native build is claimed.

At the pinned bcpack-rs checkout:

cargo test --offline --no-default-features python_vectors

The Rust vector regeneration comparison passed, confirming both vendored JSON vectors are current synthetic encoder outputs.

For the existing #442 packet, a separate local comparison against Leonida revision 6a6704df1592e1dc4a3215ddf1423a78adb52045's decode_lanes and strict decode_with_info matched the same symbols, all 104 input bytes and the known BC7 block with no provisional entries. No Leonida source is included in this change.

Evidence and follow-up

The two vendored vectors come unchanged from bcpack-rs's source-built Rust encoder; model tables come from Microsoft's silicon-rans revision 2f6827d. The third packet already exists in tests/bcpack_mode6_vector.py. No game or archive bytes are used.

Provenance and licenses and reproduction documentation accompany the README entry, CTest registration and Linux CI command.

BC1 endpoint/codebook reconstruction, BC7 lane-to-field mapping, archive stream discovery and rendered pixels remain follow-up work. The full repository suite was not run locally.

Checklist

  • This pull request covers one reviewable behavior.
  • I included commands and results for verification.
  • I considered negative controls for the new decoder.
  • I updated README/docs for the new command.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted implementation, test development and documentation.

Follow-up after independent verification (2026-11-22)

Commit fa4a28c improves robustness in response to independent review:

  • Require a flushed intermediate fragment to return to the rANS home state before accepting the next fragment header. A two-fragment synthetic control accepts the authentic and one-byte-zero-trimmed streams, but rejects corrupt fragments with 2, 3 or 4 omitted physical bytes. The existing Rust-generated vectors and #442 multi-lane packet still decode unchanged.
  • Test exact public symbol-count boundaries for 1, 2 and 16 lanes and the exact 2 MiB input boundary, with a sentinel decoder to avoid allocating a million-symbol result. These are input-validation tests, not claimed successful decoding of a valid 2 MiB compressed stream.
  • Include the complete Apache-2.0 license text rather than the abbreviated notice and pin the vendored module's source revision in its header.

Local reruns on Linux / Python 3.14: python3 -B tests/bcpack_symbols_check.py -v 10/10 passed, plus bcpack_check.py, bc7_tiles_check.py, bc7_blocks_check.py (2 optional skips), docs_links_check.py, bidi_controls_check.py, and git diff --check. Original Windows results above are for 6c905a2; current-head GitHub CI is the separate Windows revalidation.

The strict home-state check applies when another fragment follows; there is no claim of an exhaustive corrupt-stream classifier. The original count-mismatch test can still fail through the generic no-progress path, and the input limit test does not process a complete 2 MiB valid stream.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6544416751 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/613). Originally posted by [Joacoorandom](https://github.com/Joacoorandom) on 2026-11-22T15:50:41Z. --- ## Change Add a bounded, standard-library-only MDU rANS symbol decoder alongside the existing fixed-symbol prefix probe. Contributors can supply known lane widths and a symbol count to recover full per-lane symbol arrays, byte consumption and fragment/end-state diagnostics. The command accepts 1–16 lanes with 1–9-bit symbols, at most 1,048,576 total output symbols and 2 MiB of input. It rejects malformed headers, truncated inputs, illegal terminal states, mismatched output shapes and non-zero trailing data. The entropy engine is extracted from [bcpack-rs by Ahmet Dedeler](https://github.com/Ahmet-Dedeler/bcpack-rs/tree/5bf5cc56ed56f1ababf1f9592300bd182ff90bd8), with exact generated tables, source revision, original credits, dual-license files and Microsoft's MIT notice preserved. Most added lines are these vendored tables and reference code. The public wrapper, integration and additional controls are in this change. One decoder extension restores at most two omitted low zero bytes when a flushed fragment exhausts its physical budget. Without it, the existing 16-lane synthetic packet from #442 stalls after consuming its input. The extension makes that packet reproduce all 32 expected symbols without extra physical reads; trimmed and untrimmed reverse-encoded controls also pass. Refs #15, #442. This completes an entropy-layer step, not either issue's full BC7 block reconstruction goal. No other PR is required. ## Verification Commit: 6c905a22fcc14fa1711aedbaa8f48b9151b90459. Linux, Python 3.14.4: ```text python3 -B tests/bcpack_symbols_check.py -v python3 -B tests/bcpack_check.py python3 -B tests/bc7_tiles_check.py python3 -B tests/bc7_blocks_check.py -v python3 -B tests/docs_links_check.py python3 -B tests/bidi_controls_check.py git diff --cached --check ``` Results: - New entropy controls: 8/8 test methods passed, including all 144 models, inverse interval boundaries, narrowed alphabets, long headers, fragment changes, CLI output/errors and rejection controls. - Unchanged Rust-generated vectors: all 9,168 symbols matched exactly, with complete byte consumption. - Existing #442 packet: all 32 symbols matched the independently checked expectation, consuming all 104 bytes. - Existing prefix/tail controls: 8/8 passed; BC7 tile controls: 6/6 passed. - BC7 block checks: 8 passed, 2 optional comparisons skipped (Leonida decoder environment variable and texture2ddecoder package were not configured for that invocation). - Documentation: 12 Markdown files / 127 links passed. Bidi check: 561 tracked source/configuration files passed. Staged whitespace check passed. Windows 11 build 26300.9974, Python 3.12.8, configured with MSVC 19.44.35230 and INTAKE_PYTHON pointing to that interpreter: ```text ctest --test-dir out/native --no-tests=error -R "^bcpack_(rans_symbols|prefix_and_mip_tail)$" --output-on-failure ``` 2/2 tests passed. These are Python tests; no GPU or full native build is claimed. At the pinned bcpack-rs checkout: ```text cargo test --offline --no-default-features python_vectors ``` The Rust vector regeneration comparison passed, confirming both vendored JSON vectors are current synthetic encoder outputs. For the existing #442 packet, a separate local comparison against Leonida revision 6a6704df1592e1dc4a3215ddf1423a78adb52045's decode_lanes and strict decode_with_info matched the same symbols, all 104 input bytes and the known BC7 block with no provisional entries. No Leonida source is included in this change. ## Evidence and follow-up The two vendored vectors come unchanged from bcpack-rs's source-built Rust encoder; model tables come from Microsoft's silicon-rans revision 2f6827d. The third packet already exists in tests/bcpack_mode6_vector.py. No game or archive bytes are used. [Provenance and licenses](https://github.com/Joacoorandom/Xbox2Windows/blob/fa4a28c495e3bff4242c385ad6f15a5cf8994e21/tools/_bcpack_rans/README.md) and [reproduction documentation](https://github.com/Joacoorandom/Xbox2Windows/blob/6c905a22fcc14fa1711aedbaa8f48b9151b90459/docs/experiments.md#decoding-mdu-rans-symbol-streams) accompany the README entry, CTest registration and Linux CI command. BC1 endpoint/codebook reconstruction, BC7 lane-to-field mapping, archive stream discovery and rendered pixels remain follow-up work. The full repository suite was not run locally. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included commands and results for verification. - [x] I considered negative controls for the new decoder. - [x] I updated README/docs for the new command. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted implementation, test development and documentation. ### Follow-up after independent verification (2026-11-22) Commit `fa4a28c` improves robustness in response to independent review: - Require a flushed intermediate fragment to return to the rANS home state before accepting the next fragment header. A two-fragment synthetic control accepts the authentic and one-byte-zero-trimmed streams, but rejects corrupt fragments with 2, 3 or 4 omitted physical bytes. The existing Rust-generated vectors and #442 multi-lane packet still decode unchanged. - Test **exact** public symbol-count boundaries for 1, 2 and 16 lanes and the exact 2 MiB input boundary, with a sentinel decoder to avoid allocating a million-symbol result. These are input-validation tests, not claimed successful decoding of a valid 2 MiB compressed stream. - Include the complete Apache-2.0 license text rather than the abbreviated notice and pin the vendored module's source revision in its header. Local reruns on Linux / Python 3.14: `python3 -B tests/bcpack_symbols_check.py -v` **10/10 passed**, plus `bcpack_check.py`, `bc7_tiles_check.py`, `bc7_blocks_check.py` (2 optional skips), `docs_links_check.py`, `bidi_controls_check.py`, and `git diff --check`. Original Windows results above are for `6c905a2`; current-head GitHub CI is the separate Windows revalidation. The strict home-state check applies when another fragment follows; there is no claim of an exhaustive corrupt-stream classifier. The original count-mismatch test can still fail through the generic no-progress path, and the input limit test does not process a complete 2 MiB valid stream.
upstream-sync closed this pull request 2026-11-24 06:43:57 +00:00
legacy-code-archaeologist commented 2026-11-24 06:48:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-22T17:27:59Z.


Verification of 6c905a2 on Windows 11 26100.9168 with Python 3.12.10. Your run used Linux and Python 3.14, and AGENTS.md asks for 3.11 or newer. The head merges cleanly with main (git merge-tree).

Check Result
python -B tests/bcpack_symbols_check.py 8 tests OK
python -B tests/bcpack_check.py OK
python -B tests/bc7_tiles_check.py OK
python -B tests/bc7_blocks_check.py OK (2 skipped)
python -B tests/docs_links_check.py 12 Markdown files, 127 links
python -B tests/bidi_controls_check.py 561 files, no bidirectional controls

I also checked the provenance claims in tools/_bcpack_rans/README.md. I compared each vendored file with upstream bcpack-rs at 5bf5cc56ed56f1ababf1f9592300bd182ff90bd8, fetched from GitHub, with line endings normalized:

Vendored file Upstream file Comparison
LICENSE-MIT LICENSE-MIT identical
LICENSE-APACHE LICENSE-APACHE identical
THIRD_PARTY_NOTICES.md THIRD_PARTY_NOTICES.md identical
bcpack_tables.py python/bcpack_tables.py identical ("copied unchanged" holds)
vectors/synthetic_11.json tests/vectors/synthetic_11.json identical
vectors/synthetic_12.json tests/vectors/synthetic_12.json identical
__init__.py python/bcpack.py up to def decode_symbols 52 changed lines

The 52 changed lines in __init__.py are all of these, and nothing else:

  • the module docstring was replaced;
  • the sys.path/json/os imports were removed;
  • the import was made package-relative, and the TABLES_SHA256 import was dropped;
  • the documented virtual_zeros slot and the restoration of at most two bytes on a flushed, exhausted fragment were added.

The remaining decoder logic matches upstream, as the README states.

AI-assisted: run and compared with Claude Code; outputs copied from the local runs.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7082859019 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/613#issuecomment-7082859019). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-22T17:27:59Z. --- Verification of `6c905a2` on Windows 11 26100.9168 with Python 3.12.10. Your run used Linux and Python 3.14, and `AGENTS.md` asks for 3.11 or newer. The head merges cleanly with `main` (`git merge-tree`). | Check | Result | |---|---| | `python -B tests/bcpack_symbols_check.py` | 8 tests OK | | `python -B tests/bcpack_check.py` | OK | | `python -B tests/bc7_tiles_check.py` | OK | | `python -B tests/bc7_blocks_check.py` | OK (2 skipped) | | `python -B tests/docs_links_check.py` | 12 Markdown files, 127 links | | `python -B tests/bidi_controls_check.py` | 561 files, no bidirectional controls | I also checked the provenance claims in `tools/_bcpack_rans/README.md`. I compared each vendored file with upstream bcpack-rs at `5bf5cc56ed56f1ababf1f9592300bd182ff90bd8`, fetched from GitHub, with line endings normalized: | Vendored file | Upstream file | Comparison | |---|---|---| | `LICENSE-MIT` | `LICENSE-MIT` | identical | | `LICENSE-APACHE` | `LICENSE-APACHE` | identical | | `THIRD_PARTY_NOTICES.md` | `THIRD_PARTY_NOTICES.md` | identical | | `bcpack_tables.py` | `python/bcpack_tables.py` | identical ("copied unchanged" holds) | | `vectors/synthetic_11.json` | `tests/vectors/synthetic_11.json` | identical | | `vectors/synthetic_12.json` | `tests/vectors/synthetic_12.json` | identical | | `__init__.py` | `python/bcpack.py` up to `def decode_symbols` | 52 changed lines | The 52 changed lines in `__init__.py` are all of these, and nothing else: - the module docstring was replaced; - the `sys.path`/`json`/`os` imports were removed; - the import was made package-relative, and the `TABLES_SHA256` import was dropped; - the documented `virtual_zeros` slot and the restoration of at most two bytes on a flushed, exhausted fragment were added. The remaining decoder logic matches upstream, as the README states. AI-assisted: run and compared with Claude Code; outputs copied from the local runs.
thepatrickworld commented 2026-11-24 06:48:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T18:33:21Z.


@Joacoorandom Independent run on 6c905a2, twice, plus coverage observations. Measurements only, no code change.

Environment

  • Windows 11 25H2, build 26200.9711
  • MSVC 19.44.35230 (toolset 14.44.35207), Windows SDK 10.0.26100.0
  • Python 3.15.2 (the repo's out/pe-env venv), pure standard library — no GPU involved, so the adapter is irrelevant here
  • Clean worktree of the PR head 6c905a2.

Commands

python -B tests/bcpack_symbols_check.py -v
python -B tests/bcpack_check.py
python -B tests/bc7_tiles_check.py
python -B tests/bc7_blocks_check.py

Each command was run twice, in separate processes, and the two logs were compared after normalising timings.

Observed — same results across two independent runs

  • bcpack_symbols_check: 8 test methods, 8 ok (all_models_and_alphabet_widths, argument_bounds, cli, narrowing_long_headers_and_flushed_fragments, published_table_checksum_and_inverse, reject_malformed_streams, rust_generated_streams, sixteen_lane_mode6_entropy).
  • bcpack_check, bc7_tiles_check, bc7_blocks_check: all ok on both runs.
  • The two runs are byte-identical once durations are normalised (0.700s vs 0.724s); no ordering, hashing or global-state dependence showed up.

Merge state

mergeable: true, and all four check-runs are green (Windows /O2, Windows, gfx1013 fixture assembly, Linux Python checks). The blocked state GitHub shows is a missing review, not a conflict.

The virtual-zero extension is grounded, not a patch to pass #442

I checked this specifically because it is the kind of change that can be a quiet workaround.

  • The upstream encoder itself trims up to two trailing zero bytes per fragment (src/encode.rs at 5bf5cc56: "Bytes emitted while encoding the last symbol from x = L are zeros that the decoder never needs to read: drop up to two"). So restoring them is the inverse of a documented encoder behaviour.
  • The restore loop (while 0 < x < L and ln.virtual_zeros < 2: x <<= 8) touches only x. No byte is read: pos, nbytes and consumed stay intact, and I confirmed full consumption on the fixtures (104/104, 515/515). In an interleaved shared stream, a real over-read would eat another lane's byte and desynchronise everything; this is structurally incapable of that.
  • An independent implementation (Leonida 6a6704d) does the same virtual-zero fill on flush, which corroborates the mechanism as a format property.

What is not settled: that implementation caps at a different bound and fails explicitly when the fragment does not return to its home state (fragment did not end at its home state). Here, any x in (0, L) is absorbed and the FSM drains into the next header. So nothing distinguishes a legitimately trimmed fragment from a corrupted one, and there is no negative control for a flush fragment short by more than two bytes. ln.flush does not discriminate either — upstream sets it unconditionally, and the block fires on untrimmed vectors too.

Bounds: exact for lanes and widths, only "beyond" for symbols and input size

  • Lanes: 0 rejected, 1 accepted, 16 accepted, 17 rejected — exact on both sides.
  • Symbol widths: 1–9 decoded, 0 and 10 rejected — exact on both sides.
  • Output symbols: the guard is symbols <= MAX_SYMBOLS // len(widths), so with two lanes the effective bound is 524 288. The only rejection case passes MAX_SYMBOLS (1 048 576), i.e. twice the effective bound, and no positive case asserts the exact limit for one lane or for sixteen.
  • Input size: only MAX_INPUT + 1 is tested; the exact 2 097 152 bound is never asserted and no valid 2 MiB stream is decoded.

Rejections: three messages checked, the rest bare

assertRaisesRegex covers trailing, alphabet and illegal, and those do reach the intended paths. Everything else is a bare assertRaises, and all truncations plus the wrong-count case raise the same generic no progress (stream truncated or not BCPack BC1) at byte N. The wrong-count control therefore passes by coincidence: the shape guard is never reached, decode raises first.

Provenance of the 9,168 symbols

vectors/synthetic_{11,12}.json are byte-identical to upstream 5bf5cc56 and were produced by that repo's own Rust encoder. That is not tautological in the strict sense (Rust encoder vs vendored Python decoder), but it is a round-trip within one project on the same Microsoft tables — no retail stream, no hardware capture. The genuinely external anchor is the #442 packet, and it holds: Leonida's independent decoder reproduces all 32 symbols with used=104. That anchor is asserted in a comment rather than replayed by a test.

Licence form

LICENSE-APACHE is the 15-line notice, not the full Apache-2.0 text that §4(a) asks you to ship with a copy of the work, and the vendored file header gives the source URL without the pinned revision (the revision only appears in the README). Everything else is clean: only __init__.py differs from upstream, and the modification is declared in three places (docstring, README, docs/experiments.md).

AI-assisted; runs executed locally, twice per suite. The coverage observations come from a separate code review that diffed against the pinned upstream, ran the decoder with and without the extension, and cross-checked with an independent implementation; the two load-bearing claims (effective symbol bound, no byte consumption) were re-verified by me before posting.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7083691388 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/613#issuecomment-7083691388). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-22T18:33:21Z. --- @Joacoorandom **Independent run on `6c905a2`**, twice, plus coverage observations. Measurements only, no code change. ### Environment - Windows 11 25H2, build **26200.9711** - MSVC **19.44.35230** (toolset 14.44.35207), Windows SDK 10.0.26100.0 - Python **3.15.2** (the repo's `out/pe-env` venv), pure standard library — no GPU involved, so the adapter is irrelevant here - Clean worktree of the PR head `6c905a2`. ### Commands ``` python -B tests/bcpack_symbols_check.py -v python -B tests/bcpack_check.py python -B tests/bc7_tiles_check.py python -B tests/bc7_blocks_check.py ``` Each command was run **twice, in separate processes**, and the two logs were compared after normalising timings. ### Observed — same results across two independent runs - `bcpack_symbols_check`: **8 test methods, 8 ok** (`all_models_and_alphabet_widths`, `argument_bounds`, `cli`, `narrowing_long_headers_and_flushed_fragments`, `published_table_checksum_and_inverse`, `reject_malformed_streams`, `rust_generated_streams`, `sixteen_lane_mode6_entropy`). - `bcpack_check`, `bc7_tiles_check`, `bc7_blocks_check`: all ok on both runs. - The two runs are **byte-identical** once durations are normalised (`0.700s` vs `0.724s`); no ordering, hashing or global-state dependence showed up. ### Merge state `mergeable: true`, and all four check-runs are green (Windows `/O2`, Windows, gfx1013 fixture assembly, Linux Python checks). The `blocked` state GitHub shows is a missing review, not a conflict. ### The virtual-zero extension is grounded, not a patch to pass #442 I checked this specifically because it is the kind of change that can be a quiet workaround. - The upstream encoder **itself trims** up to two trailing zero bytes per fragment (`src/encode.rs` at `5bf5cc56`: "Bytes emitted while encoding the last symbol from x = L are zeros that the decoder never needs to read: drop up to two"). So restoring them is the inverse of a documented encoder behaviour. - The restore loop (`while 0 < x < L and ln.virtual_zeros < 2: x <<= 8`) touches **only `x`**. No byte is read: `pos`, `nbytes` and `consumed` stay intact, and I confirmed full consumption on the fixtures (104/104, 515/515). In an interleaved shared stream, a real over-read would eat another lane's byte and desynchronise everything; this is structurally incapable of that. - An independent implementation (Leonida `6a6704d`) does the same virtual-zero fill on flush, which corroborates the mechanism as a format property. **What is not settled:** that implementation caps at a different bound and **fails explicitly** when the fragment does not return to its home state (`fragment did not end at its home state`). Here, any `x` in `(0, L)` is absorbed and the FSM drains into the next header. So nothing distinguishes a legitimately trimmed fragment from a corrupted one, and there is no negative control for a flush fragment short by more than two bytes. `ln.flush` does not discriminate either — upstream sets it unconditionally, and the block fires on untrimmed vectors too. ### Bounds: exact for lanes and widths, only "beyond" for symbols and input size - Lanes: 0 rejected, 1 accepted, 16 accepted, 17 rejected — exact on both sides. - Symbol widths: 1–9 decoded, 0 and 10 rejected — exact on both sides. - Output symbols: the guard is `symbols <= MAX_SYMBOLS // len(widths)`, so with two lanes the effective bound is 524 288. The only rejection case passes `MAX_SYMBOLS` (1 048 576), i.e. **twice** the effective bound, and no positive case asserts the exact limit for one lane or for sixteen. - Input size: only `MAX_INPUT + 1` is tested; the exact 2 097 152 bound is never asserted and no valid 2 MiB stream is decoded. ### Rejections: three messages checked, the rest bare `assertRaisesRegex` covers `trailing`, `alphabet` and `illegal`, and those do reach the intended paths. Everything else is a bare `assertRaises`, and all truncations plus the wrong-count case raise the **same** generic `no progress (stream truncated or not BCPack BC1) at byte N`. The wrong-count control therefore passes by coincidence: the shape guard is never reached, `decode` raises first. ### Provenance of the 9,168 symbols `vectors/synthetic_{11,12}.json` are byte-identical to upstream `5bf5cc56` and were produced by that repo's own Rust encoder. That is not tautological in the strict sense (Rust encoder vs vendored Python decoder), but it is a round-trip within one project on the same Microsoft tables — no retail stream, no hardware capture. The genuinely external anchor is the #442 packet, and it holds: Leonida's independent decoder reproduces all 32 symbols with `used=104`. That anchor is asserted in a comment rather than replayed by a test. ### Licence form `LICENSE-APACHE` is the 15-line notice, not the full Apache-2.0 text that §4(a) asks you to ship with a copy of the work, and the vendored file header gives the source URL without the pinned revision (the revision only appears in the README). Everything else is clean: only `__init__.py` differs from upstream, and the modification is declared in three places (docstring, README, `docs/experiments.md`). _AI-assisted; runs executed locally, twice per suite. The coverage observations come from a separate code review that diffed against the pinned upstream, ran the decoder with and without the extension, and cross-checked with an independent implementation; the two load-bearing claims (effective symbol bound, no byte consumption) were re-verified by me before posting._
Joacoorandom commented 2026-11-24 06:48:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Joacoorandom on 2026-11-22T18:41:23Z.


Thanks for the independent Windows runs and the detailed coverage/format review. I followed up in fa4a28c with three focused changes: (1) intermediate flushed fragments must reach the rANS home state before switching headers; a new two-fragment negative control rejects 2–4 omitted bytes while preserving a legitimate single-zero trim, (2) exact 1/2/16-lane symbol-count limits and the exact 2 MiB input boundary are tested with a sentinel backend (no claim of actually decoding a valid 2 MiB stream), and (3) the complete Apache-2.0 license and pinned vendored revision are included. All 10 entropy test methods and the existing BCPack/BC7/docs checks passed locally; the Linux CI jobs on this head are green and Windows CI is still running. The #442 packet is directly replayed in test_sixteen_lane_mode6_entropy, checking all 32 symbols and full byte consumption. I have not changed the generic wrong-count no-progress diagnostic and do not claim exhaustive malformed-stream classification. Thanks for pinpointing the gaps.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7083794651 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/613#issuecomment-7083794651). Originally posted by [Joacoorandom](https://github.com/Joacoorandom) on 2026-11-22T18:41:23Z. --- Thanks for the independent Windows runs and the detailed coverage/format review. I followed up in `fa4a28c` with three focused changes: (1) intermediate flushed fragments must reach the rANS home state before switching headers; a new two-fragment negative control rejects 2–4 omitted bytes while preserving a legitimate single-zero trim, (2) exact 1/2/16-lane symbol-count limits and the exact 2 MiB input boundary are tested with a sentinel backend (no claim of actually decoding a valid 2 MiB stream), and (3) the complete Apache-2.0 license and pinned vendored revision are included. All 10 entropy test methods and the existing BCPack/BC7/docs checks passed locally; the Linux CI jobs on this head are green and Windows CI is still running. The #442 packet is directly replayed in `test_sixteen_lane_mode6_entropy`, checking all 32 symbols and full byte consumption. I have not changed the generic wrong-count no-progress diagnostic and do not claim exhaustive malformed-stream classification. Thanks for pinpointing the gaps.
legacy-code-archaeologist commented 2026-11-24 06:48:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-22T18:45:22Z.


Re-checked the new head fa4a28c on Windows 11 26100.9168 with Python 3.12.10. It merges cleanly with main.

Check Result
tests/bcpack_symbols_check.py 10 tests OK (8 before)
tests/bcpack_check.py, tests/bc7_tiles_check.py OK
tests/bc7_blocks_check.py OK (2 skipped)
tests/docs_links_check.py, tests/bidi_controls_check.py pass

On provenance, correcting my earlier table for one file. LICENSE-APACHE is no longer byte-identical to upstream's short notice. It now holds the full license text, which the README states. It matches the official text at https://www.apache.org/licenses/LICENSE-2.0.txt, ignoring whitespace. LICENSE-MIT, THIRD_PARTY_NOTICES.md and bcpack_tables.py are still identical to bcpack-rs 5bf5cc56.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7083845076 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/613#issuecomment-7083845076). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-22T18:45:22Z. --- Re-checked the new head `fa4a28c` on Windows 11 26100.9168 with Python 3.12.10. It merges cleanly with `main`. | Check | Result | |---|---| | `tests/bcpack_symbols_check.py` | 10 tests OK (8 before) | | `tests/bcpack_check.py`, `tests/bc7_tiles_check.py` | OK | | `tests/bc7_blocks_check.py` | OK (2 skipped) | | `tests/docs_links_check.py`, `tests/bidi_controls_check.py` | pass | On provenance, correcting my earlier table for one file. `LICENSE-APACHE` is no longer byte-identical to upstream's short notice. It now holds the full license text, which the README states. It matches the official text at https://www.apache.org/licenses/LICENSE-2.0.txt, ignoring whitespace. `LICENSE-MIT`, `THIRD_PARTY_NOTICES.md` and `bcpack_tables.py` are still identical to bcpack-rs `5bf5cc56`. AI-assisted (Claude Code).
JB2WIN commented 2026-11-24 06:48:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-22T19:13:34Z.


Independent Windows run of this PR on physical hardware:

  • Commit under test: fa4a28c (PR head), built from source
  • Windows 11 (10.0.26200.9974), VS Build Tools 2026 (MSVC 19.51), SDK 10.0.26100.8249 (DXC 1.8.2502.11), dev preset
  • NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP 10.0.26100.9818, D3D12 debug layer enabled

ctest --preset dev --no-tests=error -R '^(bcpack|bc7|texture|resource_range)' -V: 9/9 passed: bcpack_prefix_and_mip_tail, bcpack_rans_symbols, bc7_block_reference, bc7_tile_swizzle, resource_range_controls, texture_mips_{hardware,warp} and bc7_draw_{hardware,warp}. No skips, and the debug layer reported debug_errors=0 on all 28 draws. I did not run any mutations.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7084213250 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/613#issuecomment-7084213250). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-22T19:13:34Z. --- Independent Windows run of this PR on physical hardware: - Commit under test: `fa4a28c` (PR head), built from source - Windows 11 (10.0.26200.9974), VS Build Tools 2026 (MSVC 19.51), SDK 10.0.26100.8249 (DXC 1.8.2502.11), dev preset - NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP 10.0.26100.9818, D3D12 debug layer enabled `ctest --preset dev --no-tests=error -R '^(bcpack|bc7|texture|resource_range)' -V`: **9/9 passed**: `bcpack_prefix_and_mip_tail`, `bcpack_rans_symbols`, `bc7_block_reference`, `bc7_tile_swizzle`, `resource_range_controls`, `texture_mips_{hardware,warp}` and `bc7_draw_{hardware,warp}`. No skips, and the debug layer reported `debug_errors=0` on all 28 draws. I did not run any mutations. AI-assisted.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!607
No description provided.