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 |
|
|
280 |
start_timer(); |
start_timer(); |
281 |
if (cbp & (1 << (5 - i))) // coded |
if (cbp & (1 << (5 - i))) // coded |
282 |
{ |
{ |
283 |
get_intra_block(bs, &block[i * 64], pMB->acpred_directions[i], |
int direction = dec->alternate_vertical_scan ? |
284 |
start_coeff); |
2 : pMB->acpred_directions[i]; |
285 |
|
|
286 |
|
get_intra_block(bs, &block[i * 64], direction, start_coeff); |
287 |
} |
} |
288 |
stop_coding_timer(); |
stop_coding_timer(); |
289 |
|
|
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 { |
424 |
stop_comp_timer(); |
stop_comp_timer(); |
425 |
|
|
426 |
for (i = 0; i < 6; i++) { |
for (i = 0; i < 6; i++) { |
427 |
|
int direction = dec->alternate_vertical_scan ? 2 : 0; |
428 |
|
|
429 |
if (cbp & (1 << (5 - i))) // coded |
if (cbp & (1 << (5 - i))) // coded |
430 |
{ |
{ |
431 |
memset(&block[i * 64], 0, 64 * sizeof(int16_t)); // clear |
memset(&block[i * 64], 0, 64 * sizeof(int16_t)); // clear |
432 |
|
|
433 |
start_timer(); |
start_timer(); |
434 |
get_inter_block(bs, &block[i * 64]); |
get_inter_block(bs, &block[i * 64], direction); |
435 |
stop_coding_timer(); |
stop_coding_timer(); |
436 |
|
|
437 |
start_timer(); |
start_timer(); |
604 |
|
|
605 |
start_timer(); |
start_timer(); |
606 |
image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height, |
image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height, |
607 |
dec->width, dec->height, dec->interlacing); |
dec->width, dec->height); |
608 |
stop_edges_timer(); |
stop_edges_timer(); |
609 |
|
|
610 |
bound = 0; |
bound = 0; |
672 |
mb->quant = quant; |
mb->quant = quant; |
673 |
|
|
674 |
if (dec->interlacing) { |
if (dec->interlacing) { |
675 |
|
if (cbp || intra) { |
676 |
mb->field_dct = BitstreamGetBit(bs); |
mb->field_dct = BitstreamGetBit(bs); |
677 |
DEBUG1("decp: field_dct: ", mb->field_dct); |
DEBUG1("decp: field_dct: ", mb->field_dct); |
678 |
|
} |
679 |
|
|
680 |
if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) { |
if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) { |
681 |
mb->field_pred = BitstreamGetBit(bs); |
mb->field_pred = BitstreamGetBit(bs); |
895 |
stop_comp_timer(); |
stop_comp_timer(); |
896 |
|
|
897 |
for (i = 0; i < 6; i++) { |
for (i = 0; i < 6; i++) { |
898 |
|
int direction = dec->alternate_vertical_scan ? 2 : 0; |
899 |
|
|
900 |
if (cbp & (1 << (5 - i))) // coded |
if (cbp & (1 << (5 - i))) // coded |
901 |
{ |
{ |
902 |
memset(&block[i * 64], 0, 64 * sizeof(int16_t)); // clear |
memset(&block[i * 64], 0, 64 * sizeof(int16_t)); // clear |
903 |
|
|
904 |
start_timer(); |
start_timer(); |
905 |
get_inter_block(bs, &block[i * 64]); |
get_inter_block(bs, &block[i * 64], direction); |
906 |
stop_coding_timer(); |
stop_coding_timer(); |
907 |
|
|
908 |
start_timer(); |
start_timer(); |
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++) { |
1084 |
|
int direction = dec->alternate_vertical_scan ? 2 : 0; |
1085 |
|
|
1086 |
if (cbp & (1 << (5 - i))) // coded |
if (cbp & (1 << (5 - i))) // coded |
1087 |
{ |
{ |
1088 |
memset(&block[i * 64], 0, 64 * sizeof(int16_t)); // clear |
memset(&block[i * 64], 0, 64 * sizeof(int16_t)); // clear |
1089 |
|
|
1090 |
start_timer(); |
start_timer(); |
1091 |
get_inter_block(bs, &block[i * 64]); |
get_inter_block(bs, &block[i * 64], direction); |
1092 |
stop_coding_timer(); |
stop_coding_timer(); |
1093 |
|
|
1094 |
start_timer(); |
start_timer(); |
1183 |
|
|
1184 |
start_timer(); |
start_timer(); |
1185 |
image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height, |
image_setedges(&dec->refn[0], dec->edged_width, dec->edged_height, |
1186 |
dec->width, dec->height, dec->interlacing); |
dec->width, dec->height); |
1187 |
image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height, |
image_setedges(&dec->refn[1], dec->edged_width, dec->edged_height, |
1188 |
dec->width, dec->height, dec->interlacing); |
dec->width, dec->height); |
1189 |
stop_edges_timer(); |
stop_edges_timer(); |
1190 |
|
|
1191 |
#ifdef BFRAMES_DEC_DEBUG |
#ifdef BFRAMES_DEC_DEBUG |
1420 |
|
|
1421 |
#ifdef BFRAMES_DEC |
#ifdef BFRAMES_DEC |
1422 |
// test if no B_VOP |
// test if no B_VOP |
1423 |
if (dec->low_delay) { |
if (dec->low_delay || dec->frames == 0) { |
1424 |
#endif |
#endif |
1425 |
image_output(&dec->cur, dec->width, dec->height, dec->edged_width, |
image_output(&dec->cur, dec->width, dec->height, dec->edged_width, |
1426 |
frame->image, frame->stride, frame->colorspace); |
frame->image, frame->stride, frame->colorspace); |
1427 |
|
|
1428 |
#ifdef BFRAMES_DEC |
#ifdef BFRAMES_DEC |
1429 |
} else { |
} else { |
1430 |
if (dec->frames >= 0) { |
if (dec->frames >= 1) { |
1431 |
start_timer(); |
start_timer(); |
1432 |
if ((vop_type == I_VOP || vop_type == P_VOP)) { |
if ((vop_type == I_VOP || vop_type == P_VOP)) { |
1433 |
image_output(&dec->refn[0], dec->width, dec->height, |
image_output(&dec->refn[0], dec->width, dec->height, |