[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 1569, Thu Dec 9 04:58:12 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.20 2004-12-09 04:58:12 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 958  Line 986 
986          Data_d.rounding = 0;          Data_d.rounding = 0;
987          Data_d.chroma = frame->motion_flags & XVID_ME_CHROMA_BVOP;          Data_d.chroma = frame->motion_flags & XVID_ME_CHROMA_BVOP;
988          Data_d.iQuant = frame->quant;          Data_d.iQuant = frame->quant;
989            Data_d.quant_sq = frame->quant*frame->quant;
990          Data_d.dctSpace = dct_space;          Data_d.dctSpace = dct_space;
991          Data_d.quant_type = !(pParam->vol_flags & XVID_VOL_MPEGQUANT);          Data_d.quant_type = !(pParam->vol_flags & XVID_VOL_MPEGQUANT);
992          Data_d.mpeg_quant_matrices = pParam->mpeg_quant_matrices;          Data_d.mpeg_quant_matrices = pParam->mpeg_quant_matrices;
# Line 968  Line 997 
997          memcpy(&Data_b, &Data_d, sizeof(SearchData));          memcpy(&Data_b, &Data_d, sizeof(SearchData));
998          memcpy(&Data_i, &Data_d, sizeof(SearchData));          memcpy(&Data_i, &Data_d, sizeof(SearchData));
999    
1000          Data_f.iFcode = Data_i.iFcode = frame->fcode;          Data_f.iFcode = Data_i.iFcode = frame->fcode = b_reference->fcode;
1001          Data_b.iFcode = Data_i.bFcode = frame->bcode;          Data_b.iFcode = Data_i.bFcode = frame->bcode = b_reference->fcode;
   
1002    
1003          for (j = 0; j < pParam->mb_height; j++) {          for (j = 0; j < pParam->mb_height; j++) {
1004    
# Line 1002  Line 1030 
1030    
1031                          if (pMB->mode == MODE_DIRECT_NONE_MV) {                          if (pMB->mode == MODE_DIRECT_NONE_MV) {
1032                                  pMB->sad16 = best_sad;                                  pMB->sad16 = best_sad;
1033                                    pMB->cbp = 0;
1034                                  continue;                                  continue;
1035                          }                          }
1036    
# Line 1040  Line 1069 
1069    
1070                                  if (pMB->mode == MODE_DIRECT_NONE_MV) { /* skipped? */                                  if (pMB->mode == MODE_DIRECT_NONE_MV) { /* skipped? */
1071                                          pMB->sad16 = skip_sad;                                          pMB->sad16 = skip_sad;
1072                                            pMB->cbp = 0;
1073                                          continue;                                          continue;
1074                                  }                                  }
1075                          }                          }
# Line 1050  Line 1080 
1080                          else                          else
1081                                  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);
1082    
1083                            maxMotionBVOP(&MVmaxF, &MVmaxB, pMB, Data_d.qpel);
1084    
1085                  }                  }
1086          }          }
1087    
1088            frame->fcode = getMinFcode(MVmaxF);
1089            frame->bcode = getMinFcode(MVmaxB);
1090  }  }

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

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