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 this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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) \
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); \
72 static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, \
73 const int stride, int height) \
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); \
88 /* definitions of the actual mc functions */
100 extern void MC_put_o_16_arm (uint8_t * dest
, const uint8_t * ref
,
101 int stride
, int height
);
103 extern void MC_put_x_16_arm (uint8_t * dest
, const uint8_t * ref
,
104 int stride
, int height
);
107 static void MC_put_y_16_arm (uint8_t * dest
, const uint8_t * ref
,
108 int stride
, int height
)
110 MC_put_y_16_c(dest
, ref
, stride
, height
);
113 static void MC_put_xy_16_arm (uint8_t * dest
, const uint8_t * ref
,
114 int stride
, int height
)
116 MC_put_xy_16_c(dest
, ref
, stride
, height
);
119 extern void MC_put_o_8_arm (uint8_t * dest
, const uint8_t * ref
,
120 int stride
, int height
);
122 extern void MC_put_x_8_arm (uint8_t * dest
, const uint8_t * ref
,
123 int stride
, int height
);
125 static void MC_put_y_8_arm (uint8_t * dest
, const uint8_t * ref
,
126 int stride
, int height
)
128 MC_put_y_8_c(dest
, ref
, stride
, height
);
131 static void MC_put_xy_8_arm (uint8_t * dest
, const uint8_t * ref
,
132 int stride
, int height
)
134 MC_put_xy_8_c(dest
, ref
, stride
, height
);
137 static void MC_avg_o_16_arm (uint8_t * dest
, const uint8_t * ref
,
138 int stride
, int height
)
140 MC_avg_o_16_c(dest
, ref
, stride
, height
);
143 static void MC_avg_x_16_arm (uint8_t * dest
, const uint8_t * ref
,
144 int stride
, int height
)
146 MC_avg_x_16_c(dest
, ref
, stride
, height
);
149 static void MC_avg_y_16_arm (uint8_t * dest
, const uint8_t * ref
,
150 int stride
, int height
)
152 MC_avg_y_16_c(dest
, ref
, stride
, height
);
155 static void MC_avg_xy_16_arm (uint8_t * dest
, const uint8_t * ref
,
156 int stride
, int height
)
158 MC_avg_xy_16_c(dest
, ref
, stride
, height
);
161 static void MC_avg_o_8_arm (uint8_t * dest
, const uint8_t * ref
,
162 int stride
, int height
)
164 MC_avg_o_8_c(dest
, ref
, stride
, height
);
167 static void MC_avg_x_8_arm (uint8_t * dest
, const uint8_t * ref
,
168 int stride
, int height
)
170 MC_avg_x_8_c(dest
, ref
, stride
, height
);
173 static void MC_avg_y_8_arm (uint8_t * dest
, const uint8_t * ref
,
174 int stride
, int height
)
176 MC_avg_y_8_c(dest
, ref
, stride
, height
);
179 static void MC_avg_xy_8_arm (uint8_t * dest
, const uint8_t * ref
,
180 int stride
, int height
)
182 MC_avg_xy_8_c(dest
, ref
, stride
, height
);
185 MPEG2_MC_EXTERN (arm
)