[svn] / trunk / xvidcore / src / motion / estimation_bvop.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/motion/estimation_bvop.c

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

revision 1564, Sun Dec 5 04:53:01 2004 UTC revision 1568, Thu Dec 9 04:20:44 2004 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.17 2004-12-05 04:53:01 syskin Exp $   * $Id: estimation_bvop.c,v 1.19 2004-12-09 04:20:44 syskin Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 829  Line 829 
829    
830          pMB->sad16 = best_sad;          pMB->sad16 = best_sad;
831          pMB->mode = mode;          pMB->mode = mode;
832            pMB->cbp = 63;
833    
834          switch (mode) {          switch (mode) {
835    
# Line 918  Line 919 
919          }          }
920  }  }
921    
922    static __inline void
923    maxMotionBVOP(int * const MVmaxF, int * const MVmaxB, const MACROBLOCK * const pMB, const int qpel)
924    {
925            if (pMB->mode == MODE_FORWARD || pMB->mode == MODE_INTERPOLATE) {
926                    const VECTOR * const mv = qpel ? pMB->qmvs : pMB->mvs;
927                    int max = *MVmaxF;
928                    if (mv[0].x > max) max = mv[0].x;
929                    else if (-mv[0].x - 1 > max) max = -mv[0].x - 1;
930                    if (mv[0].y > max) max = mv[0].y;
931                    else if (-mv[0].y - 1 > max) max = -mv[0].y - 1;
932    
933                    *MVmaxF = max;
934            }
935    
936            if (pMB->mode == MODE_BACKWARD || pMB->mode == MODE_INTERPOLATE) {
937                    const VECTOR * const mv = qpel ? pMB->b_qmvs : pMB->b_mvs;
938                    int max = *MVmaxB;
939                    if (mv[0].x > max) max = mv[0].x;
940                    else if (-mv[0].x - 1 > max) max = -mv[0].x - 1;
941                    if (mv[0].y > max) max = mv[0].y;
942                    else if (-mv[0].y - 1 > max) max = -mv[0].y - 1;
943                    *MVmaxB = max;
944            }
945    }
946    
947    
948  void  void
949  MotionEstimationBVOP(MBParam * const pParam,  MotionEstimationBVOP(MBParam * const pParam,
950                                           FRAMEINFO * const frame,                                           FRAMEINFO * const frame,
# Line 945  Line 972 
972    
973          VECTOR f_predMV, b_predMV;          VECTOR f_predMV, b_predMV;
974    
975            int MVmaxF = 0, MVmaxB = 0;
976          const int32_t TRB = time_pp - time_bp;          const int32_t TRB = time_pp - time_bp;
977          const int32_t TRD = time_pp;          const int32_t TRD = time_pp;
978          DECLARE_ALIGNED_MATRIX(dct_space, 3, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(dct_space, 3, 64, int16_t, CACHE_LINE);
# Line 968  Line 996 
996          memcpy(&Data_b, &Data_d, sizeof(SearchData));          memcpy(&Data_b, &Data_d, sizeof(SearchData));
997          memcpy(&Data_i, &Data_d, sizeof(SearchData));          memcpy(&Data_i, &Data_d, sizeof(SearchData));
998    
999          Data_f.iFcode = Data_i.iFcode = frame->fcode;          Data_f.iFcode = Data_i.iFcode = frame->fcode = b_reference->fcode;
1000          Data_b.iFcode = Data_i.bFcode = frame->bcode;          Data_b.iFcode = Data_i.bFcode = frame->bcode = b_reference->fcode;
   
1001    
1002          for (j = 0; j < pParam->mb_height; j++) {          for (j = 0; j < pParam->mb_height; j++) {
1003    
# Line 1002  Line 1029 
1029    
1030                          if (pMB->mode == MODE_DIRECT_NONE_MV) {                          if (pMB->mode == MODE_DIRECT_NONE_MV) {
1031                                  pMB->sad16 = best_sad;                                  pMB->sad16 = best_sad;
1032                                    pMB->cbp = 0;
1033                                  continue;                                  continue;
1034                          }                          }
1035    
# Line 1040  Line 1068 
1068    
1069                                  if (pMB->mode == MODE_DIRECT_NONE_MV) { /* skipped? */                                  if (pMB->mode == MODE_DIRECT_NONE_MV) { /* skipped? */
1070                                          pMB->sad16 = skip_sad;                                          pMB->sad16 = skip_sad;
1071                                            pMB->cbp = 0;
1072                                          continue;                                          continue;
1073                                  }                                  }
1074                          }                          }
# Line 1050  Line 1079 
1079                          else                          else
1080                                  ModeDecision_BVOP_SAD(&Data_d, &Data_b, &Data_f, &Data_i, pMB, b_mb, &f_predMV, &b_predMV);                                  ModeDecision_BVOP_SAD(&Data_d, &Data_b, &Data_f, &Data_i, pMB, b_mb, &f_predMV, &b_predMV);
1081    
1082                            maxMotionBVOP(&MVmaxF, &MVmaxB, pMB, Data_d.qpel);
1083    
1084                  }                  }
1085          }          }
1086    
1087            frame->fcode = getMinFcode(MVmaxF);
1088            frame->bcode = getMinFcode(MVmaxB);
1089  }  }

Legend:
Removed from v.1564  
changed lines
  Added in v.1568

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