Skip to content

Model K: the exposure rule in NumPy, with CPU tests - #194

Merged
phantoslayer21 merged 2 commits into
mainfrom
k/cpu-reference
Nov 14, 2026
Merged

phantoslayer21 merged 2 commits into
mainfrom
k/cpu-reference

Conversation

@phantoslayer21

Copy link
Copy Markdown
Owner

Refs #15

First piece of bringing Preset K back (#15): the rule that says which exposure value is which, in NumPy, with CPU tests. Nothing else changes.

What changes

  • clean/k/reference/exposure.py (new): the rule in front of the input and output stage references.
    • HDR: E_cur is the game's exposure (texture texel or value), 1 if the game passes none. E_aux is the auto-exposure value when auto-exposure runs, otherwise E_cur. The measured value never takes E_cur's place. E_prev is the previous frame's E_cur (kept by the caller).
    • LDR: every value and factor is 1.
    • e1 = e2 is the game's exposure scale if it is positive and finite, else 1.
  • instage.py, outstage.py: docstrings only; they point at the rule. The stage arithmetic is unchanged.
  • clean/k/tests/test_k_exposure_rule.py (new): the four HDR cases (neither, auto-exposure only, texture only, both), LDR, the scale's bad values (none, text, zero, negative, infinite, NaN), and that a frame dict that already has the values is left alone.
  • clean/k/README.md: one line in the file table.

The whole-frame runner and the HIP runtime keep their present behaviour in this PR. They take the rule in the next piece (HIP side), so that the GPU tests stay consistent with the runtime at every step.

Tested

  • python -m unittest clean.k.tests.test_k_exposure_rule: 4 tests pass.
  • tools/ci/check_line_endings.py: no problem.
  • public_gates.py on this branch: the must-pass gates pass; the LOOK counts are the same as for main (1f2a3ac): 42 and 29 leak lines, 418 numbers.

Not tested

  • GPU: this change has no kernel or runtime part.
  • The rule's use in a frame (next PR).

…with CPU tests

Refs #15. clean/k/reference/exposure.py states the rule in front of the input and output stage references: E_cur is the game's exposure or 1, E_aux the auto-exposure value when it runs (else E_cur), LDR everything 1, e1 = e2 the game's positive finite scale. The stage references are unchanged (docstrings point at the rule). No kernel, runtime or build change.

Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
Signed-off-by: phantoslayer21 <156617979+phantoslayer21@users.noreply.github.com>
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