Skip to content

Use sRGB transfer function instead of plain gamma (better accuracy for lower brightness) #5707

Description

@softhack007

It seems that sRGB has a better way for preserving low-brightness colors, compared to "plain" gamma correction.

As the gamma (and inverse gamma) LUT calculation is not in any hot path, we should try if the sRGB pedant holds its promise to provide smoother transitions at low brightness.

https://en.wikipedia.org/wiki/SRGB#Transfer_function_(%22gamma%22)

The math looks easy, by just replacing the "pow()" expression with the sRGB transfer function.
It's important to also adjust the inverse correction to use the inverse sRGB transfer function.

Edit: the sRGB transfer function uses a gamma exponent of 2.4, the resulting curve approximates a gamma=2.2 curve. I thinks it's possible to derive the correct scaling and offset coefficients for other gamma values - the wikipedia article shows the basic equations needed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions