OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 University of Szeged | 2 * Copyright (C) 2012 University of Szeged |
3 * Copyright (C) 2012 Gabor Rapcsanyi | 3 * Copyright (C) 2012 Gabor Rapcsanyi |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 unsigned char alphaA2 = srcPixelArrayA[colorOffset + 7]; | 123 unsigned char alphaA2 = srcPixelArrayA[colorOffset + 7]; |
124 unsigned char alphaB2 = srcPixelArrayB[colorOffset + 7]; | 124 unsigned char alphaB2 = srcPixelArrayB[colorOffset + 7]; |
125 | 125 |
126 uint16x8_t doubblePixelA = vmovl_u8(vld1_u8(sourcePixelA + colorOffset))
; | 126 uint16x8_t doubblePixelA = vmovl_u8(vld1_u8(sourcePixelA + colorOffset))
; |
127 uint16x8_t doubblePixelB = vmovl_u8(vld1_u8(sourcePixelB + colorOffset))
; | 127 uint16x8_t doubblePixelB = vmovl_u8(vld1_u8(sourcePixelB + colorOffset))
; |
128 uint16x8_t alphaA = vcombine_u16(vdup_n_u16(alphaA1), vdup_n_u16(alphaA2
)); | 128 uint16x8_t alphaA = vcombine_u16(vdup_n_u16(alphaA1), vdup_n_u16(alphaA2
)); |
129 uint16x8_t alphaB = vcombine_u16(vdup_n_u16(alphaB1), vdup_n_u16(alphaB2
)); | 129 uint16x8_t alphaB = vcombine_u16(vdup_n_u16(alphaB1), vdup_n_u16(alphaB2
)); |
130 | 130 |
131 uint16x8_t result; | 131 uint16x8_t result; |
132 switch (m_mode) { | 132 switch (m_mode) { |
133 case FEBLEND_MODE_NORMAL: | 133 case WebBlendModeNormal: |
134 result = FEBlendUtilitiesNEON::normal(doubblePixelA, doubblePixelB,
alphaA, alphaB, sixteenConst255, sixteenConstOne); | 134 result = FEBlendUtilitiesNEON::normal(doubblePixelA, doubblePixelB,
alphaA, alphaB, sixteenConst255, sixteenConstOne); |
135 break; | 135 break; |
136 case FEBLEND_MODE_MULTIPLY: | 136 case WebBlendModeMultiply: |
137 result = FEBlendUtilitiesNEON::multiply(doubblePixelA, doubblePixelB
, alphaA, alphaB, sixteenConst255, sixteenConstOne); | 137 result = FEBlendUtilitiesNEON::multiply(doubblePixelA, doubblePixelB
, alphaA, alphaB, sixteenConst255, sixteenConstOne); |
138 break; | 138 break; |
139 case FEBLEND_MODE_SCREEN: | 139 case WebBlendModeScreen: |
140 result = FEBlendUtilitiesNEON::screen(doubblePixelA, doubblePixelB,
alphaA, alphaB, sixteenConst255, sixteenConstOne); | 140 result = FEBlendUtilitiesNEON::screen(doubblePixelA, doubblePixelB,
alphaA, alphaB, sixteenConst255, sixteenConstOne); |
141 break; | 141 break; |
142 case FEBLEND_MODE_DARKEN: | 142 case WebBlendModeDarken: |
143 result = FEBlendUtilitiesNEON::darken(doubblePixelA, doubblePixelB,
alphaA, alphaB, sixteenConst255, sixteenConstOne); | 143 result = FEBlendUtilitiesNEON::darken(doubblePixelA, doubblePixelB,
alphaA, alphaB, sixteenConst255, sixteenConstOne); |
144 break; | 144 break; |
145 case FEBLEND_MODE_LIGHTEN: | 145 case WebBlendModeLighten: |
146 result = FEBlendUtilitiesNEON::lighten(doubblePixelA, doubblePixelB,
alphaA, alphaB, sixteenConst255, sixteenConstOne); | 146 result = FEBlendUtilitiesNEON::lighten(doubblePixelA, doubblePixelB,
alphaA, alphaB, sixteenConst255, sixteenConstOne); |
147 break; | 147 break; |
148 case FEBLEND_MODE_UNKNOWN: | |
149 default: | 148 default: |
150 result = vdupq_n_u16(0); | 149 result = vdupq_n_u16(0); |
151 break; | 150 break; |
152 } | 151 } |
153 | 152 |
154 vst1_u8(destinationPixel + colorOffset, vmovn_u16(result)); | 153 vst1_u8(destinationPixel + colorOffset, vmovn_u16(result)); |
155 | 154 |
156 unsigned char alphaR1 = 255 - ((255 - alphaA1) * (255 - alphaB1)) / 255; | 155 unsigned char alphaR1 = 255 - ((255 - alphaA1) * (255 - alphaB1)) / 255; |
157 unsigned char alphaR2 = 255 - ((255 - alphaA2) * (255 - alphaB2)) / 255; | 156 unsigned char alphaR2 = 255 - ((255 - alphaA2) * (255 - alphaB2)) / 255; |
158 | 157 |
159 dstPixelArray[colorOffset + 3] = alphaR1; | 158 dstPixelArray[colorOffset + 3] = alphaR1; |
160 dstPixelArray[colorOffset + 7] = alphaR2; | 159 dstPixelArray[colorOffset + 7] = alphaR2; |
161 | 160 |
162 colorOffset += 8; | 161 colorOffset += 8; |
163 if (colorOffset > colorArrayLength) { | 162 if (colorOffset > colorArrayLength) { |
164 ASSERT(colorOffset - 4 == colorArrayLength); | 163 ASSERT(colorOffset - 4 == colorArrayLength); |
165 colorOffset = colorArrayLength - 8; | 164 colorOffset = colorArrayLength - 8; |
166 } | 165 } |
167 } | 166 } |
168 } | 167 } |
169 | 168 |
170 } // namespace blink | 169 } // namespace blink |
171 | 170 |
172 #endif // HAVE(ARM_NEON_INTRINSICS) | 171 #endif // HAVE(ARM_NEON_INTRINSICS) |
173 | 172 |
174 #endif // FEBlendNEON_h | 173 #endif // FEBlendNEON_h |
OLD | NEW |