comparison ps2/dsputil_mmi.c @ 1146:868650fc345a libavcodec

new versions; put_pix's about 20% faster, get_pix 3.5x faster. patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
author michaelni
date Fri, 21 Mar 2003 22:50:54 +0000
parents a4facfd78935
children 7d328fd9d8a5
comparison
equal deleted inserted replaced
1145:79e8ed620b17 1146:868650fc345a
47 } 47 }
48 48
49 49
50 static void get_pixels_mmi(DCTELEM *block, const uint8_t *pixels, int line_size) 50 static void get_pixels_mmi(DCTELEM *block, const uint8_t *pixels, int line_size)
51 { 51 {
52 int i;
53 for(i=0;i<8;i++) {
54 asm volatile( 52 asm volatile(
55 ".set push \n\t" 53 ".set push \n\t"
56 ".set mips3 \n\t" 54 ".set mips3 \n\t"
57 "ld $8, 0(%1) \n\t" 55 "ld $8, 0(%0) \n\t"
58 "add %1, %1, %2 \n\t" 56 "add %0, %0, %2 \n\t"
57 "ld $9, 0(%0) \n\t"
58 "add %0, %0, %2 \n\t"
59 "ld $10, 0(%0) \n\t"
59 "pextlb $8, $0, $8 \n\t" 60 "pextlb $8, $0, $8 \n\t"
60 "sq $8, 0(%0) \n\t" 61 "sq $8, 0(%1) \n\t"
62 "add %0, %0, %2 \n\t"
63 "ld $8, 0(%0) \n\t"
64 "pextlb $9, $0, $9 \n\t"
65 "sq $9, 16(%1) \n\t"
66 "add %0, %0, %2 \n\t"
67 "ld $9, 0(%0) \n\t"
68 "pextlb $10, $0, $10 \n\t"
69 "sq $10, 32(%1) \n\t"
70 "add %0, %0, %2 \n\t"
71 "ld $10, 0(%0) \n\t"
72 "pextlb $8, $0, $8 \n\t"
73 "sq $8, 48(%1) \n\t"
74 "add %0, %0, %2 \n\t"
75 "ld $8, 0(%0) \n\t"
76 "pextlb $9, $0, $9 \n\t"
77 "sq $9, 64(%1) \n\t"
78 "add %0, %0, %2 \n\t"
79 "ld $9, 0(%0) \n\t"
80 "pextlb $10, $0, $10 \n\t"
81 "sq $10, 80(%1) \n\t"
82 "pextlb $8, $0, $8 \n\t"
83 "sq $8, 96(%1) \n\t"
84 "pextlb $9, $0, $9 \n\t"
85 "sq $9, 112(%1) \n\t"
61 ".set pop \n\t" 86 ".set pop \n\t"
62 :: "r" (block), "r" (pixels), "r" (line_size) : "$8", "memory" ); 87 : "+r" (pixels) : "r" (block), "r" (line_size) : "$8", "$9", "$10", "memory" );
63 block += 8;
64 }
65 } 88 }
66 89
67 90
68 static void put_pixels8_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h) 91 static void put_pixels8_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
69 { 92 {
70 int i;
71 for(i=0; i<h; i++) {
72 asm volatile( 93 asm volatile(
73 ".set push \n\t" 94 ".set push \n\t"
74 ".set mips3 \n\t" 95 ".set mips3 \n\t"
96 "1: \n\t"
75 "ldr $8, 0(%1) \n\t" 97 "ldr $8, 0(%1) \n\t"
98 "addiu %2, %2, -1 \n\t"
76 "ldl $8, 7(%1) \n\t" 99 "ldl $8, 7(%1) \n\t"
77 "add %1, %1, %2 \n\t" 100 "add %1, %1, %3 \n\t"
78 "sd $8, 0(%0) \n\t" 101 "sd $8, 0(%0) \n\t"
79 "add %0, %0, %2 \n\t" 102 "add %0, %0, %3 \n\t"
103 "bgtz %2, 1b \n\t"
80 ".set pop \n\t" 104 ".set pop \n\t"
81 :: "r" (block), "r" (pixels), "r" (line_size) : "$8", "memory" ); 105 : "+r" (block), "+r" (pixels), "+r" (h) : "r" (line_size)
82 } 106 : "$8", "memory" );
83 } 107 }
84 108
85 109
86 static void put_pixels16_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h) 110 static void put_pixels16_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
87 { 111 {
88 int i;
89 for(i=0; i<(h>>2); i++) {
90 asm volatile ( 112 asm volatile (
91 ".set push \n\t" 113 ".set push \n\t"
92 ".set mips3 \n\t" 114 ".set mips3 \n\t"
93 #define PUTPIX16 \ 115 "1: \n\t"
94 "ldr $8, 0(%1) \n\t" \ 116 "ldr $8, 0(%1) \n\t"
95 "ldl $8, 7(%1) \n\t" \ 117 "add $11, %1, %3 \n\t"
96 "ldr $9, 8(%1) \n\t" \ 118 "ldl $8, 7(%1) \n\t"
97 "ldl $9, 15(%1) \n\t" \ 119 "add $10, %0, %3 \n\t"
98 "add %1, %1, %2 \n\t" \ 120 "ldr $9, 8(%1) \n\t"
99 "pcpyld $8, $9, $8 \n\t" \ 121 "ldl $9, 15(%1) \n\t"
100 "sq $8, 0(%0) \n\t" \ 122 "ldr $12, 0($11) \n\t"
101 "add %0, %0, %2 \n\t" 123 "add %1, $11, %3 \n\t"
102 PUTPIX16 124 "ldl $12, 7($11) \n\t"
103 PUTPIX16 125 "pcpyld $8, $9, $8 \n\t"
104 PUTPIX16 126 "sq $8, 0(%0) \n\t"
105 PUTPIX16 127 "ldr $13, 8($11) \n\t"
128 "addiu %2, %2, -2 \n\t"
129 "ldl $13, 15($11) \n\t"
130 "add %0, $10, %3 \n\t"
131 "pcpyld $12, $13, $12 \n\t"
132 "sq $12, 0($10) \n\t"
133 "bgtz %2, 1b \n\t"
106 ".set pop \n\t" 134 ".set pop \n\t"
107 :: "r" (block), "r" (pixels), "r" (line_size) : "$8", "$9", "memory" ); 135 : "+r" (block), "+r" (pixels), "+r" (h) : "r" (line_size)
108 } 136 : "$8", "$9", "$10", "$11", "$12", "$13", "memory" );
109 } 137 }
110 138
111 139
112 void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx) 140 void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx)
113 { 141 {