mipmaps to cover higher resolution screeens and increased mipf resolution#20184
Merged
TurboGit merged 3 commits intodarktable-org:masterfrom Feb 9, 2026
Merged
Conversation
Contributor
Author
|
See #20178 (comment), some second thoughts on the mipmap levels. And those second thoughts answered, I hope, by some third thoughts. |
This clears the way for not depending on the largest 8 bit mipmap being mip8 or using the not always obvious fact that it is one less than DT_MIPMAP_F. Note that the compiler may cast dt_mipmap_size_t to an unsigned integer type. This requires some care in comparisons against values which may be negative. We can use a dt_mipmap_size_t as a loop index type so long as we count from 0 up. Counting down could trigger an infinite loop, as if the compiler makes dt_mipmap_size_t unsigned, a < 0 condition will never occur. Don't create DT_MIPMAPLDR_MIN. It is just as clear to use DT_MIPMAP_0, and casting to a dt_mipmap_size_t can mess up comparisons as it can cast both values to unsigned. In _get_dimensions_for_img_to_fit(), prior code looked for mip7 down. It should produce most accurate results to start with the full sized 8-bit mipmap, so this commit does that. In crawler, use LDR_MAX instead of mip8. But assume that there is wisdom in never creating a full-sized 8 bit mipmap, nor a mip0, so leave that code unchanged. Also give a hint in comments about what these mipmap levels mean.
Add new mip8 to cover 6K and mip9 to cover 8K displays. Rationale: - 5K monitors are somewhat common (Apple Studio Display, 5k iMacs, LG UltraFine), so it makes sense to keep a mipmap for fullscreen display in those monitors. - 10K monitors do not currently exist, so it doesn't make sense to have a mipmap to support these. I'm a bit puzzled why mip7 has been in the code as 5120x3200, as 5K is 5120x2880. Perhaps it's possible to scale a 6K or 8K display to that dimension, or it just is an even 1.25x mip6? Regardless, not mucking with this now, to not meddle too much in this PR. Closes darktable-org#20178.
As per @jenshannoschwalm, mip2 > was chosen when usual images were a few mpix, i think we should > increase that level by one having a) some performance penalty b) but > clearly better data that use output from preview pipe and c) less > differences when calculating dimensions based on preview.
2495d23 to
59dca5d
Compare
Contributor
Author
|
Updated this PR to make it merge cleanly and to simplify commit record. |
Member
|
@dtorop : Looks good, I'll do some testing in the coming days. |
Member
|
Does this PR "rearrange" the existing cache so that mip8 is now mip10, or is the crawler expected to take care of this? |
Collaborator
|
I will take care of that, seems good to me as existing mipmip sizes didn't change and you would have to manually change a setting for larger ones |
dtorop
added a commit
to dtorop/darktable
that referenced
this pull request
Feb 28, 2026
These notes cover PRs: darktable-org#20365, darktable-org#20355, darktable-org#20349, darktable-org#20346, and darktable-org#20184.
TurboGit
pushed a commit
that referenced
this pull request
Mar 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DT_MIPMAP_LDR_MAXfor the full-sized 8 bit mipmap, to ease any future mipmap size adjustments.Adding higher resolution mipmaps both covers higher resolution displays and should allow for less jumpy zooming in on high megapixel files. Increasing the mipf resolution should produce better preview pipe data.
In
_get_dimensions_for_img_to_fit(), prior code looked at mip7 or smaller. This code looks at the full-sized 8 bit mipmap or smaller, which should produce more accurate results without a slowdown.In the crawler, I noticed that the code never creates a full-sized 8 bit mipmap, nor a mip0. I left that behavior unchanged.
Closes #20178.