55 |
* 22.12.2001 lock based interpolation |
* 22.12.2001 lock based interpolation |
56 |
* 01.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
* 01.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
57 |
* |
* |
58 |
* $Id: decoder.c,v 1.37.2.1 2002-09-26 01:54:54 h Exp $ |
* $Id: decoder.c,v 1.37.2.2 2002-10-05 21:34:21 Isibaar Exp $ |
59 |
* |
* |
60 |
*************************************************************************/ |
*************************************************************************/ |
61 |
|
|
136 |
return XVID_ERR_MEMORY; |
return XVID_ERR_MEMORY; |
137 |
} |
} |
138 |
|
|
139 |
|
if (image_create(&dec->refh, dec->edged_width, dec->edged_height)) { |
140 |
|
image_destroy(&dec->cur, dec->edged_width, dec->edged_height); |
141 |
|
image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height); |
142 |
|
image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height); |
143 |
|
image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height); |
144 |
|
xvid_free(dec); |
145 |
|
return XVID_ERR_MEMORY; |
146 |
|
} |
147 |
|
|
148 |
dec->mbs = |
dec->mbs = |
149 |
xvid_malloc(sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height, |
xvid_malloc(sizeof(MACROBLOCK) * dec->mb_width * dec->mb_height, |
150 |
CACHE_LINE); |
CACHE_LINE); |
153 |
image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height); |
154 |
image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height); |
155 |
image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height); |
156 |
|
image_destroy(&dec->refh, dec->edged_width, dec->edged_height); |
157 |
xvid_free(dec); |
xvid_free(dec); |
158 |
return XVID_ERR_MEMORY; |
return XVID_ERR_MEMORY; |
159 |
} |
} |
171 |
image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height); |
172 |
image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height); |
173 |
image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height); |
174 |
|
image_destroy(&dec->refh, dec->edged_width, dec->edged_height); |
175 |
xvid_free(dec); |
xvid_free(dec); |
176 |
return XVID_ERR_MEMORY; |
return XVID_ERR_MEMORY; |
177 |
} |
} |
197 |
image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[0], dec->edged_width, dec->edged_height); |
198 |
image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[1], dec->edged_width, dec->edged_height); |
199 |
image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height); |
image_destroy(&dec->refn[2], dec->edged_width, dec->edged_height); |
200 |
|
image_destroy(&dec->refh, dec->edged_width, dec->edged_height); |
201 |
image_destroy(&dec->cur, dec->edged_width, dec->edged_height); |
image_destroy(&dec->cur, dec->edged_width, dec->edged_height); |
202 |
xvid_free(dec); |
xvid_free(dec); |
203 |
|
|
393 |
|
|
394 |
start_timer(); |
start_timer(); |
395 |
if(dec->quarterpel) { |
if(dec->quarterpel) { |
396 |
DEBUG("QUARTERPEL"); |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->refh.y, dec->refh.y + 64, |
397 |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos, |
dec->refh.y + 128, 16*x_pos, 16*y_pos, |
398 |
pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding); |
pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding); |
399 |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos, |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->refh.y, dec->refh.y + 64, |
400 |
|
dec->refh.y + 128, 16*x_pos + 8, 16*y_pos, |
401 |
pMB->mvs[1].x, pMB->mvs[1].y, stride, rounding); |
pMB->mvs[1].x, pMB->mvs[1].y, stride, rounding); |
402 |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos + 8, |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->refh.y, dec->refh.y + 64, |
403 |
|
dec->refh.y + 128, 16*x_pos, 16*y_pos + 8, |
404 |
pMB->mvs[2].x, pMB->mvs[2].y, stride, rounding); |
pMB->mvs[2].x, pMB->mvs[2].y, stride, rounding); |
405 |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos + 8, |
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->refh.y, dec->refh.y + 64, |
406 |
|
dec->refh.y + 128, 16*x_pos + 8, 16*y_pos + 8, |
407 |
pMB->mvs[3].x, pMB->mvs[3].y, stride, rounding); |
pMB->mvs[3].x, pMB->mvs[3].y, stride, rounding); |
408 |
} |
} |
409 |
else { |
else { |
1048 |
interpolate8x8_switch(dec->refn[2].v, backward.v, 8 * x_pos, 8 * y_pos, |
interpolate8x8_switch(dec->refn[2].v, backward.v, 8 * x_pos, 8 * y_pos, |
1049 |
b_uv_dx, b_uv_dy, stride2, 0); |
b_uv_dx, b_uv_dy, stride2, 0); |
1050 |
|
|
1051 |
interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos, 16 * y_pos, |
interpolate8x8_avg2(dec->cur.y + (16 * y_pos * stride) + 16 * x_pos, |
1052 |
stride); |
dec->cur.y + (16 * y_pos * stride) + 16 * x_pos, |
1053 |
interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos + 8, 16 * y_pos, |
dec->refn[2].y + (16 * y_pos * stride) + 16 * x_pos, |
1054 |
stride); |
stride, 0); |
1055 |
interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos, 16 * y_pos + 8, |
|
1056 |
stride); |
interpolate8x8_avg2(dec->cur.y + (16 * y_pos * stride) + 16 * x_pos + 8, |
1057 |
interpolate8x8_c(dec->cur.y, dec->refn[2].y, 16 * x_pos + 8, |
dec->cur.y + (16 * y_pos * stride) + 16 * x_pos + 8, |
1058 |
16 * y_pos + 8, stride); |
dec->refn[2].y + (16 * y_pos * stride) + 16 * x_pos + 8, |
1059 |
interpolate8x8_c(dec->cur.u, dec->refn[2].u, 8 * x_pos, 8 * y_pos, |
stride, 0); |
1060 |
stride2); |
|
1061 |
interpolate8x8_c(dec->cur.v, dec->refn[2].v, 8 * x_pos, 8 * y_pos, |
interpolate8x8_avg2(dec->cur.y + (16 * (y_pos + 8) * stride) + 16 * x_pos, |
1062 |
stride2); |
dec->cur.y + (16 * (y_pos + 8) * stride) + 16 * x_pos, |
1063 |
|
dec->refn[2].y + (16 * (y_pos + 8) * stride) + 16 * x_pos, |
1064 |
|
stride, 0); |
1065 |
|
|
1066 |
|
interpolate8x8_avg2(dec->cur.y + (16 * (y_pos + 8) * stride) + 16 * x_pos + 8, |
1067 |
|
dec->cur.y + (16 * (y_pos + 8) * stride) + 16 * x_pos + 8, |
1068 |
|
dec->refn[2].y + (16 * (y_pos + 8) * stride) + 16 * x_pos + 8, |
1069 |
|
stride, 0); |
1070 |
|
|
1071 |
|
interpolate8x8_avg2(dec->cur.u + (8 * y_pos * stride) + 8 * x_pos, |
1072 |
|
dec->cur.u + (8 * y_pos * stride) + 8 * x_pos, |
1073 |
|
dec->refn[2].u + (8 * y_pos * stride) + 8 * x_pos, |
1074 |
|
stride2, 0); |
1075 |
|
|
1076 |
|
interpolate8x8_avg2(dec->cur.v + (8 * y_pos * stride) + 8 * x_pos, |
1077 |
|
dec->cur.v + (8 * y_pos * stride) + 8 * x_pos, |
1078 |
|
dec->refn[2].v + (8 * y_pos * stride) + 8 * x_pos, |
1079 |
|
stride2, 0); |
1080 |
|
|
1081 |
stop_comp_timer(); |
stop_comp_timer(); |
1082 |
|
|
1083 |
for (i = 0; i < 6; i++) { |
for (i = 0; i < 6; i++) { |