annotate libmpeg2/motion_comp_alpha.c @ 10910:eb339c10228e

Lol! This command will try to change xfer_mode, and not a cdrom spin speed. Removed.
author lumag
date Sun, 21 Sep 2003 12:59:13 +0000
parents 89b48bc6c441
children d0a8810e155c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
1 /*
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
2 * motion_comp_alpha.c
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
3 * Copyright (C) 2002 Falk Hueffner <falk@debian.org>
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
4 *
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
5 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
6 * See http://libmpeg2.sourceforge.net/ for updates.
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
7 *
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
8 * mpeg2dec is free software; you can redistribute it and/or modify
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
11 * (at your option) any later version.
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
12 *
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
13 * mpeg2dec is distributed in the hope that it will be useful,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
16 * GNU General Public License for more details.
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
17 *
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
21 */
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
22
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
23 #include "config.h"
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
24
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
25 #ifdef ARCH_ALPHA
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
26
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
27 #include <inttypes.h>
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
28
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
29 #include "mpeg2.h"
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
30 #include "mpeg2_internal.h"
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
31 #include "alpha_asm.h"
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
32
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
33 static inline uint64_t avg2(uint64_t a, uint64_t b)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
34 {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
35 return (a | b) - (((a ^ b) & BYTE_VEC(0xfe)) >> 1);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
36 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
37
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
38 // Load two unaligned quadwords from addr. This macro only works if
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
39 // addr is actually unaligned.
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
40 #define ULOAD16(ret_l, ret_r, addr) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
41 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
42 uint64_t _l = ldq_u(addr + 0); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
43 uint64_t _m = ldq_u(addr + 8); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
44 uint64_t _r = ldq_u(addr + 16); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
45 ret_l = extql(_l, addr) | extqh(_m, addr); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
46 ret_r = extql(_m, addr) | extqh(_r, addr); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
47 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
48
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
49 // Load two aligned quadwords from addr.
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
50 #define ALOAD16(ret_l, ret_r, addr) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
51 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
52 ret_l = ldq(addr); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
53 ret_r = ldq(addr + 8); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
54 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
55
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
56 #define OP8(LOAD, LOAD16, STORE) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
57 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
58 STORE(LOAD(pixels), block); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
59 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
60 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
61 } while (--h)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
62
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
63 #define OP16(LOAD, LOAD16, STORE) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
64 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
65 uint64_t l, r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
66 LOAD16(l, r, pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
67 STORE(l, block); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
68 STORE(r, block + 8); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
69 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
70 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
71 } while (--h)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
72
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
73 #define OP8_X2(LOAD, LOAD16, STORE) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
74 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
75 uint64_t p0, p1; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
76 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
77 p0 = LOAD(pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
78 p1 = p0 >> 8 | ((uint64_t) pixels[8] << 56); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
79 STORE(avg2(p0, p1), block); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
80 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
81 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
82 } while (--h)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
83
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
84 #define OP16_X2(LOAD, LOAD16, STORE) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
85 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
86 uint64_t p0, p1; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
87 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
88 LOAD16(p0, p1, pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
89 STORE(avg2(p0, p0 >> 8 | p1 << 56), block); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
90 STORE(avg2(p1, p1 >> 8 | (uint64_t) pixels[16] << 56), \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
91 block + 8); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
92 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
93 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
94 } while (--h)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
95
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
96 #define OP8_Y2(LOAD, LOAD16, STORE) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
97 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
98 uint64_t p0, p1; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
99 p0 = LOAD(pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
100 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
101 p1 = LOAD(pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
102 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
103 uint64_t av = avg2(p0, p1); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
104 if (--h == 0) line_size = 0; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
105 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
106 p0 = p1; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
107 p1 = LOAD(pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
108 STORE(av, block); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
109 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
110 } while (h); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
111 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
112
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
113 #define OP16_Y2(LOAD, LOAD16, STORE) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
114 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
115 uint64_t p0l, p0r, p1l, p1r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
116 LOAD16(p0l, p0r, pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
117 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
118 LOAD16(p1l, p1r, pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
119 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
120 uint64_t avl, avr; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
121 if (--h == 0) line_size = 0; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
122 avl = avg2(p0l, p1l); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
123 avr = avg2(p0r, p1r); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
124 p0l = p1l; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
125 p0r = p1r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
126 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
127 LOAD16(p1l, p1r, pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
128 STORE(avl, block); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
129 STORE(avr, block + 8); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
130 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
131 } while (h); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
132 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
133
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
134 #define OP8_XY2(LOAD, LOAD16, STORE) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
135 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
136 uint64_t pl, ph; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
137 uint64_t p1 = LOAD(pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
138 uint64_t p2 = p1 >> 8 | ((uint64_t) pixels[8] << 56); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
139 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
140 ph = ((p1 & ~BYTE_VEC(0x03)) >> 2) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
141 + ((p2 & ~BYTE_VEC(0x03)) >> 2); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
142 pl = (p1 & BYTE_VEC(0x03)) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
143 + (p2 & BYTE_VEC(0x03)); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
144 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
145 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
146 uint64_t npl, nph; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
147 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
148 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
149 p1 = LOAD(pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
150 p2 = (p1 >> 8) | ((uint64_t) pixels[8] << 56); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
151 nph = ((p1 & ~BYTE_VEC(0x03)) >> 2) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
152 + ((p2 & ~BYTE_VEC(0x03)) >> 2); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
153 npl = (p1 & BYTE_VEC(0x03)) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
154 + (p2 & BYTE_VEC(0x03)); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
155 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
156 STORE(ph + nph \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
157 + (((pl + npl + BYTE_VEC(0x02)) >> 2) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
158 & BYTE_VEC(0x03)), block); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
159 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
160 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
161 pl = npl; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
162 ph = nph; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
163 } while (--h); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
164 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
165
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
166 #define OP16_XY2(LOAD, LOAD16, STORE) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
167 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
168 uint64_t p0, p1, p2, p3, pl_l, ph_l, pl_r, ph_r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
169 LOAD16(p0, p2, pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
170 p1 = p0 >> 8 | (p2 << 56); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
171 p3 = p2 >> 8 | ((uint64_t) pixels[16] << 56); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
172 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
173 ph_l = ((p0 & ~BYTE_VEC(0x03)) >> 2) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
174 + ((p1 & ~BYTE_VEC(0x03)) >> 2); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
175 pl_l = (p0 & BYTE_VEC(0x03)) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
176 + (p1 & BYTE_VEC(0x03)); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
177 ph_r = ((p2 & ~BYTE_VEC(0x03)) >> 2) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
178 + ((p3 & ~BYTE_VEC(0x03)) >> 2); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
179 pl_r = (p2 & BYTE_VEC(0x03)) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
180 + (p3 & BYTE_VEC(0x03)); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
181 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
182 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
183 uint64_t npl_l, nph_l, npl_r, nph_r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
184 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
185 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
186 LOAD16(p0, p2, pixels); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
187 p1 = p0 >> 8 | (p2 << 56); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
188 p3 = p2 >> 8 | ((uint64_t) pixels[16] << 56); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
189 nph_l = ((p0 & ~BYTE_VEC(0x03)) >> 2) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
190 + ((p1 & ~BYTE_VEC(0x03)) >> 2); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
191 npl_l = (p0 & BYTE_VEC(0x03)) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
192 + (p1 & BYTE_VEC(0x03)); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
193 nph_r = ((p2 & ~BYTE_VEC(0x03)) >> 2) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
194 + ((p3 & ~BYTE_VEC(0x03)) >> 2); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
195 npl_r = (p2 & BYTE_VEC(0x03)) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
196 + (p3 & BYTE_VEC(0x03)); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
197 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
198 STORE(ph_l + nph_l \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
199 + (((pl_l + npl_l + BYTE_VEC(0x02)) >> 2) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
200 & BYTE_VEC(0x03)), block); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
201 STORE(ph_r + nph_r \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
202 + (((pl_r + npl_r + BYTE_VEC(0x02)) >> 2) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
203 & BYTE_VEC(0x03)), block + 8); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
204 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
205 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
206 pl_l = npl_l; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
207 ph_l = nph_l; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
208 pl_r = npl_r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
209 ph_r = nph_r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
210 } while (--h); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
211 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
212
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
213 #define MAKE_OP(OPNAME, SIZE, SUFF, OPKIND, STORE) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
214 static void MC_ ## OPNAME ## _ ## SUFF ## _ ## SIZE ## _alpha \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
215 (uint8_t *restrict block, const uint8_t *restrict pixels, \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
216 int line_size, int h) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
217 { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
218 if ((uint64_t) pixels & 0x7) { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
219 OPKIND(uldq, ULOAD16, STORE); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
220 } else { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
221 OPKIND(ldq, ALOAD16, STORE); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
222 } \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
223 }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
224
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
225 #define PIXOP(OPNAME, STORE) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
226 MAKE_OP(OPNAME, 8, o, OP8, STORE); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
227 MAKE_OP(OPNAME, 8, x, OP8_X2, STORE); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
228 MAKE_OP(OPNAME, 8, y, OP8_Y2, STORE); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
229 MAKE_OP(OPNAME, 8, xy, OP8_XY2, STORE); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
230 MAKE_OP(OPNAME, 16, o, OP16, STORE); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
231 MAKE_OP(OPNAME, 16, x, OP16_X2, STORE); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
232 MAKE_OP(OPNAME, 16, y, OP16_Y2, STORE); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
233 MAKE_OP(OPNAME, 16, xy, OP16_XY2, STORE);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
234
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
235 #define STORE(l, b) stq(l, b)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
236 PIXOP(put, STORE);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
237
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
238 #undef STORE
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
239 #define STORE(l, b) stq(avg2(l, ldq(b)), b);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
240 PIXOP(avg, STORE);
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
241
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
242 mpeg2_mc_t mpeg2_mc_alpha = {
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
243 { MC_put_o_16_alpha, MC_put_x_16_alpha,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
244 MC_put_y_16_alpha, MC_put_xy_16_alpha,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
245 MC_put_o_8_alpha, MC_put_x_8_alpha,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
246 MC_put_y_8_alpha, MC_put_xy_8_alpha },
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
247 { MC_avg_o_16_alpha, MC_avg_x_16_alpha,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
248 MC_avg_y_16_alpha, MC_avg_xy_16_alpha,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
249 MC_avg_o_8_alpha, MC_avg_x_8_alpha,
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
250 MC_avg_y_8_alpha, MC_avg_xy_8_alpha }
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
251 };
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
252
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
253 #endif