Mercurial > libavcodec.hg
comparison ps2/dsputil_mmi.c @ 689:efcbfbd18864 libavcodec
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
author | michaelni |
---|---|
date | Mon, 23 Sep 2002 08:44:24 +0000 |
parents | |
children | 71f669e9f633 |
comparison
equal
deleted
inserted
replaced
688:894b61908734 | 689:efcbfbd18864 |
---|---|
1 /* | |
2 * MMI optimized DSP utils | |
3 * Copyright (c) 2000, 2001 Fabrice Bellard. | |
4 * | |
5 * This library is free software; you can redistribute it and/or | |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2 of the License, or (at your option) any later version. | |
9 * | |
10 * This library is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Lesser General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Lesser General Public | |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 * | |
19 * MMI optimization by Leon van Stuivenberg <leonvs@iae.nl> | |
20 */ | |
21 | |
22 #include "../dsputil.h" | |
23 | |
24 void ff_mmi_idct(DCTELEM * block); | |
25 | |
26 #include "mmi.h" | |
27 | |
28 | |
29 static void clear_blocks_mmi(DCTELEM * blocks) | |
30 { | |
31 /* $4 = blocks */ | |
32 int i; | |
33 for (i = 0; i < 6; i++) { | |
34 sq($0, 0, $4); | |
35 sq($0, 16, $4); | |
36 sq($0, 32, $4); | |
37 sq($0, 48, $4); | |
38 sq($0, 64, $4); | |
39 sq($0, 80, $4); | |
40 sq($0, 96, $4); | |
41 sq($0, 112, $4); | |
42 __asm__ __volatile__("addi $4, $4, 128"); | |
43 } | |
44 } | |
45 | |
46 | |
47 static void put_pixels_clamped_mmi(const DCTELEM * block, UINT8 * pixels, | |
48 int line_size) | |
49 { | |
50 /* $4 = block, $5 = pixels, $6 = line_size */ | |
51 __asm__ __volatile__("li $11, 255":::"$11"); | |
52 lq($4, 0, $12); | |
53 pcpyld($11, $11, $11); | |
54 pcpyh($11, $11); | |
55 | |
56 #define PUT(rs) \ | |
57 ppacb($0, $##rs, $##rs); \ | |
58 sd3(rs, 0, 5); \ | |
59 __asm__ __volatile__ ("add $5, $5, $6"); | |
60 | |
61 pminh($12, $11, $12); | |
62 pmaxh($12, $0, $12); | |
63 lq($4, 16, $13); | |
64 PUT(12); | |
65 | |
66 pminh($13, $11, $13); | |
67 pmaxh($13, $0, $13); | |
68 lq($4, 32, $12); | |
69 PUT(13); | |
70 | |
71 pminh($12, $11, $12); | |
72 pmaxh($12, $0, $12); | |
73 lq($4, 48, $13); | |
74 PUT(12); | |
75 | |
76 pminh($13, $11, $13); | |
77 pmaxh($13, $0, $13); | |
78 lq($4, 64, $12); | |
79 PUT(13); | |
80 | |
81 pminh($12, $11, $12); | |
82 pmaxh($12, $0, $12); | |
83 lq($4, 80, $13); | |
84 PUT(12); | |
85 | |
86 pminh($13, $11, $13); | |
87 pmaxh($13, $0, $13); | |
88 lq($4, 96, $12); | |
89 PUT(13); | |
90 | |
91 pminh($12, $11, $12); | |
92 pmaxh($12, $0, $12); | |
93 lq($4, 112, $13); | |
94 PUT(12); | |
95 | |
96 pminh($13, $11, $13); | |
97 pmaxh($13, $0, $13); | |
98 PUT(13); | |
99 } | |
100 | |
101 /* todo | |
102 static void add_pixels_clamped_mmi(const DCTELEM * block, UINT8 * pixels, | |
103 int line_size) | |
104 { | |
105 } | |
106 */ | |
107 | |
108 | |
109 void dsputil_init_mmi(void) | |
110 { | |
111 put_pixels_clamped = put_pixels_clamped_mmi; | |
112 //add_pixels_clamped = add_pixels_clamped_mmi; | |
113 clear_blocks = clear_blocks_mmi; | |
114 ff_idct = ff_mmi_idct; | |
115 } |