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

Side by Side Diff: src/opts/SkBlitRow_opts_SSE2.cpp

Issue 609823003: Improve SkARGB32_A8_BlitMask_SSE2 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Improve SkARGB32_A8_BlitMask_SSE2 Created 6 years, 2 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 | « AUTHORS ('k') | no next file » | 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 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 <emmintrin.h> 8 #include <emmintrin.h>
9 #include "SkBitmapProcState_opts_SSE2.h" 9 #include "SkBitmapProcState_opts_SSE2.h"
10 #include "SkBlitRow_opts_SSE2.h" 10 #include "SkBlitRow_opts_SSE2.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 __m128i *d = reinterpret_cast<__m128i*>(dst); 434 __m128i *d = reinterpret_cast<__m128i*>(dst);
435 __m128i rb_mask = _mm_set1_epi32(0x00FF00FF); 435 __m128i rb_mask = _mm_set1_epi32(0x00FF00FF);
436 __m128i c_256 = _mm_set1_epi16(256); 436 __m128i c_256 = _mm_set1_epi16(256);
437 __m128i c_1 = _mm_set1_epi16(1); 437 __m128i c_1 = _mm_set1_epi16(1);
438 __m128i src_pixel = _mm_set1_epi32(color); 438 __m128i src_pixel = _mm_set1_epi32(color);
439 while (count >= 4) { 439 while (count >= 4) {
440 // Load 4 pixels each of src and dest. 440 // Load 4 pixels each of src and dest.
441 __m128i dst_pixel = _mm_load_si128(d); 441 __m128i dst_pixel = _mm_load_si128(d);
442 442
443 //set the aphla value 443 //set the aphla value
444 __m128i src_scale_wide = _mm_set_epi8(0, *(mask+3),\ 444 __m128i src_scale_wide = _mm_cvtsi32_si128(*reinterpret_cast<con st uint32_t*>(mask));
445 0, *(mask+3),0, \ 445 src_scale_wide = _mm_unpacklo_epi8(src_scale_wide,
446 *(mask+2),0, *(mask+2),\ 446 _mm_setzero_si128());
447 0,*(mask+1), 0,*(mask+1),\ 447 src_scale_wide = _mm_unpacklo_epi16(src_scale_wide, src_scale_wi de);
448 0, *mask,0,*mask);
449 448
450 //call SkAlpha255To256() 449 //call SkAlpha255To256()
451 src_scale_wide = _mm_add_epi16(src_scale_wide, c_1); 450 src_scale_wide = _mm_add_epi16(src_scale_wide, c_1);
452 451
453 // Get red and blue pixels into lower byte of each word. 452 // Get red and blue pixels into lower byte of each word.
454 __m128i dst_rb = _mm_and_si128(rb_mask, dst_pixel); 453 __m128i dst_rb = _mm_and_si128(rb_mask, dst_pixel);
455 __m128i src_rb = _mm_and_si128(rb_mask, src_pixel); 454 __m128i src_rb = _mm_and_si128(rb_mask, src_pixel);
456 455
457 // Get alpha and green into lower byte of each word. 456 // Get alpha and green into lower byte of each word.
458 __m128i dst_ag = _mm_srli_epi16(dst_pixel, 8); 457 __m128i dst_ag = _mm_srli_epi16(dst_pixel, 8);
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 uint32_t dst_expanded = SkExpand_rgb_16(*dst); 1351 uint32_t dst_expanded = SkExpand_rgb_16(*dst);
1353 dst_expanded = dst_expanded * (SkAlpha255To256(255 - a) >> 3); 1352 dst_expanded = dst_expanded * (SkAlpha255To256(255 - a) >> 3);
1354 // now src and dst expanded are in g:11 r:10 x:1 b:10 1353 // now src and dst expanded are in g:11 r:10 x:1 b:10
1355 *dst = SkCompact_rgb_16((src_expanded + dst_expanded) >> 5); 1354 *dst = SkCompact_rgb_16((src_expanded + dst_expanded) >> 5);
1356 } 1355 }
1357 dst += 1; 1356 dst += 1;
1358 DITHER_INC_X(x); 1357 DITHER_INC_X(x);
1359 } while (--count != 0); 1358 } while (--count != 0);
1360 } 1359 }
1361 } 1360 }
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698