--- decoder.c 2004/05/31 21:26:23 1.51.2.4 +++ decoder.c 2004/04/11 09:41:27 1.54 @@ -4,7 +4,7 @@ * - Decoder Module - * * Copyright(C) 2002 MinChen - * 2002-2003 Peter Ross + * 2002-2004 Peter Ross * * This program is free software ; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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.51.2.4 2004/05/31 21:26:23 edgomez Exp $ + * $Id: decoder.c,v 1.54 2004/04/11 09:41:27 syskin Exp $ * ****************************************************************************/ @@ -222,7 +222,6 @@ dec->time = dec->time_base = dec->last_time_base = 0; dec->low_delay = 0; dec->packed_mode = 0; - dec->time_inc_resolution = 1; /* until VOL header says otherwise */ dec->fixed_dimensions = (dec->width > 0 && dec->height > 0); @@ -303,7 +302,7 @@ start_timer(); predict_acdc(dec->mbs, x_pos, y_pos, dec->mb_width, i, &block[i * 64], - iQuant, iDcScaler, predictors, bound, dec->bs_version); + iQuant, iDcScaler, predictors, bound); if (!acpred_flag) { pMB->acpred_directions[i] = 0; } @@ -1215,6 +1214,7 @@ uint32_t x, y; VECTOR mv; const VECTOR zeromv = {0,0}; + const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp; int i; start_timer(); @@ -1309,15 +1309,14 @@ case MODE_DIRECT_NONE_MV: for (i = 0; i < 4; i++) { - mb->mvs[i].x = last_mb->mvs[i].x*dec->time_bp/dec->time_pp + mv.x; - mb->mvs[i].y = last_mb->mvs[i].y*dec->time_bp/dec->time_pp + mv.y; - - mb->b_mvs[i].x = (mv.x) - ? mb->mvs[i].x - last_mb->mvs[i].x - : last_mb->mvs[i].x*(dec->time_bp - dec->time_pp)/dec->time_pp; - mb->b_mvs[i].y = (mv.y) - ? mb->mvs[i].y - last_mb->mvs[i].y - : last_mb->mvs[i].y*(dec->time_bp - dec->time_pp)/dec->time_pp; + mb->mvs[i].x = (int32_t) ((TRB * last_mb->mvs[i].x) / TRD + mv.x); + mb->b_mvs[i].x = (int32_t) ((mv.x == 0) + ? ((TRB - TRD) * last_mb->mvs[i].x) / TRD + : mb->mvs[i].x - last_mb->mvs[i].x); + mb->mvs[i].y = (int32_t) ((TRB * last_mb->mvs[i].y) / TRD + mv.y); + mb->b_mvs[i].y = (int32_t) ((mv.y == 0) + ? ((TRB - TRD) * last_mb->mvs[i].y) / TRD + : mb->mvs[i].y - last_mb->mvs[i].y); } decoder_bf_interpolate_mbinter(dec, dec->refn[1], dec->refn[0], @@ -1364,13 +1363,14 @@ if (dec->cartoon_mode) frame->general &= ~XVID_FILMEFFECT; - if (frame->general & (XVID_DEBLOCKY|XVID_DEBLOCKUV|XVID_FILMEFFECT) && mbs != NULL) /* post process */ + if ((frame->general & (XVID_DEBLOCKY|XVID_DEBLOCKUV|XVID_FILMEFFECT) || frame->brightness!=0) + && mbs != NULL) /* post process */ { /* note: image is stored to tmp */ image_copy(&dec->tmp, img, dec->edged_width, dec->height); image_postproc(&dec->postproc, &dec->tmp, dec->edged_width, mbs, dec->mb_width, dec->mb_height, dec->mb_width, - frame->general, dec->frames, (coding_type == B_VOP)); + frame->general, frame->brightness, dec->frames, (coding_type == B_VOP)); img = &dec->tmp; } @@ -1490,11 +1490,6 @@ goto repeat; } - if(dec->frames == 0 && coding_type != I_VOP) { - /* 1st frame is not an i-vop */ - goto repeat; - } - dec->p_bmv.x = dec->p_bmv.y = dec->p_fmv.y = dec->p_fmv.y = 0; /* init pred vector to 0 */ /* packed_mode: special-N_VOP treament */