Mercurial > mplayer.hg
comparison libmpeg2/motion_comp_arm.c @ 23236:f0ddd02aec27
iWMMXt-accelerated DCT and motion compensation for ARM processors
Ported to SVN by David Bateman % adb014 A gmail P com % from www.mkezx.org
Originally written for Zaurus port http://atty.skr.jp/zplayer/ by AGAWA Koji
Original thread:
Date: Apr 5, 2007 1:11 AM
Subject: [MPlayer-dev-eng] mkezx patches (Was: mplayer zaurus patches)
author | gpoirier |
---|---|
date | Mon, 07 May 2007 19:11:56 +0000 |
parents | |
children | da2271c341ee |
comparison
equal
deleted
inserted
replaced
23235:0e8285c7b2fa | 23236:f0ddd02aec27 |
---|---|
1 /* | |
2 * motion_comp_arm.c | |
3 * Copyright (C) 2004 AGAWA Koji <i (AT) atty (DOT) jp> | |
4 * | |
5 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. | |
6 * See http://libmpeg2.sourceforge.net/ for updates. | |
7 * | |
8 * mpeg2dec is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * mpeg2dec is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
22 | |
23 #include "config.h" | |
24 | |
25 #ifdef ARCH_ARM | |
26 | |
27 #include <inttypes.h> | |
28 | |
29 #include "mpeg2.h" | |
30 #include "attributes.h" | |
31 #include "mpeg2_internal.h" | |
32 | |
33 #define avg2(a,b) ((a+b+1)>>1) | |
34 #define avg4(a,b,c,d) ((a+b+c+d+2)>>2) | |
35 | |
36 #define predict_o(i) (ref[i]) | |
37 #define predict_x(i) (avg2 (ref[i], ref[i+1])) | |
38 #define predict_y(i) (avg2 (ref[i], (ref+stride)[i])) | |
39 #define predict_xy(i) (avg4 (ref[i], ref[i+1], \ | |
40 (ref+stride)[i], (ref+stride)[i+1])) | |
41 | |
42 #define put(predictor,i) dest[i] = predictor (i) | |
43 #define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i]) | |
44 | |
45 /* mc function template */ | |
46 | |
47 #define MC_FUNC(op,xy) \ | |
48 static void inline MC_##op##_##xy##_16_c (uint8_t * dest, const uint8_t * ref, \ | |
49 const int stride, int height) \ | |
50 { \ | |
51 do { \ | |
52 op (predict_##xy, 0); \ | |
53 op (predict_##xy, 1); \ | |
54 op (predict_##xy, 2); \ | |
55 op (predict_##xy, 3); \ | |
56 op (predict_##xy, 4); \ | |
57 op (predict_##xy, 5); \ | |
58 op (predict_##xy, 6); \ | |
59 op (predict_##xy, 7); \ | |
60 op (predict_##xy, 8); \ | |
61 op (predict_##xy, 9); \ | |
62 op (predict_##xy, 10); \ | |
63 op (predict_##xy, 11); \ | |
64 op (predict_##xy, 12); \ | |
65 op (predict_##xy, 13); \ | |
66 op (predict_##xy, 14); \ | |
67 op (predict_##xy, 15); \ | |
68 ref += stride; \ | |
69 dest += stride; \ | |
70 } while (--height); \ | |
71 } \ | |
72 static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \ | |
73 const int stride, int height) \ | |
74 { \ | |
75 do { \ | |
76 op (predict_##xy, 0); \ | |
77 op (predict_##xy, 1); \ | |
78 op (predict_##xy, 2); \ | |
79 op (predict_##xy, 3); \ | |
80 op (predict_##xy, 4); \ | |
81 op (predict_##xy, 5); \ | |
82 op (predict_##xy, 6); \ | |
83 op (predict_##xy, 7); \ | |
84 ref += stride; \ | |
85 dest += stride; \ | |
86 } while (--height); \ | |
87 } \ | |
88 /* definitions of the actual mc functions */ | |
89 | |
90 MC_FUNC (put,o) | |
91 MC_FUNC (avg,o) | |
92 MC_FUNC (put,x) | |
93 MC_FUNC (avg,x) | |
94 MC_FUNC (put,y) | |
95 MC_FUNC (avg,y) | |
96 MC_FUNC (put,xy) | |
97 MC_FUNC (avg,xy) | |
98 | |
99 | |
100 extern void MC_put_o_16_arm (uint8_t * dest, const uint8_t * ref, | |
101 int stride, int height); | |
102 | |
103 extern void MC_put_x_16_arm (uint8_t * dest, const uint8_t * ref, | |
104 int stride, int height); | |
105 | |
106 | |
107 static void MC_put_y_16_arm (uint8_t * dest, const uint8_t * ref, | |
108 int stride, int height) | |
109 { | |
110 MC_put_y_16_c(dest, ref, stride, height); | |
111 } | |
112 | |
113 static void MC_put_xy_16_arm (uint8_t * dest, const uint8_t * ref, | |
114 int stride, int height) | |
115 { | |
116 MC_put_xy_16_c(dest, ref, stride, height); | |
117 } | |
118 | |
119 extern void MC_put_o_8_arm (uint8_t * dest, const uint8_t * ref, | |
120 int stride, int height); | |
121 | |
122 extern void MC_put_x_8_arm (uint8_t * dest, const uint8_t * ref, | |
123 int stride, int height); | |
124 | |
125 static void MC_put_y_8_arm (uint8_t * dest, const uint8_t * ref, | |
126 int stride, int height) | |
127 { | |
128 MC_put_y_8_c(dest, ref, stride, height); | |
129 } | |
130 | |
131 static void MC_put_xy_8_arm (uint8_t * dest, const uint8_t * ref, | |
132 int stride, int height) | |
133 { | |
134 MC_put_xy_8_c(dest, ref, stride, height); | |
135 } | |
136 | |
137 static void MC_avg_o_16_arm (uint8_t * dest, const uint8_t * ref, | |
138 int stride, int height) | |
139 { | |
140 MC_avg_o_16_c(dest, ref, stride, height); | |
141 } | |
142 | |
143 static void MC_avg_x_16_arm (uint8_t * dest, const uint8_t * ref, | |
144 int stride, int height) | |
145 { | |
146 MC_avg_x_16_c(dest, ref, stride, height); | |
147 } | |
148 | |
149 static void MC_avg_y_16_arm (uint8_t * dest, const uint8_t * ref, | |
150 int stride, int height) | |
151 { | |
152 MC_avg_y_16_c(dest, ref, stride, height); | |
153 } | |
154 | |
155 static void MC_avg_xy_16_arm (uint8_t * dest, const uint8_t * ref, | |
156 int stride, int height) | |
157 { | |
158 MC_avg_xy_16_c(dest, ref, stride, height); | |
159 } | |
160 | |
161 static void MC_avg_o_8_arm (uint8_t * dest, const uint8_t * ref, | |
162 int stride, int height) | |
163 { | |
164 MC_avg_o_8_c(dest, ref, stride, height); | |
165 } | |
166 | |
167 static void MC_avg_x_8_arm (uint8_t * dest, const uint8_t * ref, | |
168 int stride, int height) | |
169 { | |
170 MC_avg_x_8_c(dest, ref, stride, height); | |
171 } | |
172 | |
173 static void MC_avg_y_8_arm (uint8_t * dest, const uint8_t * ref, | |
174 int stride, int height) | |
175 { | |
176 MC_avg_y_8_c(dest, ref, stride, height); | |
177 } | |
178 | |
179 static void MC_avg_xy_8_arm (uint8_t * dest, const uint8_t * ref, | |
180 int stride, int height) | |
181 { | |
182 MC_avg_xy_8_c(dest, ref, stride, height); | |
183 } | |
184 | |
185 MPEG2_MC_EXTERN (arm) | |
186 | |
187 #endif |