1 |
|
// 04.10.2002 added qpel support to MBMotionCompensation |
2 |
// 01.05.2002 updated MBMotionCompensationBVOP |
// 01.05.2002 updated MBMotionCompensationBVOP |
3 |
// 14.04.2002 bframe compensation |
// 14.04.2002 bframe compensation |
4 |
|
|
11 |
#define ABS(X) (((X)>0)?(X):-(X)) |
#define ABS(X) (((X)>0)?(X):-(X)) |
12 |
#define SIGN(X) (((X)>0)?1:-1) |
#define SIGN(X) (((X)>0)?1:-1) |
13 |
|
|
14 |
|
|
15 |
static __inline void |
static __inline void |
16 |
compensate8x8_halfpel(int16_t * const dct_codes, |
compensate8x8_interpolate(int16_t * const dct_codes, |
17 |
uint8_t * const cur, |
uint8_t * const cur, |
18 |
const uint8_t * const ref, |
const uint8_t * const ref, |
19 |
const uint8_t * const refh, |
const uint8_t * const refh, |
22 |
const uint32_t x, |
const uint32_t x, |
23 |
const uint32_t y, |
const uint32_t y, |
24 |
const int32_t dx, |
const int32_t dx, |
25 |
const int dy, |
const int32_t dy, |
26 |
const uint32_t stride) |
const uint32_t stride, |
27 |
{ |
const uint32_t quarterpel, |
28 |
int32_t ddx, ddy; |
const uint32_t rounding) |
|
|
|
|
switch (((dx & 1) << 1) + (dy & 1)) // ((dx%2)?2:0)+((dy%2)?1:0) |
|
29 |
{ |
{ |
30 |
case 0: |
if(quarterpel) { |
31 |
ddx = dx / 2; |
interpolate8x8_quarterpel((uint8_t *) refv, (uint8_t *) ref, (uint8_t *) refh, |
32 |
ddy = dy / 2; |
(uint8_t *) refh + 64, (uint8_t *) refhv, x, y, dx, dy, stride, rounding); |
|
transfer_8to16sub(dct_codes, cur + y * stride + x, |
|
|
ref + (int) ((y + ddy) * stride + x + ddx), stride); |
|
|
break; |
|
|
|
|
|
case 1: |
|
|
ddx = dx / 2; |
|
|
ddy = (dy - 1) / 2; |
|
|
transfer_8to16sub(dct_codes, cur + y * stride + x, |
|
|
refv + (int) ((y + ddy) * stride + x + ddx), stride); |
|
|
break; |
|
33 |
|
|
|
case 2: |
|
|
ddx = (dx - 1) / 2; |
|
|
ddy = dy / 2; |
|
34 |
transfer_8to16sub(dct_codes, cur + y * stride + x, |
transfer_8to16sub(dct_codes, cur + y * stride + x, |
35 |
refh + (int) ((y + ddy) * stride + x + ddx), stride); |
refv + y*stride + x, stride); |
36 |
break; |
} |
37 |
|
else |
38 |
|
{ |
39 |
|
const uint8_t * reference; |
40 |
|
|
41 |
|
switch (((dx & 1) << 1) + (dy & 1)) // ((dx%2)?2:0)+((dy%2)?1:0) |
42 |
|
{ |
43 |
|
case 0: reference = ref + ((y + dy / 2) * stride + x + dx / 2); break; |
44 |
|
case 1: reference = refv + ((y + (dy-1) / 2) * stride + x + dx / 2); break; |
45 |
|
case 2: reference = refh + ((y + dy / 2) * stride + x + (dx-1) / 2); break; |
46 |
default: // case 3: |
default: // case 3: |
47 |
ddx = (dx - 1) / 2; |
reference = refhv + ((y + (dy-1) / 2) * stride + x + (dx-1) / 2); break; |
48 |
ddy = (dy - 1) / 2; |
} |
49 |
transfer_8to16sub(dct_codes, cur + y * stride + x, |
transfer_8to16sub(dct_codes, cur + y * stride + x, |
50 |
refhv + (int) ((y + ddy) * stride + x + ddx), stride); |
reference, stride); |
|
break; |
|
51 |
} |
} |
52 |
} |
} |
53 |
|
|
|
|
|
|
|
|
54 |
void |
void |
55 |
MBMotionCompensation(MACROBLOCK * const mb, |
MBMotionCompensation(MACROBLOCK * const mb, |
56 |
const uint32_t i, |
const uint32_t i, |
64 |
const uint32_t width, |
const uint32_t width, |
65 |
const uint32_t height, |
const uint32_t height, |
66 |
const uint32_t edged_width, |
const uint32_t edged_width, |
67 |
|
const uint32_t quarterpel, |
68 |
const uint32_t rounding) |
const uint32_t rounding) |
69 |
{ |
{ |
70 |
static const uint32_t roundtab[16] = |
if (mb->mode == MODE_NOT_CODED) { |
71 |
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 }; |
transfer8x8_copy(cur->y + 16 * (i + j * edged_width), |
72 |
|
ref->y + 16 * (i + j * edged_width), |
73 |
|
edged_width); |
74 |
|
transfer8x8_copy(cur->y + 16 * (i + j * edged_width) + 8, |
75 |
|
ref->y + 16 * (i + j * edged_width) + 8, |
76 |
|
edged_width); |
77 |
|
transfer8x8_copy(cur->y + 16 * (i + j * edged_width) + 8 * edged_width, |
78 |
|
ref->y + 16 * (i + j * edged_width) + 8 * edged_width, |
79 |
|
edged_width); |
80 |
|
transfer8x8_copy(cur->y + 16 * (i + j * edged_width) + 8 * (edged_width+1), |
81 |
|
ref->y + 16 * (i + j * edged_width) + 8 * (edged_width+1), |
82 |
|
edged_width); |
83 |
|
|
84 |
|
transfer8x8_copy(cur->u + 8 * (i + j * edged_width/2), |
85 |
|
ref->u + 8 * (i + j * edged_width/2), |
86 |
|
edged_width / 2); |
87 |
|
transfer8x8_copy(cur->v + 8 * (i + j * edged_width/2), |
88 |
|
ref->v + 8 * (i + j * edged_width/2), |
89 |
|
edged_width / 2); |
90 |
|
return; |
91 |
|
} |
92 |
|
|
93 |
if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) { |
if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) { |
94 |
int32_t dx = mb->mvs[0].x; |
int32_t dx = mb->mvs[0].x; |
95 |
int32_t dy = mb->mvs[0].y; |
int32_t dy = mb->mvs[0].y; |
96 |
|
|
97 |
compensate8x8_halfpel(&dct_codes[0 * 64], cur->y, ref->y, refh->y, |
if(quarterpel) { |
98 |
|
dx = mb->qmvs[0].x; |
99 |
|
dy = mb->qmvs[0].y; |
100 |
|
} |
101 |
|
|
102 |
|
compensate8x8_interpolate(&dct_codes[0 * 64], cur->y, ref->y, refh->y, |
103 |
refv->y, refhv->y, 16 * i, 16 * j, dx, dy, |
refv->y, refhv->y, 16 * i, 16 * j, dx, dy, |
104 |
edged_width); |
edged_width, quarterpel, rounding); |
105 |
compensate8x8_halfpel(&dct_codes[1 * 64], cur->y, ref->y, refh->y, |
compensate8x8_interpolate(&dct_codes[1 * 64], cur->y, ref->y, refh->y, |
106 |
refv->y, refhv->y, 16 * i + 8, 16 * j, dx, dy, |
refv->y, refhv->y, 16 * i + 8, 16 * j, dx, dy, |
107 |
edged_width); |
edged_width, quarterpel, rounding); |
108 |
compensate8x8_halfpel(&dct_codes[2 * 64], cur->y, ref->y, refh->y, |
compensate8x8_interpolate(&dct_codes[2 * 64], cur->y, ref->y, refh->y, |
109 |
refv->y, refhv->y, 16 * i, 16 * j + 8, dx, dy, |
refv->y, refhv->y, 16 * i, 16 * j + 8, dx, dy, |
110 |
edged_width); |
edged_width, quarterpel, rounding); |
111 |
compensate8x8_halfpel(&dct_codes[3 * 64], cur->y, ref->y, refh->y, |
compensate8x8_interpolate(&dct_codes[3 * 64], cur->y, ref->y, refh->y, |
112 |
refv->y, refhv->y, 16 * i + 8, 16 * j + 8, dx, |
refv->y, refhv->y, 16 * i + 8, 16 * j + 8, dx, |
113 |
dy, edged_width); |
dy, edged_width, quarterpel, rounding); |
114 |
|
|
115 |
|
if (quarterpel) |
116 |
|
{ |
117 |
|
dx = (dx >> 1) | (dx & 1); |
118 |
|
dy = (dy >> 1) | (dy & 1); |
119 |
|
} |
120 |
|
|
121 |
dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2; |
dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2; |
122 |
dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2; |
dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2; |
123 |
|
|
|
/* uv-image-based compensation */ |
|
|
#ifdef BFRAMES |
|
|
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, ref->u, refh->u, |
|
|
refv->u, refhv->u, 8 * i, 8 * j, dx, dy, |
|
|
edged_width / 2); |
|
|
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, ref->v, refh->v, |
|
|
refv->v, refhv->v, 8 * i, 8 * j, dx, dy, |
|
|
edged_width / 2); |
|
|
#else |
|
124 |
/* uv-block-based compensation */ |
/* uv-block-based compensation */ |
|
interpolate8x8_switch(refv->u, ref->u, 8 * i, 8 * j, dx, dy, |
|
|
edged_width / 2, rounding); |
|
125 |
transfer_8to16sub(&dct_codes[4 * 64], |
transfer_8to16sub(&dct_codes[4 * 64], |
126 |
cur->u + 8 * j * edged_width / 2 + 8 * i, |
cur->u + 8 * j * edged_width / 2 + 8 * i, |
127 |
refv->u + 8 * j * edged_width / 2 + 8 * i, |
interpolate8x8_switch2(refv->u, ref->u, 8 * i, 8 * j, |
128 |
|
dx, dy, edged_width / 2, rounding), |
129 |
edged_width / 2); |
edged_width / 2); |
130 |
|
|
|
interpolate8x8_switch(refv->v, ref->v, 8 * i, 8 * j, dx, dy, |
|
|
edged_width / 2, rounding); |
|
131 |
transfer_8to16sub(&dct_codes[5 * 64], |
transfer_8to16sub(&dct_codes[5 * 64], |
132 |
cur->v + 8 * j * edged_width / 2 + 8 * i, |
cur->v + 8 * j * edged_width / 2 + 8 * i, |
133 |
refv->v + 8 * j * edged_width / 2 + 8 * i, |
interpolate8x8_switch2(refv->u, ref->v, 8 * i, 8 * j, |
134 |
|
dx, dy, edged_width / 2, rounding), |
135 |
edged_width / 2); |
edged_width / 2); |
136 |
#endif |
|
137 |
} else // mode == MODE_INTER4V |
} else { // mode == MODE_INTER4V |
|
{ |
|
138 |
int32_t sum, dx, dy; |
int32_t sum, dx, dy; |
139 |
|
VECTOR *mvs; |
140 |
|
|
141 |
compensate8x8_halfpel(&dct_codes[0 * 64], cur->y, ref->y, refh->y, |
if(quarterpel) |
142 |
refv->y, refhv->y, 16 * i, 16 * j, mb->mvs[0].x, |
mvs = mb->qmvs; |
143 |
mb->mvs[0].y, edged_width); |
else |
144 |
compensate8x8_halfpel(&dct_codes[1 * 64], cur->y, ref->y, refh->y, |
mvs = mb->mvs; |
145 |
|
|
146 |
|
compensate8x8_interpolate(&dct_codes[0 * 64], cur->y, ref->y, refh->y, |
147 |
|
refv->y, refhv->y, 16 * i, 16 * j, mvs[0].x, |
148 |
|
mvs[0].y, edged_width, quarterpel, rounding); |
149 |
|
compensate8x8_interpolate(&dct_codes[1 * 64], cur->y, ref->y, refh->y, |
150 |
refv->y, refhv->y, 16 * i + 8, 16 * j, |
refv->y, refhv->y, 16 * i + 8, 16 * j, |
151 |
mb->mvs[1].x, mb->mvs[1].y, edged_width); |
mvs[1].x, mvs[1].y, edged_width, quarterpel, rounding); |
152 |
compensate8x8_halfpel(&dct_codes[2 * 64], cur->y, ref->y, refh->y, |
compensate8x8_interpolate(&dct_codes[2 * 64], cur->y, ref->y, refh->y, |
153 |
refv->y, refhv->y, 16 * i, 16 * j + 8, |
refv->y, refhv->y, 16 * i, 16 * j + 8, |
154 |
mb->mvs[2].x, mb->mvs[2].y, edged_width); |
mvs[2].x, mvs[2].y, edged_width, quarterpel, rounding); |
155 |
compensate8x8_halfpel(&dct_codes[3 * 64], cur->y, ref->y, refh->y, |
compensate8x8_interpolate(&dct_codes[3 * 64], cur->y, ref->y, refh->y, |
156 |
refv->y, refhv->y, 16 * i + 8, 16 * j + 8, |
refv->y, refhv->y, 16 * i + 8, 16 * j + 8, |
157 |
mb->mvs[3].x, mb->mvs[3].y, edged_width); |
mvs[3].x, mvs[3].y, edged_width, quarterpel, rounding); |
158 |
|
|
159 |
|
sum = mvs[0].x + mvs[1].x + mvs[2].x + mvs[3].x; |
160 |
|
|
161 |
|
if(quarterpel) |
162 |
|
sum /= 2; |
163 |
|
|
|
sum = mb->mvs[0].x + mb->mvs[1].x + mb->mvs[2].x + mb->mvs[3].x; |
|
164 |
dx = (sum ? SIGN(sum) * |
dx = (sum ? SIGN(sum) * |
165 |
(roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0); |
(roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0); |
166 |
|
|
167 |
sum = mb->mvs[0].y + mb->mvs[1].y + mb->mvs[2].y + mb->mvs[3].y; |
sum = mvs[0].y + mvs[1].y + mvs[2].y + mvs[3].y; |
168 |
|
|
169 |
|
if(quarterpel) |
170 |
|
sum /= 2; |
171 |
|
|
172 |
dy = (sum ? SIGN(sum) * |
dy = (sum ? SIGN(sum) * |
173 |
(roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0); |
(roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2) : 0); |
174 |
|
|
|
/* uv-image-based compensation */ |
|
|
#ifdef BFRAMES |
|
|
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, ref->u, refh->u, |
|
|
refv->u, refhv->u, 8 * i, 8 * j, dx, dy, |
|
|
edged_width / 2); |
|
|
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, ref->v, refh->v, |
|
|
refv->v, refhv->v, 8 * i, 8 * j, dx, dy, |
|
|
edged_width / 2); |
|
|
#else |
|
175 |
/* uv-block-based compensation */ |
/* uv-block-based compensation */ |
|
interpolate8x8_switch(refv->u, ref->u, 8 * i, 8 * j, dx, dy, |
|
|
edged_width / 2, rounding); |
|
176 |
transfer_8to16sub(&dct_codes[4 * 64], |
transfer_8to16sub(&dct_codes[4 * 64], |
177 |
cur->u + 8 * j * edged_width / 2 + 8 * i, |
cur->u + 8 * j * edged_width / 2 + 8 * i, |
178 |
refv->u + 8 * j * edged_width / 2 + 8 * i, |
interpolate8x8_switch2(refv->u, ref->u, 8 * i, 8 * j, |
179 |
|
dx, dy, edged_width / 2, rounding), |
180 |
edged_width / 2); |
edged_width / 2); |
181 |
|
|
|
interpolate8x8_switch(refv->v, ref->v, 8 * i, 8 * j, dx, dy, |
|
|
edged_width / 2, rounding); |
|
182 |
transfer_8to16sub(&dct_codes[5 * 64], |
transfer_8to16sub(&dct_codes[5 * 64], |
183 |
cur->v + 8 * j * edged_width / 2 + 8 * i, |
cur->v + 8 * j * edged_width / 2 + 8 * i, |
184 |
refv->v + 8 * j * edged_width / 2 + 8 * i, |
interpolate8x8_switch2(refv->u, ref->v, 8 * i, 8 * j, |
185 |
|
dx, dy, edged_width / 2, rounding), |
186 |
|
|
187 |
edged_width / 2); |
edged_width / 2); |
|
#endif |
|
188 |
} |
} |
189 |
} |
} |
190 |
|
|
221 |
dx = mb->mvs[0].x; |
dx = mb->mvs[0].x; |
222 |
dy = mb->mvs[0].y; |
dy = mb->mvs[0].y; |
223 |
|
|
224 |
transfer_8to16sub_c(&dct_codes[0 * 64], |
transfer_8to16sub(&dct_codes[0 * 64], |
225 |
cur->y + (j * 16) * edged_width + (i * 16), |
cur->y + (j * 16) * edged_width + (i * 16), |
226 |
get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y, |
get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y, |
227 |
i * 16, j * 16, 1, dx, dy, edged_width), |
i * 16, j * 16, 1, dx, dy, edged_width), |
233 |
i * 16 + 8, j * 16, 1, dx, dy, edged_width), |
i * 16 + 8, j * 16, 1, dx, dy, edged_width), |
234 |
edged_width); |
edged_width); |
235 |
|
|
236 |
transfer_8to16sub_c(&dct_codes[2 * 64], |
transfer_8to16sub(&dct_codes[2 * 64], |
237 |
cur->y + (j * 16 + 8) * edged_width + (i * 16), |
cur->y + (j * 16 + 8) * edged_width + (i * 16), |
238 |
get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y, |
get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y, |
239 |
i * 16, j * 16 + 8, 1, dx, dy, |
i * 16, j * 16 + 8, 1, dx, dy, edged_width), |
240 |
edged_width), edged_width); |
edged_width); |
241 |
|
|
242 |
transfer_8to16sub(&dct_codes[3 * 64], |
transfer_8to16sub(&dct_codes[3 * 64], |
243 |
cur->y + (j * 16 + 8) * edged_width + (i * 16 + 8), |
cur->y + (j * 16 + 8) * edged_width + (i * 16 + 8), |
244 |
get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y, |
get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y, |
245 |
i * 16 + 8, j * 16 + 8, 1, dx, dy, |
i * 16 + 8, j * 16 + 8, 1, dx, dy, edged_width), |
246 |
edged_width), edged_width); |
edged_width); |
247 |
|
|
248 |
|
|
249 |
dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2; |
dx = (dx & 3) ? (dx >> 1) | 1 : dx / 2; |
250 |
dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2; |
dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2; |
251 |
|
|
252 |
/* uv-image-based compensation */ |
/* uv-block-based compensation */ |
253 |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, f_ref->u, f_refh->u, |
transfer_8to16sub(&dct_codes[4 * 64], |
254 |
f_refv->u, f_refhv->u, 8 * i, 8 * j, dx, dy, |
cur->u + 8 * j * edged_width / 2 + 8 * i, |
255 |
|
interpolate8x8_switch2(f_refv->u, f_ref->u, 8 * i, 8 * j, |
256 |
|
dx, dy, edged_width / 2, 0), |
257 |
|
|
258 |
edged_width / 2); |
edged_width / 2); |
259 |
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, f_ref->v, f_refh->v, |
|
260 |
f_refv->v, f_refhv->v, 8 * i, 8 * j, dx, dy, |
transfer_8to16sub(&dct_codes[5 * 64], |
261 |
|
cur->v + 8 * j * edged_width / 2 + 8 * i, |
262 |
|
interpolate8x8_switch2(f_refv->u, f_ref->v, 8 * i, 8 * j, |
263 |
|
dx, dy, edged_width / 2, 0), |
264 |
|
|
265 |
edged_width / 2); |
edged_width / 2); |
266 |
|
|
267 |
break; |
break; |
270 |
b_dx = mb->b_mvs[0].x; |
b_dx = mb->b_mvs[0].x; |
271 |
b_dy = mb->b_mvs[0].y; |
b_dy = mb->b_mvs[0].y; |
272 |
|
|
273 |
transfer_8to16sub_c(&dct_codes[0 * 64], |
transfer_8to16sub(&dct_codes[0 * 64], |
274 |
cur->y + (j * 16) * edged_width + (i * 16), |
cur->y + (j * 16) * edged_width + (i * 16), |
275 |
get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y, |
get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y, |
276 |
i * 16, j * 16, 1, b_dx, b_dy, |
i * 16, j * 16, 1, b_dx, b_dy, |
282 |
i * 16 + 8, j * 16, 1, b_dx, b_dy, |
i * 16 + 8, j * 16, 1, b_dx, b_dy, |
283 |
edged_width), edged_width); |
edged_width), edged_width); |
284 |
|
|
285 |
transfer_8to16sub_c(&dct_codes[2 * 64], |
transfer_8to16sub(&dct_codes[2 * 64], |
286 |
cur->y + (j * 16 + 8) * edged_width + (i * 16), |
cur->y + (j * 16 + 8) * edged_width + (i * 16), |
287 |
get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y, |
get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y, |
288 |
i * 16, j * 16 + 8, 1, b_dx, b_dy, |
i * 16, j * 16 + 8, 1, b_dx, b_dy, |
297 |
b_dx = (b_dx & 3) ? (b_dx >> 1) | 1 : b_dx / 2; |
b_dx = (b_dx & 3) ? (b_dx >> 1) | 1 : b_dx / 2; |
298 |
b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2; |
b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2; |
299 |
|
|
300 |
/* uv-image-based compensation */ |
/* uv-block-based compensation */ |
301 |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, b_ref->u, b_refh->u, |
transfer_8to16sub(&dct_codes[4 * 64], |
302 |
b_refv->u, b_refhv->u, 8 * i, 8 * j, b_dx, b_dy, |
cur->u + 8 * j * edged_width / 2 + 8 * i, |
303 |
|
interpolate8x8_switch2(f_refv->u, b_ref->u, 8 * i, 8 * j, |
304 |
|
b_dx, b_dy, edged_width / 2, 0), |
305 |
|
|
306 |
edged_width / 2); |
edged_width / 2); |
307 |
compensate8x8_halfpel(&dct_codes[5 * 64], cur->v, b_ref->v, b_refh->v, |
|
308 |
b_refv->v, b_refhv->v, 8 * i, 8 * j, b_dx, b_dy, |
transfer_8to16sub(&dct_codes[5 * 64], |
309 |
|
cur->v + 8 * j * edged_width / 2 + 8 * i, |
310 |
|
interpolate8x8_switch2(f_refv->u, b_ref->v, 8 * i, 8 * j, |
311 |
|
b_dx, b_dy, edged_width / 2, 0), |
312 |
|
|
313 |
edged_width / 2); |
edged_width / 2); |
314 |
|
|
315 |
break; |
break; |
316 |
|
|
317 |
|
|
318 |
case MODE_INTERPOLATE: /* _could_ use DIRECT, but would be overkill (no 4MV there) */ |
case MODE_INTERPOLATE: /* _could_ use DIRECT, but would be overkill (no 4MV there) */ |
319 |
|
case MODE_DIRECT_NO4V: |
320 |
|
|
321 |
dx = mb->mvs[0].x; |
dx = mb->mvs[0].x; |
322 |
dy = mb->mvs[0].y; |
dy = mb->mvs[0].y; |
324 |
b_dx = mb->b_mvs[0].x; |
b_dx = mb->b_mvs[0].x; |
325 |
b_dy = mb->b_mvs[0].y; |
b_dy = mb->b_mvs[0].y; |
326 |
|
|
327 |
for (k=0;k<4;k++) |
for (k = 0; k < 4; k++) { |
328 |
{ |
transfer_8to16sub2(&dct_codes[k * 64], |
|
transfer_8to16sub2_c(&dct_codes[k * 64], |
|
329 |
cur->y + (i * 16+(k&1)*8) + (j * 16+((k>>1)*8)) * edged_width, |
cur->y + (i * 16+(k&1)*8) + (j * 16+((k>>1)*8)) * edged_width, |
330 |
get_ref(f_ref->y, f_refh->y, f_refv->y, |
get_ref(f_ref->y, f_refh->y, f_refv->y, |
331 |
f_refhv->y, 2*i + (k&1), 2*j + (k>>1), 8, dx, dy, |
f_refhv->y, 2*i + (k&1), 2*j + (k>>1), 8, dx, dy, |
342 |
b_dx = (b_dx & 3) ? (b_dx >> 1) | 1 : b_dx / 2; |
b_dx = (b_dx & 3) ? (b_dx >> 1) | 1 : b_dx / 2; |
343 |
b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2; |
b_dy = (b_dy & 3) ? (b_dy >> 1) | 1 : b_dy / 2; |
344 |
|
|
345 |
transfer_8to16sub2_c(&dct_codes[4 * 64], |
transfer_8to16sub2(&dct_codes[4 * 64], |
346 |
cur->u + (y * 8) * edged_width / 2 + (x * 8), |
cur->u + (y * 8) * edged_width / 2 + (x * 8), |
347 |
get_ref(f_ref->u, f_refh->u, f_refv->u, |
interpolate8x8_switch2(f_refv->u, b_ref->u, 8 * i, 8 * j, |
348 |
f_refhv->u, i, j, 8, dx, dy, |
b_dx, b_dy, edged_width / 2, 0), |
349 |
edged_width / 2), |
interpolate8x8_switch2(f_refv->u + 8, f_ref->u, 8 * i, 8 * j, |
350 |
get_ref(b_ref->u, b_refh->u, b_refv->u, |
dx, dy, edged_width / 2, 0), |
|
b_refhv->u, i, j, 8, b_dx, b_dy, |
|
|
edged_width / 2), |
|
351 |
edged_width / 2); |
edged_width / 2); |
352 |
|
|
353 |
transfer_8to16sub2_c(&dct_codes[5 * 64], |
transfer_8to16sub2(&dct_codes[5 * 64], |
354 |
cur->v + (y * 8) * edged_width / 2 + (x * 8), |
cur->v + (y * 8) * edged_width / 2 + (x * 8), |
355 |
get_ref(f_ref->v, f_refh->v, f_refv->v, |
interpolate8x8_switch2(f_refv->u, b_ref->v, 8 * i, 8 * j, |
356 |
f_refhv->v, 8 * i, 8 * j, 1, dx, dy, |
b_dx, b_dy, edged_width / 2, 0), |
357 |
edged_width / 2), |
interpolate8x8_switch2(f_refv->u + 8, f_ref->v, 8 * i, 8 * j, |
358 |
get_ref(b_ref->v, b_refh->v, b_refv->v, |
dx, dy, edged_width / 2, 0), |
|
b_refhv->v, 8 * i, 8 * j, 1, b_dx, b_dy, |
|
|
edged_width / 2), |
|
359 |
edged_width / 2); |
edged_width / 2); |
360 |
|
|
361 |
break; |
break; |
372 |
|
|
373 |
// fprintf(stderr,"Direct Vector %d -- %d:%d %d:%d\n",k,dx,dy,b_dx,b_dy); |
// fprintf(stderr,"Direct Vector %d -- %d:%d %d:%d\n",k,dx,dy,b_dx,b_dy); |
374 |
|
|
375 |
transfer_8to16sub2_c(&dct_codes[k * 64], |
transfer_8to16sub2(&dct_codes[k * 64], |
376 |
cur->y + (i*16 + (k&1)*8) + (j*16 + (k>>1)*8 ) * edged_width, |
cur->y + (i*16 + (k&1)*8) + (j*16 + (k>>1)*8 ) * edged_width, |
377 |
get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y, |
get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y, |
378 |
2*i + (k&1), 2*j + (k>>1), 8, dx, dy, |
2*i + (k&1), 2*j + (k>>1), 8, dx, dy, |
401 |
if (quarterpel) |
if (quarterpel) |
402 |
sum /= 2; |
sum /= 2; |
403 |
*/ |
*/ |
404 |
|
transfer_8to16sub2(&dct_codes[4 * 64], |
|
transfer_8to16sub2_c(&dct_codes[4 * 64], |
|
405 |
cur->u + (y * 8) * edged_width / 2 + (x * 8), |
cur->u + (y * 8) * edged_width / 2 + (x * 8), |
406 |
get_ref(f_ref->u, f_refh->u, f_refv->u, |
interpolate8x8_switch2(f_refv->u, b_ref->u, 8 * i, 8 * j, |
407 |
f_refhv->u, i, j, 8, dx, dy, |
b_dx, b_dy, edged_width / 2, 0), |
408 |
edged_width / 2), |
interpolate8x8_switch2(f_refv->u + 8, f_ref->u, 8 * i, 8 * j, dx, dy, |
409 |
get_ref(b_ref->u, b_refh->u, b_refv->u, |
edged_width / 2, 0), |
|
b_refhv->u, i, j, 8, b_dx, b_dy, |
|
|
edged_width / 2), |
|
410 |
edged_width / 2); |
edged_width / 2); |
411 |
|
|
412 |
transfer_8to16sub2_c(&dct_codes[5 * 64], |
transfer_8to16sub2(&dct_codes[5 * 64], |
413 |
cur->v + (y * 8) * edged_width / 2 + (x * 8), |
cur->v + (y * 8) * edged_width / 2 + (x * 8), |
414 |
get_ref(f_ref->v, f_refh->v, f_refv->v, |
interpolate8x8_switch2(f_refv->u, b_ref->v, 8 * i, 8 * j, |
415 |
f_refhv->v, i, j, 8, dx, dy, |
b_dx, b_dy, edged_width / 2, 0), |
416 |
edged_width / 2), |
interpolate8x8_switch2(f_refv->u + 8, f_ref->v, 8 * i, 8 * j, |
417 |
get_ref(b_ref->v, b_refh->v, b_refv->v, |
dx, dy, edged_width / 2, 0), |
|
b_refhv->v, i, j, 8, b_dx, b_dy, |
|
|
edged_width / 2), |
|
418 |
edged_width / 2); |
edged_width / 2); |
419 |
|
|
420 |
|
|