diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/platform/graphics/cpu/arm | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/platform/graphics/cpu/arm')
6 files changed, 54 insertions, 25 deletions
diff --git a/Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNEON.h b/Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNEON.h index e41ffa216..50ec87961 100644 --- a/Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNEON.h +++ b/Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNEON.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2012 University of Szeged * Copyright (C) 2012 Gabor Rapcsanyi + * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,7 +28,7 @@ #ifndef FEBlendNEON_h #define FEBlendNEON_h -#if ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) +#if HAVE(ARM_NEON_INTRINSICS) #include "FEBlend.h" #include <arm_neon.h> @@ -105,6 +106,39 @@ public: } }; +void FEBlend::platformApplySoftware() +{ + FilterEffect* in = inputEffect(0); + FilterEffect* in2 = inputEffect(1); + + Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult(); + if (!dstPixelArray) + return; + + IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect()); + RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectADrawingRect); + + IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePaintRect()); + RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectBDrawingRect); + + unsigned pixelArrayLength = srcPixelArrayA->length(); + ASSERT(pixelArrayLength == srcPixelArrayB->length()); + + if (pixelArrayLength >= 8) { + platformApplyNEON(srcPixelArrayA->data(), srcPixelArrayB->data(), dstPixelArray->data(), pixelArrayLength); + return; + } + // If there is just one pixel we expand it to two. + ASSERT(pixelArrayLength > 0); + uint32_t sourceA[2] = {0, 0}; + uint32_t sourceBAndDest[2] = {0, 0}; + + sourceA[0] = reinterpret_cast<uint32_t*>(srcPixelArrayA->data())[0]; + sourceBAndDest[0] = reinterpret_cast<uint32_t*>(srcPixelArrayB->data())[0]; + platformApplyNEON(reinterpret_cast<uint8_t*>(sourceA), reinterpret_cast<uint8_t*>(sourceBAndDest), reinterpret_cast<uint8_t*>(sourceBAndDest), 8); + reinterpret_cast<uint32_t*>(dstPixelArray->data())[0] = sourceBAndDest[0]; +} + void FEBlend::platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray, unsigned colorArrayLength) { @@ -129,22 +163,21 @@ void FEBlend::platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* sr uint16x8_t result; switch (m_mode) { - case FEBLEND_MODE_NORMAL: + case BlendModeNormal: result = FEBlendUtilitiesNEON::normal(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); break; - case FEBLEND_MODE_MULTIPLY: + case BlendModeMultiply: result = FEBlendUtilitiesNEON::multiply(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); break; - case FEBLEND_MODE_SCREEN: + case BlendModeScreen: result = FEBlendUtilitiesNEON::screen(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); break; - case FEBLEND_MODE_DARKEN: + case BlendModeDarken: result = FEBlendUtilitiesNEON::darken(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); break; - case FEBLEND_MODE_LIGHTEN: + case BlendModeLighten: result = FEBlendUtilitiesNEON::lighten(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); break; - case FEBLEND_MODE_UNKNOWN: default: result = vdupq_n_u16(0); break; @@ -168,6 +201,6 @@ void FEBlend::platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* sr } // namespace WebCore -#endif // ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) +#endif // HAVE(ARM_NEON_INTRINSICS) #endif // FEBlendNEON_h diff --git a/Source/WebCore/platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h b/Source/WebCore/platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h index 2354dfc80..298f9afa7 100644 --- a/Source/WebCore/platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h +++ b/Source/WebCore/platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h @@ -27,9 +27,10 @@ #ifndef FECompositeArithmeticNEON_h #define FECompositeArithmeticNEON_h -#if ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) +#if HAVE(ARM_NEON_INTRINSICS) #include "FEComposite.h" +#include "NEONHelpers.h" #include <arm_neon.h> namespace WebCore { @@ -49,13 +50,8 @@ inline void FEComposite::computeArithmeticPixelsNeon(unsigned char* source, unsi uint32_t* destinationEndPixel = destinationPixel + (pixelArrayLength >> 2); while (destinationPixel < destinationEndPixel) { - uint32x2_t temporary1 = vset_lane_u32(*sourcePixel, temporary1, 0); - uint16x4_t temporary2 = vget_low_u16(vmovl_u8(vreinterpret_u8_u32(temporary1))); - float32x4_t sourcePixelAsFloat = vcvtq_f32_u32(vmovl_u16(temporary2)); - - temporary1 = vset_lane_u32(*destinationPixel, temporary1, 0); - temporary2 = vget_low_u16(vmovl_u8(vreinterpret_u8_u32(temporary1))); - float32x4_t destinationPixelAsFloat = vcvtq_f32_u32(vmovl_u16(temporary2)); + float32x4_t sourcePixelAsFloat = loadRGBA8AsFloat(sourcePixel); + float32x4_t destinationPixelAsFloat = loadRGBA8AsFloat(destinationPixel); float32x4_t result = vmulq_f32(sourcePixelAsFloat, k2x4); result = vmlaq_f32(result, destinationPixelAsFloat, k3x4); @@ -94,6 +90,6 @@ inline void FEComposite::platformArithmeticNeon(unsigned char* source, unsigned } // namespace WebCore -#endif // ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) +#endif // HAVE(ARM_NEON_INTRINSICS) #endif // FECompositeArithmeticNEON_h diff --git a/Source/WebCore/platform/graphics/cpu/arm/filters/FEGaussianBlurNEON.h b/Source/WebCore/platform/graphics/cpu/arm/filters/FEGaussianBlurNEON.h index 3779c2ec5..600704ebb 100644 --- a/Source/WebCore/platform/graphics/cpu/arm/filters/FEGaussianBlurNEON.h +++ b/Source/WebCore/platform/graphics/cpu/arm/filters/FEGaussianBlurNEON.h @@ -27,7 +27,7 @@ #ifndef FEGaussianBlurNEON_h #define FEGaussianBlurNEON_h -#if ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) +#if HAVE(ARM_NEON_INTRINSICS) #include "FEGaussianBlur.h" #include "NEONHelpers.h" @@ -73,6 +73,6 @@ inline void boxBlurNEON(Uint8ClampedArray* srcPixelArray, Uint8ClampedArray* dst } // namespace WebCore -#endif // ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) +#endif // HAVE(ARM_NEON_INTRINSICS) #endif // FEGaussianBlurNEON_h diff --git a/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp b/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp index 789b6aa48..fe44c6275 100644 --- a/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp +++ b/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp @@ -27,7 +27,7 @@ #include "config.h" #include "FELightingNEON.h" -#if CPU(ARM_NEON) && CPU(ARM_TRADITIONAL) && COMPILER(GCC) +#if CPU(ARM_NEON) && CPU(ARM_TRADITIONAL) && COMPILER(GCC_OR_CLANG) namespace WebCore { @@ -500,4 +500,4 @@ int FELighting::getPowerCoefficients(float exponent) } // namespace WebCore -#endif // CPU(ARM_NEON) && COMPILER(GCC) +#endif // CPU(ARM_NEON) && COMPILER(GCC_OR_CLANG) diff --git a/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.h b/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.h index 1e7140164..41b61e14a 100644 --- a/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.h +++ b/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.h @@ -27,7 +27,7 @@ #ifndef FELightingNEON_h #define FELightingNEON_h -#if CPU(ARM_NEON) && CPU(ARM_TRADITIONAL) && COMPILER(GCC) +#if CPU(ARM_NEON) && CPU(ARM_TRADITIONAL) && COMPILER(GCC_OR_CLANG) #include "FELighting.h" #include <wtf/ParallelJobs.h> @@ -194,6 +194,6 @@ inline void FELighting::platformApplyNeon(LightingData& data, LightSource::Paint } // namespace WebCore -#endif // CPU(ARM_NEON) && COMPILER(GCC) +#endif // CPU(ARM_NEON) && COMPILER(GCC_OR_CLANG) #endif // FELightingNEON_h diff --git a/Source/WebCore/platform/graphics/cpu/arm/filters/NEONHelpers.h b/Source/WebCore/platform/graphics/cpu/arm/filters/NEONHelpers.h index 3708b9d0a..3a13e4a4b 100644 --- a/Source/WebCore/platform/graphics/cpu/arm/filters/NEONHelpers.h +++ b/Source/WebCore/platform/graphics/cpu/arm/filters/NEONHelpers.h @@ -27,7 +27,7 @@ #ifndef NEONHelpers_h #define NEONHelpers_h -#if ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) +#if HAVE(ARM_NEON_INTRINSICS) #include <arm_neon.h> @@ -50,6 +50,6 @@ inline void storeFloatAsRGBA8(float32x4_t data, uint32_t* destination) } // namespace WebCore -#endif // ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) +#endif // HAVE(ARM_NEON_INTRINSICS) #endif // NEONHelpers_h |