镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Use raw codec for reading uncompressed BGR and BGRA DDS - #10376

Merged
radarhere merged 1 commit into
python-pillow:mainfrom
radarhere:dds
Nov 1, 2026
Merged

radarhere merged 1 commit into
python-pillow:mainfrom
radarhere:dds

Conversation

@radarhere

Copy link
Copy Markdown
Member

Extracted from #9943

When it added support for arbitrary masks for uncompressed RGB DDS data, #7589 removed the use of the raw codecs for existing masks. This restores them, so that the faster raw codec is used.

@codspeed

codspeed Bot commented Nov 1, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by ×430

1 warning

⚠️ 2 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚡ 1 improved benchmark
✅ 667 untouched benchmarks
⏩ 352 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_load[uncompressed_rgb.dds] 8,206.1 ms 19.1 ms ×430

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing radarhere:dds (67aec98) with main (86399b1)

Open in CodSpeed

Footnotes

  1. 352 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@radarhere
radarhere merged commit 5c14a51 into python-pillow:main Nov 1, 2026
51 checks passed
@radarhere
radarhere deleted the dds branch November 1, 2026 10:25
Comment thread src/PIL/DdsImagePlugin.py
masks = struct.unpack(f"<{mask_count}I", header[84 : 84 + mask_count * 4])
self.tile = [ImageFile._Tile("dds_rgb", args=(bitcount, masks))]
return
if masks == (0xFF0000, 0x00FF00, 0x0000FF):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need

Suggested change
if masks == (0xFF0000, 0x00FF00, 0x0000FF):
if bitcount == 24 and masks == (0xFF0000, 0x00FF00, 0x0000FF):

to take RGBX files into account.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you able to find a sample RGBX file?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can synthesize one from Hopper?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants