Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: src/opts/SkPMFloat_SSE2.h

Issue 1154523004: Everyone gets a namespace {}. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/opts/SkNx_sse.h ('k') | src/opts/SkPMFloat_SSSE3.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 namespace { // See SkPMFloat.h
9
8 // For SkPMFloat(SkPMColor), we widen our 8 bit components (fix8) to 8-bit compo nents in 16 bits 10 // For SkPMFloat(SkPMColor), we widen our 8 bit components (fix8) to 8-bit compo nents in 16 bits
9 // (fix8_16), then widen those to 8-bit-in-32-bits (fix8_32), and finally conver t those to floats. 11 // (fix8_16), then widen those to 8-bit-in-32-bits (fix8_32), and finally conver t those to floats.
10 12
11 // round() and roundClamp() do the opposite, working from floats to 8-bit-in-32- bit, 13 // round() and roundClamp() do the opposite, working from floats to 8-bit-in-32- bit,
12 // to 8-bit-in-16-bit, back down to 8-bit components. 14 // to 8-bit-in-16-bit, back down to 8-bit components.
13 // _mm_packus_epi16() gives us clamping for free while narrowing. 15 // _mm_packus_epi16() gives us clamping for free while narrowing.
14 16
15 inline SkPMFloat::SkPMFloat(SkPMColor c) { 17 inline SkPMFloat::SkPMFloat(SkPMColor c) {
16 SkPMColorAssert(c); 18 SkPMColorAssert(c);
17 __m128i fix8 = _mm_set_epi32(0,0,0,c), 19 __m128i fix8 = _mm_set_epi32(0,0,0,c),
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 c2 = _mm_cvttps_epi32(_mm_add_ps(_mm_set1_ps(0.5f), c.fVec)), 73 c2 = _mm_cvttps_epi32(_mm_add_ps(_mm_set1_ps(0.5f), c.fVec)),
72 c3 = _mm_cvttps_epi32(_mm_add_ps(_mm_set1_ps(0.5f), d.fVec)); 74 c3 = _mm_cvttps_epi32(_mm_add_ps(_mm_set1_ps(0.5f), d.fVec));
73 __m128i c3210 = _mm_packus_epi16(_mm_packus_epi16(c0, c1), 75 __m128i c3210 = _mm_packus_epi16(_mm_packus_epi16(c0, c1),
74 _mm_packus_epi16(c2, c3)); 76 _mm_packus_epi16(c2, c3));
75 _mm_storeu_si128((__m128i*)colors, c3210); 77 _mm_storeu_si128((__m128i*)colors, c3210);
76 SkPMColorAssert(colors[0]); 78 SkPMColorAssert(colors[0]);
77 SkPMColorAssert(colors[1]); 79 SkPMColorAssert(colors[1]);
78 SkPMColorAssert(colors[2]); 80 SkPMColorAssert(colors[2]);
79 SkPMColorAssert(colors[3]); 81 SkPMColorAssert(colors[3]);
80 } 82 }
83
84 } // namespace
OLDNEW
« no previous file with comments | « src/opts/SkNx_sse.h ('k') | src/opts/SkPMFloat_SSSE3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698