[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - common/Png.hpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Apr 23 08:18:29 UTC 2019


 common/Png.hpp |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit faa6ccffa50836496ab3a46166e8603c5dd2cd07
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Apr 19 20:09:22 2019 -0400
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue Apr 23 10:18:09 2019 +0200

    wsd: use fast deflate level for png
    
    The default deflate level of 6 is quite slow
    and the benefits are hardly worth the high
    latency that users experience.
    
    Tested on a writer document with some small
    images and a few pages of text:
    
    Level 4 gives virtually identical compression
    ratio to level 6, but is between 5-10% faster.
    
    Level 3 runs almost twice as fast as level 6,
    but the output is typically 2-3x larger.
    
    Perhaps this should be exposed via config
    so it would be possible to reduce latency
    due to compression when CPU is scarce but
    network bandwidth ample, and vice versa.
    
    Change-Id: Iba88eea8f180d11458b33c68389e797234df1a60
    Reviewed-on: https://gerrit.libreoffice.org/71038
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/common/Png.hpp b/common/Png.hpp
index f682772f7..f622a589d 100644
--- a/common/Png.hpp
+++ b/common/Png.hpp
@@ -127,6 +127,12 @@ bool encodeSubBufferToPNG(unsigned char* pixmap, size_t startX, size_t startY,
         return false;
     }
 
+    // Level 4 gives virtually identical compression
+    // ratio to level 6, but is between 5-10% faster.
+    // Level 3 runs almost twice as fast, but the
+    // output is typically 2-3x larger.
+    png_set_compression_level(png_ptr, 4);
+
     png_set_IHDR(png_ptr, info_ptr, width, height, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
 
     png_set_write_fn(png_ptr, &output, user_write_fn, user_flush_fn);


More information about the Libreoffice-commits mailing list