From 697f00c0199ffd038e19fcbcc8fbd8044ce432a2 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Mon, 2 Oct 2017 09:27:15 +0000 Subject: [PATCH 1/4] Release notes --- docs/releasenotes/4.3.0.rst | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/releasenotes/4.3.0.rst b/docs/releasenotes/4.3.0.rst index df9aeddc0..c7f4f9e4c 100644 --- a/docs/releasenotes/4.3.0.rst +++ b/docs/releasenotes/4.3.0.rst @@ -87,16 +87,22 @@ operation. The original :py:class:`PIL.ImageFilter.Filter` class remains for image filters that can process only single band images, or require splitting of channels prior to filtering. +Other Changes +============= Loading 16-bit TIFF Images -========================== +^^^^^^^^^^^^^^^^^^^^^^^^^^ Pillow now can read 16-bit multichannel TIFF files including files with alpha transparency. The image data is truncated to 8-bit precision. +Pillow now can read 16-bit signed integer single channel TIFF +files. The image data is promoted to 32-bit for storage and +processing. + Performance -=========== +^^^^^^^^^^^ This release contains several performance improvements: @@ -109,3 +115,14 @@ This release contains several performance improvements: friendly algorithm. * ImageFilters based on Kernel convolution are significantly faster due to the new MultibandFilter feature. +* All memory allocation for images is now done in blocks, rather than + falling back to an allocation for each scan line for images larger + than the block size. + +CMYK Conversion +^^^^^^^^^^^^^^^ + +The basic CMYK->RGB conversion has been tweaked to match the formula +from Google Chrome. This produces an image that is generally lighter +than the previous formula, and more in line with what color managed +applications produce. From 61b5eea82cdb405912a0923c2ebe3f4c7c3a126a Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Mon, 2 Oct 2017 11:49:53 +0000 Subject: [PATCH 2/4] sgi release notes --- docs/releasenotes/4.3.0.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/releasenotes/4.3.0.rst b/docs/releasenotes/4.3.0.rst index c7f4f9e4c..649135922 100644 --- a/docs/releasenotes/4.3.0.rst +++ b/docs/releasenotes/4.3.0.rst @@ -101,6 +101,16 @@ Pillow now can read 16-bit signed integer single channel TIFF files. The image data is promoted to 32-bit for storage and processing. +SGI Images +^^^^^^^^^^ + +Pillow can now read and write uncompressed 16-bit multichannel SGI +images to and from RGB and RGBA formats. The image data is truncated +to 8-bit precision. + +Pillow can now read RLE encoded SGI images in both 8 and 16-bit +precision. + Performance ^^^^^^^^^^^ From fb04f88147415184d47af11f8340cc64fe3c8223 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Mon, 2 Oct 2017 11:50:17 +0000 Subject: [PATCH 3/4] Block Allocator docs --- docs/reference/block_allocator.rst | 47 ++++++++++++++++++++++++++++++ docs/reference/internal_design.rst | 2 ++ 2 files changed, 49 insertions(+) create mode 100644 docs/reference/block_allocator.rst diff --git a/docs/reference/block_allocator.rst b/docs/reference/block_allocator.rst new file mode 100644 index 000000000..26be98dc7 --- /dev/null +++ b/docs/reference/block_allocator.rst @@ -0,0 +1,47 @@ +Block Allocator +=============== + +Previous Design +--------------- + +Historically there have been two image allocators in Pillow: +``ImagingAllocateBlock`` and ``ImagingAllocateArray``. The first works +for images smaller than 16MB of data and allocates one large chank of +memory of ``im->linesize * im->ysize`` bytes. The second works for +large images and make one allocation for each scan line of size +``im->linesize`` bytes. This makes for a very sharp transition +between one allocation and potentially thousands of small allocations, +leading to unpredictable performance penalties around the transition. + +New Design +---------- + +``ImagingAllocateArray`` now allocates space for images as a chain of +blocks with a maximum size of 16MB. If there is a memory allocation +error, it falls back to allocating a 4KB block, or at least one scan +line. This is now the default for all internal allocations. + +``ImagingAllocateBlock`` is now only used for those cases when we are +specifically requesting a single segment of memory for sharing with +other code. + +Memory Pools +------------ + +There is now a memory pool to contain a supply of recently freed +blocks, which can then be reused without going back to the OS for a +fresh allocation. This caching of free blocks is currently disabled by +default, but can be enabled and tweaked using three environment +variables: + + * ``PILLOW_ALIGNMENT``, in bytes. Specfies the alignment of memory + allocations. Valid values are powers of 2 between 1 and + 128, inclusive. Defaults to 1. + + * ``PILLOW_BLOCK_SIZE``, in bytes, K, or M. Specifies the maximum + block size for ``ImagingAllocateArray``. Valid values are + integers, with an optional `k` or `m` suffix. Defaults to 16M. + + * ``PILLOW_BLOCKS_MAX`` Specifies the number of freed blocks to + retain to fill future memory requests. Any freed blocks over this + threshold will be returned to the OS immediately. Defaults to 0. diff --git a/docs/reference/internal_design.rst b/docs/reference/internal_design.rst index a8d6e2284..4c0fbb85d 100644 --- a/docs/reference/internal_design.rst +++ b/docs/reference/internal_design.rst @@ -6,3 +6,5 @@ Internal Reference Docs open_files limits + block_allocator + From 306dcddc0b5cb903bb7f1fa4ef1d4c9a299c85d8 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Mon, 2 Oct 2017 12:04:27 +0000 Subject: [PATCH 4/4] typos --- docs/reference/block_allocator.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/block_allocator.rst b/docs/reference/block_allocator.rst index 26be98dc7..da5b3b8d8 100644 --- a/docs/reference/block_allocator.rst +++ b/docs/reference/block_allocator.rst @@ -6,7 +6,7 @@ Previous Design Historically there have been two image allocators in Pillow: ``ImagingAllocateBlock`` and ``ImagingAllocateArray``. The first works -for images smaller than 16MB of data and allocates one large chank of +for images smaller than 16MB of data and allocates one large chunk of memory of ``im->linesize * im->ysize`` bytes. The second works for large images and make one allocation for each scan line of size ``im->linesize`` bytes. This makes for a very sharp transition @@ -34,7 +34,7 @@ fresh allocation. This caching of free blocks is currently disabled by default, but can be enabled and tweaked using three environment variables: - * ``PILLOW_ALIGNMENT``, in bytes. Specfies the alignment of memory + * ``PILLOW_ALIGNMENT``, in bytes. Specifies the alignment of memory allocations. Valid values are powers of 2 between 1 and 128, inclusive. Defaults to 1.