Commit graph

29 commits

Author SHA1 Message Date
Tor Lillqvist
64675d2926 Add ProfileZone to encodeSubBufferToPNG
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I7363ea929ba703ce34a5c2411687f120ac5ba59e
2021-06-22 16:43:40 +03:00
Tor Lillqvist
dcf9d9f12b Log also the average tile PNG size and the average compression ratio
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I77fb1ae0e9ef892b23212222b44dc3dc522c7ce3
2021-06-11 09:42:17 +03:00
Tor Lillqvist
5e8be7005b Bin unused function
Change-Id: I9217193534bbed8f55faaa105b603e1560b1519a
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-01-21 16:12:55 +02:00
Michael Meeks
4e92b5a697 Special case opacity to avoid arithmetic where possible.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I37a72bc966424ca1b4c30b31d9fcf88d15c11789
2021-01-16 12:18:24 +00:00
Ashod Nakashian
ba4e52e7b9 wsd: log: overload chrono duration to simplify logging
Also, makes the logging of units much less error prone.

The overloaded streaming operators are temporary as
they are provided in C++20. The ones here (though
incomplete) are fashioned after the C++20 specs.

Change-Id: Ieb499282ccb6e63fa939ba07bed3e5a4fbef1bd0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-08 09:26:41 +00:00
Andras Timar
0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
Tor Lillqvist
4eb598711c Use #pragma once
LibreOffice core uses that, too, and we support an even more
restricted set of compilers.

Change-Id: I0d0e2c8608e323eb5ef0f35ee8c46d02ab49a745
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92467
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-18 15:00:18 +02:00
Ashod Nakashian
d110f4cc58 test: improve TileCacheTests
Sometimes core renderes with sub-pixel differences
(the crosshair at the corners of the Writer pages
show line anti-aliasing differences). This causes
failure of the tests that count the tile deduplication.

We now tolerate when we get an unchanged tile twice,
assuming it was due to such a rendering difference,
but we re-trigger another change and this time we
don't expect any extra tiles, no more than two
variations of the anti-aliased crosshair was
observed.

We also move some duplicate code into utility
functions to improve readability and reuse.

Reviewed-on: https://gerrit.libreoffice.org/81196
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 9603597fd1aaecb27893792cfd2d243e450b58b8)

Change-Id: I1a66732dd3443bfbd770d8dc65721571dfa08615
Reviewed-on: https://gerrit.libreoffice.org/81572
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-10-29 02:32:05 +01:00
Ashod Nakashian
f7bd2c7e1d wsd: fix variable might be clobbered by ‘longjmp’ or ‘vfork’
As the comment details, this avoids having C++ objects
in the same frame as setjmp, which may reset their
contents without the dtor getting called.

Change-Id: I851ae8bffb4356d465a25dfc815a1fecb489fa30
Reviewed-on: https://gerrit.libreoffice.org/79338
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-09-22 20:24:36 +02:00
Ashod Nakashian
e76d27188e 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/71018
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-04-23 03:00:31 +02:00
Ashod Nakashian
90c8dd41b9 wsd: logging, comments, and const correctness
Change-Id: Ibfbef282e951a80fb145239df4bbcc9f3e4c8e13
Reviewed-on: https://gerrit.libreoffice.org/71017
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-04-23 03:00:19 +02:00
Tor Lillqvist
25c8ed7897 For iOS, generate the data: URLs for the PNG tiles already in the Online code
(What we cache is also the textual data: URLs even if we store them
using .png file names.)

This avoids the current back-and-forth-encoding: First we
base64-encode the complete binary "tile:" message (one text line
followed by a newline and the binary PNG) to pass to WebKit, then in
the JavaScript snippet passed to WebKit we decode the base64 and turn
it into an ArrayBuffer, and then we unpack the ArrayBuffer and encode
the PNG part to use as a data: URL.
2019-03-22 16:21:51 +02:00
Jan Holesovsky
f76b36193d android: #if(n)def MOBILEAPP -> #if (!)MOBILEAPP for better reliability.
Change-Id: I5f9c9420b6c83601db1c8fdba4ae5a10b17b2107
2019-02-12 12:20:11 +01:00
Tor Lillqvist
2d1c865dd5 Use std::memcpy() here for consistency
Change-Id: I295b1db38333935ccf6efc4c2232bc2db8e84dd5
2018-11-02 16:20:49 +02:00
Tor Lillqvist
224bdad365 Use faster PNG compression in mobile app
Also, log the average time taken for PNG compression of tiles.

Change-Id: I720f55dc44bd6729dce710e3b781a7239a8bf585
2018-11-01 02:32:56 +02:00
Miklos Vajna
9eacfe4fcb common: spell out non-trivial autos to improve readability
Change-Id: Id13bc0e48cec845f5b05171128be5b4efc05c6bc
2018-02-07 10:18:12 +01:00
Tor Lillqvist
11ae90cfcb No Hungarian notation please
Change-Id: Ia624de45a792db7e39f2245aaea7d940b30b0db2
2017-01-13 14:52:08 +02:00
Tor Lillqvist
7d7e5a4bfe Remove assert as this function can also be called with a non-empty output vector
Change-Id: Idff29a5bd298ada7b6d8fe3e76fd2e25d8f25c79
2017-01-11 14:02:40 +02:00
Tor Lillqvist
c8d3f90e56 Add an assert to make sure assumptions I am about to make will hold
Change-Id: Ifc1eeb61aa345cf177e3c5996ed7bc48f6aeb07c
2017-01-04 17:10:58 +02:00
Tor Lillqvist
b837f58814 Bin superfluous assert()
Change-Id: Ie50b44e0681e9fd7c33e125476e1aafda1010f34
2017-01-04 14:37:05 +02:00
Tor Lillqvist
a36d4b0fc3 Reanme png namespace to Png for consistency
As far as I see, we tend to use the same namespace name as the
basename of the corresponding include file, and this stuff is defined
in a file called Png.hpp.

Change-Id: Id859e13e94568abd9f1d5b4ef3bfbbb0c156db11
2017-01-04 13:35:26 +02:00
Noel Grandin
d6b767b840 loplugin:cstylecast
Change-Id: I5a0524aca89b16ba336d69028faf76cccab22d59
Reviewed-on: https://gerrit.libreoffice.org/32371
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:46:57 +00:00
Noel Grandin
0caeab803b loplugin:loopvartoosmall
Change-Id: I32f75fac7626b9ae56fa3f898bfa50051a22677f
Reviewed-on: https://gerrit.libreoffice.org/32362
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:15:38 +00:00
Noel Grandin
4ed820d3d5 add a configure option for using clang compiler plugins
and apply the nullptr plugin.

Lots of hacking in my LO tree required to make this work, will probably
end up needing to add an extra parameter to the LO side.

Change-Id: I02ae1dcdece9d9ddf05f7757f6696e3a5d7d1f14
Reviewed-on: https://gerrit.libreoffice.org/32339
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-22 14:23:42 +00:00
Miklos Vajna
6a08b44433 Png: avoid multiplication at int precision, then converting to long
Change-Id: Id05d1db07ae7e8978b2a6b989b6366ae66d0e9de
2016-12-05 11:56:46 +01:00
Ashod Nakashian
b35725ab70 loolwsd: support more efficient full-buffer hashing
Change-Id: Ie30929ad4665b51e280c1126adde645742814dad
Reviewed-on: https://gerrit.libreoffice.org/31294
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:03:17 +00:00
Ashod Nakashian
47fa3b1b10 loolwsd: use a better hash function for png caching
We need a fast and good (high avalanche properties)
hash function for the png caching to avoid collissions
(even in the very limited samples we have, since tiles
are likely to have patters, such as all 0's and all 1's
etc.).

Bob Jenkins's public domain SpookyV2 is used here.
It has great avalanache properties and is fast at
~3-bytes / cycle for large messages.

Only trailing whitespace was removed from original
sources and 4 tabs converted to spaces.

Change-Id: Ife57237321625c836d85c894d939fd04a8f577bb
Reviewed-on: https://gerrit.libreoffice.org/31292
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:00:37 +00:00
Michael Meeks
85583f0a89 Avoid PNG compression for un-changed tiles. 2016-11-25 15:48:56 +00:00
Michael Meeks
cca657c8f2 Apply the pre-branch rename script to re-organize the source. 2016-11-25 09:58:48 +00:00
Renamed from loolwsd/Png.hpp (Browse further)