-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Resample vertical pass #1933
Resample vertical pass #1933
Conversation
Changes Unknown when pulling f09067e on uploadcare:resample-vertical-pass into * on python-pillow:master*. |
@@ -40,6 +40,7 @@ def getmode(mode): | |||
_modes[m] = ModeDescriptor(m, bands, basemode, basetype) | |||
# extra experimental modes | |||
_modes["LA"] = ModeDescriptor("LA", ("L", "A"), "L", "L") | |||
_modes["La"] = ModeDescriptor("La", ("L", "a"), "L", "L") |
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.
This required for Image.merge('La', ...)
. But there is no 'RGBa', so I used 'RGBX', which is. Modes support in Pillow is a mess ((
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.
@wiredfool If you don't mind about adding La
in _modes
, I'd like to merge it. I don't see any other controversial points in this RP.
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.
I went through the review, hit this, started wondering why we didn't have RGBa
as a mode here, and then determined that modes are a mess.
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.
I can add RGBa
here as a temporary solution.
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.
Added.
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.
works for me
As a bonus: It will be easier for me to maintain Pillow-SIMD, because Pillow-SIMD does two separate passes from the start. |
Changes Unknown when pulling 3b7923c on uploadcare:resample-vertical-pass into * on python-pillow:master*. |
Changes Unknown when pulling c826266 on uploadcare:resample-vertical-pass into * on python-pillow:master*. |
Changes Unknown when pulling 12c8cf9 on uploadcare:resample-vertical-pass into * on python-pillow:master*. |
Are you ready for this to be merged? |
Yes |
This PR implements separate vertical pass of resampling instead of two transposes.
Originally I've replaced two passes with transpose for the following reasons:
Since then there are many tests for resampling were written and many optimizations were implemented. Now it is time to return upscaling performance.
Result on aws ec2 c4.large with 1920×1280 RGB image. Megapixels of source image per second.
I also include results of stable version and fixed-point separetely to show what FPI doesn't affect upscaling too much, while vertical pass does. Vertical pass faster for upscaling in average by 40% and also makes downscaling to reasonable sizes 10% faster in average.
This last two improvements together makes all resampling operations about 60% faster.