OLD | NEW |
1 // VERSION 2 | 1 // VERSION 2 |
2 /* | 2 /* |
3 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 3 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license | 5 * Use of this source code is governed by a BSD-style license |
6 * that can be found in the LICENSE file in the root of the source | 6 * that can be found in the LICENSE file in the root of the source |
7 * tree. An additional intellectual property rights grant can be found | 7 * tree. An additional intellectual property rights grant can be found |
8 * in the file PATENTS. All contributing project authors may | 8 * in the file PATENTS. All contributing project authors may |
9 * be found in the AUTHORS file in the root of the source tree. | 9 * be found in the AUTHORS file in the root of the source tree. |
10 */ | 10 */ |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 "lea " MEMLEA(0x8,1) ",%1 \n" | 519 "lea " MEMLEA(0x8,1) ",%1 \n" |
520 "sub $0x4,%2 \n" | 520 "sub $0x4,%2 \n" |
521 "jg 1b \n" | 521 "jg 1b \n" |
522 : "+r"(src), // %0 | 522 : "+r"(src), // %0 |
523 "+r"(dst), // %1 | 523 "+r"(dst), // %1 |
524 "+r"(pix) // %2 | 524 "+r"(pix) // %2 |
525 :: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5" | 525 :: "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5" |
526 ); | 526 ); |
527 } | 527 } |
528 | 528 |
| 529 void ARGBToRGB565DitherRow_SSE2(const uint8* src, uint8* dst, |
| 530 const uint32 dither4, int pix) { |
| 531 asm volatile ( |
| 532 "movd %3,%%xmm6 \n" |
| 533 "punpcklbw %%xmm6,%%xmm6 \n" |
| 534 "movdqa %%xmm6,%%xmm7 \n" |
| 535 "punpcklwd %%xmm6,%%xmm6 \n" |
| 536 "punpckhwd %%xmm7,%%xmm7 \n" |
| 537 "pcmpeqb %%xmm3,%%xmm3 \n" |
| 538 "psrld $0x1b,%%xmm3 \n" |
| 539 "pcmpeqb %%xmm4,%%xmm4 \n" |
| 540 "psrld $0x1a,%%xmm4 \n" |
| 541 "pslld $0x5,%%xmm4 \n" |
| 542 "pcmpeqb %%xmm5,%%xmm5 \n" |
| 543 "pslld $0xb,%%xmm5 \n" |
| 544 |
| 545 LABELALIGN |
| 546 "1: \n" |
| 547 "movdqu (%0),%%xmm0 \n" |
| 548 "paddusb %%xmm6,%%xmm0 \n" |
| 549 "movdqa %%xmm0,%%xmm1 \n" |
| 550 "movdqa %%xmm0,%%xmm2 \n" |
| 551 "pslld $0x8,%%xmm0 \n" |
| 552 "psrld $0x3,%%xmm1 \n" |
| 553 "psrld $0x5,%%xmm2 \n" |
| 554 "psrad $0x10,%%xmm0 \n" |
| 555 "pand %%xmm3,%%xmm1 \n" |
| 556 "pand %%xmm4,%%xmm2 \n" |
| 557 "pand %%xmm5,%%xmm0 \n" |
| 558 "por %%xmm2,%%xmm1 \n" |
| 559 "por %%xmm1,%%xmm0 \n" |
| 560 "packssdw %%xmm0,%%xmm0 \n" |
| 561 "lea 0x10(%0),%0 \n" |
| 562 "movq %%xmm0,(%1) \n" |
| 563 "lea 0x8(%1),%1 \n" |
| 564 "sub $0x4,%2 \n" |
| 565 "jg 1b \n" |
| 566 : "+r"(src), // %0 |
| 567 "+r"(dst), // %1 |
| 568 "+r"(pix) // %2 |
| 569 : "m"(dither4) // %3 |
| 570 : "memory", "cc", |
| 571 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" |
| 572 ); |
| 573 } |
| 574 |
529 void ARGBToARGB1555Row_SSE2(const uint8* src, uint8* dst, int pix) { | 575 void ARGBToARGB1555Row_SSE2(const uint8* src, uint8* dst, int pix) { |
530 asm volatile ( | 576 asm volatile ( |
531 "pcmpeqb %%xmm4,%%xmm4 \n" | 577 "pcmpeqb %%xmm4,%%xmm4 \n" |
532 "psrld $0x1b,%%xmm4 \n" | 578 "psrld $0x1b,%%xmm4 \n" |
533 "movdqa %%xmm4,%%xmm5 \n" | 579 "movdqa %%xmm4,%%xmm5 \n" |
534 "pslld $0x5,%%xmm5 \n" | 580 "pslld $0x5,%%xmm5 \n" |
535 "movdqa %%xmm4,%%xmm6 \n" | 581 "movdqa %%xmm4,%%xmm6 \n" |
536 "pslld $0xa,%%xmm6 \n" | 582 "pslld $0xa,%%xmm6 \n" |
537 "pcmpeqb %%xmm7,%%xmm7 \n" | 583 "pcmpeqb %%xmm7,%%xmm7 \n" |
538 "pslld $0xf,%%xmm7 \n" | 584 "pslld $0xf,%%xmm7 \n" |
(...skipping 4953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5492 ); | 5538 ); |
5493 } | 5539 } |
5494 #endif // HAS_ARGBLUMACOLORTABLEROW_SSSE3 | 5540 #endif // HAS_ARGBLUMACOLORTABLEROW_SSSE3 |
5495 | 5541 |
5496 #endif // defined(__x86_64__) || defined(__i386__) | 5542 #endif // defined(__x86_64__) || defined(__i386__) |
5497 | 5543 |
5498 #ifdef __cplusplus | 5544 #ifdef __cplusplus |
5499 } // extern "C" | 5545 } // extern "C" |
5500 } // namespace libyuv | 5546 } // namespace libyuv |
5501 #endif | 5547 #endif |
OLD | NEW |