| 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 "SkUtils.h" | 10 #include "SkUtils.h" |
| (...skipping 367 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 | 378 // 16 bits because the results are 16 bits. This basically allows us to process |
| 379 // twice as many pixel components per iteration. | 379 // twice as many pixel components per iteration. |
| 380 // | 380 // |
| 381 // As a result, this method behaves faster than the traditional SSE2. The actual | 381 // As a result, this method behaves faster than the traditional SSE2. The actual |
| 382 // boost varies greatly on the underlying architecture. | 382 // boost varies greatly on the underlying architecture. |
| 383 template<bool has_alpha> | 383 template<bool has_alpha> |
| 384 void S32_generic_D32_filter_DX_SSSE3(const SkBitmapProcState& s, | 384 void S32_generic_D32_filter_DX_SSSE3(const SkBitmapProcState& s, |
| 385 const uint32_t* xy, | 385 const uint32_t* xy, |
| 386 int count, uint32_t* colors) { | 386 int count, uint32_t* colors) { |
| 387 SkASSERT(count > 0 && colors != NULL); | 387 SkASSERT(count > 0 && colors != NULL); |
| 388 SkASSERT(s.fDoFilter); | 388 SkASSERT(s.fFilterQuality != SkBitmapProcState::kNone_BitmapFilter); |
| 389 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); | 389 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); |
| 390 if (has_alpha) { | 390 if (has_alpha) { |
| 391 SkASSERT(s.fAlphaScale < 256); | 391 SkASSERT(s.fAlphaScale < 256); |
| 392 } else { | 392 } else { |
| 393 SkASSERT(s.fAlphaScale == 256); | 393 SkASSERT(s.fAlphaScale == 256); |
| 394 } | 394 } |
| 395 | 395 |
| 396 const uint8_t* src_addr = | 396 const uint8_t* src_addr = |
| 397 static_cast<const uint8_t*>(s.fBitmap->getPixels()); | 397 static_cast<const uint8_t*>(s.fBitmap->getPixels()); |
| 398 const size_t rb = s.fBitmap->rowBytes(); | 398 const size_t rb = s.fBitmap->rowBytes(); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 | 569 |
| 570 /* | 570 /* |
| 571 * Similar to S32_generic_D32_filter_DX_SSSE3, we do not need to handle the | 571 * 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. | 572 * special case suby == 0 as suby is changing in every loop. |
| 573 */ | 573 */ |
| 574 template<bool has_alpha> | 574 template<bool has_alpha> |
| 575 void S32_generic_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, | 575 void S32_generic_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, |
| 576 const uint32_t* xy, | 576 const uint32_t* xy, |
| 577 int count, uint32_t* colors) { | 577 int count, uint32_t* colors) { |
| 578 SkASSERT(count > 0 && colors != NULL); | 578 SkASSERT(count > 0 && colors != NULL); |
| 579 SkASSERT(s.fDoFilter); | 579 SkASSERT(s.fFilterQuality != SkBitmapProcState::kNone_BitmapFilter); |
| 580 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); | 580 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); |
| 581 if (has_alpha) { | 581 if (has_alpha) { |
| 582 SkASSERT(s.fAlphaScale < 256); | 582 SkASSERT(s.fAlphaScale < 256); |
| 583 } else { | 583 } else { |
| 584 SkASSERT(s.fAlphaScale == 256); | 584 SkASSERT(s.fAlphaScale == 256); |
| 585 } | 585 } |
| 586 | 586 |
| 587 const uint8_t* src_addr = | 587 const uint8_t* src_addr = |
| 588 static_cast<const uint8_t*>(s.fBitmap->getPixels()); | 588 static_cast<const uint8_t*>(s.fBitmap->getPixels()); |
| 589 const size_t rb = s.fBitmap->rowBytes(); | 589 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, | 714 const uint32_t* xy, |
| 715 int count, uint32_t* colors) { | 715 int count, uint32_t* colors) { |
| 716 S32_generic_D32_filter_DXDY_SSSE3<false>(s, xy, count, colors); | 716 S32_generic_D32_filter_DXDY_SSSE3<false>(s, xy, count, colors); |
| 717 } | 717 } |
| 718 | 718 |
| 719 void S32_alpha_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, | 719 void S32_alpha_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, |
| 720 const uint32_t* xy, | 720 const uint32_t* xy, |
| 721 int count, uint32_t* colors) { | 721 int count, uint32_t* colors) { |
| 722 S32_generic_D32_filter_DXDY_SSSE3<true>(s, xy, count, colors); | 722 S32_generic_D32_filter_DXDY_SSSE3<true>(s, xy, count, colors); |
| 723 } | 723 } |
| OLD | NEW |