[cvs] / xvidcore / src / prediction / mbprediction.h Repository:
ViewVC logotype

Diff of /xvidcore/src/prediction/mbprediction.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6, Fri May 3 00:45:10 2002 UTC revision 1.16, Sat Oct 19 12:20:33 2002 UTC
# Line 3  Line 3 
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  -  MB prediction header file  -   *  -  MB prediction header file  -
5   *   *
6     *  Copyright(C) 2002 Christoph Lampert <gruel@web.de>
7     *               2002 Peter Ross <pross@xvid.org>
8     *
9   *  This program is an implementation of a part of one or more MPEG-4   *  This program is an implementation of a part of one or more MPEG-4
10   *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending   *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
11   *  to use this software module in hardware or software products are   *  to use this software module in hardware or software products are
# Line 45  Line 48 
48    
49  #define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) )  #define MVequal(A,B) ( ((A).x)==((B).x) && ((A).y)==((B).y) )
50    
51  void MBPrediction(  /*****************************************************************************
52          FRAMEINFO *frame, /* <-- The parameter for ACDC and MV prediction */   * Prototypes
53     ****************************************************************************/
54    
55    void MBPrediction(FRAMEINFO * frame,    /* <-- The parameter for ACDC and MV prediction */
56    
57          uint32_t x_pos,   /* <-- The x position of the MB to be searched  */          uint32_t x_pos,   /* <-- The x position of the MB to be searched  */
58    
59          uint32_t y_pos,   /* <-- The y position of the MB to be searched  */          uint32_t y_pos,   /* <-- The y position of the MB to be searched  */
60    
61          uint32_t x_dim,   /* <-- Number of macroblocks in a row           */          uint32_t x_dim,   /* <-- Number of macroblocks in a row           */
62    
63          int16_t *qcoeff); /* <-> The quantized DCT coefficients           */          int16_t *qcoeff); /* <-> The quantized DCT coefficients           */
64    
65  void add_acdc(MACROBLOCK *pMB,  void add_acdc(MACROBLOCK *pMB,
# Line 67  Line 77 
77                    int16_t qcoeff[64],                    int16_t qcoeff[64],
78                    uint32_t current_quant,                    uint32_t current_quant,
79                    int32_t iDcScaler,                    int32_t iDcScaler,
80                    int16_t predictors[8]);                                    int16_t predictors[8],
81                                    const int bound);
82    
 /* get_pmvdata returns the median predictor and nothing else */  
   
 static __inline VECTOR get_pmv(const MACROBLOCK * const pMBs,  
                                const uint32_t x,  
                                const uint32_t y,  
                                const uint32_t x_dim,  
                                const uint32_t block)  
 {  
83    
84          int xin1, xin2, xin3;  /*****************************************************************************
85          int yin1, yin2, yin3;   * Inlined functions
86          int vec1, vec2, vec3;   ****************************************************************************/
         VECTOR lneigh,tneigh,trneigh; /* left neighbour, top neighbour, topright neighbour */  
         VECTOR median;  
   
         static VECTOR zeroMV = {0,0};  
         uint32_t index = x + y * x_dim;  
   
         /* first row (special case) */  
         if (y == 0 && (block == 0 || block == 1))  
         {  
                 if ((x == 0) && (block == 0))           // first column, first block  
                 {  
                         return zeroMV;  
                 }  
                 if (block == 1)         // second block; has only a left neighbour  
                 {  
                         return pMBs[index].mvs[0];  
                 }  
                 else /* block==0, but x!=0, so again, there is a left neighbour*/  
                 {  
                         return pMBs[index-1].mvs[1];  
                 }  
         }  
87    
88          /*          /*
89           * MODE_INTER, vm18 page 48           * MODE_INTER, vm18 page 48
# Line 117  Line 98 
98           *   [   | 3 ]    [ 2 | 3 ]    [   |   ]           *   [   | 3 ]    [ 2 | 3 ]    [   |   ]
99           */           */
100    
101          switch (block)  static __inline VECTOR
102          {  get_pmv2(const MACROBLOCK * const mbs,
103             const int mb_width,
104             const int bound,
105             const int x,
106             const int y,
107             const int block)
108    {
109            static const VECTOR zeroMV = { 0, 0 };
110    
111        int lx, ly, lz;         /* left */
112        int tx, ty, tz;         /* top */
113        int rx, ry, rz;         /* top-right */
114        int lpos, tpos, rpos;
115        int num_cand, last_cand;
116    
117            VECTOR pmv[4];  /* left neighbour, top neighbour, top-right neighbour */
118    
119            switch (block) {
120          case 0:          case 0:
121                  xin1 = x - 1;   yin1 = y;       vec1 = 1;       /* left */                  lx = x - 1;     ly = y;         lz = 1;
122                  xin2 = x;       yin2 = y - 1;   vec2 = 2;       /* top */                  tx = x;         ty = y - 1;     tz = 2;
123                  xin3 = x + 1;   yin3 = y - 1;   vec3 = 2;       /* top right */                  rx = x + 1;     ry = y - 1;     rz = 2;
124                  break;                  break;
125          case 1:          case 1:
126                  xin1 = x;               yin1 = y;               vec1 = 0;                  lx = x;         ly = y;         lz = 0;
127                  xin2 = x;               yin2 = y - 1;   vec2 = 3;                  tx = x;         ty = y - 1;     tz = 3;
128                  xin3 = x + 1;   yin3 = y - 1;   vec3 = 2;                  rx = x + 1;     ry = y - 1;     rz = 2;
129                  break;                  break;
130          case 2:          case 2:
131                  xin1 = x - 1;   yin1 = y;               vec1 = 3;                  lx = x - 1;     ly = y;         lz = 3;
132                  xin2 = x;               yin2 = y;               vec2 = 0;                  tx = x;         ty = y;         tz = 0;
133                  xin3 = x;               yin3 = y;               vec3 = 1;                  rx = x;         ry = y;         rz = 1;
134                  break;                  break;
135          default:          default:
136                  xin1 = x;               yin1 = y;               vec1 = 2;                  lx = x;         ly = y;         lz = 2;
137                  xin2 = x;               yin2 = y;               vec2 = 0;                  tx = x;         ty = y;         tz = 0;
138                  xin3 = x;               yin3 = y;               vec3 = 1;                  rx = x;         ry = y;         rz = 1;
139          }          }
140    
141        lpos = lx + ly * mb_width;
142          if (xin1 < 0 || /* yin1 < 0  || */ xin1 >= (int32_t)x_dim)      rpos = rx + ry * mb_width;
143          {      tpos = tx + ty * mb_width;
144                  lneigh = zeroMV;      last_cand = num_cand = 0;
145          }  
146          else      if (lpos >= bound && lx >= 0) {
147          {          num_cand++;
148                  lneigh = pMBs[xin1 + yin1 * x_dim].mvs[vec1];          last_cand = 1;
149            pmv[1] = mbs[lpos].mvs[lz];
150        } else {
151            pmv[1] = zeroMV;
152          }          }
153    
154          if (xin2 < 0 || /* yin2 < 0 || */ xin2 >= (int32_t)x_dim)      if (tpos >= bound) {
155          {          num_cand++;
156                  tneigh = zeroMV;          last_cand = 2;
157          }          pmv[2] = mbs[tpos].mvs[tz];
158          else      } else {
159          {          pmv[2] = zeroMV;
                 tneigh = pMBs[xin2 + yin2 * x_dim].mvs[vec2];  
160          }          }
161    
162          if (xin3 < 0 || /* yin3 < 0 || */ xin3 >= (int32_t)x_dim)      if (rpos >= bound && rx < mb_width) {
163          {          num_cand++;
164                  trneigh = zeroMV;          last_cand = 3;
165          }          pmv[3] = mbs[rpos].mvs[rz];
166          else      } else {
167          {          pmv[3] = zeroMV;
                 trneigh = pMBs[xin3 + yin3 * x_dim].mvs[vec3];  
168          }          }
169    
170          /* median,minimum */      /*
171             * If there're more than one candidate, we return the median vector
172             * edgomez : the special case "no candidates" is handled the same way
173             *           because all vectors are set to zero. So the median vector
174             *           is {0,0}, and this is exactly the vector we must return
175             *           according to the mpeg4 specs.
176             */
177    
178            if (num_cand != 1) {
179                    /* set median */
180    
181          median.x = MIN(MAX(lneigh.x, tneigh.x), MIN(MAX(tneigh.x, trneigh.x), MAX(lneigh.x, trneigh.x)));                  pmv[0].x =
182          median.y = MIN(MAX(lneigh.y, tneigh.y), MIN(MAX(tneigh.y, trneigh.y), MAX(lneigh.y, trneigh.y)));                          MIN(MAX(pmv[1].x, pmv[2].x),
183          return median;                                  MIN(MAX(pmv[2].x, pmv[3].x), MAX(pmv[1].x, pmv[3].x)));
184                    pmv[0].y =
185                            MIN(MAX(pmv[1].y, pmv[2].y),
186                                    MIN(MAX(pmv[2].y, pmv[3].y), MAX(pmv[1].y, pmv[3].y)));
187                    return pmv[0];
188  }  }
189    
190             return pmv[last_cand];  /* no point calculating median mv */
191    }
192    
 /* This is somehow a copy of get_pmv, but returning all MVs and Minimum SAD  
    instead of only Median MV */  
193    
 static __inline int get_pmvdata(const MACROBLOCK * const pMBs,  
                                 const uint32_t x, const uint32_t y,  
                                 const uint32_t x_dim,  
                                 const uint32_t block,  
                                 VECTOR * const pmv,  
                                 int32_t * const psad)  
 {  
194    
195          /*          /*
196           * pmv are filled with:           * pmv are filled with:
# Line 200  Line 205 
205           *  [3]: topright neighbour's SAD           *  [3]: topright neighbour's SAD
206           */           */
207    
208          int xin1, xin2, xin3;  static __inline int
209          int yin1, yin2, yin3;  get_pmvdata2(const MACROBLOCK * const mbs,
210          int vec1, vec2, vec3;           const int mb_width,
211             const int bound,
212          static VECTOR zeroMV;           const int x,
213          uint32_t index = x + y * x_dim;           const int y,
214          zeroMV.x = zeroMV.y = 0;           const int block,
215                     VECTOR * const pmv,
216          // first row (special case)                   int32_t * const psad)
         if (y == 0 && (block == 0 || block == 1))  
217          {          {
218                  if ((x == 0) && (block == 0))           // first column, first block          static const VECTOR zeroMV = { 0, 0 };
219    
220        int lx, ly, lz;         /* left */
221        int tx, ty, tz;         /* top */
222        int rx, ry, rz;         /* top-right */
223        int lpos, tpos, rpos;
224        int num_cand, last_cand;
225    
226            switch (block) {
227            case 0:
228                    lx = x - 1;     ly = y;         lz = 1;
229                    tx = x;         ty = y - 1;     tz = 2;
230                    rx = x + 1;     ry = y - 1;     rz = 2;
231                    break;
232            case 1:
233                    lx = x;         ly = y;         lz = 0;
234                    tx = x;         ty = y - 1;     tz = 3;
235                    rx = x + 1;     ry = y - 1;     rz = 2;
236                    break;
237            case 2:
238                    lx = x - 1;     ly = y;         lz = 3;
239                    tx = x;         ty = y;         tz = 0;
240                    rx = x;         ry = y;         rz = 1;
241                    break;
242            default:
243                    lx = x;         ly = y;         lz = 2;
244                    tx = x;         ty = y;         tz = 0;
245                    rx = x;         ry = y;         rz = 1;
246            }
247    
248        lpos = lx + ly * mb_width;
249        rpos = rx + ry * mb_width;
250        tpos = tx + ty * mb_width;
251        last_cand = num_cand = 0;
252    
253        if (lpos >= bound && lx >= 0) {
254            num_cand++;
255            last_cand = 1;
256            pmv[1] = mbs[lpos].mvs[lz];
257                    psad[1] = mbs[lpos].sad8[lz];
258        } else {
259            pmv[1] = zeroMV;
260                    psad[1] = MV_MAX_ERROR;
261        }
262    
263        if (tpos >= bound) {
264            num_cand++;
265            last_cand = 2;
266            pmv[2]= mbs[tpos].mvs[tz];
267            psad[2] = mbs[tpos].sad8[tz];
268        } else {
269            pmv[2] = zeroMV;
270                    psad[2] = MV_MAX_ERROR;
271        }
272    
273        if (rpos >= bound && rx < mb_width) {
274            num_cand++;
275            last_cand = 3;
276            pmv[3] = mbs[rpos].mvs[rz];
277            psad[3] = mbs[rpos].sad8[rz];
278        } else {
279            pmv[3] = zeroMV;
280                    psad[3] = MV_MAX_ERROR;
281        }
282    
283            /* original pmvdata() compatibility hack */
284            if (x == 0 && y == 0 && block == 0)
285                  {                  {
286                          pmv[0] = pmv[1] = pmv[2] = pmv[3] = zeroMV;                          pmv[0] = pmv[1] = pmv[2] = pmv[3] = zeroMV;
287                          psad[0] = psad[1] = psad[2] = psad[3] = MV_MAX_ERROR;                  psad[0] = 0;
288                    psad[1] = psad[2] = psad[3] = MV_MAX_ERROR;
289                          return 0;                          return 0;
290                  }                  }
291                  if (block == 1)         // second block; has only a left neighbour  
292                  {      /* if only one valid candidate preictor, the invalid candiates are set to the canidate */
293                          pmv[0] = pmv[1] = pMBs[index].mvs[0];          if (num_cand == 1) {
294                          pmv[2] = pmv[3] = zeroMV;                  pmv[0] = pmv[last_cand];
295                          psad[0] = psad[1] = pMBs[index].sad8[0];                  psad[0] = psad[last_cand];
296                          psad[2] = psad[3] = MV_MAX_ERROR;          // return MVequal(pmv[0], zeroMV); /* no point calculating median mv and minimum sad */
297                          return 0;  
298                    /* original pmvdata() compatibility hack */
299                    return y==0 && block <= 1 ? 0 : MVequal(pmv[0], zeroMV);
300                  }                  }
301                  else /* block==0, but x!=0, so again, there is a left neighbour*/  
302                  {          if ((MVequal(pmv[1], pmv[2])) && (MVequal(pmv[1], pmv[3]))) {
303                          pmv[0] = pmv[1] = pMBs[index-1].mvs[1];                  pmv[0] = pmv[1];
304                          pmv[2] = pmv[3] = zeroMV;                  psad[0] = MIN(MIN(psad[1], psad[2]), psad[3]);
305                          psad[0] = psad[1] = pMBs[index-1].sad8[1];                  return 1;
306                          psad[2] = psad[3] = MV_MAX_ERROR;                  /* compatibility patch */
307                          return 0;                  //return y==0 && block <= 1 ? 0 : 1;
308                  }                  }
309    
310            /* set median, minimum */
311    
312            pmv[0].x =
313                    MIN(MAX(pmv[1].x, pmv[2].x),
314                            MIN(MAX(pmv[2].x, pmv[3].x), MAX(pmv[1].x, pmv[3].x)));
315            pmv[0].y =
316                    MIN(MAX(pmv[1].y, pmv[2].y),
317                            MIN(MAX(pmv[2].y, pmv[3].y), MAX(pmv[1].y, pmv[3].y)));
318    
319            psad[0] = MIN(MIN(psad[1], psad[2]), psad[3]);
320    
321            return 0;
322          }          }
323    
324          /*  /* copies of get_pmv and get_pmvdata for prediction from integer search */
          * MODE_INTER, vm18 page 48  
          * MODE_INTER4V vm18 page 51  
          *  
          *  (x,y-1)      (x+1,y-1)  
          *  [   |   ]    [   |   ]  
          *  [ 2 | 3 ]    [ 2 |   ]  
          *  
          *  (x-1,y)      (x,y)        (x+1,y)  
          *  [   | 1 ]    [ 0 | 1 ]    [ 0 |   ]  
          *  [   | 3 ]    [ 2 | 3 ]    [   |   ]  
          */  
325    
326          switch (block)  static __inline VECTOR
327          {  get_ipmv(const MACROBLOCK * const mbs,
328             const int mb_width,
329             const int bound,
330             const int x,
331             const int y,
332             const int block)
333    {
334            static const VECTOR zeroMV = { 0, 0 };
335    
336            int lx, ly, lz;         /* left */
337            int tx, ty, tz;         /* top */
338            int rx, ry, rz;         /* top-right */
339            int lpos, tpos, rpos;
340            int num_cand, last_cand;
341    
342            VECTOR pmv[4];  /* left neighbour, top neighbour, top-right neighbour */
343    
344            switch (block) {
345          case 0:          case 0:
346                  xin1 = x - 1; yin1 = y;     vec1 = 1; /* left */                  lx = x - 1;     ly = y;         lz = 1;
347                  xin2 = x;     yin2 = y - 1; vec2 = 2; /* top */                  tx = x;         ty = y - 1;     tz = 2;
348                  xin3 = x + 1; yin3 = y - 1; vec3 = 2; /* top right */                  rx = x + 1;     ry = y - 1;     rz = 2;
349                  break;                  break;
350          case 1:          case 1:
351                  xin1 = x;     yin1 = y;     vec1 = 0;                  lx = x;         ly = y;         lz = 0;
352                  xin2 = x;     yin2 = y - 1; vec2 = 3;                  tx = x;         ty = y - 1;     tz = 3;
353                  xin3 = x + 1; yin3 = y - 1; vec3 = 2;                  rx = x + 1;     ry = y - 1;     rz = 2;
354                  break;                  break;
355          case 2:          case 2:
356                  xin1 = x - 1; yin1 = y; vec1 = 3;                  lx = x - 1;     ly = y;         lz = 3;
357                  xin2 = x;     yin2 = y; vec2 = 0;                  tx = x;         ty = y;         tz = 0;
358                  xin3 = x;     yin3 = y; vec3 = 1;                  rx = x;         ry = y;         rz = 1;
359                  break;                  break;
360          default:          default:
361                  xin1 = x; yin1 = y; vec1 = 2;                  lx = x;         ly = y;         lz = 2;
362                  xin2 = x; yin2 = y; vec2 = 0;                  tx = x;         ty = y;         tz = 0;
363                  xin3 = x; yin3 = y; vec3 = 1;                  rx = x;         ry = y;         rz = 1;
364          }          }
365    
366        lpos = lx + ly * mb_width;
367        rpos = rx + ry * mb_width;
368        tpos = tx + ty * mb_width;
369        last_cand = num_cand = 0;
370    
371        if (lpos >= bound && lx >= 0) {
372            num_cand++;
373            last_cand = 1;
374            pmv[1] = mbs[lpos].i_mvs[lz];
375        } else {
376            pmv[1] = zeroMV;
377        }
378    
379          if (xin1 < 0 || /* yin1 < 0  || */ xin1 >= (int32_t)x_dim)      if (tpos >= bound) {
380            num_cand++;
381            last_cand = 2;
382            pmv[2] = mbs[tpos].i_mvs[tz];
383        } else {
384            pmv[2] = zeroMV;
385        }
386    
387        if (rpos >= bound && rx < mb_width) {
388            num_cand++;
389            last_cand = 3;
390            pmv[3] = mbs[rpos].i_mvs[rz];
391        } else {
392            pmv[3] = zeroMV;
393        }
394    
395        /* if only one valid candidate predictor, the invalid candiates are set to the canidate */
396            if (num_cand != 1) {
397                    /* set median */
398    
399                    pmv[0].x =
400                            MIN(MAX(pmv[1].x, pmv[2].x),
401                                    MIN(MAX(pmv[2].x, pmv[3].x), MAX(pmv[1].x, pmv[3].x)));
402                    pmv[0].y =
403                            MIN(MAX(pmv[1].y, pmv[2].y),
404                                    MIN(MAX(pmv[2].y, pmv[3].y), MAX(pmv[1].y, pmv[3].y)));
405                    return pmv[0];
406             }
407    
408             return pmv[last_cand];  /* no point calculating median mv */
409    }
410    
411    static __inline int
412    get_ipmvdata(const MACROBLOCK * const mbs,
413             const int mb_width,
414             const int bound,
415             const int x,
416             const int y,
417             const int block,
418                     VECTOR * const pmv,
419                     int32_t * const psad)
420          {          {
421            static const VECTOR zeroMV = { 0, 0 };
422    
423        int lx, ly, lz;         /* left */
424        int tx, ty, tz;         /* top */
425        int rx, ry, rz;         /* top-right */
426        int lpos, tpos, rpos;
427        int num_cand, last_cand;
428    
429            switch (block) {
430            case 0:
431                    lx = x - 1;     ly = y;         lz = 1;
432                    tx = x;         ty = y - 1;     tz = 2;
433                    rx = x + 1;     ry = y - 1;     rz = 2;
434                    break;
435            case 1:
436                    lx = x;         ly = y;         lz = 0;
437                    tx = x;         ty = y - 1;     tz = 3;
438                    rx = x + 1;     ry = y - 1;     rz = 2;
439                    break;
440            case 2:
441                    lx = x - 1;     ly = y;         lz = 3;
442                    tx = x;         ty = y;         tz = 0;
443                    rx = x;         ry = y;         rz = 1;
444                    break;
445            default:
446                    lx = x;         ly = y;         lz = 2;
447                    tx = x;         ty = y;         tz = 0;
448                    rx = x;         ry = y;         rz = 1;
449            }
450    
451        lpos = lx + ly * mb_width;
452        rpos = rx + ry * mb_width;
453        tpos = tx + ty * mb_width;
454        last_cand = num_cand = 0;
455    
456        if (lpos >= bound && lx >= 0) {
457            num_cand++;
458            last_cand = 1;
459            pmv[1] = mbs[lpos].i_mvs[lz];
460                    psad[1] = mbs[lpos].i_sad8[lz];
461        } else {
462              pmv[1] = zeroMV;              pmv[1] = zeroMV;
463                  psad[1] = MV_MAX_ERROR;                  psad[1] = MV_MAX_ERROR;
464          }          }
         else  
         {  
                 pmv[1] = pMBs[xin1 + yin1 * x_dim].mvs[vec1];  
                 psad[1] = pMBs[xin1 + yin1 * x_dim].sad8[vec1];  
         }  
465    
466          if (xin2 < 0 || /* yin2 < 0 || */ xin2 >= (int32_t)x_dim)      if (tpos >= bound) {
467          {          num_cand++;
468            last_cand = 2;
469            pmv[2]= mbs[tpos].i_mvs[tz];
470            psad[2] = mbs[tpos].i_sad8[tz];
471        } else {
472                  pmv[2] = zeroMV;                  pmv[2] = zeroMV;
473                  psad[2] = MV_MAX_ERROR;                  psad[2] = MV_MAX_ERROR;
474          }          }
         else  
         {  
                 pmv[2] = pMBs[xin2 + yin2 * x_dim].mvs[vec2];  
                 psad[2] = pMBs[xin2 + yin2 * x_dim].sad8[vec2];  
         }  
475    
476          if (xin3 < 0 || /* yin3 < 0 || */ xin3 >= (int32_t)x_dim)      if (rpos >= bound && rx < mb_width) {
477          {          num_cand++;
478            last_cand = 3;
479            pmv[3] = mbs[rpos].i_mvs[rz];
480            psad[3] = mbs[rpos].i_sad8[rz];
481        } else {
482                  pmv[3] = zeroMV;                  pmv[3] = zeroMV;
483                  psad[3] = MV_MAX_ERROR;                  psad[3] = MV_MAX_ERROR;
484          }          }
485          else  
486            /* original pmvdata() compatibility hack */
487            if (x == 0 && y == 0 && block == 0)
488          {          {
489                  pmv[3] = pMBs[xin3 + yin3 * x_dim].mvs[vec3];                  pmv[0] = pmv[1] = pmv[2] = pmv[3] = zeroMV;
490                  psad[3] = pMBs[xin2 + yin2 * x_dim].sad8[vec3];                  psad[0] = 0;
491                    psad[1] = psad[2] = psad[3] = MV_MAX_ERROR;
492                    return 0;
493            }
494    
495        /* if only one valid candidate preictor, the invalid candiates are set to the canidate */
496            if (num_cand == 1) {
497                    pmv[0] = pmv[last_cand];
498                    psad[0] = psad[last_cand];
499            // return MVequal(pmv[0], zeroMV); /* no point calculating median mv and minimum sad */
500    
501                    /* original pmvdata() compatibility hack */
502                    return y==0 && block <= 1 ? 0 : MVequal(pmv[0], zeroMV);
503          }          }
504    
505          if ( (MVequal(pmv[1],pmv[2])) && (MVequal(pmv[1],pmv[3])) )          if ((MVequal(pmv[1], pmv[2])) && (MVequal(pmv[1], pmv[3]))) {
506          {       pmv[0]=pmv[1];                  pmv[0] = pmv[1];
507          psad[0]=psad[1];                  psad[0] = MIN(MIN(psad[1], psad[2]), psad[3]);
508          return 1;          return 1;
509                    /* compatibility patch */
510                    //return y==0 && block <= 1 ? 0 : 1;
511          }          }
512    
513          /* median,minimum */          /* set median, minimum */
514    
515            pmv[0].x =
516                    MIN(MAX(pmv[1].x, pmv[2].x),
517                            MIN(MAX(pmv[2].x, pmv[3].x), MAX(pmv[1].x, pmv[3].x)));
518            pmv[0].y =
519                    MIN(MAX(pmv[1].y, pmv[2].y),
520                            MIN(MAX(pmv[2].y, pmv[3].y), MAX(pmv[1].y, pmv[3].y)));
521    
         pmv[0].x = MIN(MAX(pmv[1].x, pmv[2].x), MIN(MAX(pmv[2].x, pmv[3].x), MAX(pmv[1].x, pmv[3].x)));  
         pmv[0].y = MIN(MAX(pmv[1].y, pmv[2].y), MIN(MAX(pmv[2].y, pmv[3].y), MAX(pmv[1].y, pmv[3].y)));  
522          psad[0]=MIN(MIN(psad[1],psad[2]),psad[3]);          psad[0]=MIN(MIN(psad[1],psad[2]),psad[3]);
523    
524          return 0;          return 0;
525  }  }
526    
527    
   
528  #endif /* _MBPREDICTION_H_ */  #endif /* _MBPREDICTION_H_ */

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.16

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4