--- decoder.c 2003/11/30 16:13:15 1.49.2.20 +++ decoder.c 2003/12/10 15:07:42 1.49.2.24 @@ -20,7 +20,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: decoder.c,v 1.49.2.20 2003/11/30 16:13:15 edgomez Exp $ + * $Id: decoder.c,v 1.49.2.24 2003/12/10 15:07:42 edgomez Exp $ * ****************************************************************************/ @@ -58,6 +58,7 @@ #include "image/image.h" #include "image/colorspace.h" +#include "image/postprocessing.h" #include "utils/mem_align.h" static int @@ -1316,6 +1317,16 @@ void decoder_output(DECODER * dec, IMAGE * img, MACROBLOCK * mbs, xvid_dec_frame_t * frame, xvid_dec_stats_t * stats, int coding_type) { + if (frame->general & (XVID_DEBLOCKY|XVID_DEBLOCKUV)) /* post process */ + { + /* note: image is stored to tmp */ + image_copy(&dec->tmp, img, dec->edged_width, dec->height); + image_deblock(&dec->tmp, dec->edged_width, + mbs, dec->mb_width, dec->mb_height, dec->mb_width, + frame->general); + img = &dec->tmp; + } + image_output(img, dec->width, dec->height, dec->edged_width, (uint8_t**)frame->output.plane, frame->output.stride, frame->output.csp, dec->interlacing); @@ -1450,6 +1461,7 @@ /* XXX: not_coded vops are not used for forward prediction */ /* we should not swap(last_mbs,mbs) */ image_copy(&dec->cur, &dec->refn[0], dec->edged_width, dec->height); + SWAP(MACROBLOCK *, dec->mbs, dec->last_mbs); /* it will be swapped back */ break; } @@ -1491,16 +1503,18 @@ /* attemping to decode a bvop without atleast 2 reference frames */ image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16, "broken b-frame, mising ref frames"); + stats->type = XVID_TYPE_NOTHING; } else if (dec->time_pp <= dec->time_bp) { /* this occurs when dx50_bvop_compatibility==0 sequences are decoded in vfw. */ image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16, "broken b-frame, tpp=%i tbp=%i", dec->time_pp, dec->time_bp); + stats->type = XVID_TYPE_NOTHING; } else { decoder_bframe(dec, &bs, quant, fcode_forward, fcode_backward); + decoder_output(dec, &dec->cur, dec->mbs, frame, stats, coding_type); } - decoder_output(dec, &dec->cur, dec->mbs, frame, stats, coding_type); output = 1; dec->frames++; }