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

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

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

revision 851, Sat Feb 15 15:22:19 2003 UTC revision 876, Wed Feb 19 21:59:30 2003 UTC
# Line 46  Line 46 
46  #include "../utils/emms.h"  #include "../utils/emms.h"
47  #include "../dct/fdct.h"  #include "../dct/fdct.h"
48    
49    /*****************************************************************************
50     * Modified rounding tables -- declared in motion.h
51     * Original tables see ISO spec tables 7-6 -> 7-9
52     ****************************************************************************/
53    
54    const uint32_t roundtab[16] =
55    {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 };
56    
57    /* K = 4 */
58    const uint32_t roundtab_76[16] =
59    { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1 };
60    
61    /* K = 2 */
62    const uint32_t roundtab_78[8] =
63    { 0, 0, 1, 1, 0, 0, 0, 1  };
64    
65    /* K = 1 */
66    const uint32_t roundtab_79[4] =
67    { 0, 1, 0, 0 };
68    
69  #define INITIAL_SKIP_THRESH     (10)  #define INITIAL_SKIP_THRESH     (10)
70  #define FINAL_SKIP_THRESH       (50)  #define FINAL_SKIP_THRESH       (50)
71  #define MAX_SAD00_FOR_SKIP      (20)  #define MAX_SAD00_FOR_SKIP      (20)
# Line 54  Line 74 
74  #define CHECK_CANDIDATE(X,Y,D) { \  #define CHECK_CANDIDATE(X,Y,D) { \
75  CheckCandidate((X),(Y), (D), &iDirection, data ); }  CheckCandidate((X),(Y), (D), &iDirection, data ); }
76    
77    /*****************************************************************************
78     * Code
79     ****************************************************************************/
80    
81  static __inline uint32_t  static __inline uint32_t
82  d_mv_bits(int x, int y, const VECTOR pred, const uint32_t iFcode, const int qpel, const int rrv)  d_mv_bits(int x, int y, const VECTOR pred, const uint32_t iFcode, const int qpel, const int rrv)
83  {  {
# Line 1154  Line 1178 
1178          int mode = MODE_INTER;          int mode = MODE_INTER;
1179    
1180          if (!(GlobalFlags & XVID_MODEDECISION_BITS)) { //normal, fast, SAD-based mode decision          if (!(GlobalFlags & XVID_MODEDECISION_BITS)) { //normal, fast, SAD-based mode decision
1181                  int intra = 0;  //              int intra = 0;
1182                  int sad;                  int sad;
1183                  int InterBias = MV16_INTER_BIAS;                  int InterBias = MV16_INTER_BIAS;
1184                  if (inter4v == 0 || Data->iMinSAD[0] < Data->iMinSAD[1] + Data->iMinSAD[2] +                  if (inter4v == 0 || Data->iMinSAD[0] < Data->iMinSAD[1] + Data->iMinSAD[2] +
# Line 2271  Line 2295 
2295          double meanx,meany;          double meanx,meany;
2296          int num,oldnum;          int num,oldnum;
2297    
2298          if (!MBmask) { fprintf(stderr,"Mem error\n"); return gmc;}          if (!MBmask) { fprintf(stderr,"Mem error\n");
2299                                   gmc.duv[0].x= gmc.duv[0].y =
2300                                                    gmc.duv[1].x= gmc.duv[1].y =
2301                                                    gmc.duv[2].x= gmc.duv[2].y = 0;
2302                                            return gmc; }
2303    
2304  // filter mask of all blocks  // filter mask of all blocks
2305    
2306          for (my = 1; my < MBh-1; my++)          for (my = 1; my < (uint32_t)MBh-1; my++)
2307          for (mx = 1; mx < MBw-1; mx++)          for (mx = 1; mx < (uint32_t)MBw-1; mx++)
2308          {          {
2309                  const int mbnum = mx + my * MBw;                  const int mbnum = mx + my * MBw;
2310                  const MACROBLOCK *pMB = &pMBs[mbnum];                  const MACROBLOCK *pMB = &pMBs[mbnum];
# Line 2292  Line 2320 
2320                          MBmask[mbnum]=1;                          MBmask[mbnum]=1;
2321          }          }
2322    
2323          for (my = 1; my < MBh-1; my++)          for (my = 1; my < (uint32_t)MBh-1; my++)
2324          for (mx = 1; mx < MBw-1; mx++)          for (mx = 1; mx < (uint32_t)MBw-1; mx++)
2325          {          {
2326                  const uint8_t *const pCur = current->image.y + 16*my*pParam->edged_width + 16*mx;                  const uint8_t *const pCur = current->image.y + 16*my*pParam->edged_width + 16*mx;
2327    
# Line 2301  Line 2329 
2329                  if (!MBmask[mbnum])                  if (!MBmask[mbnum])
2330                          continue;                          continue;
2331    
2332                  if (sad16 ( pCur, pCur+1 , pParam->edged_width, 65536) <= grad )                  if (sad16 ( pCur, pCur+1 , pParam->edged_width, 65536) <= (uint32_t)grad )
2333                          MBmask[mbnum] = 0;                          MBmask[mbnum] = 0;
2334                  if (sad16 ( pCur, pCur+pParam->edged_width, pParam->edged_width, 65536) <= grad )                  if (sad16 ( pCur, pCur+pParam->edged_width, pParam->edged_width, 65536) <= (uint32_t)grad )
2335                          MBmask[mbnum] = 0;                          MBmask[mbnum] = 0;
2336    
2337          }          }
# Line 2314  Line 2342 
2342    
2343          a = b = c = n = 0;          a = b = c = n = 0;
2344          DtimesF[0] = DtimesF[1] = DtimesF[2] = DtimesF[3] = 0.;          DtimesF[0] = DtimesF[1] = DtimesF[2] = DtimesF[3] = 0.;
2345          for (my = 0; my < MBh; my++)          for (my = 0; my < (uint32_t)MBh; my++)
2346                  for (mx = 0; mx < MBw; mx++)                  for (mx = 0; mx < (uint32_t)MBw; mx++)
2347                  {                  {
2348                          const int mbnum = mx + my * MBw;                          const int mbnum = mx + my * MBw;
2349                          const MACROBLOCK *pMB = &pMBs[mbnum];                          const MACROBLOCK *pMB = &pMBs[mbnum];
# Line 2352  Line 2380 
2380    
2381          meanx = meany = 0.;          meanx = meany = 0.;
2382          oldnum = 0;          oldnum = 0;
2383          for (my = 0; my < MBh; my++)          for (my = 0; my < (uint32_t)MBh; my++)
2384                  for (mx = 0; mx < MBw; mx++)                  for (mx = 0; mx < (uint32_t)MBw; mx++)
2385                  {                  {
2386                          const int mbnum = mx + my * MBw;                          const int mbnum = mx + my * MBw;
2387                          const MACROBLOCK *pMB = &pMBs[mbnum];                          const MACROBLOCK *pMB = &pMBs[mbnum];
# Line 2381  Line 2409 
2409          fprintf(stderr,"meanx = %8.5f  meany = %8.5f   %d\n",meanx,meany, oldnum);          fprintf(stderr,"meanx = %8.5f  meany = %8.5f   %d\n",meanx,meany, oldnum);
2410  */  */
2411          num = 0;          num = 0;
2412          for (my = 0; my < MBh; my++)          for (my = 0; my < (uint32_t)MBh; my++)
2413                  for (mx = 0; mx < MBw; mx++)                  for (mx = 0; mx < (uint32_t)MBw; mx++)
2414                  {                  {
2415                          const int mbnum = mx + my * MBw;                          const int mbnum = mx + my * MBw;
2416                          const MACROBLOCK *pMB = &pMBs[mbnum];                          const MACROBLOCK *pMB = &pMBs[mbnum];

Legend:
Removed from v.851  
changed lines
  Added in v.876

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