Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support reading BC4U and DX10 BC1 images#6486

Merged
hugovk merged 68 commits into
python-pillow:mainfrom
REDxEYE:improved_dds
Dec 6, 2023
Merged

Support reading BC4U and DX10 BC1 images#6486
hugovk merged 68 commits into
python-pillow:mainfrom
REDxEYE:improved_dds

Conversation

@REDxEYE

@REDxEYE REDxEYE commented Aug 6, 2022

Copy link
Copy Markdown
Contributor

Changes proposed in this pull request:

  • Refactored DDS reader/writter
  • Add Tile namedtuple for code readability
  • Add support for reading/writing single channel DDS textures

@REDxEYE REDxEYE marked this pull request as draft August 6, 2022 21:05
@REDxEYE

REDxEYE commented Aug 6, 2022

Copy link
Copy Markdown
Contributor Author

Is it possible to make pre-commit.ci not to reformat some parts of the code?

@radarhere

Copy link
Copy Markdown
Member

@REDxEYE REDxEYE marked this pull request as ready for review August 25, 2022 13:15
Comment thread src/PIL/Image.py Outdated
("offset", int),
("tile_args", Tuple),
],
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you say a few words about why this is helpful?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added it to understand what tile structure is. I didn't found any doc for it, so i scouted sources to understand what everything mean

Comment thread src/PIL/DdsImagePlugin.py Outdated
@REDxEYE REDxEYE requested a review from radarhere August 26, 2022 20:53
Comment thread src/PIL/DdsImagePlugin.py Outdated
Comment thread src/PIL/DdsImagePlugin.py Outdated
Comment thread src/PIL/DdsImagePlugin.py Outdated
NV12 = 103
P010 = 104
P016 = 105
_420_OPAQUE = 106

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just to note - this should be 420_OPAQUE, but you've prefixed it with an underscore because otherwise Python will throw a SyntaxError.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is there any better way around this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No, I don't think so, not while using an enum.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about OPAQUE_420? Some might think it's private with a leading underscore.

@radarhere

Copy link
Copy Markdown
Member

I extracted the support for single channel images, and it has been merged as PR #6820.

@REDxEYE

REDxEYE commented Dec 26, 2022

Copy link
Copy Markdown
Contributor Author

Awesome!

@REDxEYE

REDxEYE commented Dec 3, 2023

Copy link
Copy Markdown
Contributor Author

A bit offtop. I may work on adding support for PVR textures in some time. I already implemented ETC decoder(one of they compression formats) https://github.com/REDxEYE/TextureDecoder/blob/master/library/src/decoders/etc/etc1.cpp

@radarhere radarhere changed the title Refactor DDS plugin Added enums to DdsImagePlugin Dec 3, 2023
Comment thread Tests/test_file_dds.py Outdated
Comment thread Tests/test_file_dds.py Outdated

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

Let's also add release notes for this (can be in a followup PR) and retitle the PR for the most important thing ("Add support for ..."?).

Comment thread src/PIL/DdsImagePlugin.py Outdated
NV12 = 103
P010 = 104
P016 = 105
_420_OPAQUE = 106

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about OPAQUE_420? Some might think it's private with a leading underscore.

Comment thread src/PIL/DdsImagePlugin.py Outdated
@radarhere radarhere changed the title Added enums to DdsImagePlugin Support reading BC4U and DX10 BC1 images Dec 5, 2023
@radarhere

Copy link
Copy Markdown
Member

I've retitled the PR, and added release notes. The release notes also cover #7603

Co-authored-by: Hugo van Kemenade <[email protected]>
Comment thread docs/releasenotes/10.2.0.rst Outdated
^^^^^^^^^^^^^^^^^^^^^^^^^^

``DDSD``, ``DDSCAPS``, ``DDSCAPS2``, ``DDPF``, ``DXGI_FORMAT`` and ``D3DFMT``
enums have been added to DdsImagePlugin.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
enums have been added to DdsImagePlugin.
enums have been added to py:class:`PIL.DdsImagePlugin`.

Comment thread docs/releasenotes/10.2.0.rst Outdated
@radarhere radarhere force-pushed the improved_dds branch 2 times, most recently from b8aa548 to 306b58a Compare December 5, 2023 21:13
Comment thread docs/releasenotes/10.2.0.rst Outdated
Comment thread docs/releasenotes/10.2.0.rst Outdated
Comment thread docs/releasenotes/10.2.0.rst Outdated
Co-authored-by: Hugo van Kemenade <[email protected]>
@hugovk hugovk merged commit 7cc0482 into python-pillow:main Dec 6, 2023
@hugovk

hugovk commented Dec 6, 2023

Copy link
Copy Markdown
Member

Thank you for your patience! This will be in the next release, set for 2nd January 2024.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants