--- decoder.c 2002/05/06 03:58:09 1.16 +++ decoder.c 2002/05/20 17:12:53 1.18 @@ -32,6 +32,9 @@ * * History: * + * 08.05.2002 add low_delay support for B_VOP decode + * MinChen + * 05.05.2002 fix some B-frame decode problem * 02.05.2002 add B-frame decode support(have some problem); * MinChen * 22.04.2002 add some B-frame decode support; chenm001 @@ -44,7 +47,7 @@ * 22.12.2001 lock based interpolation * 01.12.2001 inital version; (c)2001 peter ross * - * $Id: decoder.c,v 1.16 2002/05/06 03:58:09 chenm001 Exp $ + * $Id: decoder.c,v 1.18 2002/05/20 17:12:53 Isibaar Exp $ * *************************************************************************/ @@ -1138,10 +1141,11 @@ // add by chenm001 // for support B-frame to reference last 2 frame - dec->frames ++; + dec->frames++; vop_type=BitstreamReadHeaders(&bs, dec, &rounding, &quant, &fcode_forward, &fcode_backward, &intra_dc_threshold); dec->p_bmv.x=dec->p_bmv.y=dec->p_fmv.y=dec->p_fmv.y=0; // init pred vector to 0 + switch (vop_type) { case P_VOP : @@ -1155,12 +1159,14 @@ break; case B_VOP : +#ifdef BFRAMES if (dec->time_pp > dec->time_bp){ DEBUG1("B_VOP Time=",dec->time); decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward); } else { DEBUG("broken B-frame!"); } +#endif break; case N_VOP : // vop not coded @@ -1172,23 +1178,34 @@ frame->length = BitstreamPos(&bs) / 8; - if (dec->frames >= 1){ - start_timer(); - if ((vop_type == I_VOP || vop_type == P_VOP)) - { - image_output(&dec->refn[0], dec->width, dec->height, dec->edged_width, - frame->image, frame->stride, frame->colorspace); - } else if (vop_type == B_VOP) { - image_output(&dec->cur, dec->width, dec->height, dec->edged_width, +#ifdef BFRAMES + // test if no B_VOP + if (dec->low_delay){ +#endif + image_output(&dec->cur, dec->width, dec->height, dec->edged_width, frame->image, frame->stride, frame->colorspace); +#ifdef BFRAMES + } else { + if (dec->frames >= 1){ + start_timer(); + if ((vop_type == I_VOP || vop_type == P_VOP)) + { + image_output(&dec->refn[0], dec->width, dec->height, dec->edged_width, + frame->image, frame->stride, frame->colorspace); + } else if (vop_type == B_VOP) { + image_output(&dec->cur, dec->width, dec->height, dec->edged_width, + frame->image, frame->stride, frame->colorspace); + } + stop_conv_timer(); } - stop_conv_timer(); } +#endif + if (vop_type==I_VOP || vop_type==P_VOP){ image_swap(&dec->refn[0], &dec->refn[1]); image_swap(&dec->cur, &dec->refn[0]); // swap MACROBLOCK - if (vop_type==P_VOP) + if (dec->low_delay && vop_type==P_VOP) mb_swap(&dec->mbs, &dec->last_mbs); }