Skip to content

feat: add saturating quantize_round - #32

Merged
swgiacomelli merged 1 commit into
mainfrom
feat/quantize-round
Aug 22, 2026
Merged

swgiacomelli merged 1 commit into
mainfrom
feat/quantize-round

Conversation

@swgiacomelli

Copy link
Copy Markdown
Contributor

Summary

  • add const quantize_round:: with half-bin round-to-nearest, round-up ties, and a load-bearing full-scale clamp
  • exhaustively verify correctness, excursion, range, full-scale saturation, 16-bit identity, tie direction, and consistency with quantize across every valid width and u16 input
  • document the zero-parameter admission rule and keep parameterized dithering policy out of scope
  • exercise the new API in the embedded link binary so resource and panic checks cover it

Verification

cargo xtask ci passed. All runnable checks passed; no checks skipped.

The final thumbv6m linked exercise sizes compared with pre-change main are:

  • default: 2234 bytes, +84 bytes (limit 3072)
  • f32: 5954 bytes, +92 bytes (limit 8192)
  • oklab: 3550 bytes, +72 bytes (limit 5120)
  • f32+oklab: 7270 bytes, +88 bytes (limit 9216)

Static RAM remains zero and no panic or wide-division symbols were linked.

Scope audit

No golden file, budget, existing quantize/expand behavior, type-state rule, dependency, version, tag, release, registry setting, or repository setting changed. ph-color-bake is untouched.

The brief did not conflict with AGENTS.md, docs/NUMERICS.md, CONTRIBUTING.md, or RELEASING.md. CONTRIBUTING.md additionally requires every new feature surface to be reachable from ph-color-exercise; that coupled edit is included so the resource evidence covers this API.

@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: 15eed8ddbe

ℹ️ 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 crates/color/src/quantize.rs
@swgiacomelli
swgiacomelli merged commit 86c9e8c into main Aug 22, 2026
1 check passed
@swgiacomelli
swgiacomelli deleted the feat/quantize-round branch August 22, 2026 20:05
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.

1 participant