OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> |
| 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 5 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 6 * |
| 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. |
| 11 * |
| 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. |
| 16 * |
| 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. |
| 21 */ |
| 22 |
| 23 #ifndef FilterEffectNEON_h |
| 24 #define FilterEffectNEON_h |
| 25 |
| 26 #if HAVE(ARM_NEON_INTRINSICS) |
| 27 |
| 28 #include "platform/graphics/filters/FilterEffect.h" |
| 29 #include <arm_neon.h> |
| 30 |
| 31 namespace blink { |
| 32 |
| 33 inline int FilterEffect::validPreMultipliedPixels64NEON(int pixelArrayLength, un
signed char* pixelData) |
| 34 { |
| 35 if (pixelArrayLength >= 64) { |
| 36 unsigned char* lastPixel = pixelData + (pixelArrayLength & ~0x3f); |
| 37 do { |
| 38 // Increments pixelData by 64. |
| 39 uint8x16x4_t sixteenPixels = vld4q_u8(pixelData); |
| 40 sixteenPixels.val[0] = vminq_u8(sixteenPixels.val[0], sixteenPixels.
val[3]); |
| 41 sixteenPixels.val[1] = vminq_u8(sixteenPixels.val[1], sixteenPixels.
val[3]); |
| 42 sixteenPixels.val[2] = vminq_u8(sixteenPixels.val[2], sixteenPixels.
val[3]); |
| 43 vst4q_u8(pixelData, sixteenPixels); |
| 44 pixelData += 64; |
| 45 } while (pixelData < lastPixel); |
| 46 |
| 47 pixelArrayLength &= 0x3f; |
| 48 if (!pixelArrayLength) |
| 49 return pixelArrayLength; |
| 50 } |
| 51 |
| 52 return pixelArrayLength; |
| 53 } |
| 54 |
| 55 } // namespace blink |
| 56 |
| 57 #endif |
| 58 |
| 59 #endif // FilterEffectNEON_h |
OLD | NEW |