diff options
Diffstat (limited to 'apps/plugins/mpegplayer/motion_comp.h')
-rw-r--r-- | apps/plugins/mpegplayer/motion_comp.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/apps/plugins/mpegplayer/motion_comp.h b/apps/plugins/mpegplayer/motion_comp.h new file mode 100644 index 0000000000..2823cc6da1 --- /dev/null +++ b/apps/plugins/mpegplayer/motion_comp.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | * motion_comp.h | ||
3 | * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org> | ||
4 | * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> | ||
5 | * | ||
6 | * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. | ||
7 | * See http://libmpeg2.sourceforge.net/ for updates. | ||
8 | * | ||
9 | * mpeg2dec is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * mpeg2dec is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | |||
25 | #define avg2(a,b) ((a+b+1)>>1) | ||
26 | #define avg4(a,b,c,d) ((a+b+c+d+2)>>2) | ||
27 | |||
28 | #define predict_o(i) (ref[i]) | ||
29 | #define predict_x(i) (avg2 (ref[i], ref[i+1])) | ||
30 | #define predict_y(i) (avg2 (ref[i], (ref+stride)[i])) | ||
31 | #define predict_xy(i) (avg4 (ref[i], ref[i+1], \ | ||
32 | (ref+stride)[i], (ref+stride)[i+1])) | ||
33 | |||
34 | #define put(predictor,i) dest[i] = predictor (i) | ||
35 | #define avg(predictor,i) dest[i] = avg2 (predictor (i), dest[i]) | ||
36 | |||
37 | /* mc function template */ | ||
38 | #define MC_FUNC(op, xy) \ | ||
39 | MC_FUNC_16(op, xy) \ | ||
40 | MC_FUNC_8(op, xy) | ||
41 | |||
42 | #define MC_FUNC_16(op, xy) \ | ||
43 | void MC_##op##_##xy##_16 (uint8_t * dest, const uint8_t * ref, \ | ||
44 | const int stride, int height) \ | ||
45 | { \ | ||
46 | do { \ | ||
47 | op (predict_##xy, 0); \ | ||
48 | op (predict_##xy, 1); \ | ||
49 | op (predict_##xy, 2); \ | ||
50 | op (predict_##xy, 3); \ | ||
51 | op (predict_##xy, 4); \ | ||
52 | op (predict_##xy, 5); \ | ||
53 | op (predict_##xy, 6); \ | ||
54 | op (predict_##xy, 7); \ | ||
55 | op (predict_##xy, 8); \ | ||
56 | op (predict_##xy, 9); \ | ||
57 | op (predict_##xy, 10); \ | ||
58 | op (predict_##xy, 11); \ | ||
59 | op (predict_##xy, 12); \ | ||
60 | op (predict_##xy, 13); \ | ||
61 | op (predict_##xy, 14); \ | ||
62 | op (predict_##xy, 15); \ | ||
63 | ref += stride; \ | ||
64 | dest += stride; \ | ||
65 | } while (--height); \ | ||
66 | } | ||
67 | |||
68 | #define MC_FUNC_8(op, xy) \ | ||
69 | void MC_##op##_##xy##_8 (uint8_t * dest, const uint8_t * ref, \ | ||
70 | const int stride, int height) \ | ||
71 | { \ | ||
72 | do { \ | ||
73 | op (predict_##xy, 0); \ | ||
74 | op (predict_##xy, 1); \ | ||
75 | op (predict_##xy, 2); \ | ||
76 | op (predict_##xy, 3); \ | ||
77 | op (predict_##xy, 4); \ | ||
78 | op (predict_##xy, 5); \ | ||
79 | op (predict_##xy, 6); \ | ||
80 | op (predict_##xy, 7); \ | ||
81 | ref += stride; \ | ||
82 | dest += stride; \ | ||
83 | } while (--height); \ | ||
84 | } | ||