BCPack: BC3, BC4, BC5 and BC7 presets made consistent with three more exact rules #125

Manually merged
github merged 1 commit from gh-pr/125/head into gh-pr/125/base 2026-11-26 20:11:42 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-24 05:24 UTC · original
holdmysocks:claude/bcpack-rules-3 → master · +194 −194 · 3 files · 1 commits · merged 2026-11-24 05:54 UTC

Preset tables only; no decoder code changes. Each rule was found on chains that never touch a preset table, where it depends on the decoder rules alone, and is then used to correct preset values on the chains that do.

Codec Rule Without presets Preset-rooted before After
BC7 mode 1: both endpoints of a subset carry the same p-bit position 0 of 3,359,376 subsets 31,054 of 8,853,332 0
BC3 colour endpoint 0 is never below endpoint 1 0 of 61,383 blocks 727 of 534,073 13
BC4 e0 - e1 is never in -4..=0 0 of 52,049 blocks 407 of 149,679 31
BC5 same, per channel 286 of 1,256,644 (flat default blocks left out) 380,478 of 8,524,092 1,052

Effect on the decode:

  • BC7: 103 of 478 slot/subset entries change, in the low two bits of one channel. No measurable PSNR change; it removes a known inconsistency.
  • BC3: the two slots that held 713 of the 727 violations go from about 36 dB to 41.4 and 38.9 dB against plain child mips. Everything else is unchanged within 0.1 dB.
  • BC4: 38.12 to 38.31 dB against plain child mips.
  • BC5: 38.98 to 39.60 dB against plain child mips. One slot (the block just before the chunk start, 560,037 blocks) had 47 % of its blocks with reversed endpoints in one channel; it now has none.

The BC4/BC5 rule is applied only where the child-mip error allows it (a violation costs 50 units of squared error), because it is not perfectly exact for BC5. In most slots the error falls together with the violations, which is independent support for the rule.

Not applied: the same gap rule on BC3 alpha. It holds on chains without presets (4 of 61,383), but enforcing it raised the alpha error, so BC3 alpha presets are unchanged.

Tests: cargo test --release -p sixng-core bc, 18 pass.

**@⁠holdmysocks** on GitHub · 2026-11-24 05:24 UTC · [original](https://github.com/holdmysocks/SixNG/pull/125) `holdmysocks:claude/bcpack-rules-3` → `master` · +194 −194 · 3 files · 1 commits · merged 2026-11-24 05:54 UTC Preset tables only; no decoder code changes. Each rule was found on chains that never touch a preset table, where it depends on the decoder rules alone, and is then used to correct preset values on the chains that do. | Codec | Rule | Without presets | Preset-rooted before | After | |---|---|---|---|---| | BC7 | mode 1: both endpoints of a subset carry the same p-bit position | 0 of 3,359,376 subsets | 31,054 of 8,853,332 | 0 | | BC3 | colour endpoint 0 is never below endpoint 1 | 0 of 61,383 blocks | 727 of 534,073 | 13 | | BC4 | e0 - e1 is never in -4..=0 | 0 of 52,049 blocks | 407 of 149,679 | 31 | | BC5 | same, per channel | 286 of 1,256,644 (flat default blocks left out) | 380,478 of 8,524,092 | 1,052 | Effect on the decode: - BC7: 103 of 478 slot/subset entries change, in the low two bits of one channel. No measurable PSNR change; it removes a known inconsistency. - BC3: the two slots that held 713 of the 727 violations go from about 36 dB to 41.4 and 38.9 dB against plain child mips. Everything else is unchanged within 0.1 dB. - BC4: 38.12 to 38.31 dB against plain child mips. - BC5: 38.98 to 39.60 dB against plain child mips. One slot (the block just before the chunk start, 560,037 blocks) had 47 % of its blocks with reversed endpoints in one channel; it now has none. The BC4/BC5 rule is applied only where the child-mip error allows it (a violation costs 50 units of squared error), because it is not perfectly exact for BC5. In most slots the error falls together with the violations, which is independent support for the rule. Not applied: the same gap rule on BC3 alpha. It holds on chains without presets (4 of 61,383), but enforcing it raised the alpha error, so BC3 alpha presets are unchanged. Tests: `cargo test --release -p sixng-core bc`, 18 pass.
BC7 mode 1: both endpoints of a subset carry the same p-bit position
(0 of 3,359,376 subsets differ on chains that avoid the presets). The low
two bits of channel 0 of the endpoint presets are chosen so that no
preset-rooted subset breaks it: 31,054 of 8,853,332 before, 0 after.

BC3: colour endpoint 0 is never below endpoint 1 (0 of 61,383 blocks on
chains that start at the default). Presets refitted with that as a
constraint: 727 of 534,073 preset-rooted blocks broke it, 13 do now.

BC4 and BC5: e0 - e1 is never in -4..=0 (BC4 0 of 52,049 default-rooted
blocks; BC5 286 of 1,256,644 apart from flat default blocks). Presets
shifted to satisfy it where the child-mip error allows: BC4 407 to 31
violations, BC5 380,478 to 1,052; against plain child mips BC4 38.12 to
38.31 dB and BC5 38.98 to 39.60 dB.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:11:40 +00:00
github manually merged commit 8eff158cde into gh-pr/125/base 2026-11-26 20:11:42 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.