13thsymphony / HDRImageViewer

UWP app to view high dynamic range (HDR) and wide color gamut (WCG) images.
https://13thsymphony.github.io/
MIT License
76 stars 21 forks source link

Use 100% DPI for histogram calculation to avoid D2DERR_INTERMEDIATE_TOO_LARGE #49

Closed imbushuo closed 1 year ago

imbushuo commented 2 years ago

I think it's kind of weird and fun to have this repro on screen beyond 4K, but anyway it works at higher resolution now. Is the issue possible from Direct2D itself?

Untitled

Windows AC Example has the exact same issue, and this fix can be applied there as well.

Filoppi commented 2 years ago

I'm sorry for the stupid question, but how did you get to build this app? I just get libheif include errors (missing libheif/heif.h), even if I have its nuget package and even if I manually add them to the project.

13thsymphony commented 1 year ago

@imbushuo thanks for the PR and sorry for the radio silence!

This looks like a righteous bug and fix; I can't personally repro the bug (my GPU is too good??) but I definitely should be using 96 DPI for histogram rendering (and possibly for image rendering too). However I'd like to reasonably ensure that the histogram always returns some reasonable value, versus ignoring texture limit exceeded issues.

I made a new commit which explicitly caps the texture size: 1483b3c

If you agree, I'd like to keep your 96.0DPI change, but I don't want to ignore D2DERR_INTERMEDIATE_TOO_LARGE - with our combined changes this should once again become an exceptional situation, as the histogram texture and intermediates should never exceed 2048 pixel size.

imbushuo commented 1 year ago

Updated commit & validated 6K images based on comment.

13thsymphony commented 1 year ago

Thanks for your help! Approved and squash/merged.

Filoppi commented 1 year ago

@13thsymphony Maybe I ask if you are planning on making a new Microsoft Store release of the app with this fix?

13thsymphony commented 1 year ago

@Filoppi @ValZapod Sorry for the delay, yes I'm working on getting an updated version to the Store soon.