New issue
Advanced search Search tips

Issue 702860 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Task

Blocking:
issue 709707



Sign in to add a comment

Optimize ImageFrame::setRGBAPremultiply

Project Member Reported by cavalcantii@chromium.org, Mar 18 2017

Issue description

Our research on PNG handling showed that the aforementioned function could be made faster on ARM.

The idea is to NEON-ize it in a similar fashion as in RGBAtoRGB used by JPEGImageEncoder.
 
Cc: scroggo@chromium.org
This could certainly be made faster on ARM.  SkPngCodec already has a version of this optimization.

As I understand it, the path forward here might be to switch Chrome to using SkPngCodec.  I'm not sure if it makes sense to do something in the shorter term.

scroggo@ probably knows the most about the long term plan.
@Matt

Thanks for commenting, I see benefits of having optimizations in Skia as that should also benefit Android apps.

So what would take to use SkPngCodec in ImageFrame?
@scroggo

When you get some time, could you grant me access to the design document mentioned in https://codereview.chromium.org/1997703003 ?
Blockedon: -687631
Blocking: 709707

Comment 6 by jonathan...@arm.com, Dec 14 2017

Two patches have been implemented to optimise SetRGBARaw and SetRGBAPremultiply:

https://chromium-review.googlesource.com/c/chromium/src/+/827136
https://chromium-review.googlesource.com/c/chromium/src/+/827137

The combined effect of these patches can be seen in the attached spreadsheet. I would suggest landing patch 827136 first as it gives an unquestionable benefit across the board.
both_patches_applied.ods
87.9 KB Download
Cc: -msarett@chromium.org cblume@chromium.org
Project Member

Comment 8 by bugdroid1@chromium.org, Feb 7 2018

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

commit 6e8bc8975b84a91bd235107ca5a2f30fa6bae09c
Author: Jonathan Wright <jonathan.wright@arm.com>
Date: Wed Feb 07 18:30:44 2018

NEON-ise SetRGBARaw() in PNGImageDecoder

Adds an Arm NEON implementation of SetRGBARaw() for use in
PNGImageDecoder.cpp.

Bug:  702860 
Change-Id: If39902474054e5342347ee207d9d085c8e92ea98
Reviewed-on: https://chromium-review.googlesource.com/827136
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@chromium.org>
Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535069}
[modify] https://crrev.com/6e8bc8975b84a91bd235107ca5a2f30fa6bae09c/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp

The combined performance benefits of the latest SetRGBARaw and SetRGBAPremultiply patchsets can be seen in the attached spreadsheet. The data was collected on Elm, running image_decode_bench 150 times on each of the four corpora.
both_patches_latest.ods
87.4 KB Download
Project Member

Comment 10 by bugdroid1@chromium.org, Feb 9 2018

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

commit b418ba9fb4875c53ef63b684e283699f2cfcd4e1
Author: Jonathan Wright <jonathan.wright@arm.com>
Date: Fri Feb 09 16:27:05 2018

NEON-ise SetRGBAPremultiply()

Adds an Arm NEON implementation of SetRGBAPremultiply() for use in
PNGImageDecoder.cpp.

8-pixel and 16-pixel implementations have the same performance. The 8
pixel implementation is preferred because the code is significantly
easier to understand.

Bug:  702860 
Change-Id: I218ebf60cbd0708aea065001459f16a95e18909f
Reviewed-on: https://chromium-review.googlesource.com/827137
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@chromium.org>
Commit-Queue: Leon Scroggins <scroggo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535731}
[modify] https://crrev.com/b418ba9fb4875c53ef63b684e283699f2cfcd4e1/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp

Status: Started (was: Assigned)

Comment 12 by noel@chromium.org, Feb 10 2018

Cc: noel@chromium.org
> SkPngCodec already has a version of this optimization.

Leon, where are we on that plan?

It's on the backburner as I've been focused on Android P

Comment 14 by noel@chromium.org, Feb 15 2018

No worries, understood.

I guess I was wondering: if Skia has these optimizations (I'm pretty sure it does, last time I looked) then maybe we could reach into Skia and use them, perhaps even from ImageFrame.h?  That'd be neat if it was possible, since all our image decoders would benefit, not just PNG.
Status: Fixed (was: Started)

Sign in to add a comment