-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Move DDS decoders to C #2068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move DDS decoders to C #2068
Conversation
PIL/DdsImagePlugin.py
Outdated
| def _c3(a, b): | ||
| return (2 * b + a) // 3 | ||
| def _dxt1(data, width, height): | ||
| return _dxtc.decode_dxt1(data, width, height) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
param data was stream, is now bytes; this breaks the DDS container code later in the file
|
This would fix #1652. |
setup.py
Outdated
| class feature: | ||
| features = ['zlib', 'jpeg', 'tiff', 'freetype', 'lcms', 'webp', | ||
| 'webpmux', 'jpeg2000', 'imagequant'] | ||
| 'webpmux', 'jpeg2000', 'imagequant', 'dxtc'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to create a separate feature, because _dxtc.c doesn't depend on external modules which can be not available.
a57a724 to
2fa8486
Compare
|
Updated to move the decoder in to libImaging, and fixed compile errors and test failures. BcnDecoder is a decoder for BC1-7. This includes BC1, BC2, and BC3 also known as S3TC or DXTn; BC6 and BC7 also known as BPTC; and BC4 and BC5 which are 1- and 2-channel intepolated formats using the alpha encoding from BC3. Currently only BC1 and BC3 are tested. |
|
@hugovk this is gtm, any chance landing it? |
|
@mischanix: Can you unpack your previous comment and list what's supported and not, and what's tested and not? I'm not clear which formats correspond to existing functionality and which are new. Prior to this PR, we had dtx1 and dtx5 compression. (and a pr to refactor them #1938) Since then there was a PR for dtx3, #2079, which added an additional compression format. |
- Fixed inaccurate BC1/BC3 texture decoding
|
@wiredfool this PR makes both of those previous PRs obsolete. |
|
I've added a commit to support and test DXT3. With this commit, DXT1, DXT3, and DXT5 dds files are supported. These correspond to BC1, BC2, and BC3 respectively in the decoder. I don't think this PR makes #1938 obsolete, it just removes the need to port the DdsImagePlugin to the proposed plugin style since the decoder is now in C. |
|
@wiredfool New ping on this. Since this is slightly backwards incompatible (although only on internal APIs), I really want it to land before the next release, which is due in only two weeks. |
Profile before:
After: