annotate libmpeg2/motion_comp_alpha.c @ 35677:539f3d45dcf5

Cosmetic: Adjust indent.
author ib
date Thu, 17 Jan 2013 17:36:16 +0000
parents 25337a2147e7
children
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
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
3 * Copyright (C) 2002-2003 Falk Hueffner <falk@debian.org>
9857
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
28290
25337a2147e7 Lots and lots of #ifdef ARCH_... -> #if ARCH_...
reimar
parents: 12932
diff changeset
25 #if ARCH_ALPHA
9857
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"
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
30 #include "attributes.h"
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
31 #include "mpeg2_internal.h"
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
32 #include "alpha_asm.h"
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
33
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
34 static inline uint64_t avg2 (uint64_t a, uint64_t b)
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
35 {
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
36 return (a | b) - (((a ^ b) & BYTE_VEC (0xfe)) >> 1);
9857
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
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
39 // Load two unaligned quadwords from addr. This macro only works if
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
40 // addr is actually unaligned.
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
41 #define ULOAD16(ret_l,ret_r,addr) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
42 do { \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
43 uint64_t _l = ldq_u (addr + 0); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
44 uint64_t _m = ldq_u (addr + 8); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
45 uint64_t _r = ldq_u (addr + 16); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
46 ret_l = extql (_l, addr) | extqh (_m, addr); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
47 ret_r = extql (_m, addr) | extqh (_r, addr); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
48 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
49
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
50 // Load two aligned quadwords from addr.
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
51 #define ALOAD16(ret_l,ret_r,addr) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
52 do { \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
53 ret_l = ldq (addr); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
54 ret_r = ldq (addr + 8); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
55 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
56
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
57 #define OP8(LOAD,LOAD16,STORE) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
58 do { \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
59 STORE (LOAD (pixels), block); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
60 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
61 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
62 } while (--h)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
63
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
64 #define OP16(LOAD,LOAD16,STORE) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
65 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
66 uint64_t l, r; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
67 LOAD16 (l, r, pixels); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
68 STORE (l, block); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
69 STORE (r, block + 8); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
70 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
71 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
72 } while (--h)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
73
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
74 #define OP8_X2(LOAD,LOAD16,STORE) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
75 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
76 uint64_t p0, p1; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
77 \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
78 p0 = LOAD (pixels); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
79 p1 = p0 >> 8 | ((uint64_t) pixels[8] << 56); \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
80 STORE (avg2 (p0, p1), block); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
81 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
82 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
83 } while (--h)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
84
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
85 #define OP16_X2(LOAD,LOAD16,STORE) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
86 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
87 uint64_t p0, p1; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
88 \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
89 LOAD16 (p0, p1, pixels); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
90 STORE (avg2(p0, p0 >> 8 | p1 << 56), block); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
91 STORE (avg2(p1, p1 >> 8 | (uint64_t) pixels[16] << 56), \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
92 block + 8); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
93 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
94 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
95 } while (--h)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
96
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
97 #define OP8_Y2(LOAD,LOAD16,STORE) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
98 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
99 uint64_t p0, p1; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
100 p0 = LOAD (pixels); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
101 pixels += line_size; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
102 p1 = LOAD (pixels); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
103 do { \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
104 uint64_t av = avg2 (p0, p1); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
105 if (--h == 0) line_size = 0; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
106 pixels += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
107 p0 = p1; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
108 p1 = LOAD (pixels); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
109 STORE (av, block); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
110 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
111 } while (h); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
112 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
113
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
114 #define OP16_Y2(LOAD,LOAD16,STORE) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
115 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
116 uint64_t p0l, p0r, p1l, p1r; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
117 LOAD16 (p0l, p0r, pixels); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
118 pixels += line_size; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
119 LOAD16 (p1l, p1r, pixels); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
120 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
121 uint64_t avl, avr; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
122 if (--h == 0) line_size = 0; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
123 avl = avg2 (p0l, p1l); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
124 avr = avg2 (p0r, p1r); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
125 p0l = p1l; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
126 p0r = p1r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
127 pixels += line_size; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
128 LOAD16 (p1l, p1r, pixels); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
129 STORE (avl, block); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
130 STORE (avr, block + 8); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
131 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
132 } while (h); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
133 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
134
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
135 #define OP8_XY2(LOAD,LOAD16,STORE) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
136 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
137 uint64_t pl, ph; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
138 uint64_t p1 = LOAD (pixels); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
139 uint64_t p2 = p1 >> 8 | ((uint64_t) pixels[8] << 56); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
140 \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
141 ph = (((p1 & ~BYTE_VEC (0x03)) >> 2) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
142 ((p2 & ~BYTE_VEC (0x03)) >> 2)); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
143 pl = ((p1 & BYTE_VEC (0x03)) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
144 (p2 & BYTE_VEC (0x03))); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
145 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
146 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
147 uint64_t npl, nph; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
148 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
149 pixels += line_size; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
150 p1 = LOAD (pixels); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
151 p2 = (p1 >> 8) | ((uint64_t) pixels[8] << 56); \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
152 nph = (((p1 & ~BYTE_VEC (0x03)) >> 2) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
153 ((p2 & ~BYTE_VEC (0x03)) >> 2)); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
154 npl = ((p1 & BYTE_VEC (0x03)) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
155 (p2 & BYTE_VEC (0x03))); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
156 \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
157 STORE (ph + nph + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
158 (((pl + npl + BYTE_VEC (0x02)) >> 2) & \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
159 BYTE_VEC (0x03)), block); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
160 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
161 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
162 pl = npl; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
163 ph = nph; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
164 } while (--h); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
165 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
166
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
167 #define OP16_XY2(LOAD,LOAD16,STORE) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
168 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
169 uint64_t p0, p1, p2, p3, pl_l, ph_l, pl_r, ph_r; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
170 LOAD16 (p0, p2, pixels); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
171 p1 = p0 >> 8 | (p2 << 56); \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
172 p3 = p2 >> 8 | ((uint64_t)pixels[16] << 56); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
173 \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
174 ph_l = (((p0 & ~BYTE_VEC (0x03)) >> 2) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
175 ((p1 & ~BYTE_VEC (0x03)) >> 2)); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
176 pl_l = ((p0 & BYTE_VEC (0x03)) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
177 (p1 & BYTE_VEC(0x03))); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
178 ph_r = (((p2 & ~BYTE_VEC (0x03)) >> 2) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
179 ((p3 & ~BYTE_VEC (0x03)) >> 2)); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
180 pl_r = ((p2 & BYTE_VEC (0x03)) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
181 (p3 & BYTE_VEC (0x03))); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
182 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
183 do { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
184 uint64_t npl_l, nph_l, npl_r, nph_r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
185 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
186 pixels += line_size; \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
187 LOAD16 (p0, p2, pixels); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
188 p1 = p0 >> 8 | (p2 << 56); \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
189 p3 = p2 >> 8 | ((uint64_t)pixels[16] << 56); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
190 nph_l = (((p0 & ~BYTE_VEC (0x03)) >> 2) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
191 ((p1 & ~BYTE_VEC (0x03)) >> 2)); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
192 npl_l = ((p0 & BYTE_VEC (0x03)) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
193 (p1 & BYTE_VEC (0x03))); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
194 nph_r = (((p2 & ~BYTE_VEC (0x03)) >> 2) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
195 ((p3 & ~BYTE_VEC (0x03)) >> 2)); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
196 npl_r = ((p2 & BYTE_VEC (0x03)) + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
197 (p3 & BYTE_VEC (0x03))); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
198 \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
199 STORE (ph_l + nph_l + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
200 (((pl_l + npl_l + BYTE_VEC (0x02)) >> 2) & \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
201 BYTE_VEC(0x03)), block); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
202 STORE (ph_r + nph_r + \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
203 (((pl_r + npl_r + BYTE_VEC (0x02)) >> 2) & \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
204 BYTE_VEC(0x03)), block + 8); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
205 \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
206 block += line_size; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
207 pl_l = npl_l; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
208 ph_l = nph_l; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
209 pl_r = npl_r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
210 ph_r = nph_r; \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
211 } while (--h); \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
212 } while (0)
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
213
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
214 #define MAKE_OP(OPNAME,SIZE,SUFF,OPKIND,STORE) \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
215 static void MC_ ## OPNAME ## _ ## SUFF ## _ ## SIZE ## _alpha \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
216 (uint8_t *restrict block, const uint8_t *restrict pixels, \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
217 int line_size, int h) \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
218 { \
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
219 if ((uint64_t) pixels & 0x7) { \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
220 OPKIND (uldq, ULOAD16, STORE); \
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
221 } else { \
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
222 OPKIND (ldq, ALOAD16, STORE); \
9857
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
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
226 #define PIXOP(OPNAME,STORE) \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
227 MAKE_OP (OPNAME, 8, o, OP8, STORE); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
228 MAKE_OP (OPNAME, 8, x, OP8_X2, STORE); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
229 MAKE_OP (OPNAME, 8, y, OP8_Y2, STORE); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
230 MAKE_OP (OPNAME, 8, xy, OP8_XY2, STORE); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
231 MAKE_OP (OPNAME, 16, o, OP16, STORE); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
232 MAKE_OP (OPNAME, 16, x, OP16_X2, STORE); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
233 MAKE_OP (OPNAME, 16, y, OP16_Y2, STORE); \
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
234 MAKE_OP (OPNAME, 16, xy, OP16_XY2, STORE);
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
235
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
236 #define STORE(l,b) stq (l, b)
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
237 PIXOP (put, STORE);
9857
89b48bc6c441 Importing libmpeg2 from mpeg2dec-0.3.1
arpi
parents:
diff changeset
238 #undef STORE
12932
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
239 #define STORE(l,b) stq (avg2 (l, ldq (b)), b);
d0a8810e155c Importing libmpeg2 from mpeg2dec-0.4.0b
henry
parents: 9857
diff changeset
240 PIXOP (avg, STORE);
9857
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