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 skjpeg_destination_mgr to make it work with both optimized and orignial Libjpeg's SW JPEG encoders

Issue:
"dest->free_in_buffer" is always 0 when sk_empty_output_buffer is called in
orignial Libjpeg's SW JPEG encoder, but it tends not to 0 when
sk_empty_output_buffer is called after optimization, for we probably need to
flush encoded data before the buffer is 100% full. This is required for some
3rd party libraries such as Intel-IPP.

Solution:
Change the size to be copies from "skjpeg_destination_mgr::kBufferSize" to
"skjpeg_destination_mgr::kBufferSize - dest->free_in_buffer".

Change-Id: If74a8f77e2bd371eee5ee7488fccf349b713d9ac
Author: Jing Sun <jing.a.sun@intel.com>
Signed-off-by: Jing Sun <jing.a.sun@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 51639
skia: add missing endif

Change-Id: Ib86582e3360aa02a5e4c664bf459f80fc795f283
Revert "Modify skjpeg_destination_mgr to make it work with both optimized and orignial Libjpeg's SW JPEG encoders"

This reverts commit 538423bf36ddb3df6a20c5b8a717b00fc0ae9789.

Change-Id: Ia3693a92650ad87624445c9ce4ace440c790ae8d