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

Skip to content

Conversation

@robert-nix
Copy link
Contributor

@robert-nix robert-nix commented Aug 11, 2016

Profile before:

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      100  195.845    1.958  279.784    2.798 DdsImagePlugin.py:177(_dxt5)
 69173248   30.887    0.000   30.887    0.000 DdsImagePlugin.py:153(_dxtc_alpha)
 77631258   21.764    0.000   21.764    0.000 {built-in method pack}
        6   20.287    3.381   26.548    4.425 DdsImagePlugin.py:115(_dxt1)
 76474341   15.447    0.000   15.447    0.000 DdsImagePlugin.py:111(_c3)
 64710225   13.599    0.000   13.599    0.000 DdsImagePlugin.py:103(_c2a)
      982    6.371    0.006    6.371    0.006 {method 'encode' of 'ImagingEncoder' objects}
  9703424    5.501    0.000    5.501    0.000 DdsImagePlugin.py:96(_decode565)

After:

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      990    6.156    0.006    6.156    0.006 {method 'encode' of 'ImagingEncoder' objects}
      100    0.311    0.003    0.311    0.003 {built-in method decode_dxt5}
...
        6    0.036    0.006    0.036    0.006 {built-in method decode_dxt1}

def _c3(a, b):
return (2 * b + a) // 3
def _dxt1(data, width, height):
return _dxtc.decode_dxt1(data, width, height)
Copy link
Contributor Author

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

@jleclanche
Copy link
Contributor

This would fix #1652.

setup.py Outdated
class feature:
features = ['zlib', 'jpeg', 'tiff', 'freetype', 'lcms', 'webp',
'webpmux', 'jpeg2000', 'imagequant']
'webpmux', 'jpeg2000', 'imagequant', 'dxtc']
Copy link
Member

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.

@robert-nix robert-nix force-pushed the dxtc branch 2 times, most recently from a57a724 to 2fa8486 Compare August 15, 2016 07:36
@robert-nix
Copy link
Contributor Author

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.

@jleclanche
Copy link
Contributor

@hugovk this is gtm, any chance landing it?

@wiredfool
Copy link
Member

@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
@jleclanche
Copy link
Contributor

@wiredfool this PR makes both of those previous PRs obsolete.

@robert-nix
Copy link
Contributor Author

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.

@jleclanche jleclanche mentioned this pull request Aug 26, 2016
@jleclanche
Copy link
Contributor

@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.

@wiredfool wiredfool merged commit 9c4c16d into python-pillow:master Sep 22, 2016
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