diff options
Diffstat (limited to 'apps/plugins/mpegplayer/motion_comp_arm.c')
-rw-r--r-- | apps/plugins/mpegplayer/motion_comp_arm.c | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/apps/plugins/mpegplayer/motion_comp_arm.c b/apps/plugins/mpegplayer/motion_comp_arm.c new file mode 100644 index 0000000000..ec9eddab72 --- /dev/null +++ b/apps/plugins/mpegplayer/motion_comp_arm.c | |||
@@ -0,0 +1,183 @@ | |||
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 "mpeg2dec_config.h" | ||
24 | |||
25 | #include <inttypes.h> | ||
26 | |||
27 | #include "mpeg2.h" | ||
28 | #include "attributes.h" | ||
29 | #include "mpeg2_internal.h" | ||
30 | |||
31 | #define avg2(a,b) ((a+b+1)>>1) | ||
32 | #define avg4(a,b,c,d) ((a+b+c+d+2)>>2) | ||
33 | |||
34 | #define predict_o(i) (ref[i]) | ||
35 | #define predict_x(i) (avg2 (ref[i], ref[i+1])) | ||
36 | #define predict_y(i) (avg2 (ref[i], (ref+stride)[i])) | ||
37 | #define predict_xy(i) (avg4 (ref[i], ref[i+1], \ | ||
38 | (ref+stride)[i], (ref+stride)[i+1])) | ||
39 | |||
40 | #define put(predictor,i) dest[i] = predictor (i) | ||
41 | #define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i]) | ||
42 | |||
43 | /* mc function template */ | ||
44 | |||
45 | #define MC_FUNC(op,xy) \ | ||
46 | inline static void MC_##op##_##xy##_16_c (uint8_t * dest, const uint8_t * ref, \ | ||
47 | const int stride, int height) \ | ||
48 | { \ | ||
49 | do { \ | ||
50 | op (predict_##xy, 0); \ | ||
51 | op (predict_##xy, 1); \ | ||
52 | op (predict_##xy, 2); \ | ||
53 | op (predict_##xy, 3); \ | ||
54 | op (predict_##xy, 4); \ | ||
55 | op (predict_##xy, 5); \ | ||
56 | op (predict_##xy, 6); \ | ||
57 | op (predict_##xy, 7); \ | ||
58 | op (predict_##xy, 8); \ | ||
59 | op (predict_##xy, 9); \ | ||
60 | op (predict_##xy, 10); \ | ||
61 | op (predict_##xy, 11); \ | ||
62 | op (predict_##xy, 12); \ | ||
63 | op (predict_##xy, 13); \ | ||
64 | op (predict_##xy, 14); \ | ||
65 | op (predict_##xy, 15); \ | ||
66 | ref += stride; \ | ||
67 | dest += stride; \ | ||
68 | } while (--height); \ | ||
69 | } \ | ||
70 | static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \ | ||
71 | const int stride, int height) \ | ||
72 | { \ | ||
73 | do { \ | ||
74 | op (predict_##xy, 0); \ | ||
75 | op (predict_##xy, 1); \ | ||
76 | op (predict_##xy, 2); \ | ||
77 | op (predict_##xy, 3); \ | ||
78 | op (predict_##xy, 4); \ | ||
79 | op (predict_##xy, 5); \ | ||
80 | op (predict_##xy, 6); \ | ||
81 | op (predict_##xy, 7); \ | ||
82 | ref += stride; \ | ||
83 | dest += stride; \ | ||
84 | } while (--height); \ | ||
85 | } \ | ||
86 | /* definitions of the actual mc functions */ | ||
87 | |||
88 | /* MC_FUNC (put,o) */ | ||
89 | MC_FUNC (avg,o) | ||
90 | /* MC_FUNC (put,x) */ | ||
91 | MC_FUNC (avg,x) | ||
92 | MC_FUNC (put,y) | ||
93 | MC_FUNC (avg,y) | ||
94 | MC_FUNC (put,xy) | ||
95 | MC_FUNC (avg,xy) | ||
96 | |||
97 | |||
98 | extern void MC_put_o_16_arm (uint8_t * dest, const uint8_t * ref, | ||
99 | int stride, int height); | ||
100 | |||
101 | extern void MC_put_x_16_arm (uint8_t * dest, const uint8_t * ref, | ||
102 | int stride, int height); | ||
103 | |||
104 | |||
105 | static void MC_put_y_16_arm (uint8_t * dest, const uint8_t * ref, | ||
106 | int stride, int height) | ||
107 | { | ||
108 | MC_put_y_16_c(dest, ref, stride, height); | ||
109 | } | ||
110 | |||
111 | static void MC_put_xy_16_arm (uint8_t * dest, const uint8_t * ref, | ||
112 | int stride, int height) | ||
113 | { | ||
114 | MC_put_xy_16_c(dest, ref, stride, height); | ||
115 | } | ||
116 | |||
117 | extern void MC_put_o_8_arm (uint8_t * dest, const uint8_t * ref, | ||
118 | int stride, int height); | ||
119 | |||
120 | extern void MC_put_x_8_arm (uint8_t * dest, const uint8_t * ref, | ||
121 | int stride, int height); | ||
122 | |||
123 | static void MC_put_y_8_arm (uint8_t * dest, const uint8_t * ref, | ||
124 | int stride, int height) | ||
125 | { | ||
126 | MC_put_y_8_c(dest, ref, stride, height); | ||
127 | } | ||
128 | |||
129 | static void MC_put_xy_8_arm (uint8_t * dest, const uint8_t * ref, | ||
130 | int stride, int height) | ||
131 | { | ||
132 | MC_put_xy_8_c(dest, ref, stride, height); | ||
133 | } | ||
134 | |||
135 | static void MC_avg_o_16_arm (uint8_t * dest, const uint8_t * ref, | ||
136 | int stride, int height) | ||
137 | { | ||
138 | MC_avg_o_16_c(dest, ref, stride, height); | ||
139 | } | ||
140 | |||
141 | static void MC_avg_x_16_arm (uint8_t * dest, const uint8_t * ref, | ||
142 | int stride, int height) | ||
143 | { | ||
144 | MC_avg_x_16_c(dest, ref, stride, height); | ||
145 | } | ||
146 | |||
147 | static void MC_avg_y_16_arm (uint8_t * dest, const uint8_t * ref, | ||
148 | int stride, int height) | ||
149 | { | ||
150 | MC_avg_y_16_c(dest, ref, stride, height); | ||
151 | } | ||
152 | |||
153 | static void MC_avg_xy_16_arm (uint8_t * dest, const uint8_t * ref, | ||
154 | int stride, int height) | ||
155 | { | ||
156 | MC_avg_xy_16_c(dest, ref, stride, height); | ||
157 | } | ||
158 | |||
159 | static void MC_avg_o_8_arm (uint8_t * dest, const uint8_t * ref, | ||
160 | int stride, int height) | ||
161 | { | ||
162 | MC_avg_o_8_c(dest, ref, stride, height); | ||
163 | } | ||
164 | |||
165 | static void MC_avg_x_8_arm (uint8_t * dest, const uint8_t * ref, | ||
166 | int stride, int height) | ||
167 | { | ||
168 | MC_avg_x_8_c(dest, ref, stride, height); | ||
169 | } | ||
170 | |||
171 | static void MC_avg_y_8_arm (uint8_t * dest, const uint8_t * ref, | ||
172 | int stride, int height) | ||
173 | { | ||
174 | MC_avg_y_8_c(dest, ref, stride, height); | ||
175 | } | ||
176 | |||
177 | static void MC_avg_xy_8_arm (uint8_t * dest, const uint8_t * ref, | ||
178 | int stride, int height) | ||
179 | { | ||
180 | MC_avg_xy_8_c(dest, ref, stride, height); | ||
181 | } | ||
182 | |||
183 | MPEG2_MC_EXTERN (arm) | ||