| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The LibYuv project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The LibYuv project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 ); | 586 ); |
| 587 } | 587 } |
| 588 | 588 |
| 589 // Convert (4 Y and 2 VU) I422 and arrange RGB values into | 589 // Convert (4 Y and 2 VU) I422 and arrange RGB values into |
| 590 // t5 = | 0 | B0 | 0 | b0 | | 590 // t5 = | 0 | B0 | 0 | b0 | |
| 591 // t4 = | 0 | B1 | 0 | b1 | | 591 // t4 = | 0 | B1 | 0 | b1 | |
| 592 // t9 = | 0 | G0 | 0 | g0 | | 592 // t9 = | 0 | G0 | 0 | g0 | |
| 593 // t8 = | 0 | G1 | 0 | g1 | | 593 // t8 = | 0 | G1 | 0 | g1 | |
| 594 // t2 = | 0 | R0 | 0 | r0 | | 594 // t2 = | 0 | R0 | 0 | r0 | |
| 595 // t1 = | 0 | R1 | 0 | r1 | | 595 // t1 = | 0 | R1 | 0 | r1 | |
| 596 #define I422ToTransientMipsRGB \ | 596 #define YUVTORGB \ |
| 597 "lw $t0, 0(%[y_buf]) \n" \ | 597 "lw $t0, 0(%[y_buf]) \n" \ |
| 598 "lhu $t1, 0(%[u_buf]) \n" \ | 598 "lhu $t1, 0(%[u_buf]) \n" \ |
| 599 "lhu $t2, 0(%[v_buf]) \n" \ | 599 "lhu $t2, 0(%[v_buf]) \n" \ |
| 600 "preceu.ph.qbr $t1, $t1 \n" \ | 600 "preceu.ph.qbr $t1, $t1 \n" \ |
| 601 "preceu.ph.qbr $t2, $t2 \n" \ | 601 "preceu.ph.qbr $t2, $t2 \n" \ |
| 602 "preceu.ph.qbra $t3, $t0 \n" \ | 602 "preceu.ph.qbra $t3, $t0 \n" \ |
| 603 "preceu.ph.qbla $t0, $t0 \n" \ | 603 "preceu.ph.qbla $t0, $t0 \n" \ |
| 604 "subu.ph $t1, $t1, $s5 \n" \ | 604 "subu.ph $t1, $t1, $s5 \n" \ |
| 605 "subu.ph $t2, $t2, $s5 \n" \ | 605 "subu.ph $t2, $t2, $s5 \n" \ |
| 606 "subu.ph $t3, $t3, $s4 \n" \ | 606 "subu.ph $t3, $t3, $s4 \n" \ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 "shra.ph $t8, $t8, 8 \n" \ | 645 "shra.ph $t8, $t8, 8 \n" \ |
| 646 "shra.ph $t2, $t2, 8 \n" \ | 646 "shra.ph $t2, $t2, 8 \n" \ |
| 647 "shra.ph $t1, $t1, 8 \n" \ | 647 "shra.ph $t1, $t1, 8 \n" \ |
| 648 "addu.ph $t5, $t5, $s5 \n" \ | 648 "addu.ph $t5, $t5, $s5 \n" \ |
| 649 "addu.ph $t4, $t4, $s5 \n" \ | 649 "addu.ph $t4, $t4, $s5 \n" \ |
| 650 "addu.ph $t9, $t9, $s5 \n" \ | 650 "addu.ph $t9, $t9, $s5 \n" \ |
| 651 "addu.ph $t8, $t8, $s5 \n" \ | 651 "addu.ph $t8, $t8, $s5 \n" \ |
| 652 "addu.ph $t2, $t2, $s5 \n" \ | 652 "addu.ph $t2, $t2, $s5 \n" \ |
| 653 "addu.ph $t1, $t1, $s5 \n" | 653 "addu.ph $t1, $t1, $s5 \n" |
| 654 | 654 |
| 655 // TODO(fbarchard): accept yuv conversion constants. |
| 655 void I422ToARGBRow_MIPS_DSPR2(const uint8* y_buf, | 656 void I422ToARGBRow_MIPS_DSPR2(const uint8* y_buf, |
| 656 const uint8* u_buf, | 657 const uint8* u_buf, |
| 657 const uint8* v_buf, | 658 const uint8* v_buf, |
| 658 uint8* rgb_buf, | 659 uint8* rgb_buf, |
| 660 struct YuvConstants* yuvconstants, |
| 659 int width) { | 661 int width) { |
| 660 __asm__ __volatile__ ( | 662 __asm__ __volatile__ ( |
| 661 ".set push \n" | 663 ".set push \n" |
| 662 ".set noreorder \n" | 664 ".set noreorder \n" |
| 663 "beqz %[width], 2f \n" | 665 "beqz %[width], 2f \n" |
| 664 " repl.ph $s0, 74 \n" // |YG|YG| = |74|74| | 666 " repl.ph $s0, 74 \n" // |YG|YG| = |74|74| |
| 665 "repl.ph $s1, -25 \n" // |UG|UG| = |-25|-25| | 667 "repl.ph $s1, -25 \n" // |UG|UG| = |-25|-25| |
| 666 "repl.ph $s2, -52 \n" // |VG|VG| = |-52|-52| | 668 "repl.ph $s2, -52 \n" // |VG|VG| = |-52|-52| |
| 667 "repl.ph $s3, 102 \n" // |VR|VR| = |102|102| | 669 "repl.ph $s3, 102 \n" // |VR|VR| = |102|102| |
| 668 "repl.ph $s4, 16 \n" // |0|16|0|16| | 670 "repl.ph $s4, 16 \n" // |0|16|0|16| |
| 669 "repl.ph $s5, 128 \n" // |128|128| // clipping | 671 "repl.ph $s5, 128 \n" // |128|128| // clipping |
| 670 "lui $s6, 0xff00 \n" | 672 "lui $s6, 0xff00 \n" |
| 671 "ori $s6, 0xff00 \n" // |ff|00|ff|00|ff| | 673 "ori $s6, 0xff00 \n" // |ff|00|ff|00|ff| |
| 672 | 674 |
| 673 "1: \n" | 675 "1: \n" |
| 674 I422ToTransientMipsRGB | 676 YUVTORGB |
| 675 // Arranging into argb format | 677 // Arranging into argb format |
| 676 "precr.qb.ph $t4, $t8, $t4 \n" // |G1|g1|B1|b1| | 678 "precr.qb.ph $t4, $t8, $t4 \n" // |G1|g1|B1|b1| |
| 677 "precr.qb.ph $t5, $t9, $t5 \n" // |G0|g0|B0|b0| | 679 "precr.qb.ph $t5, $t9, $t5 \n" // |G0|g0|B0|b0| |
| 678 "addiu %[width], -4 \n" | 680 "addiu %[width], -4 \n" |
| 679 "precrq.qb.ph $t8, $t4, $t5 \n" // |G1|B1|G0|B0| | 681 "precrq.qb.ph $t8, $t4, $t5 \n" // |G1|B1|G0|B0| |
| 680 "precr.qb.ph $t9, $t4, $t5 \n" // |g1|b1|g0|b0| | 682 "precr.qb.ph $t9, $t4, $t5 \n" // |g1|b1|g0|b0| |
| 681 "precr.qb.ph $t2, $t1, $t2 \n" // |R1|r1|R0|r0| | 683 "precr.qb.ph $t2, $t1, $t2 \n" // |R1|r1|R0|r0| |
| 682 | 684 |
| 683 "addiu %[y_buf], 4 \n" | 685 "addiu %[y_buf], 4 \n" |
| 684 "preceu.ph.qbla $t1, $t2 \n" // |0 |R1|0 |R0| | 686 "preceu.ph.qbla $t1, $t2 \n" // |0 |R1|0 |R0| |
| (...skipping 25 matching lines...) Expand all Loading... |
| 710 "t6", "t7", "t8", "t9", | 712 "t6", "t7", "t8", "t9", |
| 711 "s0", "s1", "s2", "s3", | 713 "s0", "s1", "s2", "s3", |
| 712 "s4", "s5", "s6" | 714 "s4", "s5", "s6" |
| 713 ); | 715 ); |
| 714 } | 716 } |
| 715 | 717 |
| 716 void I422ToABGRRow_MIPS_DSPR2(const uint8* y_buf, | 718 void I422ToABGRRow_MIPS_DSPR2(const uint8* y_buf, |
| 717 const uint8* u_buf, | 719 const uint8* u_buf, |
| 718 const uint8* v_buf, | 720 const uint8* v_buf, |
| 719 uint8* rgb_buf, | 721 uint8* rgb_buf, |
| 722 struct YuvConstants* yuvconstants, |
| 720 int width) { | 723 int width) { |
| 721 __asm__ __volatile__ ( | 724 __asm__ __volatile__ ( |
| 722 ".set push \n" | 725 ".set push \n" |
| 723 ".set noreorder \n" | 726 ".set noreorder \n" |
| 724 "beqz %[width], 2f \n" | 727 "beqz %[width], 2f \n" |
| 725 " repl.ph $s0, 74 \n" // |YG|YG| = |74|74| | 728 " repl.ph $s0, 74 \n" // |YG|YG| = |74|74| |
| 726 "repl.ph $s1, -25 \n" // |UG|UG| = |-25|-25| | 729 "repl.ph $s1, -25 \n" // |UG|UG| = |-25|-25| |
| 727 "repl.ph $s2, -52 \n" // |VG|VG| = |-52|-52| | 730 "repl.ph $s2, -52 \n" // |VG|VG| = |-52|-52| |
| 728 "repl.ph $s3, 102 \n" // |VR|VR| = |102|102| | 731 "repl.ph $s3, 102 \n" // |VR|VR| = |102|102| |
| 729 "repl.ph $s4, 16 \n" // |0|16|0|16| | 732 "repl.ph $s4, 16 \n" // |0|16|0|16| |
| 730 "repl.ph $s5, 128 \n" // |128|128| | 733 "repl.ph $s5, 128 \n" // |128|128| |
| 731 "lui $s6, 0xff00 \n" | 734 "lui $s6, 0xff00 \n" |
| 732 "ori $s6, 0xff00 \n" // |ff|00|ff|00| | 735 "ori $s6, 0xff00 \n" // |ff|00|ff|00| |
| 733 | 736 |
| 734 "1: \n" | 737 "1: \n" |
| 735 I422ToTransientMipsRGB | 738 YUVTORGB |
| 736 // Arranging into abgr format | 739 // Arranging into abgr format |
| 737 "precr.qb.ph $t0, $t8, $t1 \n" // |G1|g1|R1|r1| | 740 "precr.qb.ph $t0, $t8, $t1 \n" // |G1|g1|R1|r1| |
| 738 "precr.qb.ph $t3, $t9, $t2 \n" // |G0|g0|R0|r0| | 741 "precr.qb.ph $t3, $t9, $t2 \n" // |G0|g0|R0|r0| |
| 739 "precrq.qb.ph $t8, $t0, $t3 \n" // |G1|R1|G0|R0| | 742 "precrq.qb.ph $t8, $t0, $t3 \n" // |G1|R1|G0|R0| |
| 740 "precr.qb.ph $t9, $t0, $t3 \n" // |g1|r1|g0|r0| | 743 "precr.qb.ph $t9, $t0, $t3 \n" // |g1|r1|g0|r0| |
| 741 | 744 |
| 742 "precr.qb.ph $t2, $t4, $t5 \n" // |B1|b1|B0|b0| | 745 "precr.qb.ph $t2, $t4, $t5 \n" // |B1|b1|B0|b0| |
| 743 "addiu %[width], -4 \n" | 746 "addiu %[width], -4 \n" |
| 744 "addiu %[y_buf], 4 \n" | 747 "addiu %[y_buf], 4 \n" |
| 745 "preceu.ph.qbla $t1, $t2 \n" // |0 |B1|0 |B0| | 748 "preceu.ph.qbla $t1, $t2 \n" // |0 |B1|0 |B0| |
| (...skipping 25 matching lines...) Expand all Loading... |
| 771 "t6", "t7", "t8", "t9", | 774 "t6", "t7", "t8", "t9", |
| 772 "s0", "s1", "s2", "s3", | 775 "s0", "s1", "s2", "s3", |
| 773 "s4", "s5", "s6" | 776 "s4", "s5", "s6" |
| 774 ); | 777 ); |
| 775 } | 778 } |
| 776 | 779 |
| 777 void I422ToBGRARow_MIPS_DSPR2(const uint8* y_buf, | 780 void I422ToBGRARow_MIPS_DSPR2(const uint8* y_buf, |
| 778 const uint8* u_buf, | 781 const uint8* u_buf, |
| 779 const uint8* v_buf, | 782 const uint8* v_buf, |
| 780 uint8* rgb_buf, | 783 uint8* rgb_buf, |
| 784 struct YuvConstants* yuvconstants, |
| 781 int width) { | 785 int width) { |
| 782 __asm__ __volatile__ ( | 786 __asm__ __volatile__ ( |
| 783 ".set push \n" | 787 ".set push \n" |
| 784 ".set noreorder \n" | 788 ".set noreorder \n" |
| 785 "beqz %[width], 2f \n" | 789 "beqz %[width], 2f \n" |
| 786 " repl.ph $s0, 74 \n" // |YG|YG| = |74 |74 | | 790 " repl.ph $s0, 74 \n" // |YG|YG| = |74 |74 | |
| 787 "repl.ph $s1, -25 \n" // |UG|UG| = |-25|-25| | 791 "repl.ph $s1, -25 \n" // |UG|UG| = |-25|-25| |
| 788 "repl.ph $s2, -52 \n" // |VG|VG| = |-52|-52| | 792 "repl.ph $s2, -52 \n" // |VG|VG| = |-52|-52| |
| 789 "repl.ph $s3, 102 \n" // |VR|VR| = |102|102| | 793 "repl.ph $s3, 102 \n" // |VR|VR| = |102|102| |
| 790 "repl.ph $s4, 16 \n" // |0|16|0|16| | 794 "repl.ph $s4, 16 \n" // |0|16|0|16| |
| 791 "repl.ph $s5, 128 \n" // |128|128| | 795 "repl.ph $s5, 128 \n" // |128|128| |
| 792 "lui $s6, 0xff \n" | 796 "lui $s6, 0xff \n" |
| 793 "ori $s6, 0xff \n" // |00|ff|00|ff| | 797 "ori $s6, 0xff \n" // |00|ff|00|ff| |
| 794 | 798 |
| 795 "1: \n" | 799 "1: \n" |
| 796 I422ToTransientMipsRGB | 800 YUVTORGB |
| 797 // Arranging into bgra format | 801 // Arranging into bgra format |
| 798 "precr.qb.ph $t4, $t4, $t8 \n" // |B1|b1|G1|g1| | 802 "precr.qb.ph $t4, $t4, $t8 \n" // |B1|b1|G1|g1| |
| 799 "precr.qb.ph $t5, $t5, $t9 \n" // |B0|b0|G0|g0| | 803 "precr.qb.ph $t5, $t5, $t9 \n" // |B0|b0|G0|g0| |
| 800 "precrq.qb.ph $t8, $t4, $t5 \n" // |B1|G1|B0|G0| | 804 "precrq.qb.ph $t8, $t4, $t5 \n" // |B1|G1|B0|G0| |
| 801 "precr.qb.ph $t9, $t4, $t5 \n" // |b1|g1|b0|g0| | 805 "precr.qb.ph $t9, $t4, $t5 \n" // |b1|g1|b0|g0| |
| 802 | 806 |
| 803 "precr.qb.ph $t2, $t1, $t2 \n" // |R1|r1|R0|r0| | 807 "precr.qb.ph $t2, $t1, $t2 \n" // |R1|r1|R0|r0| |
| 804 "addiu %[width], -4 \n" | 808 "addiu %[width], -4 \n" |
| 805 "addiu %[y_buf], 4 \n" | 809 "addiu %[y_buf], 4 \n" |
| 806 "preceu.ph.qbla $t1, $t2 \n" // |0 |R1|0 |R0| | 810 "preceu.ph.qbla $t1, $t2 \n" // |0 |R1|0 |R0| |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 ); | 899 ); |
| 896 } | 900 } |
| 897 #endif // __mips_dsp_rev >= 2 | 901 #endif // __mips_dsp_rev >= 2 |
| 898 | 902 |
| 899 #endif // defined(__mips__) | 903 #endif // defined(__mips__) |
| 900 | 904 |
| 901 #ifdef __cplusplus | 905 #ifdef __cplusplus |
| 902 } // extern "C" | 906 } // extern "C" |
| 903 } // namespace libyuv | 907 } // namespace libyuv |
| 904 #endif | 908 #endif |
| OLD | NEW |