common/Png.hpp | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit faa6ccffa50836496ab3a46166e8603c5dd2cd07
Author: Ashod Nakashian <[email protected]>
AuthorDate: Fri Apr 19 20:09:22 2019 -0400
Commit: Michael Meeks <[email protected]>
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 <[email protected]>
Tested-by: Michael Meeks <[email protected]>
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);
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits