OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
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 #include <tmmintrin.h> // SSSE3 | 8 #include <tmmintrin.h> // SSSE3 |
9 #include "SkBitmapProcState_opts_SSSE3.h" | 9 #include "SkBitmapProcState_opts_SSSE3.h" |
| 10 #include "SkPaint.h" |
10 #include "SkUtils.h" | 11 #include "SkUtils.h" |
11 | 12 |
12 // adding anonymous namespace seemed to force gcc to inline directly the | 13 // adding anonymous namespace seemed to force gcc to inline directly the |
13 // instantiation, instead of creating the functions | 14 // instantiation, instead of creating the functions |
14 // S32_generic_D32_filter_DX_SSSE3<true> and | 15 // S32_generic_D32_filter_DX_SSSE3<true> and |
15 // S32_generic_D32_filter_DX_SSSE3<false> which were then called by the | 16 // S32_generic_D32_filter_DX_SSSE3<false> which were then called by the |
16 // external functions. | 17 // external functions. |
17 namespace { | 18 namespace { |
18 // In this file, variations for alpha and non alpha versions are implemented | 19 // In this file, variations for alpha and non alpha versions are implemented |
19 // with a template, as it makes the code more compact and a bit easier to | 20 // with a template, as it makes the code more compact and a bit easier to |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // 16 bits because the results are 16 bits. This basically allows us to process | 379 // 16 bits because the results are 16 bits. This basically allows us to process |
379 // twice as many pixel components per iteration. | 380 // twice as many pixel components per iteration. |
380 // | 381 // |
381 // As a result, this method behaves faster than the traditional SSE2. The actual | 382 // As a result, this method behaves faster than the traditional SSE2. The actual |
382 // boost varies greatly on the underlying architecture. | 383 // boost varies greatly on the underlying architecture. |
383 template<bool has_alpha> | 384 template<bool has_alpha> |
384 void S32_generic_D32_filter_DX_SSSE3(const SkBitmapProcState& s, | 385 void S32_generic_D32_filter_DX_SSSE3(const SkBitmapProcState& s, |
385 const uint32_t* xy, | 386 const uint32_t* xy, |
386 int count, uint32_t* colors) { | 387 int count, uint32_t* colors) { |
387 SkASSERT(count > 0 && colors != NULL); | 388 SkASSERT(count > 0 && colors != NULL); |
388 SkASSERT(s.fFilterQuality != SkBitmapProcState::kNone_BitmapFilter); | 389 SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); |
389 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); | 390 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); |
390 if (has_alpha) { | 391 if (has_alpha) { |
391 SkASSERT(s.fAlphaScale < 256); | 392 SkASSERT(s.fAlphaScale < 256); |
392 } else { | 393 } else { |
393 SkASSERT(s.fAlphaScale == 256); | 394 SkASSERT(s.fAlphaScale == 256); |
394 } | 395 } |
395 | 396 |
396 const uint8_t* src_addr = | 397 const uint8_t* src_addr = |
397 static_cast<const uint8_t*>(s.fBitmap->getPixels()); | 398 static_cast<const uint8_t*>(s.fBitmap->getPixels()); |
398 const size_t rb = s.fBitmap->rowBytes(); | 399 const size_t rb = s.fBitmap->rowBytes(); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 | 570 |
570 /* | 571 /* |
571 * Similar to S32_generic_D32_filter_DX_SSSE3, we do not need to handle the | 572 * Similar to S32_generic_D32_filter_DX_SSSE3, we do not need to handle the |
572 * special case suby == 0 as suby is changing in every loop. | 573 * special case suby == 0 as suby is changing in every loop. |
573 */ | 574 */ |
574 template<bool has_alpha> | 575 template<bool has_alpha> |
575 void S32_generic_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, | 576 void S32_generic_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, |
576 const uint32_t* xy, | 577 const uint32_t* xy, |
577 int count, uint32_t* colors) { | 578 int count, uint32_t* colors) { |
578 SkASSERT(count > 0 && colors != NULL); | 579 SkASSERT(count > 0 && colors != NULL); |
579 SkASSERT(s.fFilterQuality != SkBitmapProcState::kNone_BitmapFilter); | 580 SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); |
580 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); | 581 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); |
581 if (has_alpha) { | 582 if (has_alpha) { |
582 SkASSERT(s.fAlphaScale < 256); | 583 SkASSERT(s.fAlphaScale < 256); |
583 } else { | 584 } else { |
584 SkASSERT(s.fAlphaScale == 256); | 585 SkASSERT(s.fAlphaScale == 256); |
585 } | 586 } |
586 | 587 |
587 const uint8_t* src_addr = | 588 const uint8_t* src_addr = |
588 static_cast<const uint8_t*>(s.fBitmap->getPixels()); | 589 static_cast<const uint8_t*>(s.fBitmap->getPixels()); |
589 const size_t rb = s.fBitmap->rowBytes(); | 590 const size_t rb = s.fBitmap->rowBytes(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 const uint32_t* xy, | 715 const uint32_t* xy, |
715 int count, uint32_t* colors) { | 716 int count, uint32_t* colors) { |
716 S32_generic_D32_filter_DXDY_SSSE3<false>(s, xy, count, colors); | 717 S32_generic_D32_filter_DXDY_SSSE3<false>(s, xy, count, colors); |
717 } | 718 } |
718 | 719 |
719 void S32_alpha_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, | 720 void S32_alpha_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, |
720 const uint32_t* xy, | 721 const uint32_t* xy, |
721 int count, uint32_t* colors) { | 722 int count, uint32_t* colors) { |
722 S32_generic_D32_filter_DXDY_SSSE3<true>(s, xy, count, colors); | 723 S32_generic_D32_filter_DXDY_SSSE3<true>(s, xy, count, colors); |
723 } | 724 } |
OLD | NEW |