Support for HW JPEG Decoder in SKIA

Add support to use HW JPEG Decoder in SKIA
through dynamic loading of vendor specific
library. Vendor library to provide APIs to
check if HW decode is possible for a stream
and if so decode the stream. Methods
allocPixelRef and getPrefConfig in
SkImageDecoder made public because vendor
lib has access only to the SkImageDecoder
and not its derived class.

Change-Id: Ie6e9366603a3a3923d7f041d7601589dadf75ac8
ARM Skia NEON patches - 20 - New improved BitmapProcState code

BitmapProcState: new factorised code

This one basically factorises the clamp and repeat transformations with
some performance improvements. It has the benefit of being faster, much
easier to maintain (nearly three times less code for more work
done :-)), and more complete (all persp transformations weren't optimised
in the previous version).

It also introduces the use of can_truncate_to_fixed_for_decal where
useful.

The effect on benchmarks ranges from a 5% penalty to a 25% gain on a
Cortex-A9 and from a 5% penalty to a 100% gain on a Cortex-A15.

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=
R=djsollen@google.com, mtklein@google.com, luisjoseromeroesclusa@hotmail.com, reed@google.com

Author: kevin.petit.arm@gmail.com

Review URL: https://codereview.chromium.org/23835006

Change-Id: Ifb1a610730548f6e487dbb60bebcf69150186ed1
git-svn-id: http://skia.googlecode.com/svn/trunk@13218 2bbb7eff-a529-9590-31e7-b0007b416f81
ARM Skia NEON patches - 27 - S32A_D565_Blend

BlitRow565: new intrinsics version of S32A_D565_Blend

This new version is basically a rewrite of the existing code with
a few speed and accuracy improvements. There is a switch to enable
pixel perfect results at the cost of a (quite big) decrease of
performances (disabled in this patch).

Here are the benchmark results (speedup vs. existing code):

+-------+------------+------------+
| count | Cortex -A9 | Cortex-A15 |
+-------+------------+------------+
| 1     | +103.6%    | +12%       |
+-------+------------+------------+
| 2     | +3.6%      | +21.6%     |
+-------+------------+------------+
| 4     | +0.8%      | -0.8%      |
+-------+------------+------------+
| 8     | +3.9%      | -1%        |
+-------+------------+------------+
| 16    | +14.7%     | +5.7%      |
+-------+------------+------------+
| 64    | +18.1%     | +13.2%     |
+-------+------------+------------+
| 256   | +16.3%     | +27.4%     |
+-------+------------+------------+
| 1024  | +78.2%     | +17.4%     |
+-------+------------+------------+

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:
R=djsollen@google.com, mtklein@google.com, halcanary@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/156113005

Change-Id: I92a1a6dfdb813b77ba05b245a3fdbb5e02458981
git-svn-id: http://skia.googlecode.com/svn/trunk@13438 2bbb7eff-a529-9590-31e7-b0007b416f81
ARM Skia NEON patches - 20bis - BitmapProcState accurracy

Use SkFractionalInt for some calculations to improve accuracy.

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:2175
NOTRY=true
R=djsollen@google.com, mtklein@google.com, hshi@chromium.org

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/167433002

Change-Id: I2452ff401cc584084f44ec3a27240aa564eb19bc
git-svn-id: http://skia.googlecode.com/svn/trunk@13518 2bbb7eff-a529-9590-31e7-b0007b416f81
ARM Skia NEON patches - 12 - S32_Blend

Blitrow32: S32_Blend fix and little speed improvement

- the results are now exactly similar as the C code
- the speed has improved, especially for small values of count

+-------+-----------+------------+
| count | Cortex-A9 | Cortex-A15 |
+-------+-----------+------------+
| 1     | +30%      | +18%       |
+-------+-----------+------------+
| 2     | 0         | 0          |
+-------+-----------+------------+
| 4     | - <1%     | +14%       |
+-------+-----------+------------+
| > 4   | -0.5..+5% | -0.5..+4%  |
+-------+-----------+------------+

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:

Committed: http://code.google.com/p/skia/source/detail?r=13532

R=djsollen@google.com, mtklein@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/158973002

Change-Id: I75a4d2a31313664b4df057ea58821899646a1577
git-svn-id: http://skia.googlecode.com/svn/trunk@13543 2bbb7eff-a529-9590-31e7-b0007b416f81
ARM Skia NEON patches - 25 - S32A_D565_Opaque_Dither clean/bugfix/speed

BlitRow565: S32A_D565_Opaque_Dither: some improvements

    - Supports ARGB and ABGR
    - Less magic numbers
    - Reduced instruction count : 5-25% speedup
    - Fixed indentation, removed some commented and useless code

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:
R=djsollen@google.com, mtklein@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/177963003

Change-Id: I4f6083372e653fda5224b0f74dc5affbaa4c8f8f
git-svn-id: http://skia.googlecode.com/svn/trunk@13577 2bbb7eff-a529-9590-31e7-b0007b416f81
ARM Skia NEON patches - 22 - S32_D565_Blend

BlitRow565: new NEON version of S32_D565_Blend

This new implementation brings a good speedup in most cases and
gives exact results (removes one mismatch in gm).

Here are the benchmark results (speedup vs. existing S32A_D565_Blend):

+-------+-----------+------------+
| count | Cortex-A9 | Cortex-A15 |
+-------+-----------+------------+
| 1     | -26,7%    | -27,5%     |
+-------+-----------+------------+
| 2     | 0%        | +53%       |
+-------+-----------+------------+
| 4     | +38,3%    | +26,5%     |
+-------+-----------+------------+
| 8     | +10,9%    |  -4,5%     |
+-------+-----------+------------+
| 16    | +18,2%    | +1,6%      |
+-------+-----------+------------+
| 64    | +22,3%    | +8,75%     |
+-------+-----------+------------+
| 256   | +12,3%    | +11,2%     |
+-------+-----------+------------+
| 1024  | +79,2%    | +10,9%     |
+-------+-----------+------------+

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:
R=djsollen@google.com, mtklein@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/181523002

Change-Id: I9307ea4ee185e0319aed20ef9708cef5552c561b
git-svn-id: http://skia.googlecode.com/svn/trunk@14103 2bbb7eff-a529-9590-31e7-b0007b416f81
ARM Skia NEON patches - 36 - Color32

Convert Color32 to intrinsics

This change is performance-neutral for high values of count and is
a big improvement for values smaller than 64.

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:
R=djsollen@google.com, mtklein@google.com, borenet@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/258173005

Change-Id: Id7173a61efc6ebf8812149d2084e2b27c07fec52
git-svn-id: http://skia.googlecode.com/svn/trunk@14435 2bbb7eff-a529-9590-31e7-b0007b416f81
Remove the unused SkCachePreload_arm

Signed-off-by: Kévin PETIT <kevin.petit@arm.com>

BUG=skia:
R=djsollen@google.com, mtklein@google.com

Author: kevin.petit@arm.com

Review URL: https://codereview.chromium.org/263553008

Change-Id: I7312ca230cd98ec335970c4f503b3b04d2ec7db3
git-svn-id: http://skia.googlecode.com/svn/trunk@14456 2bbb7eff-a529-9590-31e7-b0007b416f81
Always inline Filter_32_*_neon functions

The functions are rather performance critical and already marked
'inline'. However, Chrome for Android will not have these functions
inlined due to it being compiled with -Os and a small -finline-limit.

This avoids one call in the filtering functions.

Does not increase the library size.

BUG=chromium:363073
R=mtklein@google.com

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/280403005

Change-Id: I3a1191a3b6f0afe8c035ab0af745280883680efc
git-svn-id: http://skia.googlecode.com/svn/trunk@14709 2bbb7eff-a529-9590-31e7-b0007b416f81
Fix SkBlitRow_opts_arm so that it works on ARM v4t.
Original Mozilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=901208

R=reed@google.com, mtklein@google.com, reed1
BUG=skia:

Author: george@mozilla.com

Review URL: https://codereview.chromium.org/337853003

Change-Id: I822ef24123f2ae10815d99f25d07ee06e2c47af9
Add optimization of Skia S32A_Opaque blitter

Adds optimization of Skia S32A_Opaque_BlitRow32 blitter using ARM NEON
instruction set. Special cases for when alpha is zero or opaque.
Improves performance platform wide.

Change-Id: I0ffeb23b128e61cfe581ad121f227631d2918686
Signed-off-by: Henrik Smiding <henrik.smiding@stericsson.com>
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
Add optimization of Skia S32A_Blend blitter

Adds optimization of Skia S32A_Blend_BlitRow32 blitter using ARM NEON
instruction set. Special cases for when pixel alpha is zero.
Improves performance platform wide.

Change-Id: I6c8bf8a9525838682206ebd139855354d6b3a563
Signed-off-by: Henrik Smiding <henrik.smiding@stericsson.com>
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
Add optimized S32A_D565_Opaque_Dither blitter.

Adds optimization of Skia S32A_D565_Opaque_Dither blitter using
ARM NEON instruction set.
Improves performance in browser.
Change-Id: Ie20fb3cf3ad9a60f01b79e3ed2ddba7651bcf013
Signed-off-by: Henrik Smiding <henrik.smiding@stericsson.com>
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
Modify sample buffer size for larger displays

BZ: 146848

Increases the intermediate buffer size for sample pixel indexes,
used in the sample proc function calls. If the operation is bigger
than the buffer it's split into multiple calls, creating overhead.
This would especially impact the performance of SIMD optimizations.

Change-Id: I44d0723cb26372050741e28fc14f676ddcd56d77
Category: aosp improvement
Domain: AOSP-Others
Origin: internal
Upstream-Candidate: yes
Signed-off-by: Henrik Smiding <henrik.smiding@intel.com>
Reviewed-on: https://android.intel.com/163478
Tested-by: sys_abtbuild <sys_abtbuild@intel.com>
Reviewed-by: Landberg, Joakim <joakim.landberg@intel.com>
Reviewed-by: Chen, HuaqiangX <huaqiangx.chen@intel.com>
Reviewed-by: Fagerstedt, Axel <axel.fagerstedt@intel.com>
Add patch for Samsung Galaxy Tab 10.1

Change-Id: I19b2f6948d57d5c6a83b287bc378d696cf2bda27
Remove register keywords

The register keyword is deprecated in C++, even at -O0, registers are
used automatically.
Having the register keyword there causes a warning about deprecated
keywords when using clang (and possibly future gcc versions), and
isn't needed.

Change-Id: I0117139d351b737da44177ddada3e03a23763427
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
Change SkCanvasState to use inheritance.

Cherry-pick of
https://skia.googlesource.com/skia/+/352c2181d15ed053c3b759f08ff1f51d50e2d3bb

The base class, SkCanvasState, now holds the version, width, and
height. These fields will always be a necessary part of the class.
(Also add in some padding.)
The other fields, which may change, have been moved into the
subclass, SkCanvasState_v1. If/when the version changes, it will
correspond to a new subclass.
In SkCanvasStateUtils::CreateFromCanvasState, check the version on
the base class, then do a static_cast to the version corresponding
to SkCanvasState::version.

Remove CANVAS_STATE_VERSION, which is redundant with the version
specified by the subclass.

Use unambiguous type for rowBytes.

Build Android with SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG. This allows us
to run the full suite of CanvasState tests. It is also representative
of what will be used on Android by WebView.

Fix CanvasStateTest where it was broken inside ifdef'ed out code.

Update the comments in the header to be more clear. In particular,
an SkCanvasState can only be used to pass an SkCanvas' state to a
future version of Skia (or the same); not an older version.

NOTREECHECKS=true

BUG=b/15693384
R=reed@google.com, mtklein@google.com, djsollen@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/372003002

Change-Id: I75ef9443291b308a3555e4b2154bdc087f419662
[skia]: fix gif decode can't decode transparent pixels

Symptom : gif decoder can't decode transparent pixels
Root Cause : the transparent block should be decoded into temp image
Solution : store the transparent block to correct temp image
Reproduce steps : draw a transparent gif image.

Change-Id: I77397edd14387db9cc7e11720b95f1a75e193cb3