New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 674264 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocked on:
issue 674765



Sign in to add a comment

Optimize RGBAtoRGB function

Project Member Reported by cavalcantii@chromium.org, Dec 14 2016

Issue description

Calls to the new API canvas.toBlob() will scan pixels and convert it to RGB when the export format is JPEG.

That is quite expensive on ARM and could be made much faster by using NEON instructions.
 
For a test case: http://codepen.io/Savago/pen/dOKPWM
Sample trace screenshot comparing the scalar code X NEON (device tested was Nexus 6).
4kcanvas_scalar_vs_neon.png
266 KB View Download
Owner: cavalcantii@chromium.org
Status: Started (was: Untriaged)
From the trace, the CPU Self time went from an average of 0.077ms to 0.018ms, yielding a saving of around 238 ms for the test case.
Cc: simon.ho...@arm.com schenney@chromium.org esprehn@chromium.org fmalita@chromium.org thakis@chromium.org
Cc: amaury.l...@arm.com
Blockedon: 674765
Using vraddhn dropped the walltime even more (from 90ms to 77ms).
vraddhn.png
146 KB View Download
Project Member

Comment 9 by bugdroid1@chromium.org, Jan 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/39aabd2e6f55099ec252ee0fa12f51549e4b011c

commit 39aabd2e6f55099ec252ee0fa12f51549e4b011c
Author: cavalcantii <cavalcantii@chromium.org>
Date: Fri Jan 06 18:40:11 2017

Introducing a perf test for canvas.toBlob() JPEG case

The idea is to allow to monitor performance gains while optimizing
parts of the JPEG code path.

BUG= 674264 

Review-Url: https://codereview.chromium.org/2617843002
Cr-Commit-Position: refs/heads/master@{#441989}

[add] https://crrev.com/39aabd2e6f55099ec252ee0fa12f51549e4b011c/third_party/WebKit/PerformanceTests/Canvas/toBlob_duration_jpeg.html

Project Member

Comment 10 by bugdroid1@chromium.org, Jan 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b630fb4deab73deea701d7122154a2835dbdf7fc

commit b630fb4deab73deea701d7122154a2835dbdf7fc
Author: cavalcantii <cavalcantii@chromium.org>
Date: Mon Jan 09 09:34:43 2017

NEON-ize RGBA to RGB code

The code path alone was made at least 4x faster than the original
(from 85us to 14us in a Nexus 6), lowering the runtime of pixel
conversion in 1/4 (e.g. from 330ms to 77ms in a 4K canvas).

This yields a global improvement of about 15% while calling
canvas.toBlob() and toDataURL() when the output format is JPEG and
canvas is hardware accelerated.

BUG= 674264 

Review-Url: https://codereview.chromium.org/2576223002
Cr-Commit-Position: refs/heads/master@{#442218}

[modify] https://crrev.com/b630fb4deab73deea701d7122154a2835dbdf7fc/third_party/WebKit/Source/platform/BUILD.gn
[modify] https://crrev.com/b630fb4deab73deea701d7122154a2835dbdf7fc/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoder.cpp
[add] https://crrev.com/b630fb4deab73deea701d7122154a2835dbdf7fc/third_party/WebKit/Source/platform/image-encoders/JPEGImageEncoderTest.cpp
[add] https://crrev.com/b630fb4deab73deea701d7122154a2835dbdf7fc/third_party/WebKit/Source/platform/image-encoders/RGBAtoRGB.h

Status: Fixed (was: Started)

Sign in to add a comment