[svn] / branches / dev-api-4 / xvidcore / src / motion / estimation_bvop.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/motion/estimation_bvop.c

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

revision 1160, Tue Sep 30 18:20:31 2003 UTC revision 1281, Thu Dec 18 21:40:11 2003 UTC
# Line 21  Line 21 
21   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
22   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23   *   *
24   * $Id: estimation_bvop.c,v 1.1.2.2 2003-09-30 18:20:31 edgomez Exp $   * $Id: estimation_bvop.c,v 1.1.2.12 2003-12-18 21:36:46 Isibaar Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 39  Line 39 
39  #include "sad.h"  #include "sad.h"
40  #include "motion_inlines.h"  #include "motion_inlines.h"
41    
   
42  static int32_t  static int32_t
43  ChromaSAD2(const int fx, const int fy, const int bx, const int by,  ChromaSAD2(const int fx, const int fy, const int bx, const int by,
44                          const SearchData * const data)                          SearchData * const data)
45  {  {
46          int sad;          int sad;
47          const uint32_t stride = data->iEdgedWidth/2;          const uint32_t stride = data->iEdgedWidth/2;
# Line 88  Line 87 
87  }  }
88    
89  static void  static void
90  CheckCandidateInt(const int xf, const int yf, const SearchData * const data, const unsigned int Direction)  CheckCandidateInt(const int x, const int y, SearchData * const data, const unsigned int Direction)
91  {  {
92          int32_t sad, xb, yb, xcf, ycf, xcb, ycb;          int32_t sad, xf, yf, xb, yb, xcf, ycf, xcb, ycb;
93          uint32_t t;          uint32_t t;
94    
95          const uint8_t *ReferenceF, *ReferenceB;          const uint8_t *ReferenceF, *ReferenceB;
96          VECTOR *current;          VECTOR *current;
97    
98          if ((xf > data->max_dx) || (xf < data->min_dx) ||          if ((x > data->max_dx) || (x < data->min_dx) ||
99                  (yf > data->max_dy) || (yf < data->min_dy))                  (y > data->max_dy) || (y < data->min_dy))
100                  return;                  return;
101    
102            if (Direction == 1) { /* x and y mean forward vector */
103                    VECTOR backward = data->qpel_precision ? data->currentQMV[1] : data->currentMV[1];
104                    xb = backward.x;
105                    yb = backward.y;
106                    xf = x; yf = y;
107            } else { /* x and y mean backward vector */
108                    VECTOR forward = data->qpel_precision ? data->currentQMV[0] : data->currentMV[0];
109                    xf = forward.x;
110                    yf = forward.y;
111                    xb = x; yb = y;
112            }
113    
114          if (!data->qpel_precision) {          if (!data->qpel_precision) {
115                  ReferenceF = GetReference(xf, yf, data);                  ReferenceF = GetReference(xf, yf, data);
                 xb = data->currentMV[1].x; yb = data->currentMV[1].y;  
116                  ReferenceB = GetReferenceB(xb, yb, 1, data);                  ReferenceB = GetReferenceB(xb, yb, 1, data);
117                  current = data->currentMV;                  current = data->currentMV + Direction - 1;
118                  xcf = xf; ycf = yf;                  xcf = xf; ycf = yf;
119                  xcb = xb; ycb = yb;                  xcb = xb; ycb = yb;
120          } else {          } else {
121                  ReferenceF = xvid_me_interpolate16x16qpel(xf, yf, 0, data);                  ReferenceF = xvid_me_interpolate16x16qpel(xf, yf, 0, data);
122                  xb = data->currentQMV[1].x; yb = data->currentQMV[1].y;                  current = data->currentQMV + Direction - 1;
                 current = data->currentQMV;  
123                  ReferenceB = xvid_me_interpolate16x16qpel(xb, yb, 1, data);                  ReferenceB = xvid_me_interpolate16x16qpel(xb, yb, 1, data);
124                  xcf = xf/2; ycf = yf/2;                  xcf = xf/2; ycf = yf/2;
125                  xcb = xb/2; ycb = yb/2;                  xcb = xb/2; ycb = yb/2;
# Line 128  Line 138 
138                                                          (ycb >> 1) + roundtab_79[ycb & 0x3], data);                                                          (ycb >> 1) + roundtab_79[ycb & 0x3], data);
139    
140          if (sad < *(data->iMinSAD)) {          if (sad < *(data->iMinSAD)) {
141                  *(data->iMinSAD) = sad;                  *data->iMinSAD = sad;
142                  current->x = xf; current->y = yf;                  current->x = x; current->y = y;
143                  *data->dir = Direction;                  data->dir = Direction;
144          }          }
145  }  }
146    
147  static void  static void
148  CheckCandidateDirect(const int x, const int y, const SearchData * const data, const unsigned int Direction)  CheckCandidateInt_qpel(const int x, const int y, SearchData * const data, const unsigned int Direction)
149    {
150            int32_t sad, xf, yf, xb, yb, xcf, ycf, xcb, ycb;
151            uint32_t t;
152    
153            const uint8_t *ReferenceF, *ReferenceB;
154            VECTOR *current;
155    
156            if ((x > data->max_dx) || (x < data->min_dx) ||
157                    (y > data->max_dy) || (y < data->min_dy))
158                    return;
159    
160            if (Direction == 1) { /* x and y mean forward vector */
161                    VECTOR backward = data->qpel_precision ? data->currentQMV[1] : data->currentMV[1];
162                    xb = backward.x;
163                    yb = backward.y;
164                    xf = x; yf = y;
165            } else { /* x and y mean backward vector */
166                    VECTOR forward = data->qpel_precision ? data->currentQMV[0] : data->currentMV[0];
167                    xf = forward.x;
168                    yf = forward.y;
169                    xb = x; yb = y;
170            }
171    
172            ReferenceF = xvid_me_interpolate16x16qpel(xf, yf, 0, data);
173            current = data->currentQMV + Direction - 1;
174            ReferenceB = xvid_me_interpolate16x16qpel(xb, yb, 1, data);
175            xcf = xf/2; ycf = yf/2;
176            xcb = xb/2; ycb = yb/2;
177    
178            t = d_mv_bits(xf, yf, data->predMV, data->iFcode, data->qpel^data->qpel_precision, 0)
179                     + d_mv_bits(xb, yb, data->bpredMV, data->iFcode, data->qpel^data->qpel_precision, 0);
180    
181            sad = sad16bi(data->Cur, ReferenceF, ReferenceB, data->iEdgedWidth);
182            sad += (data->lambda16 * t * sad)>>10;
183    
184            if (data->chroma && sad < *data->iMinSAD)
185                    sad += ChromaSAD2((xcf >> 1) + roundtab_79[xcf & 0x3],
186                                                            (ycf >> 1) + roundtab_79[ycf & 0x3],
187                                                            (xcb >> 1) + roundtab_79[xcb & 0x3],
188                                                            (ycb >> 1) + roundtab_79[ycb & 0x3], data);
189    
190            if (sad < *(data->iMinSAD)) {
191                    *data->iMinSAD = sad;
192                    current->x = x; current->y = y;
193                    data->dir = Direction;
194            }
195    
196            if (sad < *(data->iMinSAD)) {
197                    data->iMinSAD2 = *(data->iMinSAD);
198                    data->currentQMV2.x = current->x;
199                    data->currentQMV2.y = current->y;
200    
201                    *data->iMinSAD = sad;
202                    current->x = x; current->y = y;
203            } else if (sad < data->iMinSAD2) {
204                    data->iMinSAD2 = sad;
205                    data->currentQMV2.x = x; data->currentQMV2.y = y;
206            }
207    }
208    
209    static void
210    CheckCandidateDirect(const int x, const int y, SearchData * const data, const unsigned int Direction)
211  {  {
212          int32_t sad = 0, xcf = 0, ycf = 0, xcb = 0, ycb = 0;          int32_t sad = 0, xcf = 0, ycf = 0, xcb = 0, ycb = 0;
213          uint32_t k;          uint32_t k;
# Line 189  Line 261 
261                                                          (ycb >> 3) + roundtab_76[ycb & 0xf], data);                                                          (ycb >> 3) + roundtab_76[ycb & 0xf], data);
262    
263          if (sad < *(data->iMinSAD)) {          if (sad < *(data->iMinSAD)) {
264                  *(data->iMinSAD) = sad;                  data->iMinSAD[0] = sad;
265                  data->currentMV->x = x; data->currentMV->y = y;                  data->currentMV->x = x; data->currentMV->y = y;
266                  *data->dir = Direction;                  data->dir = Direction;
267          }          }
268  }  }
269    
270  static void  static void
271  CheckCandidateDirectno4v(const int x, const int y, const SearchData * const data, const unsigned int Direction)  CheckCandidateDirectno4v(const int x, const int y, SearchData * const data, const unsigned int Direction)
272  {  {
273          int32_t sad, xcf, ycf, xcb, ycb;          int32_t sad, xcf, ycf, xcb, ycb;
274          const uint8_t *ReferenceF;          const uint8_t *ReferenceF;
# Line 244  Line 316 
316          if (sad < *(data->iMinSAD)) {          if (sad < *(data->iMinSAD)) {
317                  *(data->iMinSAD) = sad;                  *(data->iMinSAD) = sad;
318                  data->currentMV->x = x; data->currentMV->y = y;                  data->currentMV->x = x; data->currentMV->y = y;
319                  *data->dir = Direction;                  data->dir = Direction;
320          }          }
321  }  }
322    
323  void  void
324  CheckCandidate16no4v(const int x, const int y, const SearchData * const data, const unsigned int Direction)  CheckCandidate16no4v(const int x, const int y, SearchData * const data, const unsigned int Direction)
325  {  {
326          int32_t sad, xc, yc;          int32_t sad, xc, yc;
327          const uint8_t * Reference;          const uint8_t * Reference;
# Line 283  Line 355 
355          if (sad < *(data->iMinSAD)) {          if (sad < *(data->iMinSAD)) {
356                  *(data->iMinSAD) = sad;                  *(data->iMinSAD) = sad;
357                  current->x = x; current->y = y;                  current->x = x; current->y = y;
358                  *data->dir = Direction;                  data->dir = Direction;
359            }
360    }
361    
362    void
363    CheckCandidate16no4v_qpel(const int x, const int y, SearchData * const data, const unsigned int Direction)
364    {
365            int32_t sad, xc, yc;
366            const uint8_t * Reference;
367            uint32_t t;
368    
369            if ( (x > data->max_dx) || ( x < data->min_dx)
370                    || (y > data->max_dy) || (y < data->min_dy) ) return;
371    
372            if (data->rrv && (!(x&1) && x !=0) | (!(y&1) && y !=0) ) return; /* non-zero even value */
373    
374            Reference = xvid_me_interpolate16x16qpel(x, y, 0, data);
375    
376            xc = x/2; yc = y/2;
377            t = d_mv_bits(x, y, data->predMV, data->iFcode,
378                                            data->qpel^data->qpel_precision, data->rrv);
379    
380            sad = sad16(data->Cur, Reference, data->iEdgedWidth, 256*4096);
381            sad += (data->lambda16 * t * sad)>>10;
382    
383            if (data->chroma && sad < *data->iMinSAD)
384                    sad += xvid_me_ChromaSAD((xc >> 1) + roundtab_79[xc & 0x3],
385                                                                    (yc >> 1) + roundtab_79[yc & 0x3], data);
386    
387            if (sad < *(data->iMinSAD)) {
388                    data->iMinSAD2 = *(data->iMinSAD);
389                    data->currentQMV2.x = data->currentQMV->x;
390                    data->currentQMV2.y = data->currentQMV->y;
391    
392                    data->iMinSAD[0] = sad;
393                    data->currentQMV[0].x = x; data->currentQMV[0].y = y;
394            } else if (sad < data->iMinSAD2) {
395                    data->iMinSAD2 = sad;
396                    data->currentQMV2.x = x; data->currentQMV2.y = y;
397          }          }
398  }  }
399    
# Line 350  Line 460 
460    
461          int i;          int i;
462          VECTOR pmv[7];          VECTOR pmv[7];
463          MainSearchFunc *MainSearchPtr;          int threshA = (MotionFlags & XVID_ME_FASTREFINE16) ? 150 : 300;
464          *Data->iMinSAD = MV_MAX_ERROR;          *Data->iMinSAD = MV_MAX_ERROR;
465          Data->iFcode = iFcode;          Data->iFcode = iFcode;
466          Data->qpel_precision = 0;          Data->qpel_precision = 0;
467          Data->temp[5] = Data->temp[6] = Data->temp[7] = 256*4096; /* reset chroma-sad cache */          Data->chromaX = Data->chromaY = Data->chromaSAD = 256*4096; /* reset chroma-sad cache */
468    
469          Data->RefP[0] = pRef->y + (x + Data->iEdgedWidth*y) * 16;          Data->RefP[0] = pRef->y + (x + Data->iEdgedWidth*y) * 16;
470          Data->RefP[2] = pRefH + (x + Data->iEdgedWidth*y) * 16;          Data->RefP[2] = pRefH + (x + Data->iEdgedWidth*y) * 16;
# Line 380  Line 490 
490                  if (!vector_repeats(pmv, i) )                  if (!vector_repeats(pmv, i) )
491                          CheckCandidate16no4v(pmv[i].x, pmv[i].y, Data, i);                          CheckCandidate16no4v(pmv[i].x, pmv[i].y, Data, i);
492    
493            if (*Data->iMinSAD > 512) {
494                    unsigned int mask = make_mask(pmv, 7, Data->dir);
495    
496                    MainSearchFunc *MainSearchPtr;
497          if (MotionFlags & XVID_ME_USESQUARES16) MainSearchPtr = xvid_me_SquareSearch;          if (MotionFlags & XVID_ME_USESQUARES16) MainSearchPtr = xvid_me_SquareSearch;
498          else if (MotionFlags & XVID_ME_ADVANCEDDIAMOND16) MainSearchPtr = xvid_me_AdvDiamondSearch;          else if (MotionFlags & XVID_ME_ADVANCEDDIAMOND16) MainSearchPtr = xvid_me_AdvDiamondSearch;
499                  else MainSearchPtr = xvid_me_DiamondSearch;                  else MainSearchPtr = xvid_me_DiamondSearch;
500    
         if (*Data->iMinSAD > 512) {  
                 unsigned int mask = make_mask(pmv, 7, *Data->dir);  
501                  MainSearchPtr(Data->currentMV->x, Data->currentMV->y, Data, mask, CheckCandidate16no4v);                  MainSearchPtr(Data->currentMV->x, Data->currentMV->y, Data, mask, CheckCandidate16no4v);
502          }          }
503    
504          xvid_me_SubpelRefine(Data, CheckCandidate16no4v);          xvid_me_SubpelRefine(Data, CheckCandidate16no4v);
505    
506          if (Data->qpel && *Data->iMinSAD < *best_sad + 300) {          if (Data->qpel && (*Data->iMinSAD < *best_sad + threshA)) {
507                  Data->currentQMV->x = 2*Data->currentMV->x;                  Data->currentQMV->x = 2*Data->currentMV->x;
508                  Data->currentQMV->y = 2*Data->currentMV->y;                  Data->currentQMV->y = 2*Data->currentMV->y;
509                  Data->qpel_precision = 1;                  Data->qpel_precision = 1;
510                  get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 4,                  get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 4,
511                                          pParam->width, pParam->height, iFcode, 2, 0);                                          pParam->width, pParam->height, iFcode, 2, 0);
512    
513                    if (MotionFlags & XVID_ME_QUARTERPELREFINE16) {
514                            if (MotionFlags & XVID_ME_FASTREFINE16)
515                                    SubpelRefine_Fast(Data, CheckCandidate16no4v_qpel);
516                            else
517                  xvid_me_SubpelRefine(Data, CheckCandidate16no4v);                  xvid_me_SubpelRefine(Data, CheckCandidate16no4v);
518          }          }
519            }
520    
521          /* three bits are needed to code backward mode. four for forward */          /* three bits are needed to code backward mode. four for forward */
522    
# Line 435  Line 553 
553                                  const uint32_t x, const uint32_t y,                                  const uint32_t x, const uint32_t y,
554                                  const SearchData * const Data)                                  const SearchData * const Data)
555  {  {
556            int k;
557    
558            if (!Data->chroma) {
559          int dx = 0, dy = 0, b_dx = 0, b_dy = 0;          int dx = 0, dy = 0, b_dx = 0, b_dy = 0;
560          int32_t sum;          int32_t sum;
         int k;  
561          const uint32_t stride = Data->iEdgedWidth/2;          const uint32_t stride = Data->iEdgedWidth/2;
562          /* this is not full chroma compensation, only it's fullpel approximation. should work though */          /* this is not full chroma compensation, only it's fullpel approximation. should work though */
563    
# Line 465  Line 585 
585                                          b_Ref->v + (y*8 + b_dy/2) * stride + x*8 + b_dx/2,                                          b_Ref->v + (y*8 + b_dy/2) * stride + x*8 + b_dx/2,
586                                          stride);                                          stride);
587    
588          if (sum < MAX_CHROMA_SAD_FOR_SKIP * (int)Data->iQuant) {                  if (sum >= MAX_CHROMA_SAD_FOR_SKIP * (int)Data->iQuant) return; /* no skip */
589            }
590    
591            /* skip */
592                  pMB->mode = MODE_DIRECT_NONE_MV; /* skipped */                  pMB->mode = MODE_DIRECT_NONE_MV; /* skipped */
593                  for (k = 0; k < 4; k++) {                  for (k = 0; k < 4; k++) {
594                          pMB->qmvs[k] = pMB->mvs[k];                  pMB->qmvs[k] = pMB->mvs[k] = Data->directmvF[k];
595                          pMB->b_qmvs[k] = pMB->b_mvs[k];                  pMB->b_qmvs[k] = pMB->b_mvs[k] =  Data->directmvB[k];
                 }  
596          }          }
597  }  }
598    
# Line 552  Line 674 
674          /* initial (fast) skip decision */          /* initial (fast) skip decision */
675          if (*Data->iMinSAD < (int)Data->iQuant * INITIAL_SKIP_THRESH * (Data->chroma?3:2)) {          if (*Data->iMinSAD < (int)Data->iQuant * INITIAL_SKIP_THRESH * (Data->chroma?3:2)) {
676                  /* possible skip */                  /* possible skip */
                 if (Data->chroma) {  
                         pMB->mode = MODE_DIRECT_NONE_MV;  
                         return *Data->iMinSAD; /* skip. */  
                 } else {  
677                          SkipDecisionB(pCur, f_Ref, b_Ref, pMB, x, y, Data);                          SkipDecisionB(pCur, f_Ref, b_Ref, pMB, x, y, Data);
678                          if (pMB->mode == MODE_DIRECT_NONE_MV) return *Data->iMinSAD; /* skip. */                  if (pMB->mode == MODE_DIRECT_NONE_MV) return *Data->iMinSAD; /* skipped */
                 }  
679          }          }
680    
681          *Data->iMinSAD += Data->lambda16;          *Data->iMinSAD += Data->lambda16;
682          skip_sad = *Data->iMinSAD;          skip_sad = *Data->iMinSAD;
683    
684          /*          if (!(MotionFlags & XVID_ME_SKIP_DELTASEARCH)) {
          * DIRECT MODE DELTA VECTOR SEARCH.  
          * This has to be made more effective, but at the moment I'm happy it's running at all  
          */  
   
685          if (MotionFlags & XVID_ME_USESQUARES16) MainSearchPtr = xvid_me_SquareSearch;          if (MotionFlags & XVID_ME_USESQUARES16) MainSearchPtr = xvid_me_SquareSearch;
686                  else if (MotionFlags & XVID_ME_ADVANCEDDIAMOND16) MainSearchPtr = xvid_me_AdvDiamondSearch;                  else if (MotionFlags & XVID_ME_ADVANCEDDIAMOND16) MainSearchPtr = xvid_me_AdvDiamondSearch;
687                          else MainSearchPtr = xvid_me_DiamondSearch;                          else MainSearchPtr = xvid_me_DiamondSearch;
# Line 576  Line 689 
689          MainSearchPtr(0, 0, Data, 255, CheckCandidate);          MainSearchPtr(0, 0, Data, 255, CheckCandidate);
690    
691          xvid_me_SubpelRefine(Data, CheckCandidate);          xvid_me_SubpelRefine(Data, CheckCandidate);
692            }
693    
694          *best_sad = *Data->iMinSAD;          *best_sad = *Data->iMinSAD;
695    
# Line 611  Line 725 
725          return skip_sad;          return skip_sad;
726  }  }
727    
728    
729    static void set_range(int * range, SearchData * Data)
730    {
731            Data->min_dx = range[0];
732            Data->max_dx = range[1];
733            Data->min_dy = range[2];
734            Data->max_dy = range[3];
735    }
736    
737    static void
738    SubpelRefine_dir(SearchData * const data, CheckFunc * const CheckCandidate, const int dir)
739    {
740    /* Do a half-pel or q-pel refinement */
741            const VECTOR centerMV = data->qpel_precision ?
742                    data->currentQMV[dir-1] : data->currentMV[dir-1];
743    
744            CHECK_CANDIDATE(centerMV.x, centerMV.y - 1, dir);
745            CHECK_CANDIDATE(centerMV.x + 1, centerMV.y - 1, dir);
746            CHECK_CANDIDATE(centerMV.x + 1, centerMV.y, dir);
747            CHECK_CANDIDATE(centerMV.x + 1, centerMV.y + 1, dir);
748            CHECK_CANDIDATE(centerMV.x, centerMV.y + 1, dir);
749            CHECK_CANDIDATE(centerMV.x - 1, centerMV.y + 1, dir);
750            CHECK_CANDIDATE(centerMV.x - 1, centerMV.y, dir);
751            CHECK_CANDIDATE(centerMV.x - 1, centerMV.y - 1, dir);
752    }
753    
754    /* Pretty much redundant code, just as SubpelRefine_dir above too
755     *
756     * TODO: Get rid off all the redundancy (SubpelRefine_Fast_dir,
757     *       CheckCandidate16no4v_qpel etc.)                          */
758    
759    void
760    SubpelRefine_Fast_dir(SearchData * data, CheckFunc * CheckCandidate, const int dir)
761    {
762    /* Do a fast q-pel refinement */
763            VECTOR centerMV;
764            VECTOR second_best;
765            int best_sad = *data->iMinSAD;
766            int xo, yo, xo2, yo2;
767            int size = 2;
768            data->iMinSAD2 = 0;
769    
770            /* check all halfpixel positions near our best halfpel position */
771            centerMV = data->currentQMV[dir-1];
772            *data->iMinSAD = 256 * 4096;
773    
774            CHECK_CANDIDATE(centerMV.x, centerMV.y - size, dir);
775            CHECK_CANDIDATE(centerMV.x + size, centerMV.y - size, dir);
776            CHECK_CANDIDATE(centerMV.x + size, centerMV.y, dir);
777            CHECK_CANDIDATE(centerMV.x + size, centerMV.y + size, dir);
778    
779            CHECK_CANDIDATE(centerMV.x, centerMV.y + size, dir);
780            CHECK_CANDIDATE(centerMV.x - size, centerMV.y + size, dir);
781            CHECK_CANDIDATE(centerMV.x - size, centerMV.y, dir);
782            CHECK_CANDIDATE(centerMV.x - size, centerMV.y - size, dir);
783    
784            second_best = data->currentQMV[dir-1];
785    
786            /* after second_best has been found, go back to the vector we began with */
787    
788            data->currentQMV[dir-1] = centerMV;
789            *data->iMinSAD = best_sad;
790    
791            xo = centerMV.x;
792            yo = centerMV.y;
793            xo2 = second_best.x;
794            yo2 = second_best.y;
795    
796            data->iMinSAD2 = 256 * 4096;
797    
798            if (yo == yo2) {
799                    CHECK_CANDIDATE((xo+xo2)>>1, yo, dir);
800                    CHECK_CANDIDATE(xo, yo-1, dir);
801                    CHECK_CANDIDATE(xo, yo+1, dir);
802    
803                    if(best_sad <= data->iMinSAD2) return;
804    
805                    if(data->currentQMV[dir-1].x == data->currentQMV2.x) {
806                            CHECK_CANDIDATE((xo+xo2)>>1, yo-1, dir);
807                            CHECK_CANDIDATE((xo+xo2)>>1, yo+1, dir);
808                    } else {
809                            CHECK_CANDIDATE((xo+xo2)>>1,
810                                    (data->currentQMV[dir-1].x == xo) ? data->currentQMV[dir-1].y : data->currentQMV2.y, dir);
811                    }
812                    return;
813            }
814    
815            if (xo == xo2) {
816                    CHECK_CANDIDATE(xo, (yo+yo2)>>1, dir);
817                    CHECK_CANDIDATE(xo-1, yo, dir);
818                    CHECK_CANDIDATE(xo+1, yo, dir);
819    
820                    if(best_sad < data->iMinSAD2) return;
821    
822                    if(data->currentQMV[dir-1].y == data->currentQMV2.y) {
823                            CHECK_CANDIDATE(xo-1, (yo+yo2)>>1, dir);
824                            CHECK_CANDIDATE(xo+1, (yo+yo2)>>1, dir);
825                    } else {
826                            CHECK_CANDIDATE((data->currentQMV[dir-1].y == yo) ? data->currentQMV[dir-1].x : data->currentQMV2.x, (yo+yo2)>>1, dir);
827                    }
828                    return;
829            }
830    
831            CHECK_CANDIDATE(xo, (yo+yo2)>>1, dir);
832            CHECK_CANDIDATE((xo+xo2)>>1, yo, dir);
833    
834            if(best_sad <= data->iMinSAD2) return;
835    
836            CHECK_CANDIDATE((xo+xo2)>>1, (yo+yo2)>>1, dir);
837    }
838    
839  static void  static void
840  SearchInterpolate(const IMAGE * const f_Ref,  SearchInterpolate(const IMAGE * const f_Ref,
841                                  const uint8_t * const f_RefH,                                  const uint8_t * const f_RefH,
# Line 629  Line 854 
854                                  const VECTOR * const b_predMV,                                  const VECTOR * const b_predMV,
855                                  MACROBLOCK * const pMB,                                  MACROBLOCK * const pMB,
856                                  int32_t * const best_sad,                                  int32_t * const best_sad,
857                                  SearchData * const fData)                                  SearchData * const Data)
858    
859  {  {
860          int i, j;          int i, j;
861          SearchData bData;          int b_range[4], f_range[4];
862            int threshA = (MotionFlags & XVID_ME_FAST_MODEINTERPOLATE) ? 250 : 500;
863            int threshB = (MotionFlags & XVID_ME_FAST_MODEINTERPOLATE) ? 150 : 300;
864    
865            Data->qpel_precision = 0;
866            *Data->iMinSAD = 4096*256;
867            Data->iFcode = fcode; Data->bFcode = bcode;
868    
869          fData->qpel_precision = 0;          i = (x + y * Data->iEdgedWidth) * 16;
870          memcpy(&bData, fData, sizeof(SearchData)); /* quick copy of common data */  
871          *fData->iMinSAD = 4096*256;          Data->RefP[0] = f_Ref->y + i;
872          bData.currentMV++; bData.currentQMV++;          Data->RefP[2] = f_RefH + i;
873          fData->iFcode = bData.bFcode = fcode; fData->bFcode = bData.iFcode = bcode;          Data->RefP[1] = f_RefV + i;
874            Data->RefP[3] = f_RefHV + i;
875          i = (x + y * fData->iEdgedWidth) * 16;          Data->b_RefP[0] = b_Ref->y + i;
876            Data->b_RefP[2] = b_RefH + i;
877          bData.b_RefP[0] = fData->RefP[0] = f_Ref->y + i;          Data->b_RefP[1] = b_RefV + i;
878          bData.b_RefP[2] = fData->RefP[2] = f_RefH + i;          Data->b_RefP[3] = b_RefHV + i;
879          bData.b_RefP[1] = fData->RefP[1] = f_RefV + i;          Data->RefP[4] = f_Ref->u + (x + (Data->iEdgedWidth/2) * y) * 8;
880          bData.b_RefP[3] = fData->RefP[3] = f_RefHV + i;          Data->RefP[5] = f_Ref->v + (x + (Data->iEdgedWidth/2) * y) * 8;
881          bData.RefP[0] = fData->b_RefP[0] = b_Ref->y + i;          Data->b_RefP[4] = b_Ref->u + (x + (Data->iEdgedWidth/2) * y) * 8;
882          bData.RefP[2] = fData->b_RefP[2] = b_RefH + i;          Data->b_RefP[5] = b_Ref->v + (x + (Data->iEdgedWidth/2) * y) * 8;
         bData.RefP[1] = fData->b_RefP[1] = b_RefV + i;  
         bData.RefP[3] = fData->b_RefP[3] = b_RefHV + i;  
         bData.b_RefP[4] = fData->RefP[4] = f_Ref->u + (x + (fData->iEdgedWidth/2) * y) * 8;  
         bData.b_RefP[5] = fData->RefP[5] = f_Ref->v + (x + (fData->iEdgedWidth/2) * y) * 8;  
         bData.RefP[4] = fData->b_RefP[4] = b_Ref->u + (x + (fData->iEdgedWidth/2) * y) * 8;  
         bData.RefP[5] = fData->b_RefP[5] = b_Ref->v + (x + (fData->iEdgedWidth/2) * y) * 8;  
         bData.dir = fData->dir;  
   
         bData.bpredMV = fData->predMV = *f_predMV;  
         fData->bpredMV = bData.predMV = *b_predMV;  
         fData->currentMV[0] = fData->currentMV[2];  
   
         get_range(&fData->min_dx, &fData->max_dx, &fData->min_dy, &fData->max_dy, x, y, 4, pParam->width, pParam->height, fcode - fData->qpel, 1, 0);  
         get_range(&bData.min_dx, &bData.max_dx, &bData.min_dy, &bData.max_dy, x, y, 4, pParam->width, pParam->height, bcode - fData->qpel, 1, 0);  
   
         if (fData->currentMV[0].x > fData->max_dx) fData->currentMV[0].x = fData->max_dx;  
         if (fData->currentMV[0].x < fData->min_dx) fData->currentMV[0].x = fData->min_dx;  
         if (fData->currentMV[0].y > fData->max_dy) fData->currentMV[0].y = fData->max_dy;  
         if (fData->currentMV[0].y < fData->min_dy) fData->currentMV[0].y = fData->min_dy;  
   
         if (fData->currentMV[1].x > bData.max_dx) fData->currentMV[1].x = bData.max_dx;  
         if (fData->currentMV[1].x < bData.min_dx) fData->currentMV[1].x = bData.min_dx;  
         if (fData->currentMV[1].y > bData.max_dy) fData->currentMV[1].y = bData.max_dy;  
         if (fData->currentMV[1].y < bData.min_dy) fData->currentMV[1].y = bData.min_dy;  
883    
884          CheckCandidateInt(fData->currentMV[0].x, fData->currentMV[0].y, fData, 255);          Data->predMV = *f_predMV;
885            Data->bpredMV = *b_predMV;
886    
887            Data->currentMV[0] = Data->currentMV[2]; /* forward search left its vector here */
888    
889            get_range(f_range, f_range+1, f_range+2, f_range+3, x, y, 4, pParam->width, pParam->height, fcode - Data->qpel, 1, 0);
890            get_range(b_range, b_range+1, b_range+2, b_range+3, x, y, 4, pParam->width, pParam->height, bcode - Data->qpel, 1, 0);
891    
892            if (Data->currentMV[0].x > f_range[1]) Data->currentMV[0].x = f_range[1];
893            if (Data->currentMV[0].x < f_range[0]) Data->currentMV[0].x = f_range[0];
894            if (Data->currentMV[0].y > f_range[3]) Data->currentMV[0].y = f_range[3];
895            if (Data->currentMV[0].y < f_range[2]) Data->currentMV[0].y = f_range[2];
896    
897            if (Data->currentMV[1].x > b_range[1]) Data->currentMV[1].x = b_range[1];
898            if (Data->currentMV[1].x < b_range[0]) Data->currentMV[1].x = b_range[0];
899            if (Data->currentMV[1].y > b_range[3]) Data->currentMV[1].y = b_range[3];
900            if (Data->currentMV[1].y < b_range[2]) Data->currentMV[1].y = b_range[2];
901    
902            set_range(f_range, Data);
903    
904            CheckCandidateInt(Data->currentMV[0].x, Data->currentMV[0].y, Data, 1);
905    
906          /* diamond */          /* diamond */
907          do {          do {
908                  *fData->dir = 255;                  Data->dir = 0;
909                  /* forward MV moves */                  /* forward MV moves */
910                  i = fData->currentMV[0].x; j = fData->currentMV[0].y;                  i = Data->currentMV[0].x; j = Data->currentMV[0].y;
911    
912                  CheckCandidateInt(i + 1, j, fData, 0);                  CheckCandidateInt(i + 1, j, Data, 1);
913                  CheckCandidateInt(i, j + 1, fData, 0);                  CheckCandidateInt(i, j + 1, Data, 1);
914                  CheckCandidateInt(i - 1, j, fData, 0);                  CheckCandidateInt(i - 1, j, Data, 1);
915                  CheckCandidateInt(i, j - 1, fData, 0);                  CheckCandidateInt(i, j - 1, Data, 1);
916    
917                  /* backward MV moves */                  /* backward MV moves */
918                  i = fData->currentMV[1].x; j = fData->currentMV[1].y;                  set_range(b_range, Data);
919                  fData->currentMV[2] = fData->currentMV[0];                  i = Data->currentMV[1].x; j = Data->currentMV[1].y;
                 CheckCandidateInt(i + 1, j, &bData, 0);  
                 CheckCandidateInt(i, j + 1, &bData, 0);  
                 CheckCandidateInt(i - 1, j, &bData, 0);  
                 CheckCandidateInt(i, j - 1, &bData, 0);  
920    
921          } while (!(*fData->dir));                  CheckCandidateInt(i + 1, j, Data, 2);
922                    CheckCandidateInt(i, j + 1, Data, 2);
923                    CheckCandidateInt(i - 1, j, Data, 2);
924                    CheckCandidateInt(i, j - 1, Data, 2);
925    
926                    set_range(f_range, Data);
927    
928            } while (Data->dir != 0);
929    
930          /* qpel refinement */          /* qpel refinement */
931          if (fData->qpel) {          if (Data->qpel) {
932                  if (*fData->iMinSAD > *best_sad + 500) return;                  if (*Data->iMinSAD > *best_sad + threshA) return;
933                  fData->qpel_precision = bData.qpel_precision = 1;                  Data->qpel_precision = 1;
934                  get_range(&fData->min_dx, &fData->max_dx, &fData->min_dy, &fData->max_dy, x, y, 4, pParam->width, pParam->height, fcode, 2, 0);                  get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 4, pParam->width, pParam->height, fcode, 2, 0);
935                  get_range(&bData.min_dx, &bData.max_dx, &bData.min_dy, &bData.max_dy, x, y, 4, pParam->width, pParam->height, bcode, 2, 0);  
936                  fData->currentQMV[2].x = fData->currentQMV[0].x = 2 * fData->currentMV[0].x;                  Data->currentQMV[0].x = 2 * Data->currentMV[0].x;
937                  fData->currentQMV[2].y = fData->currentQMV[0].y = 2 * fData->currentMV[0].y;                  Data->currentQMV[0].y = 2 * Data->currentMV[0].y;
938                  fData->currentQMV[1].x = 2 * fData->currentMV[1].x;                  Data->currentQMV[1].x = 2 * Data->currentMV[1].x;
939                  fData->currentQMV[1].y = 2 * fData->currentMV[1].y;                  Data->currentQMV[1].y = 2 * Data->currentMV[1].y;
940                  xvid_me_SubpelRefine(fData, CheckCandidateInt);  
941                  if (*fData->iMinSAD > *best_sad + 300) return;                  if (MotionFlags & XVID_ME_QUARTERPELREFINE16) {
942                  fData->currentQMV[2] = fData->currentQMV[0];                          if (MotionFlags & XVID_ME_FASTREFINE16)
943                  xvid_me_SubpelRefine(&bData, CheckCandidateInt);                                  SubpelRefine_Fast_dir(Data, CheckCandidateInt_qpel, 1);
944          }                          else
945                                    SubpelRefine_dir(Data, CheckCandidateInt, 1);
946          *fData->iMinSAD += (2+3) * fData->lambda16; /* two bits are needed to code interpolate mode. */                  }
947    
948          if (*fData->iMinSAD < *best_sad) {                  if (*Data->iMinSAD > *best_sad + threshB) return;
949                  *best_sad = *fData->iMinSAD;                  get_range(&Data->min_dx, &Data->max_dx, &Data->min_dy, &Data->max_dy, x, y, 4, pParam->width, pParam->height, bcode, 2, 0);
950                  pMB->mvs[0] = fData->currentMV[0];  
951                  pMB->b_mvs[0] = fData->currentMV[1];                  if (MotionFlags & XVID_ME_QUARTERPELREFINE16) {
952                            if (MotionFlags & XVID_ME_FASTREFINE16)
953                                    SubpelRefine_Fast_dir(Data, CheckCandidateInt_qpel, 2);
954                            else
955                                    SubpelRefine_dir(Data, CheckCandidateInt, 2);
956                    }
957            }
958    
959            *Data->iMinSAD += 2 * Data->lambda16; /* two bits are needed to code interpolate mode. */
960    
961            if (*Data->iMinSAD < *best_sad) {
962                    *best_sad = *Data->iMinSAD;
963                    pMB->mvs[0] = Data->currentMV[0];
964                    pMB->b_mvs[0] = Data->currentMV[1];
965                  pMB->mode = MODE_INTERPOLATE;                  pMB->mode = MODE_INTERPOLATE;
966                  if (fData->qpel) {                  if (Data->qpel) {
967                          pMB->qmvs[0] = fData->currentQMV[0];                          pMB->qmvs[0] = Data->currentQMV[0];
968                          pMB->b_qmvs[0] = fData->currentQMV[1];                          pMB->b_qmvs[0] = Data->currentQMV[1];
969                          pMB->pmvs[1].x = pMB->qmvs[0].x - f_predMV->x;                          pMB->pmvs[1].x = pMB->qmvs[0].x - f_predMV->x;
970                          pMB->pmvs[1].y = pMB->qmvs[0].y - f_predMV->y;                          pMB->pmvs[1].y = pMB->qmvs[0].y - f_predMV->y;
971                          pMB->pmvs[0].x = pMB->b_qmvs[0].x - b_predMV->x;                          pMB->pmvs[0].x = pMB->b_qmvs[0].x - b_predMV->x;
# Line 759  Line 1002 
1002          uint32_t skip_sad;          uint32_t skip_sad;
1003    
1004          const MACROBLOCK * const b_mbs = b_reference->mbs;          const MACROBLOCK * const b_mbs = b_reference->mbs;
1005            MACROBLOCK *const pMBs = frame->mbs;
1006    
1007          VECTOR f_predMV, b_predMV;          VECTOR f_predMV, b_predMV;
1008    
# Line 768  Line 1012 
1012          /* some pre-inintialized data for the rest of the search */          /* some pre-inintialized data for the rest of the search */
1013    
1014          SearchData Data;          SearchData Data;
         int32_t iMinSAD;  
         uint32_t dir;  
         VECTOR currentMV[3];  
         VECTOR currentQMV[3];  
         int32_t temp[8];  
1015          memset(&Data, 0, sizeof(SearchData));          memset(&Data, 0, sizeof(SearchData));
1016    
1017          Data.iEdgedWidth = pParam->edged_width;          Data.iEdgedWidth = pParam->edged_width;
         Data.currentMV = currentMV; Data.currentQMV = currentQMV;  
         Data.iMinSAD = &iMinSAD;  
         Data.lambda16 = xvid_me_lambda_vec16[MAX(frame->quant-2, 2)];  
1018          Data.qpel = pParam->vol_flags & XVID_VOL_QUARTERPEL ? 1 : 0;          Data.qpel = pParam->vol_flags & XVID_VOL_QUARTERPEL ? 1 : 0;
1019          Data.rounding = 0;          Data.rounding = 0;
1020          Data.chroma = frame->motion_flags & XVID_ME_CHROMA_BVOP;          Data.chroma = frame->motion_flags & XVID_ME_CHROMA_BVOP;
         Data.temp = temp;  
         Data.dir = &dir;  
1021          Data.iQuant = frame->quant;          Data.iQuant = frame->quant;
1022    
1023          Data.RefQ = f_refV->u; /* a good place, also used in MC (for similar purpose) */          Data.RefQ = f_refV->u; /* a good place, also used in MC (for similar purpose) */
# Line 795  Line 1030 
1030                  for (i = 0; i < pParam->mb_width; i++) {                  for (i = 0; i < pParam->mb_width; i++) {
1031                          MACROBLOCK * const pMB = frame->mbs + i + j * pParam->mb_width;                          MACROBLOCK * const pMB = frame->mbs + i + j * pParam->mb_width;
1032                          const MACROBLOCK * const b_mb = b_mbs + i + j * pParam->mb_width;                          const MACROBLOCK * const b_mb = b_mbs + i + j * pParam->mb_width;
1033                            int interpol_search = 0;
1034                            int bf_search = 0;
1035                            int bf_thresh = 0;
1036    
1037  /* special case, if collocated block is SKIPed in P-VOP: encoding is forward (0,0), cpb=0 without further ado */  /* special case, if collocated block is SKIPed in P-VOP: encoding is forward (0,0), cpb=0 without further ado */
1038                          if (b_reference->coding_type != S_VOP)                          if (b_reference->coding_type != S_VOP)
1039                                  if (b_mb->mode == MODE_NOT_CODED) {                                  if (b_mb->mode == MODE_NOT_CODED) {
1040                                          pMB->mode = MODE_NOT_CODED;                                          pMB->mode = MODE_NOT_CODED;
1041                                            pMB->mvs[0] = pMB->b_mvs[0] = zeroMV;
1042                                            pMB->sad16 = 0;
1043                                          continue;                                          continue;
1044                                  }                                  }
1045    
1046                            Data.lambda16 = xvid_me_lambda_vec16[b_mb->quant];
1047    
1048                          Data.Cur = frame->image.y + (j * Data.iEdgedWidth + i) * 16;                          Data.Cur = frame->image.y + (j * Data.iEdgedWidth + i) * 16;
1049                          Data.CurU = frame->image.u + (j * Data.iEdgedWidth/2 + i) * 8;                          Data.CurU = frame->image.u + (j * Data.iEdgedWidth/2 + i) * 8;
1050                          Data.CurV = frame->image.v + (j * Data.iEdgedWidth/2 + i) * 8;                          Data.CurV = frame->image.v + (j * Data.iEdgedWidth/2 + i) * 8;
# Line 820  Line 1062 
1062                                                                          &best_sad,                                                                          &best_sad,
1063                                                                          &Data);                                                                          &Data);
1064    
1065                          if (pMB->mode == MODE_DIRECT_NONE_MV) continue;                          if (pMB->mode == MODE_DIRECT_NONE_MV) {
1066                                    pMB->sad16 = best_sad;
1067                                    continue;
1068                            }
1069    
1070                            if (frame->motion_flags & XVID_ME_BFRAME_EARLYSTOP) {
1071                                    if(i > 0 && j > 0 && i < pParam->mb_width) {
1072                                            bf_thresh = MIN((&pMBs[(i-1) + j * pParam->mb_width])->sad16,
1073                                                                         MIN((&pMBs[i + (j-1) * pParam->mb_width])->sad16,
1074                                                                         (&pMBs[(i+1) + (j-1) * pParam->mb_width])->sad16));
1075    
1076                                            if (((&pMBs[(i-1) + j * pParam->mb_width])->mode != MODE_FORWARD) &&
1077                                                    ((&pMBs[(i-1) + j * pParam->mb_width])->mode != MODE_BACKWARD) &&
1078                                                    ((&pMBs[(i-1) + j * pParam->mb_width])->mode != MODE_INTERPOLATE))
1079                                                            bf_search++;
1080    
1081                                            if (((&pMBs[i + (j - 1) * pParam->mb_width])->mode != MODE_FORWARD) &&
1082                                                    ((&pMBs[i + (j - 1) * pParam->mb_width])->mode != MODE_BACKWARD) &&
1083                                                    ((&pMBs[i + (j - 1) * pParam->mb_width])->mode != MODE_INTERPOLATE))
1084                                                            bf_search++;
1085    
1086                                            if (((&pMBs[(i + 1) + (j - 1) * pParam->mb_width])->mode != MODE_FORWARD) &&
1087                                                    ((&pMBs[(i + 1) + (j - 1) * pParam->mb_width])->mode != MODE_BACKWARD) &&
1088                                                    ((&pMBs[(i + 1) + (j - 1) * pParam->mb_width])->mode != MODE_INTERPOLATE))
1089                                                    bf_search++;
1090                                    }
1091    
1092                                    if ((best_sad < bf_thresh) && (bf_search == 3))
1093                                            continue;
1094                            }
1095    
1096                          /* forward search */                          /* forward search */
1097                          SearchBF(f_ref, f_refH->y, f_refV->y, f_refHV->y,                          SearchBF(f_ref, f_refH->y, f_refV->y, f_refHV->y,
# Line 839  Line 1110 
1110                                                  MODE_BACKWARD, &Data);                                                  MODE_BACKWARD, &Data);
1111    
1112                          /* interpolate search comes last, because it uses data from forward and backward as prediction */                          /* interpolate search comes last, because it uses data from forward and backward as prediction */
1113                            if (frame->motion_flags & XVID_ME_FAST_MODEINTERPOLATE) {
1114    
1115                                    if(i > 0 && j > 0 && i < pParam->mb_width) {
1116                                            if ((&pMBs[(i-1) + j * pParam->mb_width])->mode == MODE_INTERPOLATE)
1117                                                    interpol_search++;
1118                                            if ((&pMBs[i + (j - 1) * pParam->mb_width])->mode == MODE_INTERPOLATE)
1119                                                    interpol_search++;
1120                                            if ((&pMBs[(i + 1) + (j - 1) * pParam->mb_width])->mode == MODE_INTERPOLATE)
1121                                                    interpol_search++;
1122                                    }
1123                                    else
1124                                            interpol_search = 1;
1125    
1126                                    interpol_search |= !(best_sad < 3 * Data.iQuant * MAX_SAD00_FOR_SKIP * (Data.chroma ? 3:2));
1127                            }
1128                            else
1129                                    interpol_search = 1;
1130    
1131                            if (interpol_search) {
1132                          SearchInterpolate(f_ref, f_refH->y, f_refV->y, f_refHV->y,                          SearchInterpolate(f_ref, f_refH->y, f_refV->y, f_refHV->y,
1133                                                  b_ref, b_refH->y, b_refV->y, b_refHV->y,                                                  b_ref, b_refH->y, b_refV->y, b_refHV->y,
1134                                                  i, j,                                                  i, j,
# Line 848  Line 1138 
1138                                                  &f_predMV, &b_predMV,                                                  &f_predMV, &b_predMV,
1139                                                  pMB, &best_sad,                                                  pMB, &best_sad,
1140                                                  &Data);                                                  &Data);
1141                            }
1142    
1143                          /* final skip decision */                          /* final skip decision */
1144                          if ( (skip_sad < Data.iQuant * MAX_SAD00_FOR_SKIP * 2)                          if ( (skip_sad < Data.iQuant * MAX_SAD00_FOR_SKIP * (Data.chroma ? 3:2) )
1145                                          && ((100*best_sad)/(skip_sad+1) > FINAL_SKIP_THRESH) )                                          && ((100*best_sad)/(skip_sad+1) > FINAL_SKIP_THRESH) )
1146    
1147                                  SkipDecisionB(&frame->image, f_ref, b_ref, pMB, i, j, &Data);                                  SkipDecisionB(&frame->image, f_ref, b_ref, pMB, i, j, &Data);
1148    
1149                          switch (pMB->mode) {                          switch (pMB->mode) {
1150                                  case MODE_FORWARD:                                  case MODE_FORWARD:
1151                                          f_predMV = Data.qpel ? pMB->qmvs[0] : pMB->mvs[0];                                          f_predMV = Data.qpel ? pMB->qmvs[0] : pMB->mvs[0];
1152                                            pMB->sad16 = best_sad;
1153                                          break;                                          break;
1154                                  case MODE_BACKWARD:                                  case MODE_BACKWARD:
1155                                          b_predMV = Data.qpel ? pMB->b_qmvs[0] : pMB->b_mvs[0];                                          b_predMV = Data.qpel ? pMB->b_qmvs[0] : pMB->b_mvs[0];
1156                                            pMB->sad16 = best_sad;
1157                                          break;                                          break;
1158                                  case MODE_INTERPOLATE:                                  case MODE_INTERPOLATE:
1159                                          f_predMV = Data.qpel ? pMB->qmvs[0] : pMB->mvs[0];                                          f_predMV = Data.qpel ? pMB->qmvs[0] : pMB->mvs[0];
1160                                          b_predMV = Data.qpel ? pMB->b_qmvs[0] : pMB->b_mvs[0];                                          b_predMV = Data.qpel ? pMB->b_qmvs[0] : pMB->b_mvs[0];
1161                                            pMB->sad16 = best_sad;
1162                                          break;                                          break;
1163                                  default:                                  default:
1164                                            pMB->sad16 = best_sad;
1165                                          break;                                          break;
1166                          }                          }
1167                  }                  }
1168          }          }
1169  }  }
1170    
1171    

Legend:
Removed from v.1160  
changed lines
  Added in v.1281

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