BC1 preset window: correct 74 fitted slots and fill slot 4 #6

Manually merged
github merged 1 commit from gh-pr/6/head into gh-pr/6/base 2026-11-26 18:55:57 +00:00
Owner

@⁠Ahmet-Dedeler on GitHub · 2026-11-24 13:33 UTC · original
Ahmet-Dedeler:fix/bc1-window-format-values → master · +84 −84 · 5 files · 1 commits · merged 2026-11-24 13:34 UTC

Closes #4.

The report was right. I compared data/bc1_window.json with the format's constant BC1 dictionary as a reference decoder carries it:

  • 180 of the 254 fitted slots were already equal, which also confirms the slot mapping (entry j stands for block -(j+1), slot 255-j).
  • 74 differed by an L1 distance of 1 to 8, the same histogram as in the issue.
  • Slot 4 was never referenced in the fitting data. Slot 0 does not exist in the format (255 entries).

Those 75 slots now hold the reference value; the old fitted value stays in the file as fitted_value.

Measured

tools/retail/mip_e2e.py 600 1 (600 random pair textures, BCPack mip 0 decoded and compared with the plain mip 1), old table vs new:

old new
median 35.39 dB 35.52 dB
p10 30.17 30.72
below 25 dB 3 0
not 3 dB above flat 18 16

Per texture: 44 better, 27 worse, 529 unchanged. Largest gain 12.31 dB, largest loss 0.30 dB. The old numbers reproduce the README's published ones exactly.

cargo test passes. The index codebook (bc1_quad_table.json) is not touched and has not been compared with a reference yet.

Also fixes a temp file name in mip_e2e.py that broke on texture ids containing a slash.

**@⁠Ahmet-Dedeler** on GitHub · 2026-11-24 13:33 UTC · [original](https://github.com/Ahmet-Dedeler/bcpack-rs/pull/6) `Ahmet-Dedeler:fix/bc1-window-format-values` → `master` · +84 −84 · 5 files · 1 commits · merged 2026-11-24 13:34 UTC Closes #4. The report was right. I compared `data/bc1_window.json` with the format's constant BC1 dictionary as a reference decoder carries it: - 180 of the 254 fitted slots were already equal, which also confirms the slot mapping (entry j stands for block -(j+1), slot 255-j). - 74 differed by an L1 distance of 1 to 8, the same histogram as in the issue. - Slot 4 was never referenced in the fitting data. Slot 0 does not exist in the format (255 entries). Those 75 slots now hold the reference value; the old fitted value stays in the file as `fitted_value`. ## Measured `tools/retail/mip_e2e.py 600 1` (600 random pair textures, BCPack mip 0 decoded and compared with the plain mip 1), old table vs new: | | old | new | |---|---|---| | median | 35.39 dB | 35.52 dB | | p10 | 30.17 | 30.72 | | below 25 dB | 3 | 0 | | not 3 dB above flat | 18 | 16 | Per texture: 44 better, 27 worse, 529 unchanged. Largest gain 12.31 dB, largest loss 0.30 dB. The old numbers reproduce the README's published ones exactly. `cargo test` passes. The index codebook (`bc1_quad_table.json`) is not touched and has not been compared with a reference yet. Also fixes a temp file name in `mip_e2e.py` that broke on texture ids containing a slash.
Compared with the format's constant BC1 dictionary as a reference decoder
carries it, 180 fitted slots were already equal, 74 differed by an L1 distance
of 1 to 8 and slot 4 was never referenced by the fitting data. Those 75 now
hold the reference value (the old fit is kept as fitted_value). Slot 0 does
not exist in the format.

600-texture mip check: median 35.39 -> 35.52 dB, p10 30.17 -> 30.72, below
25 dB 3 -> 0. Also fix mip_e2e.py's temp file name for texture ids that
contain a slash.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:55:55 +00:00
github manually merged commit e24372bdd6 into gh-pr/6/base 2026-11-26 18:55:57 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 13:33 UTC · original · edited 2026-11-24 13:36 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T13:36:52.382383Z e24372b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 13:33 UTC · [original](https://github.com/Ahmet-Dedeler/bcpack-rs/pull/6#issuecomment-7133006709) · edited 2026-11-24 13:36 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"e24372bdd66e7e32616347baa854d2edd182bf22","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T13:36:52.382383Z">2026-11-24T13:36:52.382383Z</relative-time> | `e24372b` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-24 13:33 UTC · original · edited 2026-11-24 13:35 UTC

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

**@⁠coderabbitai[bot]** on GitHub · 2026-11-24 13:33 UTC · [original](https://github.com/Ahmet-Dedeler/bcpack-rs/pull/6#issuecomment-7133008542) · edited 2026-11-24 13:35 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/Ahmet-Dedeler/bcpack-rs/pull/6?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- This is an auto-generated comment: failure by coderabbit.ai --> > [!CAUTION] > ## Review failed > > <!-- failure_reason_start --> > The pull request is closed. > <!-- failure_reason_end --> <!-- end of auto-generated comment: failure by coderabbit.ai --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=Ahmet-Dedeler/bcpack-rs&utm_content=6)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> <br> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end -->
Author
Owner

@⁠Yoshi-233 on GitHub · 2026-11-25 02:49 UTC · original

I checked how the updated table affects the Rust assembler on x86-64 Linux at merge commit b1c3099a3402. I made 255 synthetic one-block inputs: block 0 references one preset slot at a time, with zero endpoint residuals and identical index symbols. I assembled each input with both the pre-PR table and the merged default table.

75 slots changed their emitted RGB565 endpoint pair and 180 kept the same pair. All 255 matched an independent RGB565 packing of the JSON entries; the index bytes stayed identical. For slot 4 specifically, the endpoint pair changed from (0x0000, 0x0000) to (0x636d, 0x3186), and the unfitted-block count went from 1 to 0. The existing CPU roundtrip suite also passed 9/9. This checks the table-to-decoder path with generated inputs.

**@⁠Yoshi-233** on GitHub · 2026-11-25 02:49 UTC · [original](https://github.com/Ahmet-Dedeler/bcpack-rs/pull/6#issuecomment-7151231321) I checked how the updated table affects the Rust assembler on x86-64 Linux at merge commit `b1c3099a3402`. I made 255 synthetic one-block inputs: block 0 references one preset slot at a time, with zero endpoint residuals and identical index symbols. I assembled each input with both the pre-PR table and the merged default table. 75 slots changed their emitted RGB565 endpoint pair and 180 kept the same pair. All 255 matched an independent RGB565 packing of the JSON entries; the index bytes stayed identical. For slot 4 specifically, the endpoint pair changed from `(0x0000, 0x0000)` to `(0x636d, 0x3186)`, and the unfitted-block count went from 1 to 0. The existing CPU roundtrip suite also passed 9/9. This checks the table-to-decoder path with generated inputs.
This discussion has been locked. Commenting is limited to contributors.
No description provided.