codecs_conf, mp_taglists: Use only one fourcc for LATM
[mplayer/glamo.git] / libmpeg2 / motion_comp_arm.c
blobf783434a30bd50d9f2d4acf321227ceecf9abe24
1 /*
2 * motion_comp_arm.c
3 * Copyright (C) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
5 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
6 * See http://libmpeg2.sourceforge.net/ for updates.
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.
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.
18 * You should have received a copy of the GNU General Public License
19 * along with mpeg2dec; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "config.h"
25 #if ARCH_ARM
27 #include <inttypes.h>
29 #include "mpeg2.h"
30 #include "attributes.h"
31 #include "mpeg2_internal.h"
33 #define avg2(a,b) ((a+b+1)>>1)
34 #define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
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]))
42 #define put(predictor,i) dest[i] = predictor (i)
43 #define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i])
45 /* mc function template */
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 */
90 MC_FUNC (avg,o)
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)
98 extern void MC_put_o_16_arm (uint8_t * dest, const uint8_t * ref,
99 int stride, int height);
101 extern void MC_put_x_16_arm (uint8_t * dest, const uint8_t * ref,
102 int stride, int height);
105 static void MC_put_y_16_arm (uint8_t * dest, const uint8_t * ref,
106 int stride, int height)
108 MC_put_y_16_c(dest, ref, stride, height);
111 static void MC_put_xy_16_arm (uint8_t * dest, const uint8_t * ref,
112 int stride, int height)
114 MC_put_xy_16_c(dest, ref, stride, height);
117 extern void MC_put_o_8_arm (uint8_t * dest, const uint8_t * ref,
118 int stride, int height);
120 extern void MC_put_x_8_arm (uint8_t * dest, const uint8_t * ref,
121 int stride, int height);
123 static void MC_put_y_8_arm (uint8_t * dest, const uint8_t * ref,
124 int stride, int height)
126 MC_put_y_8_c(dest, ref, stride, height);
129 static void MC_put_xy_8_arm (uint8_t * dest, const uint8_t * ref,
130 int stride, int height)
132 MC_put_xy_8_c(dest, ref, stride, height);
135 static void MC_avg_o_16_arm (uint8_t * dest, const uint8_t * ref,
136 int stride, int height)
138 MC_avg_o_16_c(dest, ref, stride, height);
141 static void MC_avg_x_16_arm (uint8_t * dest, const uint8_t * ref,
142 int stride, int height)
144 MC_avg_x_16_c(dest, ref, stride, height);
147 static void MC_avg_y_16_arm (uint8_t * dest, const uint8_t * ref,
148 int stride, int height)
150 MC_avg_y_16_c(dest, ref, stride, height);
153 static void MC_avg_xy_16_arm (uint8_t * dest, const uint8_t * ref,
154 int stride, int height)
156 MC_avg_xy_16_c(dest, ref, stride, height);
159 static void MC_avg_o_8_arm (uint8_t * dest, const uint8_t * ref,
160 int stride, int height)
162 MC_avg_o_8_c(dest, ref, stride, height);
165 static void MC_avg_x_8_arm (uint8_t * dest, const uint8_t * ref,
166 int stride, int height)
168 MC_avg_x_8_c(dest, ref, stride, height);
171 static void MC_avg_y_8_arm (uint8_t * dest, const uint8_t * ref,
172 int stride, int height)
174 MC_avg_y_8_c(dest, ref, stride, height);
177 static void MC_avg_xy_8_arm (uint8_t * dest, const uint8_t * ref,
178 int stride, int height)
180 MC_avg_xy_8_c(dest, ref, stride, height);
183 MPEG2_MC_EXTERN (arm)
185 #endif