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 |
|
|
362 |
uv_dx = pMB->mvs[0].x; |
uv_dx = pMB->mvs[0].x; |
363 |
uv_dy = pMB->mvs[0].y; |
uv_dy = pMB->mvs[0].y; |
364 |
|
|
365 |
|
if (dec->quarterpel) |
366 |
|
{ |
367 |
|
uv_dx = (uv_dx >> 1) | (uv_dx & 1); |
368 |
|
uv_dy = (uv_dy >> 1) | (uv_dy & 1); |
369 |
|
} |
370 |
|
|
371 |
uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2; |
uv_dx = (uv_dx & 3) ? (uv_dx >> 1) | 1 : uv_dx / 2; |
372 |
uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2; |
uv_dy = (uv_dy & 3) ? (uv_dy >> 1) | 1 : uv_dy / 2; |
373 |
} else { |
} else { |
374 |
int sum; |
int sum; |
|
|
|
375 |
sum = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x; |
sum = pMB->mvs[0].x + pMB->mvs[1].x + pMB->mvs[2].x + pMB->mvs[3].x; |
376 |
uv_dx = |
|
377 |
(sum == |
if (dec->quarterpel) |
378 |
0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] + |
{ |
379 |
(ABS(sum) / 16) * 2)); |
sum /= 2; |
380 |
|
} |
381 |
|
|
382 |
|
uv_dx = (sum == 0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2)); |
383 |
|
|
384 |
sum = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y; |
sum = pMB->mvs[0].y + pMB->mvs[1].y + pMB->mvs[2].y + pMB->mvs[3].y; |
385 |
uv_dy = |
|
386 |
(sum == |
if (dec->quarterpel) |
387 |
0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] + |
{ |
388 |
(ABS(sum) / 16) * 2)); |
sum /= 2; |
389 |
|
} |
390 |
|
|
391 |
|
uv_dy = (sum == 0 ? 0 : SIGN(sum) * (roundtab[ABS(sum) % 16] + (ABS(sum) / 16) * 2)); |
392 |
} |
} |
393 |
|
|
394 |
start_timer(); |
start_timer(); |
395 |
|
if(dec->quarterpel) { |
396 |
|
interpolate8x8_quarterpel(dec->cur.y, dec->refn[0].y, dec->refh.y, dec->refh.y + 64, |
397 |
|
dec->refh.y + 128, 16*x_pos, 16*y_pos, |
398 |
|
pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding); |
399 |
|
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); |
402 |
|
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); |
405 |
|
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); |
408 |
|
} |
409 |
|
else { |
410 |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos, 16 * y_pos, |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos, 16 * y_pos, |
411 |
pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding); |
pMB->mvs[0].x, pMB->mvs[0].y, stride, rounding); |
412 |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos + 8, |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos, |
413 |
16 * y_pos, pMB->mvs[1].x, pMB->mvs[1].y, stride, |
pMB->mvs[1].x, pMB->mvs[1].y, stride, rounding); |
414 |
rounding); |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos, 16*y_pos + 8, |
415 |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos, |
pMB->mvs[2].x, pMB->mvs[2].y, stride, rounding); |
416 |
16 * y_pos + 8, pMB->mvs[2].x, pMB->mvs[2].y, stride, |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16*x_pos + 8, 16*y_pos + 8, |
417 |
rounding); |
pMB->mvs[3].x, pMB->mvs[3].y, stride, rounding); |
418 |
interpolate8x8_switch(dec->cur.y, dec->refn[0].y, 16 * x_pos + 8, |
} |
419 |
16 * y_pos + 8, pMB->mvs[3].x, pMB->mvs[3].y, stride, |
|
|
rounding); |
|
420 |
interpolate8x8_switch(dec->cur.u, dec->refn[0].u, 8 * x_pos, 8 * y_pos, |
interpolate8x8_switch(dec->cur.u, dec->refn[0].u, 8 * x_pos, 8 * y_pos, |
421 |
uv_dx, uv_dy, stride2, rounding); |
uv_dx, uv_dy, stride2, rounding); |
422 |
interpolate8x8_switch(dec->cur.v, dec->refn[0].v, 8 * x_pos, 8 * y_pos, |
interpolate8x8_switch(dec->cur.v, dec->refn[0].v, 8 * x_pos, 8 * y_pos, |
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(); |
534 |
decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant, |
decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant, |
535 |
intra_dc_threshold, bound); |
intra_dc_threshold, bound); |
536 |
} |
} |
537 |
|
if(dec->out_frm) |
538 |
|
output_slice(&dec->cur, dec->edged_width,dec->width,dec->out_frm,0,y,dec->mb_width); |
539 |
|
|
540 |
} |
} |
541 |
|
|
542 |
} |
} |
600 |
|
|
601 |
uint32_t x, y; |
uint32_t x, y; |
602 |
uint32_t bound; |
uint32_t bound; |
603 |
|
int cp_mb, st_mb; |
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; |
611 |
|
|
612 |
for (y = 0; y < dec->mb_height; y++) { |
for (y = 0; y < dec->mb_height; y++) { |
613 |
|
cp_mb = st_mb = 0; |
614 |
for (x = 0; x < dec->mb_width; x++) { |
for (x = 0; x < dec->mb_width; x++) { |
615 |
MACROBLOCK *mb; |
MACROBLOCK *mb; |
616 |
|
|
638 |
uint32_t cbp; |
uint32_t cbp; |
639 |
uint32_t intra; |
uint32_t intra; |
640 |
|
|
641 |
|
cp_mb++; |
642 |
mcbpc = get_mcbpc_inter(bs); |
mcbpc = get_mcbpc_inter(bs); |
643 |
mb->mode = mcbpc & 7; |
mb->mode = mcbpc & 7; |
644 |
cbpc = (mcbpc >> 4); |
cbpc = (mcbpc >> 4); |
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); |
704 |
mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = |
mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = |
705 |
mb->mvs[0].y; |
mb->mvs[0].y; |
706 |
} |
} |
707 |
} else if (mb->mode == |
} else if (mb->mode == MODE_INTER4V ) { |
708 |
MODE_INTER4V /* || mb->mode == MODE_INTER4V_Q */ ) { |
|
709 |
get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], fcode, bound); |
get_motion_vector(dec, bs, x, y, 0, &mb->mvs[0], fcode, bound); |
710 |
get_motion_vector(dec, bs, x, y, 1, &mb->mvs[1], fcode, bound); |
get_motion_vector(dec, bs, x, y, 1, &mb->mvs[1], fcode, bound); |
711 |
get_motion_vector(dec, bs, x, y, 2, &mb->mvs[2], fcode, bound); |
get_motion_vector(dec, bs, x, y, 2, &mb->mvs[2], fcode, bound); |
725 |
rounding); |
rounding); |
726 |
} else // not coded |
} else // not coded |
727 |
{ |
{ |
728 |
//DEBUG2("P-frame MB at (X,Y)=",x,y); |
DEBUG2("P-frame MB at (X,Y)=",x,y); |
729 |
mb->mode = MODE_NOT_CODED; |
mb->mode = MODE_NOT_CODED; |
730 |
mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = 0; |
mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = 0; |
731 |
mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = 0; |
mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = 0; |
767 |
dec->refn[0].v + |
dec->refn[0].v + |
768 |
(8 * y) * dec->edged_width / 2 + (8 * x), |
(8 * y) * dec->edged_width / 2 + (8 * x), |
769 |
dec->edged_width / 2); |
dec->edged_width / 2); |
|
|
|
770 |
stop_transfer_timer(); |
stop_transfer_timer(); |
771 |
|
if(dec->out_frm && cp_mb > 0) { |
772 |
|
output_slice(&dec->cur, dec->edged_width,dec->width,dec->out_frm,st_mb,y,cp_mb); |
773 |
|
cp_mb = 0; |
774 |
|
} |
775 |
|
st_mb = x+1; |
776 |
} |
} |
777 |
} |
} |
778 |
|
if(dec->out_frm && cp_mb > 0) |
779 |
|
output_slice(&dec->cur, dec->edged_width,dec->width,dec->out_frm,st_mb,y,cp_mb); |
780 |
} |
} |
781 |
} |
} |
782 |
|
|
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 |
1253 |
#ifdef BFRAMES_DEC_DEBUG |
#ifdef BFRAMES_DEC_DEBUG |
1254 |
BFRAME_DEBUG |
BFRAME_DEBUG |
1255 |
#endif |
#endif |
1256 |
|
|
1257 |
switch (mb->mb_type) { |
switch (mb->mb_type) { |
1258 |
case MODE_DIRECT: |
case MODE_DIRECT: |
1259 |
get_b_motion_vector(dec, bs, x, y, &mv, 1, zeromv); |
get_b_motion_vector(dec, bs, x, y, &mv, 1, zeromv); |
1260 |
|
|
1261 |
case MODE_DIRECT_NONE_MV: |
case MODE_DIRECT_NONE_MV: |
1262 |
{ // Because this file is a C file not C++ so I use '{' to define var |
{ |
1263 |
const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp; |
const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp; |
1264 |
int i; |
int i; |
1265 |
|
|
1319 |
break; |
break; |
1320 |
|
|
1321 |
default: |
default: |
1322 |
//DEBUG1("Not support B-frame mb_type =", mb->mb_type); |
DEBUG1("Not support B-frame mb_type =", mb->mb_type); |
|
; |
|
1323 |
} |
} |
1324 |
|
|
1325 |
} // end of FOR |
} // end of FOR |
1359 |
|
|
1360 |
start_global_timer(); |
start_global_timer(); |
1361 |
|
|
1362 |
|
dec->out_frm = (frame->colorspace == XVID_CSP_EXTERN) ? frame->image : NULL; |
1363 |
|
|
1364 |
BitstreamInit(&bs, frame->bitstream, frame->length); |
BitstreamInit(&bs, frame->bitstream, frame->length); |
1365 |
|
|
1366 |
// add by chenm001 <chenm001@163.com> |
// add by chenm001 <chenm001@163.com> |
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, |
1446 |
if (vop_type == I_VOP || vop_type == P_VOP) { |
if (vop_type == I_VOP || vop_type == P_VOP) { |
1447 |
image_swap(&dec->refn[0], &dec->refn[1]); |
image_swap(&dec->refn[0], &dec->refn[1]); |
1448 |
image_swap(&dec->cur, &dec->refn[0]); |
image_swap(&dec->cur, &dec->refn[0]); |
1449 |
|
|
1450 |
// swap MACROBLOCK |
// swap MACROBLOCK |
1451 |
if (!dec->low_delay && vop_type == P_VOP) |
// the Divx will not set the low_delay flage some times |
1452 |
|
// so follow code will wrong to not swap at that time |
1453 |
|
// this will broken bitstream! so I'm change it, |
1454 |
|
// But that is not the best way! can anyone tell me how |
1455 |
|
// to do another way? |
1456 |
|
// 18-07-2002 MinChen<chenm001@163.com> |
1457 |
|
//if (!dec->low_delay && vop_type == P_VOP) |
1458 |
|
if (vop_type == P_VOP) |
1459 |
mb_swap(&dec->mbs, &dec->last_mbs); |
mb_swap(&dec->mbs, &dec->last_mbs); |
1460 |
} |
} |
1461 |
|
|