Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Issue 2096723003: Double AdobeCMYK_to_sRGB speed with faster rounding (Closed)

Created:
4 years, 6 months ago by brucedawson
Modified:
4 years, 5 months ago
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Target Ref:
refs/heads/master
Project:
pdfium
Visibility:
Public.

Description

Double AdobeCMYK_to_sRGB speed with faster rounding FXSYS_round is painfully slow on Windows. It does range checking and then calls an extremely expensive function. It ends up consuming half the CPU time when decoding the images in PDFs such as this one: https://www.ets.org/Media/Tests/GRE/pdf/gre_research_validity_data.pdf SSE can be used to optimize this: __m128 cmyk = {c * 255, m * 255, y * 255, k * 255}; uint32_t output[4]; _mm_storeu_si128((__m128i*)output, _mm_cvtps_epi32(cmyk)); but is cryptic, only works for x86/x64, and gives basically identical performance to this solution - int(c * 255 + 0.5f); The rounding behavior is not identical but in practice this rarely matters, and in this specific case it does not matter because the edge cases that vary are not hit. The three divisions at the end were changed to multiplies because profiling showed they were a significant cost. This change reduces the image-decode stalls in the PDF listed above by about 40%, making for a noticeably better experience. Further optimizations are possible but would require significantly more time and testing. BUG=617365 Committed: https://pdfium.googlesource.com/pdfium/+/160bd0e26f5dfe5fa11322f61b3d156c2214cba8

Patch Set 1 #

Patch Set 2 : Double AdobeCMYK_to_sRGB speed with faster rounding #

Patch Set 3 : Comment and ASSERT tweaks #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -7 lines) Patch
M core/fxcodec/codec/fx_codec_icc.cpp View 1 2 1 chunk +25 lines, -7 lines 0 comments Download

Messages

Total messages: 13 (5 generated)
brucedawson
PTAL This contains some error checking that can't ship as is - a faked out ...
4 years, 6 months ago (2016-06-23 20:47:41 UTC) #1
dsinclair
Added a few reviewers to take a look. PDFium doesn't have DCHECK, we just use ...
4 years, 6 months ago (2016-06-23 20:52:32 UTC) #3
brucedawson
On 2016/06/23 20:52:32, dsinclair wrote: > Added a few reviewers to take a look. > ...
4 years, 6 months ago (2016-06-23 20:59:42 UTC) #4
Lei Zhang
Cary's probably the best reviewer?
4 years, 6 months ago (2016-06-23 22:36:11 UTC) #7
caryclark
lgtm A unit test would be nice.
4 years, 5 months ago (2016-06-27 13:11:23 UTC) #8
dsinclair
lgtm RS lgtm
4 years, 5 months ago (2016-06-27 13:46:13 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2096723003/40001
4 years, 5 months ago (2016-06-27 13:46:23 UTC) #11
commit-bot: I haz the power
4 years, 5 months ago (2016-06-27 13:58:44 UTC) #13
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://pdfium.googlesource.com/pdfium/+/160bd0e26f5dfe5fa11322f61b3d156c2214...

Powered by Google App Engine
This is Rietveld 408576698