Skip to content

refactor: relocate scale for inverse pathway (#160) - #164

Open
scottdyer wants to merge 1 commit into
aces-aswf:mainfrom
scottdyer:refactor/tonescale
Open

scottdyer wants to merge 1 commit into
aces-aswf:mainfrom
scottdyer:refactor/tonescale

Conversation

@scottdyer

@scottdyer scottdyer commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Encapsulates reference luminance scaling directly within tonescale_inv() and updates call accordingly in Lib.Academy.OutputTransform.

Rationale
The function comment for tonescale_inv() in Lib.Academy.Tonescale.ctl states that parameter Y accepts luminance in absolute units ($\text{cd/m}^2$). The tonescale math relies on luminance normalized 0-1 relative to the reference luminance of 100 $\text{cd/m}^2$.

Previously, the calling function in Lib.Academy.OutputTransform.ctl (e.g., inside tonemap_and_compress_inv()) manually performed luminance / ref_luminance prior to invoking tonescale_inv(). While the OutputTransform is functionally correct, handling the scaling in the call meant that tonescale_inv() was incorrect when called independently according to its documented interface.

Changes

  • aces-core/lib/Lib.Academy.Tonescale.ctl: Changed Y to Y / params.n_r on first line of tonescale_inv(), allowing it to follow its documented scaling expectations and work as a standalone inverse of the tonescale_fwd() function
  • aces-core/lib/Lib.Academy.OutputTransform.ctl: Removed the now redundant pre-scaling (luminance / ref_luminance) at the call site to prevent double-scaling.

Impact
There should be no change to overall mathematical or pixel-level output across the inverse Output Transform pathway.
The refactor just aligns internal caller logic and independent usage to be consistent with the function signature.


Fixes #160
PR Description was
Assisted-by: Gemini / 3.6 Flash

@scottdyer scottdyer added this to 2.1 Aug 28, 2026
@github-project-automation github-project-automation Bot moved this to Todo in 2.1 Aug 28, 2026
Signed-off-by: Scott Dyer <sdyer@oscars.org>
@scottdyer
scottdyer requested a review from a team September 1, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Scale from luminance to 0-1 is in wrong location in inverse path

1 participant