Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 | |
| 2 /* | |
| 3 * Copyright 2014 The Android Open Source Project | |
| 4 * | |
| 5 * Use of this source code is governed by a BSD-style license that can be | |
| 6 * found in the LICENSE file. | |
| 7 */ | |
| 8 | |
| 9 | |
|
mtklein
2014/02/07 15:15:46
Can you add include guards?
#ifndef SkColor_opts_
| |
| 10 #include <emmintrin.h> | |
| 11 | |
| 12 static inline __m128i SkMul16ShiftRound_SSE(__m128i a, __m128i b, int shift) { | |
| 13 __m128i prod = _mm_mullo_epi16(a, b); | |
| 14 prod = _mm_add_epi16(prod, _mm_set1_epi16(1 << (shift - 1))); | |
| 15 prod = _mm_add_epi16(prod, _mm_srli_epi16(prod, shift)); | |
| 16 prod = _mm_srli_epi16(prod, shift); | |
| 17 | |
| 18 return prod; | |
| 19 } | |
| 20 | |
| 21 static inline __m128i SkPackRGB16_SSE(__m128i r, __m128i g, __m128i b) { | |
| 22 r = _mm_slli_epi16(r, SK_R16_SHIFT); | |
| 23 g = _mm_slli_epi16(g, SK_G16_SHIFT); | |
| 24 b = _mm_slli_epi16(b, SK_B16_SHIFT); | |
| 25 | |
| 26 __m128i c = _mm_or_si128(r, g); | |
| 27 return _mm_or_si128(c, b); | |
| 28 } | |
| OLD | NEW |