Skip to content

[External] Decoding HDR AVIF image consumes huge amounts of RAM #4968

Open
@benstevens48

Description

@benstevens48

Describe the bug

Windows 11 24H2 added support in WIC for decoding HDR AVIF images, which decode to a 64bpp floating point pixel format. However, the decoding process seems to consume a huge amount of RAM. I tested a 20 mega-pixel HDR AVIF exported from Lightroom (which uses the PQ HDR curve I think) and decoding it (in a C++ component) consumes about 2.7GB of RAM (peak in the Visual Studio debugger). The decoded image itself should only consume about 160MB of RAM, and I would expect 2 times or maybe 3 times this at most to be used during decoding. Also, maybe this is inevitable, but it's quite slow. It's much quicker to take a 64bpp PNG with PQ transfer curve, decode that to WIC without color management then use Diret2D to apply the PQ transfer curve.

Steps to reproduce the bug

See description.

Expected behavior

At most ~500MB of RAM used for decoding a 20MP HDR AVIF image, not 2.7GB.

Screenshots

No response

NuGet package version

None

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions