annotate ps2/dsputil_mmi.c @ 772:311ac50375e4 libavcodec

dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
author michaelni
date Sun, 27 Oct 2002 09:20:48 +0000
parents 71f669e9f633
children 3c6df37177dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
689
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
1 /*
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
2 * MMI optimized DSP utils
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
3 * Copyright (c) 2000, 2001 Fabrice Bellard.
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
4 *
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
9 *
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
13 * Lesser General Public License for more details.
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
14 *
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
18 *
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
19 * MMI optimization by Leon van Stuivenberg <leonvs@iae.nl>
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
20 */
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
21
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
22 #include "../dsputil.h"
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
23 #include "mmi.h"
689
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
24
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
25
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
26 static void clear_blocks_mmi(DCTELEM * blocks)
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
27 {
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
28 int i;
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
29 for (i = 0; i < 6; i++) {
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
30 asm volatile(
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
31 "sq $0, 0(%0) \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
32 "sq $0, 16(%0) \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
33 "sq $0, 32(%0) \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
34 "sq $0, 48(%0) \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
35 "sq $0, 64(%0) \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
36 "sq $0, 80(%0) \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
37 "sq $0, 96(%0) \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
38 "sq $0, 112(%0) \n\t" :: "r" (blocks) : "memory" );
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
39 blocks += 64;
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
40 }
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
41 }
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
42
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
43
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
44 static void get_pixels_mmi(DCTELEM *block, const UINT8 *pixels, int line_size)
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
45 {
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
46 int i;
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
47 for(i=0;i<8;i++) {
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
48 asm volatile(
772
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
49 ".set push \n\t"
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
50 ".set mips3 \n\t"
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
51 "ld $8, 0(%1) \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
52 "add %1, %1, %2 \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
53 "pextlb $8, $0, $8 \n\t"
772
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
54 "sq $8, 0(%0) \n\t"
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
55 ".set pop \n\t"
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
56 :: "r" (block), "r" (pixels), "r" (line_size) : "$8", "memory" );
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
57 block += 8;
689
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
58 }
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
59 }
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
60
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
61
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
62 static void put_pixels8_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
689
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
63 {
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
64 int i;
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
65 for(i=0; i<h; i++) {
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
66 asm volatile(
772
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
67 ".set push \n\t"
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
68 ".set mips3 \n\t"
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
69 "ldr $8, 0(%1) \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
70 "ldl $8, 7(%1) \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
71 "add %1, %1, %2 \n\t"
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
72 "sd $8, 0(%0) \n\t"
772
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
73 "add %0, %0, %2 \n\t"
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
74 ".set pop \n\t"
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
75 :: "r" (block), "r" (pixels), "r" (line_size) : "$8", "memory" );
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
76 }
689
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
77 }
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
78
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
79
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
80 static void put_pixels16_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
689
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
81 {
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
82 int i;
772
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
83 for(i=0; i<(h>>2); i++) {
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
84 asm volatile (
772
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
85 ".set push \n\t"
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
86 ".set mips3 \n\t"
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
87 #define PUTPIX16 \
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
88 "ldr $8, 0(%1) \n\t" \
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
89 "ldl $8, 7(%1) \n\t" \
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
90 "ldr $9, 8(%1) \n\t" \
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
91 "ldl $9, 15(%1) \n\t" \
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
92 "add %1, %1, %2 \n\t" \
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
93 "pcpyld $8, $9, $8 \n\t" \
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
94 "sq $8, 0(%0) \n\t" \
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
95 "add %0, %0, %2 \n\t"
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
96 PUTPIX16
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
97 PUTPIX16
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
98 PUTPIX16
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
99 PUTPIX16
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
100 ".set pop \n\t"
311ac50375e4 dsputil mmi cleanup patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 721
diff changeset
101 :: "r" (block), "r" (pixels), "r" (line_size) : "$8", "$9", "memory" );
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
102 }
689
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
103 }
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
104
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
105
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
106 void dsputil_init_mmi(void)
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
107 {
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
108 clear_blocks = clear_blocks_mmi;
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
109
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
110 put_pixels_tab[1][0] = put_pixels8_mmi;
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
111 put_no_rnd_pixels_tab[1][0] = put_pixels8_mmi;
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
112
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
113 put_pixels_tab[0][0] = put_pixels16_mmi;
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
114 put_no_rnd_pixels_tab[0][0] = put_pixels16_mmi;
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
115
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
116 get_pixels = get_pixels_mmi;
689
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
117 }
721
71f669e9f633 ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents: 689
diff changeset
118