[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 1567, Wed Dec 8 12:43:48 2004 UTC revision 1575, Fri Dec 17 10:45:01 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.18 2004-12-08 12:43:48 syskin Exp $   * $Id: estimation_bvop.c,v 1.21 2004-12-17 10:45:01 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 964  Line 965 
965  {  {
966          uint32_t i, j;          uint32_t i, j;
967          int32_t best_sad = 256*4096;          int32_t best_sad = 256*4096;
         int32_t sad2;  
968          uint32_t skip_sad;          uint32_t skip_sad;
969            int fb_thresh;
970          const MACROBLOCK * const b_mbs = b_reference->mbs;          const MACROBLOCK * const b_mbs = b_reference->mbs;
971    
972          VECTOR f_predMV, b_predMV;          VECTOR f_predMV, b_predMV;
# Line 985  Line 985 
985          Data_d.rounding = 0;          Data_d.rounding = 0;
986          Data_d.chroma = frame->motion_flags & XVID_ME_CHROMA_BVOP;          Data_d.chroma = frame->motion_flags & XVID_ME_CHROMA_BVOP;
987          Data_d.iQuant = frame->quant;          Data_d.iQuant = frame->quant;
988            Data_d.quant_sq = frame->quant*frame->quant;
989          Data_d.dctSpace = dct_space;          Data_d.dctSpace = dct_space;
990          Data_d.quant_type = !(pParam->vol_flags & XVID_VOL_MPEGQUANT);          Data_d.quant_type = !(pParam->vol_flags & XVID_VOL_MPEGQUANT);
991          Data_d.mpeg_quant_matrices = pParam->mpeg_quant_matrices;          Data_d.mpeg_quant_matrices = pParam->mpeg_quant_matrices;
# Line 1028  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 1037  Line 1039 
1039                          SearchBF_initial(i, j, frame->motion_flags, frame->bcode, pParam, pMB,                          SearchBF_initial(i, j, frame->motion_flags, frame->bcode, pParam, pMB,
1040                                                  &b_predMV, &best_sad, MODE_BACKWARD, &Data_b, Data_d.currentMV[2]);                                                  &b_predMV, &best_sad, MODE_BACKWARD, &Data_b, Data_d.currentMV[2]);
1041    
1042                          sad2 = best_sad;                          if (frame->motion_flags&XVID_ME_BFRAME_EARLYSTOP)
1043                                    fb_thresh = best_sad;
1044                            else
1045                                    fb_thresh = best_sad + (best_sad>>1);
1046    
1047                          if (Data_f.iMinSAD[0] < 2*sad2+2000)                          if (Data_f.iMinSAD[0] <= fb_thresh)
1048                                  SearchBF_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_f);                                  SearchBF_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_f);
1049    
1050                          if (Data_b.iMinSAD[0] < 2*sad2+2000)                          if (Data_b.iMinSAD[0] <= fb_thresh)
1051                                  SearchBF_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_b);                                  SearchBF_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_b);
1052    
1053                          SearchInterpolate_initial(i, j, frame->motion_flags, pParam, &f_predMV, &b_predMV, &best_sad,                          SearchInterpolate_initial(i, j, frame->motion_flags, pParam, &f_predMV, &b_predMV, &best_sad,
1054                                                                    &Data_i, Data_f.currentMV[0], Data_b.currentMV[0]);                                                                    &Data_i, Data_f.currentMV[0], Data_b.currentMV[0]);
1055    
1056                          if (((Data_i.iMinSAD[0] < 2*best_sad+2000) && !(frame->motion_flags&XVID_ME_FAST_MODEINTERPOLATE))                          if (((Data_i.iMinSAD[0] < best_sad +(best_sad>>3)) && !(frame->motion_flags&XVID_ME_FAST_MODEINTERPOLATE))
1057                                  || Data_i.iMinSAD[0] <= best_sad)                                  || Data_i.iMinSAD[0] <= best_sad)
1058    
1059                                  SearchInterpolate_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_i);                                  SearchInterpolate_final(i, j, frame->motion_flags, pParam, &best_sad, &Data_i);
1060    
1061                          if ((Data_d.iMinSAD[0] <= 2*best_sad) && (!frame->motion_flags&XVID_ME_SKIP_DELTASEARCH))                          if (Data_d.iMinSAD[0] <= 2*best_sad)
1062                                    if ((!(frame->motion_flags&XVID_ME_SKIP_DELTASEARCH) && (best_sad > 750))
1063                                            || (best_sad > 1000))
1064    
1065                                  SearchDirect_final(frame->motion_flags, b_mb, &best_sad, &Data_d);                                  SearchDirect_final(frame->motion_flags, b_mb, &best_sad, &Data_d);
1066    
1067                          /* final skip decision */                          /* final skip decision */
# Line 1066  Line 1074 
1074    
1075                                  if (pMB->mode == MODE_DIRECT_NONE_MV) { /* skipped? */                                  if (pMB->mode == MODE_DIRECT_NONE_MV) { /* skipped? */
1076                                          pMB->sad16 = skip_sad;                                          pMB->sad16 = skip_sad;
1077                                            pMB->cbp = 0;
1078                                          continue;                                          continue;
1079                                  }                                  }
1080                          }                          }

Legend:
Removed from v.1567  
changed lines
  Added in v.1575

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