Add accelerated RGB to RGBA/BGRA expansion methods
Categories
(Core :: Graphics: ImageLib, enhancement, P3)
Tracking
()
People
(Reporter: aosmond, Assigned: aosmond)
References
(Blocks 1 open bug)
Details
Attachments
(8 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
We use gfxPackedPixel to expand from RGB to BGRA in the image decoders. Isolated testing of algorithms I've written using SSSE3 and AVX2 suggests it is 6x to 11x faster than plain old C per-pixel copying. This is similar in nature to gfx/2d/Swizzle-*.cpp methods, although if we slot it into that infrastructure, it would be better if we expose methods to get a function pointer designed for row by row conversion like how imagelib does decoding and avoid setup overhead/branches in SwizzleData on every row.
These new methods should support both RGB to RGBA and RGB to BGRA to facilitate bug 1541900.
Assignee | ||
Updated•6 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
The image decoders produce surfaces row by row, so a variant to get a
function pointer to perform swizzle/premultiply operations makes more
ergonomic sense.
Assignee | ||
Comment 2•5 years ago
|
||
Some image decoders (e.g. PNG) may have a native representation of the
data as RGB, and do not have accelerated methods to transform from RGB
to RGBX/BGRX. Exposing this as part of the swizzle/premultiply methods
allows us to write accelerated versions ourselves in a later patch in
this series.
Assignee | ||
Comment 3•5 years ago
|
||
These variants perform significantly faster than the C implementations
according to local testing and that in treeherder. Image decoding is as
much as 40% faster in the most simple cases (solid green PNG image).
Assignee | ||
Comment 4•5 years ago
|
||
Assignee | ||
Comment 5•5 years ago
|
||
Some filters can do the copy of the given data into the working buffer
as part of the filter operation. For those that cannot, we will just
copy the data first, and then advance the row.
Assignee | ||
Comment 6•5 years ago
|
||
The PNG decoder lacks fast implementations for swizzling/unpacking
inside the library, and both PNG and WebP may need to perform
premultiplication due to the alpha channel. This patch adds a new filter
allowing us to take advantage of our accelerated implementations to
perform these transformations on their behalf.
Assignee | ||
Comment 7•5 years ago
|
||
Assignee | ||
Comment 8•5 years ago
|
||
Assignee | ||
Comment 9•5 years ago
|
||
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=267796611&repo=autoland
Back-out link: https://hg.mozilla.org/integration/autoland/rev/a5c7b61b18bc9c55cfe2c27c3d521891b9b67adc
[task 2019-09-21T11:48:58.178Z] 11:48:58 INFO - ld: warning: directory not found for option '-L/builds/worker/workspace/src/gcc/lib64'
[task 2019-09-21T11:48:58.178Z] 11:48:58 INFO - ld: warning: could not create compact unwind for _ffi_call_unix64: does not use RBP or RSP based frame
[task 2019-09-21T11:48:58.178Z] 11:48:58 INFO - Undefined symbols for architecture x86_64:
[task 2019-09-21T11:48:58.178Z] 11:48:58 INFO - "__ZN7mozilla3gfx14UnpackRowRGB24ILb1EEEvPKhPhi", referenced from:
[task 2019-09-21T11:48:58.179Z] 11:48:58 INFO - __ZN7mozilla3gfx20UnpackRowRGB24_SSSE3ILb1EEEvPKhPhi in SwizzleSSSE3.o
[task 2019-09-21T11:48:58.179Z] 11:48:58 INFO - "__ZN7mozilla3gfx14UnpackRowRGB24ILb0EEEvPKhPhi", referenced from:
[task 2019-09-21T11:48:58.179Z] 11:48:58 INFO - __ZN7mozilla3gfx20UnpackRowRGB24_SSSE3ILb0EEEvPKhPhi in SwizzleSSSE3.o
[task 2019-09-21T11:48:58.179Z] 11:48:58 INFO - ld: symbol(s) not found for architecture x86_64
[task 2019-09-21T11:48:58.179Z] 11:48:58 INFO - clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
[task 2019-09-21T11:48:58.179Z] 11:48:58 INFO - /builds/worker/workspace/build/src/config/rules.mk:657: recipe for target 'XUL' failed
[task 2019-09-21T11:48:58.179Z] 11:48:58 ERROR - make[4]: *** [XUL] Error 1
[task 2019-09-21T11:48:58.179Z] 11:48:58 INFO - make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/toolkit/library/build'
[task 2019-09-21T11:48:58.179Z] 11:48:58 INFO - /builds/worker/workspace/build/src/config/recurse.mk:74: recipe for target 'toolkit/library/build/target' failed
[task 2019-09-21T11:48:58.179Z] 11:48:58 ERROR - make[3]: *** [toolkit/library/build/target] Error 2
[task 2019-09-21T11:48:58.179Z] 11:48:58 INFO - make[3]: *** Waiting for unfinished jobs....
Comment 12•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 13•5 years ago
|
||
Backed out for causing reftest failures in SwizzleAVX2.cpp, SwizzleSSSE3.cpp and transform.cpp
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=268173857&repo=autoland&lineNumber=8797
Backout: https://hg.mozilla.org/integration/autoland/rev/33c93c2f60953a41d5c6a482b2cce83c0c84c4c7
Comment 14•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/bed9c93eeb2d
https://hg.mozilla.org/mozilla-central/rev/25a5f5563e9d
https://hg.mozilla.org/mozilla-central/rev/d90a571e581f
https://hg.mozilla.org/mozilla-central/rev/9e954d6765de
https://hg.mozilla.org/mozilla-central/rev/f77c43bcc75b
https://hg.mozilla.org/mozilla-central/rev/5d72c8de4daf
https://hg.mozilla.org/mozilla-central/rev/3e6f25b21f8c
https://hg.mozilla.org/mozilla-central/rev/9ef391e20fa6
https://hg.mozilla.org/mozilla-central/rev/d0ab25c226a7
Comment 17•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 18•5 years ago
|
||
try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=71156be9cee648a8b89b73e7f3c78a7dddcb220b
Fixed what would have been a big endian regression, as well as the premultiply issues that caused the original backout. I'll double check with the build from CI to confirm before relanding.
Comment 19•5 years ago
|
||
Assignee | ||
Comment 20•5 years ago
|
||
There were xpcshell test failures in comment 18 which I resolved prior to landing.
try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=4fecfdf872cbffec41ea33a0ed3670770dcff5e6
Comment 21•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/28f92f90d560
https://hg.mozilla.org/mozilla-central/rev/9565552bf989
https://hg.mozilla.org/mozilla-central/rev/dfdf98704a03
https://hg.mozilla.org/mozilla-central/rev/f6a6eb672d21
https://hg.mozilla.org/mozilla-central/rev/124159db74bb
https://hg.mozilla.org/mozilla-central/rev/7a6b89adb970
https://hg.mozilla.org/mozilla-central/rev/7005e7b0c756
https://hg.mozilla.org/mozilla-central/rev/c67cee7b6275
Updated•5 years ago
|
Description
•