diff options
author | 2013-07-10 07:00:58 +0000 | |
---|---|---|
committer | 2013-07-10 07:00:58 +0000 | |
commit | 9e1ec1a52985cce9db3a0d0e8d448b82a32e70cb (patch) | |
tree | 16d6e8cde90b0e4086bd61d9b79111a3740ec77e /src/opts | |
parent | ead3b83645722f9102b97f54c54a4a691d67ed72 (diff) |
Sanitizing source files in Housekeeper-Nightly
git-svn-id: http://skia.googlecode.com/svn/trunk@9948 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/opts')
-rw-r--r-- | src/opts/SkBitmapFilter_opts_SSE2.cpp | 72 | ||||
-rw-r--r-- | src/opts/SkBitmapFilter_opts_SSE2.h | 2 |
2 files changed, 37 insertions, 37 deletions
diff --git a/src/opts/SkBitmapFilter_opts_SSE2.cpp b/src/opts/SkBitmapFilter_opts_SSE2.cpp index fe0a242f23..685ec77f49 100644 --- a/src/opts/SkBitmapFilter_opts_SSE2.cpp +++ b/src/opts/SkBitmapFilter_opts_SSE2.cpp @@ -29,7 +29,7 @@ static inline void print128i_16(__m128i value) { static inline void print128i_8(__m128i value) { unsigned char *v = (unsigned char*) &value; - printf("%.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u\n", + printf("%.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u %.3u\n", v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15] ); @@ -49,10 +49,10 @@ int debug_y = 255; void highQualityFilter_SSE2(const SkBitmapProcState& s, int x, int y, SkPMColor* SK_RESTRICT colors, int count) { - + const int maxX = s.fBitmap->width() - 1; const int maxY = s.fBitmap->height() - 1; - + while (count-- > 0) { SkPoint srcPt; s.fInvProc(*s.fInvMatrix, SkIntToScalar(x), @@ -62,33 +62,33 @@ void highQualityFilter_SSE2(const SkBitmapProcState& s, int x, int y, int sx = SkScalarFloorToInt(srcPt.fX); int sy = SkScalarFloorToInt(srcPt.fY); - + __m128 weight = _mm_setzero_ps(); __m128 accum = _mm_setzero_ps(); - + int y0 = SkTMax(0, int(ceil(sy-s.getBitmapFilter()->width() + 0.5f))); int y1 = SkTMin(maxY, int(floor(sy+s.getBitmapFilter()->width() + 0.5f))); int x0 = SkTMax(0, int(ceil(sx-s.getBitmapFilter()->width() + 0.5f))); int x1 = SkTMin(maxX, int(floor(sx+s.getBitmapFilter()->width() + 0.5f))); - + for (int src_y = y0; src_y <= y1; src_y++) { float yweight = s.getBitmapFilter()->lookupFloat( (srcPt.fY - src_y) ); - + for (int src_x = x0; src_x <= x1 ; src_x++) { float xweight = s.getBitmapFilter()->lookupFloat( (srcPt.fX - src_x) ); - + float combined_weight = xweight * yweight; SkPMColor color = *s.fBitmap->getAddr32(src_x, src_y); - + __m128i c = _mm_cvtsi32_si128( color ); c = _mm_unpacklo_epi8(c, _mm_setzero_si128()); c = _mm_unpacklo_epi16(c, _mm_setzero_si128()); - + __m128 cfloat = _mm_cvtepi32_ps( c ); - + __m128 weightVector = _mm_set1_ps(combined_weight); - + accum = _mm_add_ps(accum, _mm_mul_ps(cfloat, weightVector)); weight = _mm_add_ps( weight, weightVector ); } @@ -96,16 +96,16 @@ void highQualityFilter_SSE2(const SkBitmapProcState& s, int x, int y, accum = _mm_div_ps(accum, weight); accum = _mm_add_ps(accum, _mm_set1_ps(0.5f)); - + __m128i accumInt = _mm_cvtps_epi32( accum ); - + int localResult[4]; _mm_storeu_si128((__m128i *) (localResult), accumInt); int a = SkClampMax(localResult[0], 255); int r = SkClampMax(localResult[1], a); int g = SkClampMax(localResult[2], a); int b = SkClampMax(localResult[3], a); - + *colors++ = SkPackARGB32(a, r, g, b); x++; @@ -116,67 +116,67 @@ void highQualityFilter_ScaleOnly_SSE2(const SkBitmapProcState &s, int x, int y, SkPMColor *SK_RESTRICT colors, int count) { const int maxX = s.fBitmap->width() - 1; const int maxY = s.fBitmap->height() - 1; - + SkPoint srcPt; s.fInvProc(*s.fInvMatrix, SkIntToScalar(x), SkIntToScalar(y), &srcPt); srcPt.fY -= SK_ScalarHalf; int sy = SkScalarFloorToInt(srcPt.fY); - + int y0 = SkTMax(0, int(ceil(sy-s.getBitmapFilter()->width() + 0.5f))); int y1 = SkTMin(maxY, int(floor(sy+s.getBitmapFilter()->width() + 0.5f))); - + while (count-- > 0) { srcPt.fX -= SK_ScalarHalf; srcPt.fY -= SK_ScalarHalf; - + int sx = SkScalarFloorToInt(srcPt.fX); - + float weight = 0; __m128 accum = _mm_setzero_ps(); - + int x0 = SkTMax(0, int(ceil(sx-s.getBitmapFilter()->width() + 0.5f))); int x1 = SkTMin(maxX, int(floor(sx+s.getBitmapFilter()->width() + 0.5f))); - + for (int src_y = y0; src_y <= y1; src_y++) { float yweight = s.getBitmapFilter()->lookupFloat( (srcPt.fY - src_y) ); - + for (int src_x = x0; src_x <= x1 ; src_x++) { float xweight = s.getBitmapFilter()->lookupFloat( (srcPt.fX - src_x) ); - + float combined_weight = xweight * yweight; - + SkPMColor color = *s.fBitmap->getAddr32(src_x, src_y); - - __m128 c = _mm_set_ps((float)SkGetPackedB32(color), + + __m128 c = _mm_set_ps((float)SkGetPackedB32(color), (float)SkGetPackedG32(color), (float)SkGetPackedR32(color), (float)SkGetPackedA32(color)); - + __m128 weightVector = _mm_set1_ps(combined_weight); - + accum = _mm_add_ps(accum, _mm_mul_ps(c, weightVector)); weight += combined_weight; } } - + __m128 totalWeightVector = _mm_set1_ps(weight); accum = _mm_div_ps(accum, totalWeightVector); accum = _mm_add_ps(accum, _mm_set1_ps(0.5f)); - + float localResult[4]; _mm_storeu_ps(localResult, accum); int a = SkClampMax(int(localResult[0]), 255); int r = SkClampMax(int(localResult[1]), a); int g = SkClampMax(int(localResult[2]), a); int b = SkClampMax(int(localResult[3]), a); - + *colors++ = SkPackARGB32(a, r, g, b); - + x++; - + s.fInvProc(*s.fInvMatrix, SkIntToScalar(x), SkIntToScalar(y), &srcPt); - - } + + } } diff --git a/src/opts/SkBitmapFilter_opts_SSE2.h b/src/opts/SkBitmapFilter_opts_SSE2.h index 974b00896c..c511acc83a 100644 --- a/src/opts/SkBitmapFilter_opts_SSE2.h +++ b/src/opts/SkBitmapFilter_opts_SSE2.h @@ -16,5 +16,5 @@ void highQualityFilter_ScaleOnly_SSE2(const SkBitmapProcState &s, int x, int y, SkPMColor *SK_RESTRICT colors, int count); void highQualityFilter_SSE2(const SkBitmapProcState &s, int x, int y, SkPMColor *SK_RESTRICT colors, int count); - + #endif |