Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using MRSSE for HDR error calculations #528

Closed
wants to merge 4 commits into from
Closed

Using MRSSE for HDR error calculations #528

wants to merge 4 commits into from

Conversation

solidpixel
Copy link
Contributor

@solidpixel solidpixel commented Nov 22, 2024

Status:

Suspect I have the wrong end of the stick here - MRSEE on log values is still going to be incorrect. For MRSEE to make sense we need to use linear colors, diving in/out of LNS encoding when we need to test quantization. This is going to end up a lot more expensive ...

Description

HDR texture values are stored logarithmically.

Using absolute sum of squares on the logarithmic values (the existing behaviour on main) causes the compressor to spend too much effort preserving imperceptible shifts in dark channel values at the expense of bright values in the same block. This performs poorly in blocks with sharp luminance changes (dark texels in a bright block) and in blocks with saturated color values (dark channels in bright pixels).

Using absolute sum of squares on linearized HDR values (attempted by the first patch in this PR) avoids the compressor fixating on dark values, but instead causes the compressor to spend too much effort preserving bright values. This is because the errors in the bright channels can be orders of magnitude bigger than the errors in the dark channels, and dark values can end up quantizing close to black.

Using relative sum of square on the logarithmic values, proposed by Ryg in the blog below, encourages the compressor to find a balance of relative error across the whole block, favoring neither light nor dark channels. Blog: https://fgiesen.wordpress.com/2024/11/14/mrsse/ .

This is a perceptual error metric for HDR textures, so we expect that this will make the mPSNR score worse because we are no longer optimizing for absolute error. Test failures in HDR textures are therefore expected, and LDR textures are not affected.

  • Suspect MRSSE needs to be in linear space, so try that ...
  • Consider using MRSSE during iterative refinement. It's currently only used in final block check.
  • If good, we need to regenerate test reference scores before merging so Actions keeps working.

@solidpixel solidpixel marked this pull request as draft November 22, 2024 23:41
@solidpixel solidpixel force-pushed the linear_hdr branch 2 times, most recently from ba62f4f to fb43d2d Compare November 23, 2024 20:17
Prior to this change the HDR code path computed color error,
weight error, and final encoding error, by simply using the LNS
encoded data as linear data values.
HDR texture values are stored logarithmically.

Using absolute sum of squares on the logarithmic values causes the
compressor to spend too much effort preserving imperceptible shifts in
dark channel values at the expense of bright values in the same block.
This performs poorly in blocks with sharp luminance changes (dark
texels) and in blocks with saturated color values (dark channels in
bright pixels).

Using absolute sum of squares on linearized HDR values avoids the
compressor fixating on dark values, but instead causes the compressor to
spend too much effort preserving bright values. This is because the
errors in the bright channels can be orders of magnitude bigger than
the errors in the dark channels, and dark values can end up quantizing
close to black.

Using relative sum of square on the logarithmic values, proposed by Ryg
in the blog below, encourages the compressor to find a balance of
relative error across the whole block, favoring neither light nor
dark channels.

https://fgiesen.wordpress.com/2024/11/14/mrsse/
@solidpixel solidpixel changed the title Prototype: Linearizing HDR calculations Using MRSSE for HDR error calculations Nov 23, 2024
@solidpixel
Copy link
Contributor Author

Rejecting for now - needs more work.

@solidpixel solidpixel closed this Nov 24, 2024
@solidpixel solidpixel deleted the linear_hdr branch November 24, 2024 23:39
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