Skip to content

Probe: residue upscaling — the anatomy 2000→4M technique on a codec residual (measured, honest-negative for scalar-dense)#231

Merged
AdaWorldAPI merged 2 commits into
masterfrom
claude/residue-upscale-probe
Jul 4, 2026
Merged

Probe: residue upscaling — the anatomy 2000→4M technique on a codec residual (measured, honest-negative for scalar-dense)#231
AdaWorldAPI merged 2 commits into
masterfrom
claude/residue-upscale-probe

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

The question

M1 (#230) proved motion estimation is the shader's i8 GEMM and MC is bit-exact, but it stored the residual densely. The operator's framing of M1's real point: use the q2 FMA-anatomy upscaling2000 surfels / 100k nodes → 4,000,000 vertices, via a deterministic golden-spiral anchor placement + a coded residue — to get the codec residue cheaper. This PR is the measured test of whether that transfers, not a claim that it does.

The mechanism under test is the workspace's own PLACE/RESIDUE doctrine (crates/helix: "HHTL is the deterministic PLACE; helix is the RESIDUE … the curve is regenerated from a φ-spiral template, not stored; the cost is only the endpoint pair"): sparse-anchor FMA extrapolation as a decorrelating predictor, anchor positions deterministic/regenerable (free), coding only the residue.

Fairness (no strawman, no Frankenstein)

  • Baseline is entropy-coded, not raw bytes: order-0 Shannon H₀ — the bits an ideal rANS coder spends.
  • The fair rival is Paeth local DPCM — the standard lossless spatial predictor (PNG), which stores zero anchors. Beating no-model order-0 is trivial for any predictor; the real fight is against DPCM.
  • No S² encoder is forced onto the scalar residual. The anatomy residue is a direction field on S² (surfel normals) where hpc::splat3d::helix_orient is near-optimal; a luma residual is a scalar field. The golden-spiral enters here only as 2-D anchor placement (the surfel distribution), never as an S² angle codec.

Measured (128×128, 256 anchors, H₀ bytes)

field dense (no model) paeth (local) grid a+res (global) spiral a+res (global) grid/paeth spiral/paeth
very-smooth 14807 2565 3648 6780 0.70× 0.38×
weather-like 14700 3162 4796 7784 0.66× 0.41×
mid-freq 14720 5677 9170 11425 0.62× 0.50×
noise 16357 17886 17591 17454 1.02× 1.02×

Conclusion (honest, partly negative — that's the point)

  1. Global sparse-anchor upscaling really does decorrelate — grid a+res (3648) ≪ the no-model dense (14807). The anatomy 2000→4M mechanism is real.
  2. But for a dense scalar luma residual it loses to local DPCM (grid 0.70×, spiral 0.38× of Paeth). The 256 anchor values cost real bits, and a sparse grid can't model structure finer than its stride. For scalar-dense residuals the analogy is rhyme, not a winning transfer — use DPCM / transform.
  3. grid > spiral: bilinear is a better scalar interpolant than scattered IDW. The golden-spiral's advantage is not scalar fields.
  4. Where the anatomy technique is already measured to dominate is its native domain: sparse direction fields on S² (surfel normals), where helix_orient measures 1–3 bytes at Pearson 0.9917 — a regime with no dense causal neighbor to DPCM against.
  5. Labeled conjecture (not a result): a continuous motion-vector field is directional + anchor-shaped like the surfel case, so helix/golden-spiral coding may beat dense MV coding there — but the M1 MVs (integer −2..2) are too quantised to test it; needs realistic MVs from a real decode (M2).

Ties to H-7 via the residue CellMode histogram. cargo fmt --check + cargo clippy clean on 1.95.0, feature-gated required-features = ["codec"].

Run: cargo run --release --example residue_upscale --features codec

🤖 Generated with Claude Code


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@AdaWorldAPI, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9df9053d-a03d-4e6f-aae7-df185ec8fa2e

📥 Commits

Reviewing files that changed from the base of the PR and between 55cb21b and f45b506.

📒 Files selected for processing (2)
  • Cargo.toml
  • examples/residue_upscale.rs

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

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21321d1b43

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/residue_upscale.rs Outdated
Comment on lines +291 to +292
paeth / grid_total,
paeth / spiral_total,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Report ratios in the same direction as the header

The table labels these columns as /paeth and the conclusion says "grid 0.70× ... of paeth", but the code divides Paeth by the global totals. For the very-smooth row that prints 0.70 even though grid_total is 3648 bytes and Paeth is 2565 bytes, so grid is 1.42× Paeth in byte cost. Anyone using this probe to compare coders can read the result as a 30% saving instead of a loss; invert these divisions or relabel/reword as Paeth/global.

Useful? React with 👍 / 👎.

AdaWorldAPI pushed a commit that referenced this pull request Jul 4, 2026
Columns were labeled /paeth but computed paeth/global, printing 0.70 for a case
where grid (3648 B) actually costs MORE than paeth (2565 B) — readable as a 30%
saving when it is a 42% loss. Invert to grid/paeth and spiral/paeth (byte-cost
ratio, > 1 = the global upscaler loses to local DPCM), relabel the columns
(>1=lose), and reword the conclusion: grid 1.42×, spiral 2.64× of paeth on
very-smooth (loss); ~0.98× on noise (tie). Conclusion unchanged in substance —
the anatomy upscaler loses to local DPCM on dense scalar residuals — now the
numbers point the right way.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MLBnPuScZy6w9di2QEjsXM
claude added 2 commits July 4, 2026 10:51
…c residual

The operator's framing of M1: use the q2 FMA-anatomy upscaling (2000 surfels /
100k nodes → 4,000,000 vertices via deterministic golden-spiral placement +
coded residue) to get the codec residue in improved ways. This is the measured
test of whether that transfers.

Mechanism under test: sparse-anchor FMA extrapolation as a decorrelating PLACE
predictor (anchor positions deterministic/regenerable, never stored — the helix
"template is free, only the endpoint costs" principle), coding only the RESIDUE.
Baseline is entropy-coded (order-0 Shannon H0, what an ideal rANS coder spends),
and the FAIR rival is Paeth local DPCM (the standard lossless predictor, zero
anchors) — not a no-model strawman.

Measured (128x128, 256 anchors, H0 bytes):
                dense    paeth   grid a+res  spiral a+res   grid/paeth spiral/paeth
  very-smooth   14807    2565    3648        6780           0.70x      0.38x
  weather-like  14700    3162    4796        7784           0.66x      0.41x
  mid-freq      14720    5677    9170        11425          0.62x      0.50x
  noise         16357    17886   17591       17454          1.02x      1.02x

Honest conclusion:
  - Global sparse-anchor upscaling DOES decorrelate (grid 3648 << no-model 14807);
    the anatomy 2000→4M mechanism is real.
  - BUT for a DENSE SCALAR luma residual it LOSES to local DPCM (grid 0.70x,
    spiral 0.38x of Paeth): the 256 anchor VALUES cost real bits and a sparse grid
    can't model structure finer than its stride. For scalar-dense residuals the
    analogy is rhyme, not a winning transfer — use DPCM / transform.
  - grid > spiral: bilinear beats scattered IDW as a scalar interpolant. The
    golden-spiral's win is NOT scalar fields.
  - Where the anatomy technique is ALREADY measured to dominate is its native
    domain: sparse DIRECTION fields on S² (surfel normals) — hpc::splat3d::
    helix_orient measures 1-3 bytes at Pearson 0.9917, a regime with no dense
    causal neighbor to DPCM against.
  - The continuous motion-vector field as a directional target is a labeled
    CONJECTURE (needs realistic MVs from a real decode, i.e. M2), not a result.

No S² encoder is forced onto the scalar residual (Frankenstein guard). Ties to
H-7 via the CellMode residue histogram. cargo fmt + clippy clean, feature-gated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MLBnPuScZy6w9di2QEjsXM
Columns were labeled /paeth but computed paeth/global, printing 0.70 for a case
where grid (3648 B) actually costs MORE than paeth (2565 B) — readable as a 30%
saving when it is a 42% loss. Invert to grid/paeth and spiral/paeth (byte-cost
ratio, > 1 = the global upscaler loses to local DPCM), relabel the columns
(>1=lose), and reword the conclusion: grid 1.42×, spiral 2.64× of paeth on
very-smooth (loss); ~0.98× on noise (tie). Conclusion unchanged in substance —
the anatomy upscaler loses to local DPCM on dense scalar residuals — now the
numbers point the right way.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MLBnPuScZy6w9di2QEjsXM
@AdaWorldAPI AdaWorldAPI force-pushed the claude/residue-upscale-probe branch from b6767ed to f45b506 Compare July 4, 2026 10:51
@AdaWorldAPI AdaWorldAPI merged commit 77aae6b into master Jul 4, 2026
17 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Jul 4, 2026
…ubstrate

The durable ledger for the operator's thesis: use the BF16 16×16 AMX GEMM /
blasgraph neighborhood / Morton-tile pyramid / perturbation-shader cascade to
amortize H.265/HEVC — the per-block cost collapsing to a gather (bit shift) +
one TDPBF16PS tile op over a deterministic pyramid built once.

Maps every HEVC DSP stage to the substrate primitive, each row tagged
MEASURED (#PR) / MECHANISM-unmeasured (probe named) / DOESN'T-FIT:

  - Motion estimation/compensation → i8/bf16 GEMM + gather   [MEASURED #230]
  - Inverse transform → separable tile GEMM; WHT no-op        [MEASURED #232]
  - Intra prediction / covariance → field-coupling tile op    [MEASURED shape #233]
  - Sub-pel interpolation (8-tap) → separable tile GEMM        [MECHANISM — probe]
  - CTU quad-tree → Morton/HHTL cascade                        [MECHANISM — shipped]
  - Deblock/SAO → masked tile op + LUT (the "AMX masking")     [PARTIAL — masking]
  - CABAC entropy → serial arithmetic coding                   [DOESN'T FIT]

Two honest boundaries recorded: (1) CABAC is not a GEMM — the entropy layer is
the M2 serial front-end the tile substrate does not amortize; (2) the
golden-spiral codec is for directional/sparse data, not dense scalar residuals
(#231, measured negative). Cross-repo tie grounded: OGAR's perturbation pyramid
IS the Walsh-Hadamard transform of the address tree = the same WHT #232 measured
as the codec transform.

Includes a probe queue (subpel_tap_tile, intra_angular_tile, deblock_masked_tile,
CTU routing parity, M2 CABAC). Anchors: PRs #230#233; hpc::bf16_tile_gemm,
splat3d::spd3, cascade, codec; blasgraph HHTL; OGAR perturbation pyramid.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MLBnPuScZy6w9di2QEjsXM
AdaWorldAPI pushed a commit that referenced this pull request Jul 4, 2026
…ubstrate

The durable ledger for the operator's thesis: use the BF16 16×16 AMX GEMM /
blasgraph neighborhood / Morton-tile pyramid / perturbation-shader cascade to
amortize H.265/HEVC — the per-block cost collapsing to a gather (bit shift) +
one TDPBF16PS tile op over a deterministic pyramid built once.

Maps every HEVC DSP stage to the substrate primitive, each row tagged
MEASURED (#PR) / MECHANISM-unmeasured (probe named) / DOESN'T-FIT:

  - Motion estimation/compensation → i8/bf16 GEMM + gather   [MEASURED #230]
  - Inverse transform → separable tile GEMM; WHT no-op        [MEASURED #232]
  - Intra prediction / covariance → field-coupling tile op    [MEASURED shape #233]
  - Sub-pel interpolation (8-tap) → separable tile GEMM        [MECHANISM — probe]
  - CTU quad-tree → Morton/HHTL cascade                        [MECHANISM — shipped]
  - Deblock/SAO → masked tile op + LUT (the "AMX masking")     [PARTIAL — masking]
  - CABAC entropy → serial arithmetic coding                   [DOESN'T FIT]

Two honest boundaries recorded: (1) CABAC is not a GEMM — the entropy layer is
the M2 serial front-end the tile substrate does not amortize; (2) the
golden-spiral codec is for directional/sparse data, not dense scalar residuals
(#231, measured negative). Cross-repo tie grounded: OGAR's perturbation pyramid
IS the Walsh-Hadamard transform of the address tree = the same WHT #232 measured
as the codec transform.

Includes a probe queue (subpel_tap_tile, intra_angular_tile, deblock_masked_tile,
CTU routing parity, M2 CABAC). Anchors: PRs #230#233; hpc::bf16_tile_gemm,
splat3d::spd3, cascade, codec; blasgraph HHTL; OGAR perturbation pyramid.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MLBnPuScZy6w9di2QEjsXM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants