Parent Directory | Revision Log
Revision 756 - (view) (download)
1 : | Isibaar | 616 | // 30.10.2002 corrected qpel chroma rounding |
2 : | Isibaar | 581 | // 04.10.2002 added qpel support to MBMotionCompensation |
3 : | edgomez | 195 | // 01.05.2002 updated MBMotionCompensationBVOP |
4 : | // 14.04.2002 bframe compensation | ||
5 : | suxen_drol | 118 | |
6 : | Isibaar | 3 | #include "../encoder.h" |
7 : | #include "../utils/mbfunctions.h" | ||
8 : | #include "../image/interpolate8x8.h" | ||
9 : | suxen_drol | 701 | #include "../image/reduced.h" |
10 : | Isibaar | 3 | #include "../utils/timer.h" |
11 : | suxen_drol | 118 | #include "motion.h" |
12 : | Isibaar | 3 | |
13 : | edgomez | 195 | static __inline void |
14 : | Isibaar | 588 | compensate16x16_interpolate(int16_t * const dct_codes, |
15 : | syskin | 756 | uint8_t * const cur, |
16 : | const uint8_t * const ref, | ||
17 : | const uint8_t * const refh, | ||
18 : | const uint8_t * const refv, | ||
19 : | const uint8_t * const refhv, | ||
20 : | uint8_t * const tmp, | ||
21 : | uint32_t x, | ||
22 : | uint32_t y, | ||
23 : | const int32_t dx, | ||
24 : | const int32_t dy, | ||
25 : | const uint32_t stride, | ||
26 : | const int quarterpel, | ||
27 : | suxen_drol | 701 | const int reduced_resolution, |
28 : | const uint32_t rounding) | ||
29 : | Isibaar | 588 | { |
30 : | syskin | 756 | const uint8_t * ptr; |
31 : | Isibaar | 588 | |
32 : | syskin | 756 | if (!reduced_resolution) { |
33 : | Isibaar | 588 | |
34 : | suxen_drol | 701 | if(quarterpel) { |
35 : | syskin | 744 | if (dx&3 | dy&3) { |
36 : | syskin | 756 | interpolate16x16_quarterpel(tmp - y * stride - x, |
37 : | (uint8_t *) ref, tmp + 32, | ||
38 : | tmp + 64, tmp + 96, x, y, dx, dy, stride, rounding); | ||
39 : | ptr = tmp; | ||
40 : | syskin | 744 | } else ptr = ref + (y + dy/4)*stride + x + dx/4; // fullpixel position |
41 : | suxen_drol | 701 | |
42 : | syskin | 756 | } else ptr = get_ref(ref, refh, refv, refhv, x, y, 1, dx, dy, stride); |
43 : | |||
44 : | transfer_8to16sub(dct_codes, cur + y * stride + x, | ||
45 : | syskin | 744 | ptr, stride); |
46 : | syskin | 756 | transfer_8to16sub(dct_codes+64, cur + y * stride + x + 8, |
47 : | syskin | 744 | ptr + 8, stride); |
48 : | syskin | 756 | transfer_8to16sub(dct_codes+128, cur + y * stride + x + 8*stride, |
49 : | syskin | 744 | ptr + 8*stride, stride); |
50 : | syskin | 756 | transfer_8to16sub(dct_codes+192, cur + y * stride + x + 8*stride+8, |
51 : | ptr + 8*stride + 8, stride); | ||
52 : | suxen_drol | 701 | |
53 : | syskin | 756 | } else { //reduced_resolution |
54 : | |||
55 : | x *= 2; y *= 2; | ||
56 : | suxen_drol | 701 | |
57 : | syskin | 756 | ptr = get_ref(ref, refh, refv, refhv, x, y, 1, dx, dy, stride); |
58 : | |||
59 : | filter_18x18_to_8x8(dct_codes, cur+y*stride + x, stride); | ||
60 : | filter_diff_18x18_to_8x8(dct_codes, ptr, stride); | ||
61 : | |||
62 : | filter_18x18_to_8x8(dct_codes+64, cur+y*stride + x + 16, stride); | ||
63 : | filter_diff_18x18_to_8x8(dct_codes+64, ptr + 16, stride); | ||
64 : | |||
65 : | filter_18x18_to_8x8(dct_codes+128, cur+(y+16)*stride + x, stride); | ||
66 : | filter_diff_18x18_to_8x8(dct_codes+128, ptr + 16*stride, stride); | ||
67 : | |||
68 : | filter_18x18_to_8x8(dct_codes+192, cur+(y+16)*stride + x + 16, stride); | ||
69 : | filter_diff_18x18_to_8x8(dct_codes+192, ptr + 16*stride + 16, stride); | ||
70 : | |||
71 : | transfer32x32_copy(cur + y*stride + x, ptr, stride); | ||
72 : | Isibaar | 588 | } |
73 : | } | ||
74 : | |||
75 : | static __inline void | ||
76 : | syskin | 756 | compensate8x8_interpolate( int16_t * const dct_codes, |
77 : | uint8_t * const cur, | ||
78 : | const uint8_t * const ref, | ||
79 : | const uint8_t * const refh, | ||
80 : | const uint8_t * const refv, | ||
81 : | const uint8_t * const refhv, | ||
82 : | uint8_t * const tmp, | ||
83 : | uint32_t x, | ||
84 : | uint32_t y, | ||
85 : | const int32_t dx, | ||
86 : | const int32_t dy, | ||
87 : | const uint32_t stride, | ||
88 : | const uint32_t quarterpel, | ||
89 : | const int reduced_resolution, | ||
90 : | const uint32_t rounding) | ||
91 : | Isibaar | 3 | { |
92 : | syskin | 756 | const uint8_t * ptr; |
93 : | suxen_drol | 702 | |
94 : | syskin | 756 | if (!reduced_resolution) { |
95 : | suxen_drol | 702 | |
96 : | suxen_drol | 701 | if(quarterpel) { |
97 : | syskin | 744 | if (dx&3 | dy&3) { |
98 : | syskin | 756 | interpolate8x8_quarterpel(tmp - y*stride - x, |
99 : | (uint8_t *) ref, tmp + 32, | ||
100 : | tmp + 64, tmp + 96, x, y, dx, dy, stride, rounding); | ||
101 : | ptr = tmp; | ||
102 : | } else ptr = ref + (y + dy/4)*stride + x + dx/4; // fullpixel position | ||
103 : | } else ptr = get_ref(ref, refh, refv, refhv, x, y, 1, dx, dy, stride); | ||
104 : | Isibaar | 581 | |
105 : | syskin | 756 | transfer_8to16sub(dct_codes, cur + y * stride + x, ptr, stride); |
106 : | syskin | 744 | |
107 : | syskin | 756 | } else { //reduced_resolution |
108 : | suxen_drol | 701 | |
109 : | syskin | 756 | x *= 2; y *= 2; |
110 : | |||
111 : | ptr = get_ref(ref, refh, refv, refhv, x, y, 1, dx, dy, stride); | ||
112 : | |||
113 : | filter_18x18_to_8x8(dct_codes, cur+y*stride + x, stride); | ||
114 : | filter_diff_18x18_to_8x8(dct_codes, ptr, stride); | ||
115 : | |||
116 : | transfer16x16_copy(cur + y*stride + x, ptr, stride); | ||
117 : | edgomez | 195 | } |
118 : | Isibaar | 3 | } |
119 : | |||
120 : | suxen_drol | 703 | /* XXX: slow, inelegant... */ |
121 : | static void | ||
122 : | interpolate18x18_switch(uint8_t * const cur, | ||
123 : | syskin | 756 | const uint8_t * const refn, |
124 : | const uint32_t x, | ||
125 : | const uint32_t y, | ||
126 : | const int32_t dx, | ||
127 : | const int dy, | ||
128 : | const uint32_t stride, | ||
129 : | const uint32_t rounding) | ||
130 : | suxen_drol | 703 | { |
131 : | interpolate8x8_switch(cur, refn, x-1, y-1, dx, dy, stride, rounding); | ||
132 : | interpolate8x8_switch(cur, refn, x+7, y-1, dx, dy, stride, rounding); | ||
133 : | interpolate8x8_switch(cur, refn, x+9, y-1, dx, dy, stride, rounding); | ||
134 : | |||
135 : | interpolate8x8_switch(cur, refn, x-1, y+7, dx, dy, stride, rounding); | ||
136 : | interpolate8x8_switch(cur, refn, x+7, y+7, dx, dy, stride, rounding); | ||
137 : | interpolate8x8_switch(cur, refn, x+9, y+7, dx, dy, stride, rounding); | ||
138 : | |||
139 : | interpolate8x8_switch(cur, refn, x-1, y+9, dx, dy, stride, rounding); | ||
140 : | interpolate8x8_switch(cur, refn, x+7, y+9, dx, dy, stride, rounding); | ||
141 : | interpolate8x8_switch(cur, refn, x+9, y+9, dx, dy, stride, rounding); | ||
142 : | } | ||
143 : | |||
144 : | syskin | 756 | static void |
145 : | CompensateChroma( int dx, int dy, | ||
146 : | const int i, const int j, | ||
147 : | IMAGE * const Cur, | ||
148 : | const IMAGE * const Ref, | ||
149 : | uint8_t * const temp, | ||
150 : | int16_t * const coeff, | ||
151 : | const uint32_t stride, | ||
152 : | const int rounding, | ||
153 : | const int rrv) | ||
154 : | { /* uv-block-based compensation */ | ||
155 : | suxen_drol | 703 | |
156 : | syskin | 756 | if (!rrv) { |
157 : | transfer_8to16sub(coeff, Cur->u + 8 * j * stride + 8 * i, | ||
158 : | interpolate8x8_switch2(temp, Ref->u, 8 * i, 8 * j, | ||
159 : | dx, dy, stride, rounding), | ||
160 : | stride); | ||
161 : | |||
162 : | transfer_8to16sub(coeff + 64, Cur->v + 8 * j * stride + 8 * i, | ||
163 : | interpolate8x8_switch2(temp, Ref->v, 8 * i, 8 * j, | ||
164 : | dx, dy, stride, rounding), | ||
165 : | stride); | ||
166 : | } else { | ||
167 : | uint8_t * current, * reference; | ||
168 : | |||
169 : | current = Cur->u + 16*j*stride + 16*i; | ||
170 : | reference = temp - 16*j*stride - 16*i; | ||
171 : | interpolate18x18_switch(reference, Ref->u, 16*i, 16*j, dx, dy, stride, rounding); | ||
172 : | filter_18x18_to_8x8(coeff, current, stride); | ||
173 : | filter_diff_18x18_to_8x8(coeff, temp, stride); | ||
174 : | transfer16x16_copy(current, temp, stride); | ||
175 : | |||
176 : | current = Cur->v + 16*j*stride + 16*i; | ||
177 : | interpolate18x18_switch(reference, Ref->v, 16*i, 16*j, dx, dy, stride, rounding); | ||
178 : | filter_18x18_to_8x8(coeff + 64, current, stride); | ||
179 : | filter_diff_18x18_to_8x8(coeff + 64, temp, stride); | ||
180 : | transfer16x16_copy(current, temp, stride); | ||
181 : | } | ||
182 : | } | ||
183 : | |||
184 : | edgomez | 195 | void |
185 : | MBMotionCompensation(MACROBLOCK * const mb, | ||
186 : | syskin | 756 | const uint32_t i, |
187 : | const uint32_t j, | ||
188 : | const IMAGE * const ref, | ||
189 : | const IMAGE * const refh, | ||
190 : | const IMAGE * const refv, | ||
191 : | const IMAGE * const refhv, | ||
192 : | IMAGE * const cur, | ||
193 : | int16_t * dct_codes, | ||
194 : | const uint32_t width, | ||
195 : | const uint32_t height, | ||
196 : | const uint32_t edged_width, | ||
197 : | const int quarterpel, | ||
198 : | const int reduced_resolution, | ||
199 : | const uint32_t rounding) | ||
200 : | Isibaar | 3 | { |
201 : | syskin | 744 | int32_t dx = (quarterpel ? mb->qmvs[0].x : mb->mvs[0].x); |
202 : | int32_t dy = (quarterpel ? mb->qmvs[0].y : mb->mvs[0].y); | ||
203 : | syskin | 756 | uint8_t * const tmp = refv->u; |
204 : | suxen_drol | 701 | |
205 : | syskin | 756 | if ( mb->mode == MODE_NOT_CODED && dx==0 && dy==0 && !reduced_resolution) { /* quick copy */ |
206 : | syskin | 744 | transfer16x16_copy(cur->y + 16 * (i + j * edged_width), |
207 : | ref->y + 16 * (i + j * edged_width), | ||
208 : | edged_width); | ||
209 : | |||
210 : | transfer8x8_copy(cur->u + 8 * (i + j * edged_width/2), | ||
211 : | ref->u + 8 * (i + j * edged_width/2), | ||
212 : | edged_width / 2); | ||
213 : | transfer8x8_copy(cur->v + 8 * (i + j * edged_width/2), | ||
214 : | ref->v + 8 * (i + j * edged_width/2), | ||
215 : | edged_width / 2); | ||
216 : | return; | ||
217 : | } | ||
218 : | Isibaar | 3 | |
219 : | syskin | 744 | if ((mb->mode == MODE_NOT_CODED || mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) /*&& !quarterpel*/) { |
220 : | chl | 530 | |
221 : | chl | 619 | /* quick MODE_NOT_CODED for GMC with MV!=(0,0) is still needed */ |
222 : | Isibaar | 581 | |
223 : | syskin | 744 | if (reduced_resolution) { |
224 : | suxen_drol | 702 | dx = RRV_MV_SCALEUP(dx); |
225 : | dy = RRV_MV_SCALEUP(dy); | ||
226 : | } | ||
227 : | |||
228 : | Isibaar | 588 | compensate16x16_interpolate(&dct_codes[0 * 64], cur->y, ref->y, refh->y, |
229 : | syskin | 756 | refv->y, refhv->y, tmp, 16 * i, 16 * j, dx, dy, |
230 : | edged_width, quarterpel, reduced_resolution, rounding); | ||
231 : | |||
232 : | dx /= 1 + quarterpel; | ||
233 : | dy /= 1 + quarterpel; | ||
234 : | Isibaar | 617 | dx = (dx >> 1) + roundtab_79[dx & 0x3]; |
235 : | dy = (dy >> 1) + roundtab_79[dy & 0x3]; | ||
236 : | |||
237 : | chl | 530 | } else { // mode == MODE_INTER4V |
238 : | syskin | 756 | int k, sumx = 0, sumy = 0; |
239 : | const VECTOR * const mvs = (quarterpel ? mb->qmvs : mb->mvs); | ||
240 : | Isibaar | 3 | |
241 : | syskin | 756 | for (k = 0; k < 4; k++) { |
242 : | dx = mvs[k].x; | ||
243 : | dy = mvs[k].y; | ||
244 : | sumx += dx / (1 + quarterpel); | ||
245 : | sumy += dy / (1 + quarterpel); | ||
246 : | Isibaar | 581 | |
247 : | syskin | 756 | if (reduced_resolution){ |
248 : | dx = RRV_MV_SCALEUP(dx); | ||
249 : | dy = RRV_MV_SCALEUP(dy); | ||
250 : | suxen_drol | 702 | } |
251 : | Isibaar | 3 | |
252 : | syskin | 756 | compensate8x8_interpolate(&dct_codes[k * 64], cur->y, ref->y, refh->y, |
253 : | refv->y, refhv->y, tmp, 16 * i + 8*(k&1), 16 * j + 8*(k>>1), dx, | ||
254 : | dy, edged_width, quarterpel, reduced_resolution, rounding); | ||
255 : | syskin | 744 | } |
256 : | syskin | 756 | dx = (sumx >> 3) + roundtab_76[sumx & 0xf]; |
257 : | dy = (sumy >> 3) + roundtab_76[sumy & 0xf]; | ||
258 : | } | ||
259 : | Isibaar | 581 | |
260 : | syskin | 756 | CompensateChroma(dx, dy, i, j, cur, ref, tmp, |
261 : | &dct_codes[4 * 64], edged_width / 2, rounding, reduced_resolution); | ||
262 : | Isibaar | 3 | |
263 : | } | ||
264 : | suxen_drol | 118 | |
265 : | |||
266 : | edgomez | 195 | void |
267 : | MBMotionCompensationBVOP(MBParam * pParam, | ||
268 : | syskin | 756 | MACROBLOCK * const mb, |
269 : | const uint32_t i, | ||
270 : | const uint32_t j, | ||
271 : | IMAGE * const cur, | ||
272 : | const IMAGE * const f_ref, | ||
273 : | const IMAGE * const f_refh, | ||
274 : | const IMAGE * const f_refv, | ||
275 : | const IMAGE * const f_refhv, | ||
276 : | const IMAGE * const b_ref, | ||
277 : | const IMAGE * const b_refh, | ||
278 : | const IMAGE * const b_refv, | ||
279 : | const IMAGE * const b_refhv, | ||
280 : | int16_t * dct_codes) | ||
281 : | suxen_drol | 118 | { |
282 : | syskin | 756 | const uint32_t edged_width = pParam->edged_width; |
283 : | int32_t dx, dy, b_dx, b_dy, sumx, sumy, b_sumx, b_sumy; | ||
284 : | int k; | ||
285 : | const int quarterpel = pParam->m_quarterpel; | ||
286 : | syskin | 744 | const uint8_t * ptr1, * ptr2; |
287 : | syskin | 756 | uint8_t * const tmp = f_refv->u; |
288 : | const VECTOR * const fmvs = (quarterpel ? mb->qmvs : mb->mvs); | ||
289 : | const VECTOR * const bmvs = (quarterpel ? mb->b_qmvs : mb->b_mvs); | ||
290 : | suxen_drol | 118 | |
291 : | edgomez | 195 | switch (mb->mode) { |
292 : | case MODE_FORWARD: | ||
293 : | syskin | 756 | dx = fmvs->x; dy = fmvs->y; |
294 : | suxen_drol | 118 | |
295 : | syskin | 658 | compensate16x16_interpolate(&dct_codes[0 * 64], cur->y, f_ref->y, f_refh->y, |
296 : | syskin | 756 | f_refv->y, f_refhv->y, tmp, 16 * i, 16 * j, dx, |
297 : | dy, edged_width, quarterpel, 0, 0); | ||
298 : | suxen_drol | 118 | |
299 : | syskin | 756 | dx /= 1 + quarterpel; |
300 : | dy /= 1 + quarterpel; | ||
301 : | CompensateChroma( (dx >> 1) + roundtab_79[dx & 0x3], | ||
302 : | (dy >> 1) + roundtab_79[dy & 0x3], | ||
303 : | i, j, cur, f_ref, tmp, | ||
304 : | &dct_codes[4 * 64], edged_width / 2, 0, 0); | ||
305 : | suxen_drol | 118 | |
306 : | syskin | 756 | return; |
307 : | suxen_drol | 118 | |
308 : | edgomez | 195 | case MODE_BACKWARD: |
309 : | syskin | 756 | b_dx = bmvs->x; b_dy = bmvs->y; |
310 : | suxen_drol | 118 | |
311 : | syskin | 658 | compensate16x16_interpolate(&dct_codes[0 * 64], cur->y, b_ref->y, b_refh->y, |
312 : | syskin | 756 | b_refv->y, b_refhv->y, tmp, 16 * i, 16 * j, b_dx, |
313 : | b_dy, edged_width, quarterpel, 0, 0); | ||
314 : | suxen_drol | 118 | |
315 : | syskin | 756 | b_dx /= 1 + quarterpel; |
316 : | b_dy /= 1 + quarterpel; | ||
317 : | CompensateChroma( (b_dx >> 1) + roundtab_79[b_dx & 0x3], | ||
318 : | (b_dy >> 1) + roundtab_79[b_dy & 0x3], | ||
319 : | i, j, cur, b_ref, tmp, | ||
320 : | &dct_codes[4 * 64], edged_width / 2, 0, 0); | ||
321 : | suxen_drol | 118 | |
322 : | syskin | 756 | return; |
323 : | suxen_drol | 118 | |
324 : | syskin | 744 | case MODE_INTERPOLATE: /* _could_ use DIRECT, but would be overkill (no 4MV there) */ |
325 : | chl | 530 | case MODE_DIRECT_NO4V: |
326 : | syskin | 756 | dx = fmvs->x; dy = fmvs->y; |
327 : | b_dx = bmvs->x; b_dy = bmvs->y; | ||
328 : | chl | 374 | |
329 : | syskin | 658 | if (quarterpel) { |
330 : | syskin | 744 | |
331 : | if (dx&3 | dy&3) { | ||
332 : | syskin | 756 | interpolate16x16_quarterpel(tmp - i * 16 - j * 16 * edged_width, |
333 : | (uint8_t *) f_ref->y, tmp + 32, | ||
334 : | tmp + 64, tmp + 96, 16*i, 16*j, dx, dy, edged_width, 0); | ||
335 : | ptr1 = tmp; | ||
336 : | syskin | 744 | } else ptr1 = f_ref->y + (16*j + dy/4)*edged_width + 16*i + dx/4; // fullpixel position |
337 : | chl | 374 | |
338 : | syskin | 744 | if (b_dx&3 | b_dy&3) { |
339 : | syskin | 756 | interpolate16x16_quarterpel(tmp - i * 16 - j * 16 * edged_width + 16, |
340 : | (uint8_t *) b_ref->y, tmp + 32, | ||
341 : | tmp + 64, tmp + 96, 16*i, 16*j, b_dx, b_dy, edged_width, 0); | ||
342 : | ptr2 = tmp + 16; | ||
343 : | syskin | 744 | } else ptr2 = b_ref->y + (16*j + b_dy/4)*edged_width + 16*i + b_dx/4; // fullpixel position |
344 : | suxen_drol | 118 | |
345 : | syskin | 658 | b_dx /= 2; |
346 : | b_dy /= 2; | ||
347 : | dx /= 2; | ||
348 : | dy /= 2; | ||
349 : | |||
350 : | } else { | ||
351 : | syskin | 756 | ptr1 = get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y, |
352 : | i, j, 16, dx, dy, edged_width); | ||
353 : | syskin | 658 | |
354 : | syskin | 756 | ptr2 = get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y, |
355 : | i, j, 16, b_dx, b_dy, edged_width); | ||
356 : | } | ||
357 : | for (k = 0; k < 4; k++) | ||
358 : | syskin | 658 | transfer_8to16sub2(&dct_codes[k * 64], |
359 : | syskin | 756 | cur->y + (i * 16+(k&1)*8) + (j * 16+((k>>1)*8)) * edged_width, |
360 : | ptr1 + (k&1)*8 + (k>>1)*8*edged_width, | ||
361 : | ptr2 + (k&1)*8 + (k>>1)*8*edged_width, edged_width); | ||
362 : | syskin | 658 | |
363 : | suxen_drol | 118 | |
364 : | syskin | 658 | dx = (dx >> 1) + roundtab_79[dx & 0x3]; |
365 : | dy = (dy >> 1) + roundtab_79[dy & 0x3]; | ||
366 : | suxen_drol | 118 | |
367 : | syskin | 658 | b_dx = (b_dx >> 1) + roundtab_79[b_dx & 0x3]; |
368 : | b_dy = (b_dy >> 1) + roundtab_79[b_dy & 0x3]; | ||
369 : | |||
370 : | suxen_drol | 118 | break; |
371 : | chl | 374 | |
372 : | syskin | 756 | default: // MODE_DIRECT |
373 : | sumx = sumy = b_sumx = b_sumy = 0; | ||
374 : | syskin | 744 | |
375 : | syskin | 756 | for (k = 0; k < 4; k++) { |
376 : | |||
377 : | dx = fmvs[k].x; dy = fmvs[k].y; | ||
378 : | b_dx = bmvs[k].x; b_dy = bmvs[k].y; | ||
379 : | |||
380 : | if (quarterpel) { | ||
381 : | sumx += dx/2; sumy += dy/2; | ||
382 : | b_sumx += b_dx/2; b_sumy += b_dy/2; | ||
383 : | |||
384 : | syskin | 744 | if (dx&3 | dy&3) { |
385 : | syskin | 756 | interpolate8x8_quarterpel(tmp - (i * 16+(k&1)*8) - (j * 16+((k>>1)*8)) * edged_width, |
386 : | syskin | 744 | (uint8_t *) f_ref->y, |
387 : | syskin | 756 | tmp + 32, tmp + 64, tmp + 96, |
388 : | syskin | 744 | 16*i + (k&1)*8, 16*j + (k>>1)*8, dx, dy, edged_width, 0); |
389 : | syskin | 756 | ptr1 = tmp; |
390 : | syskin | 744 | } else ptr1 = f_ref->y + (16*j + (k>>1)*8 + dy/4)*edged_width + 16*i + (k&1)*8 + dx/4; |
391 : | chl | 374 | |
392 : | syskin | 744 | if (b_dx&3 | b_dy&3) { |
393 : | syskin | 756 | interpolate8x8_quarterpel(tmp - (i * 16+(k&1)*8) - (j * 16+((k>>1)*8)) * edged_width + 16, |
394 : | (uint8_t *) b_ref->y, | ||
395 : | tmp + 16, tmp + 32, tmp + 48, | ||
396 : | syskin | 744 | 16*i + (k&1)*8, 16*j + (k>>1)*8, b_dx, b_dy, edged_width, 0); |
397 : | syskin | 756 | ptr2 = tmp + 16; |
398 : | syskin | 744 | } else ptr2 = b_ref->y + (16*j + (k>>1)*8 + b_dy/4)*edged_width + 16*i + (k&1)*8 + b_dx/4; |
399 : | syskin | 756 | } else { |
400 : | sumx += dx; sumy += dy; | ||
401 : | b_sumx += b_dx; b_sumy += b_dy; | ||
402 : | chl | 374 | |
403 : | syskin | 756 | ptr1 = get_ref(f_ref->y, f_refh->y, f_refv->y, f_refhv->y, |
404 : | 2*i + (k&1), 2*j + (k>>1), 8, dx, dy, edged_width); | ||
405 : | ptr2 = get_ref(b_ref->y, b_refh->y, b_refv->y, b_refhv->y, | ||
406 : | 2*i + (k&1), 2*j + (k>>1), 8, b_dx, b_dy, edged_width); | ||
407 : | } | ||
408 : | transfer_8to16sub2(&dct_codes[k * 64], | ||
409 : | syskin | 658 | cur->y + (i * 16+(k&1)*8) + (j * 16+((k>>1)*8)) * edged_width, |
410 : | syskin | 744 | ptr1, ptr2, edged_width); |
411 : | syskin | 756 | |
412 : | syskin | 658 | } |
413 : | suxen_drol | 449 | |
414 : | syskin | 756 | dx = (sumx >> 3) + roundtab_76[sumx & 0xf]; |
415 : | dy = (sumy >> 3) + roundtab_76[sumy & 0xf]; | ||
416 : | b_dx = (b_sumx >> 3) + roundtab_76[b_sumx & 0xf]; | ||
417 : | b_dy = (b_sumy >> 3) + roundtab_76[b_sumy & 0xf]; | ||
418 : | chl | 530 | |
419 : | suxen_drol | 118 | break; |
420 : | } | ||
421 : | syskin | 756 | |
422 : | // uv block-based chroma interpolation for direct and interpolate modes | ||
423 : | transfer_8to16sub2(&dct_codes[4 * 64], | ||
424 : | cur->u + (j * 8) * edged_width / 2 + (i * 8), | ||
425 : | interpolate8x8_switch2(tmp, b_ref->u, 8 * i, 8 * j, | ||
426 : | b_dx, b_dy, edged_width / 2, 0), | ||
427 : | interpolate8x8_switch2(tmp + 8, f_ref->u, 8 * i, 8 * j, | ||
428 : | dx, dy, edged_width / 2, 0), | ||
429 : | edged_width / 2); | ||
430 : | |||
431 : | transfer_8to16sub2(&dct_codes[5 * 64], | ||
432 : | cur->v + (j * 8) * edged_width / 2 + (i * 8), | ||
433 : | interpolate8x8_switch2(tmp, b_ref->v, 8 * i, 8 * j, | ||
434 : | b_dx, b_dy, edged_width / 2, 0), | ||
435 : | interpolate8x8_switch2(tmp + 8, f_ref->v, 8 * i, 8 * j, | ||
436 : | dx, dy, edged_width / 2, 0), | ||
437 : | edged_width / 2); | ||
438 : | suxen_drol | 118 | } |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |