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

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

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

revision 1564, Sun Dec 5 04:53:01 2004 UTC revision 1602, Thu Mar 3 01:27:07 2005 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_pvop.c,v 1.9 2004-12-05 04:53:01 syskin Exp $   * $Id: estimation_pvop.c,v 1.14 2005-03-03 01:27:07 Isibaar Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 751  Line 751 
751          return Flags;          return Flags;
752  }  }
753    
754    static __inline void
755    motionStatsPVOP(int * const MVmax, int * const mvCount, int * const mvSum,
756                                    const MACROBLOCK * const pMB, const int qpel)
757    {
758            const VECTOR * const mv = qpel ? pMB->qmvs : pMB->mvs;
759            int i;
760            int max = *MVmax;
761    
762            switch (pMB->mode) {
763            case MODE_INTER4V:
764                    *mvCount += 3;
765                    for(i = 3; i; i--) {
766                            if (mv[i].x > max) max = mv[i].x;
767                            else if (-mv[i].x - 1 > max) max = -mv[i].x - 1;
768                            *mvSum += mv[i].x * mv[i].x;
769                            if (mv[i].y > max) max = mv[i].y;
770                            else if (-mv[i].y - 1 > max) max = -mv[i].y - 1;
771                            *mvSum += mv[i].y * mv[i].y;
772                    }
773            case MODE_INTER:
774                    (*mvCount)++;
775                    *mvSum += mv[0].x * mv[0].x;
776                    *mvSum += mv[0].y * mv[0].y;
777                    if (mv[0].x > max) max = mv[0].x;
778                    else if (-mv[0].x - 1 > max) max = -mv[0].x - 1;
779                    if (mv[0].y > max) max = mv[0].y;
780                    else if (-mv[0].y - 1 > max) max = -mv[0].y - 1;
781                    *MVmax = max;
782            default:
783                    break;
784            }
785    }
786    
787  bool  bool
788  MotionEstimation(MBParam * const pParam,  MotionEstimation(MBParam * const pParam,
789                                   FRAMEINFO * const current,                                   FRAMEINFO * const current,
# Line 770  Line 803 
803          const uint32_t iEdgedWidth = pParam->edged_width;          const uint32_t iEdgedWidth = pParam->edged_width;
804          const uint32_t MotionFlags = MakeGoodMotionFlags(current->motion_flags, current->vop_flags, current->vol_flags);          const uint32_t MotionFlags = MakeGoodMotionFlags(current->motion_flags, current->vop_flags, current->vol_flags);
805          int stat_thresh = 0;          int stat_thresh = 0;
806            int MVmax = 0, mvSum = 0, mvCount = 0;
807    
808          uint32_t x, y;          uint32_t x, y;
809          int32_t sad00;          int32_t sad00;
# Line 846  Line 880 
880                          if ((current->vop_flags & XVID_VOP_CARTOON) &&                          if ((current->vop_flags & XVID_VOP_CARTOON) &&
881                                  ((sad00 < pMB->quant * 4 * skip_thresh) || (sad00 < stat_thresh))) {                                  ((sad00 < pMB->quant * 4 * skip_thresh) || (sad00 < stat_thresh))) {
882                                  ZeroMacroblockP(pMB, sad00);                                  ZeroMacroblockP(pMB, sad00);
883                                    pMB->cbp = 0x3f;
884                                  continue;                                  continue;
885                          }                          }
886    
# Line 868  Line 903 
903                                                                  pCurrent, pRef, pGMC, current->coding_type, sad00);                                                                  pCurrent, pRef, pGMC, current->coding_type, sad00);
904    
905    
906                            motionStatsPVOP(&MVmax, &mvCount, &mvSum, pMB, Data.qpel);
907                  }                  }
908          }          }
         return 0;  
 }  
909    
910            current->fcode = getMinFcode(MVmax);
911            current->sStat.iMvSum = mvSum;
912            current->sStat.iMvCount = mvCount;
913    
914            return 0;
915    }

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

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