Enable 4:2:0 chroma subsampling for JPEG thumbnails
authorBrion Vibber <brion@pobox.com>
Wed, 27 Apr 2016 16:26:48 +0000 (09:26 -0700)
committerBrion Vibber <brion@pobox.com>
Wed, 27 Apr 2016 22:36:18 +0000 (15:36 -0700)
commita30bc4f7e0b8a2d310217741dc41f76129c26019
tree1825d8eb99183b272207dee857a5acd07a422ab1
parentfe87b6575a1b8eb67ddb4fc705a4c55bade4b479
Enable 4:2:0 chroma subsampling for JPEG thumbnails

* Add $wgJpegPixelFormat, default to 'yuv420'
* Implemented for ImageMagick via CLI and extension
* Currently ignored for other scaler backends
* Added test case to run when using ImageMagick

4:2:0 subsampling can save an average of 17% bandwidth
over 4:4:4 subsampling, at the cost of some artifacting
at sharp red or blue edges. This is usually not noticeable
in photographic images.

To restore the previous behavior, set to false:

  $wgJpegPixelFormat = false;

which will maintain the original file's pixel subsampling
settings in the thumbnail.

Can set explicitly to one of:

  'yuv444' - never subsample
  'yuv422' - subsample 2x horizontally, not vert
  'yuv420' - subsample 2x in both dimensions

Bug: T129128
Change-Id: Ib9cb36c3a7e6a69d66c11150ef4a1d02dbac2df5
RELEASE-NOTES-1.27
includes/DefaultSettings.php
includes/media/Bitmap.php
tests/phpunit/data/media/yuv420.jpg [new file with mode: 0644]
tests/phpunit/data/media/yuv444.jpg [new file with mode: 0644]
tests/phpunit/includes/media/JpegPixelFormatTest.php [new file with mode: 0644]