no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / gfx / 2d / FilterProcessingSSE2.cpp
blob0b9e0aa3d1f57b775437ab74e4d0b7617b942ac7
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #define SIMD_COMPILE_SSE2
9 #include "FilterProcessingSIMD-inl.h"
11 #ifndef USE_SSE2
12 static_assert(
13 false, "If this file is built, FilterProcessing.h should know about it!");
14 #endif
16 namespace mozilla::gfx {
18 void FilterProcessing::ExtractAlpha_SSE2(const IntSize& size,
19 uint8_t* sourceData,
20 int32_t sourceStride,
21 uint8_t* alphaData,
22 int32_t alphaStride) {
23 ExtractAlpha_SIMD<__m128i>(size, sourceData, sourceStride, alphaData,
24 alphaStride);
27 already_AddRefed<DataSourceSurface> FilterProcessing::ConvertToB8G8R8A8_SSE2(
28 SourceSurface* aSurface) {
29 return ConvertToB8G8R8A8_SIMD<__m128i>(aSurface);
32 already_AddRefed<DataSourceSurface> FilterProcessing::ApplyBlending_SSE2(
33 DataSourceSurface* aInput1, DataSourceSurface* aInput2,
34 BlendMode aBlendMode) {
35 return ApplyBlending_SIMD<__m128i, __m128i, __m128i>(aInput1, aInput2,
36 aBlendMode);
39 void FilterProcessing::ApplyMorphologyHorizontal_SSE2(
40 uint8_t* aSourceData, int32_t aSourceStride, uint8_t* aDestData,
41 int32_t aDestStride, const IntRect& aDestRect, int32_t aRadius,
42 MorphologyOperator aOp) {
43 ApplyMorphologyHorizontal_SIMD<__m128i, __m128i>(aSourceData, aSourceStride,
44 aDestData, aDestStride,
45 aDestRect, aRadius, aOp);
48 void FilterProcessing::ApplyMorphologyVertical_SSE2(
49 uint8_t* aSourceData, int32_t aSourceStride, uint8_t* aDestData,
50 int32_t aDestStride, const IntRect& aDestRect, int32_t aRadius,
51 MorphologyOperator aOp) {
52 ApplyMorphologyVertical_SIMD<__m128i, __m128i>(aSourceData, aSourceStride,
53 aDestData, aDestStride,
54 aDestRect, aRadius, aOp);
57 already_AddRefed<DataSourceSurface> FilterProcessing::ApplyColorMatrix_SSE2(
58 DataSourceSurface* aInput, const Matrix5x4& aMatrix) {
59 return ApplyColorMatrix_SIMD<__m128i, __m128i, __m128i>(aInput, aMatrix);
62 void FilterProcessing::ApplyComposition_SSE2(DataSourceSurface* aSource,
63 DataSourceSurface* aDest,
64 CompositeOperator aOperator) {
65 return ApplyComposition_SIMD<__m128i, __m128i, __m128i>(aSource, aDest,
66 aOperator);
69 void FilterProcessing::SeparateColorChannels_SSE2(
70 const IntSize& size, uint8_t* sourceData, int32_t sourceStride,
71 uint8_t* channel0Data, uint8_t* channel1Data, uint8_t* channel2Data,
72 uint8_t* channel3Data, int32_t channelStride) {
73 SeparateColorChannels_SIMD<__m128i>(size, sourceData, sourceStride,
74 channel0Data, channel1Data, channel2Data,
75 channel3Data, channelStride);
78 void FilterProcessing::CombineColorChannels_SSE2(
79 const IntSize& size, int32_t resultStride, uint8_t* resultData,
80 int32_t channelStride, uint8_t* channel0Data, uint8_t* channel1Data,
81 uint8_t* channel2Data, uint8_t* channel3Data) {
82 CombineColorChannels_SIMD<__m128i>(size, resultStride, resultData,
83 channelStride, channel0Data, channel1Data,
84 channel2Data, channel3Data);
87 void FilterProcessing::DoPremultiplicationCalculation_SSE2(
88 const IntSize& aSize, uint8_t* aTargetData, int32_t aTargetStride,
89 uint8_t* aSourceData, int32_t aSourceStride) {
90 DoPremultiplicationCalculation_SIMD<__m128i, __m128i, __m128i>(
91 aSize, aTargetData, aTargetStride, aSourceData, aSourceStride);
94 void FilterProcessing::DoUnpremultiplicationCalculation_SSE2(
95 const IntSize& aSize, uint8_t* aTargetData, int32_t aTargetStride,
96 uint8_t* aSourceData, int32_t aSourceStride) {
97 DoUnpremultiplicationCalculation_SIMD<__m128i, __m128i>(
98 aSize, aTargetData, aTargetStride, aSourceData, aSourceStride);
101 void FilterProcessing::DoOpacityCalculation_SSE2(
102 const IntSize& aSize, uint8_t* aTargetData, int32_t aTargetStride,
103 uint8_t* aSourceData, int32_t aSourceStride, Float aValue) {
104 DoOpacityCalculation_SIMD<__m128i, __m128i>(
105 aSize, aTargetData, aTargetStride, aSourceData, aSourceStride, aValue);
108 already_AddRefed<DataSourceSurface> FilterProcessing::RenderTurbulence_SSE2(
109 const IntSize& aSize, const Point& aOffset, const Size& aBaseFrequency,
110 int32_t aSeed, int aNumOctaves, TurbulenceType aType, bool aStitch,
111 const Rect& aTileRect) {
112 return RenderTurbulence_SIMD<__m128, __m128i, __m128i>(
113 aSize, aOffset, aBaseFrequency, aSeed, aNumOctaves, aType, aStitch,
114 aTileRect);
117 already_AddRefed<DataSourceSurface>
118 FilterProcessing::ApplyArithmeticCombine_SSE2(DataSourceSurface* aInput1,
119 DataSourceSurface* aInput2,
120 Float aK1, Float aK2, Float aK3,
121 Float aK4) {
122 return ApplyArithmeticCombine_SIMD<__m128i, __m128i, __m128i>(
123 aInput1, aInput2, aK1, aK2, aK3, aK4);
126 } // namespace mozilla::gfx