--- decoder.c 2002/12/14 06:07:02 1.37.2.21 +++ decoder.c 2003/01/03 16:25:14 1.37.2.25 @@ -55,7 +55,7 @@ * 22.12.2001 lock based interpolation * 01.12.2001 inital version; (c)2001 peter ross * - * $Id: decoder.c,v 1.37.2.21 2002/12/14 06:07:02 suxen_drol Exp $ + * $Id: decoder.c,v 1.37.2.25 2003/01/03 16:25:14 suxen_drol Exp $ * *************************************************************************/ @@ -678,7 +678,7 @@ if (dec->interlacing) { mb->field_dct = BitstreamGetBit(bs); - DEBUG1("deci: field_dct: ", mb->field_dct); + DPRINTF(DPRINTF_MB,"deci: field_dct: %i", mb->field_dct); } decoder_mbintra(dec, mb, x, y, acpred_flag, cbp, bs, quant, @@ -856,18 +856,18 @@ if (dec->interlacing) { if (cbp || intra) { mb->field_dct = BitstreamGetBit(bs); - DEBUG1("decp: field_dct: ", mb->field_dct); + DPRINTF(DPRINTF_MB,"decp: field_dct: %i", mb->field_dct); } if (mb->mode == MODE_INTER || mb->mode == MODE_INTER_Q) { mb->field_pred = BitstreamGetBit(bs); - DEBUG1("decp: field_pred: ", mb->field_pred); + DPRINTF(DPRINTF_MB, "decp: field_pred: %i", mb->field_pred); if (mb->field_pred) { mb->field_for_top = BitstreamGetBit(bs); - DEBUG1("decp: field_for_top: ", mb->field_for_top); + DPRINTF(DPRINTF_MB,"decp: field_for_top: %i", mb->field_for_top); mb->field_for_bot = BitstreamGetBit(bs); - DEBUG1("decp: field_for_bot: ", mb->field_for_bot); + DPRINTF(DPRINTF_MB,"decp: field_for_bot: %i", mb->field_for_bot); } } } @@ -915,7 +915,7 @@ } else if (gmc_mv) /* not coded S_VOP macroblock */ { - mb->mode = MODE_NOT_CODED; + mb->mode = MODE_NOT_CODED_GMC; mb->mvs[0].x = mb->mvs[1].x = mb->mvs[2].x = mb->mvs[3].x = gmc_sanitize(gmc_mv[0].x, dec->quarterpel, fcode); mb->mvs[0].y = mb->mvs[1].y = mb->mvs[2].y = mb->mvs[3].y = gmc_sanitize(gmc_mv[0].y, dec->quarterpel, fcode); decoder_mbinter(dec, mb, x, y, 0, 0, bs, quant, rounding, reduced_resolution); @@ -1467,7 +1467,9 @@ mb->b_mvs[0] = mb->b_mvs[1] = mb->b_mvs[2] = mb->b_mvs[3] = mb->mvs[0] = mb->mvs[1] = mb->mvs[2] = mb->mvs[3] = zeromv; - // the last P_VOP is skip macroblock ? + // skip if the co-located P_VOP macroblock is not coded + // note: gmc+not_coded isn't skipped + if (last_mb->mode == MODE_NOT_CODED) { //DEBUG2("Skip MB in B-frame at (X,Y)=!",x,y); mb->cbp = 0; @@ -1581,7 +1583,7 @@ break; default: - DEBUG1("Not support B-frame mb_type =", mb->mb_type); + DPRINTF(DPRINTF_ERROR,"Not support B-frame mb_type = %i", mb->mb_type); } } // end of FOR @@ -1651,6 +1653,9 @@ dec->low_delay_default = (frame->general & XVID_DEC_LOWDELAY); dec->out_frm = (frame->colorspace == XVID_CSP_EXTERN) ? frame->image : NULL; + if ((frame->general & XVID_DEC_DISCONTINUITY)) + dec->frames = 0; + if (frame->length < 0) /* decoder flush */ { /* if not decoding "low_delay/packed", and this isn't low_delay and @@ -1700,6 +1705,7 @@ if (vop_type == - 1) { if (success) goto done; + emms(); return XVID_ERR_FAIL; } @@ -1720,6 +1726,7 @@ stats->data.vol.par_width = dec->par_width; stats->data.vol.par_height = dec->par_height; frame->length = BitstreamPos(&bs) / 8; + emms(); return XVID_ERR_OK; } goto repeat; @@ -1835,6 +1842,7 @@ { /* output the recently decoded frame */ decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, dec->last_reduced_resolution); + output = 1; } else { @@ -1846,7 +1854,6 @@ decoder_output(dec, &dec->cur, NULL, frame, 1 /*disable pp*/); } - output = 1; } frame->length = BitstreamPos(&bs) / 8;