--- mbprediction.h 2003/02/15 15:22:19 1.19 +++ mbprediction.h 2003/02/19 21:02:11 1.20 @@ -26,7 +26,7 @@ * along with this program; if not, write to the xvid_free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: mbprediction.h,v 1.19 2003/02/15 15:22:19 edgomez Exp $ + * $Id: mbprediction.h,v 1.20 2003/02/19 21:02:11 edgomez Exp $ * *************************************************************************/ @@ -549,7 +549,7 @@ lpos = lx + ly * mb_width; rpos = rx + ry * mb_width; tpos = tx + ty * mb_width; - num_cand = 0; + last_cand = num_cand = 0; if (lpos >= bound && lx >= 0) { num_cand++; @@ -575,7 +575,13 @@ pmv[3] = zeroMV; } - /* if only one valid candidate predictor, the invalid candiates are set to the canidate */ + /* + * If there're more than one candidate, we return the median vector + * edgomez : the special case "no candidates" is handled the same way + * because all vectors are set to zero. So the median vector + * is {0,0}, and this is exactly the vector we must return + * according to the mpeg4 specs. + */ if (num_cand != 1) { /* set median */ @@ -649,7 +655,7 @@ lpos = lx + ly * mb_width; rpos = rx + ry * mb_width; tpos = tx + ty * mb_width; - num_cand = 0; + last_cand = num_cand = 0; if (lpos >= bound && lx >= 0) { num_cand++; @@ -675,7 +681,13 @@ pmv[3] = zeroMV; } - /* if only one valid candidate predictor, the invalid candiates are set to the canidate */ + /* + * If there're more than one candidate, we return the median vector + * edgomez : the special case "no candidates" is handled the same way + * because all vectors are set to zero. So the median vector + * is {0,0}, and this is exactly the vector we must return + * according to the mpeg4 specs. + */ if (num_cand != 1) { /* set median */ @@ -748,7 +760,7 @@ lpos = lx + ly * mb_width; rpos = rx + ry * mb_width; tpos = tx + ty * mb_width; - num_cand = 0; + last_cand = num_cand = 0; if (lpos >= bound && lx >= 0) { num_cand++;