OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBlitRow_opts_arm_neon.h" | 8 #include "SkBlitRow_opts_arm_neon.h" |
9 | 9 |
10 #include "SkBlitMask.h" | 10 #include "SkBlitMask.h" |
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 /////////////////////////////////////////////////////////////////////////////// | 1534 /////////////////////////////////////////////////////////////////////////////// |
1535 | 1535 |
1536 const SkBlitRow::Proc16 sk_blitrow_platform_565_procs_arm_neon[] = { | 1536 const SkBlitRow::Proc16 sk_blitrow_platform_565_procs_arm_neon[] = { |
1537 // no dither | 1537 // no dither |
1538 S32_D565_Opaque_neon, | 1538 S32_D565_Opaque_neon, |
1539 S32_D565_Blend_neon, | 1539 S32_D565_Blend_neon, |
1540 S32A_D565_Opaque_neon, | 1540 S32A_D565_Opaque_neon, |
1541 #if 0 | 1541 #if 0 |
1542 S32A_D565_Blend_neon, | 1542 S32A_D565_Blend_neon, |
1543 #else | 1543 #else |
1544 NULL, // https://code.google.com/p/skia/issues/detail?id=2797 | 1544 nullptr, // https://code.google.com/p/skia/issues/detail?id=2797 |
1545 #endif | 1545 #endif |
1546 | 1546 |
1547 // dither | 1547 // dither |
1548 S32_D565_Opaque_Dither_neon, | 1548 S32_D565_Opaque_Dither_neon, |
1549 S32_D565_Blend_Dither_neon, | 1549 S32_D565_Blend_Dither_neon, |
1550 S32A_D565_Opaque_Dither_neon, | 1550 S32A_D565_Opaque_Dither_neon, |
1551 NULL, // S32A_D565_Blend_Dither | 1551 nullptr, // S32A_D565_Blend_Dither |
1552 }; | 1552 }; |
1553 | 1553 |
1554 const SkBlitRow::ColorProc16 sk_blitrow_platform_565_colorprocs_arm_neon[] = { | 1554 const SkBlitRow::ColorProc16 sk_blitrow_platform_565_colorprocs_arm_neon[] = { |
1555 Color32A_D565_neon, // Color32_D565, | 1555 Color32A_D565_neon, // Color32_D565, |
1556 Color32A_D565_neon, // Color32A_D565, | 1556 Color32A_D565_neon, // Color32A_D565, |
1557 Color32A_D565_neon, // Color32_D565_Dither, | 1557 Color32A_D565_neon, // Color32_D565_Dither, |
1558 Color32A_D565_neon, // Color32A_D565_Dither | 1558 Color32A_D565_neon, // Color32A_D565_Dither |
1559 }; | 1559 }; |
1560 | 1560 |
1561 const SkBlitRow::Proc32 sk_blitrow_platform_32_procs_arm_neon[] = { | 1561 const SkBlitRow::Proc32 sk_blitrow_platform_32_procs_arm_neon[] = { |
1562 NULL, // S32_Opaque, | 1562 nullptr, // S32_Opaque, |
1563 S32_Blend_BlitRow32_neon, // S32_Blend, | 1563 S32_Blend_BlitRow32_neon, // S32_Blend, |
1564 /* | 1564 /* |
1565 * We have two choices for S32A_Opaque procs. The one reads the src alpha | 1565 * We have two choices for S32A_Opaque procs. The one reads the src alpha |
1566 * value and attempts to optimize accordingly. The optimization is | 1566 * value and attempts to optimize accordingly. The optimization is |
1567 * sensitive to the source content and is not a win in all cases. For | 1567 * sensitive to the source content and is not a win in all cases. For |
1568 * example, if there are a lot of transitions between the alpha states, | 1568 * example, if there are a lot of transitions between the alpha states, |
1569 * the performance will almost certainly be worse. However, for many | 1569 * the performance will almost certainly be worse. However, for many |
1570 * common cases the performance is equivalent or better than the standard | 1570 * common cases the performance is equivalent or better than the standard |
1571 * case where we do not inspect the src alpha. | 1571 * case where we do not inspect the src alpha. |
1572 */ | 1572 */ |
1573 #if SK_A32_SHIFT == 24 | 1573 #if SK_A32_SHIFT == 24 |
1574 // This proc assumes the alpha value occupies bits 24-32 of each SkPMColor | 1574 // This proc assumes the alpha value occupies bits 24-32 of each SkPMColor |
1575 S32A_Opaque_BlitRow32_neon_src_alpha, // S32A_Opaque, | 1575 S32A_Opaque_BlitRow32_neon_src_alpha, // S32A_Opaque, |
1576 #else | 1576 #else |
1577 S32A_Opaque_BlitRow32_neon, // S32A_Opaque, | 1577 S32A_Opaque_BlitRow32_neon, // S32A_Opaque, |
1578 #endif | 1578 #endif |
1579 #ifdef SK_CPU_ARM32 | 1579 #ifdef SK_CPU_ARM32 |
1580 S32A_Blend_BlitRow32_neon // S32A_Blend | 1580 S32A_Blend_BlitRow32_neon // S32A_Blend |
1581 #else | 1581 #else |
1582 NULL | 1582 nullptr |
1583 #endif | 1583 #endif |
1584 }; | 1584 }; |
1585 | 1585 |
1586 #include "Sk4px.h" | 1586 #include "Sk4px.h" |
1587 | 1587 |
1588 void sk_blitrow_color32_arm_neon(SkPMColor* dst, const SkPMColor* src, int count
, SkPMColor color) { | 1588 void sk_blitrow_color32_arm_neon(SkPMColor* dst, const SkPMColor* src, int count
, SkPMColor color) { |
1589 // Until it becomes a little more reasonable to assume we'll be built with N
EON, | 1589 // Until it becomes a little more reasonable to assume we'll be built with N
EON, |
1590 // we copy our Sk4px implementation of SkBlitRow::Color32 here so it picks u
p NEON at runtime. | 1590 // we copy our Sk4px implementation of SkBlitRow::Color32 here so it picks u
p NEON at runtime. |
1591 unsigned invA = 255 - SkGetPackedA32(color); | 1591 unsigned invA = 255 - SkGetPackedA32(color); |
1592 invA += invA >> 7; | 1592 invA += invA >> 7; |
1593 SkASSERT(invA < 256); // Our caller has already handled the alpha == 0 case
. | 1593 SkASSERT(invA < 256); // Our caller has already handled the alpha == 0 case
. |
1594 | 1594 |
1595 Sk16h colorHighAndRound = Sk4px::DupPMColor(color).widenHi() + Sk16h(128); | 1595 Sk16h colorHighAndRound = Sk4px::DupPMColor(color).widenHi() + Sk16h(128); |
1596 Sk16b invA_16x(invA); | 1596 Sk16b invA_16x(invA); |
1597 | 1597 |
1598 Sk4px::MapSrc(count, dst, src, [&](const Sk4px& src4) -> Sk4px { | 1598 Sk4px::MapSrc(count, dst, src, [&](const Sk4px& src4) -> Sk4px { |
1599 return (src4 * invA_16x).addNarrowHi(colorHighAndRound); | 1599 return (src4 * invA_16x).addNarrowHi(colorHighAndRound); |
1600 }); | 1600 }); |
1601 } | 1601 } |
OLD | NEW |