[cvs] / xvidcore / src / motion / motion_inlines.h Repository:
ViewVC logotype

Diff of /xvidcore/src/motion/motion_inlines.h

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

revision 1.1.2.1, Wed Sep 10 22:19:00 2003 UTC revision 1.5, Sat Apr 28 16:30:20 2007 UTC
# Line 44  Line 44 
44                    uint32_t block_sz, /* block dimension, 3(8) or 4(16) */                    uint32_t block_sz, /* block dimension, 3(8) or 4(16) */
45                    const uint32_t width,                    const uint32_t width,
46                    const uint32_t height,                    const uint32_t height,
47                    const uint32_t fcode,                    const int fcode,
48                    const int precision, /* 2 for qpel, 1 for halfpel */                    const int precision) /* 2 for qpel, 1 for halfpel */
                   const int rrv)  
49  {  {
50          int k;          int k;
51          const int search_range = 16 << fcode;          const int search_range = 1 << (4+fcode);
52          int high = search_range - 1;          int high = search_range - 1;
53          int low = -search_range;          int low = -search_range;
54    
         if (rrv) {  
                 high = RRV_MV_SCALEUP(high);  
                 low = RRV_MV_SCALEUP(low);  
                 block_sz++;  
         }  
   
55          k = (int)(width - (x<<block_sz))<<precision;          k = (int)(width - (x<<block_sz))<<precision;
56          *max_dx = MIN(high, k);          *max_dx = MIN(high, k);
57          k = (int)(height -  (y<<block_sz))<<precision;          k = (int)(height -  (y<<block_sz))<<precision;
# Line 70  Line 63 
63          *min_dy = MAX(low, k);          *min_dy = MAX(low, k);
64  }  }
65    
66  /* mv.length table */  /* reversed mv.length table */
67  static const int mvtab[64] = {  static const int r_mvtab[65] = {
68          1, 2, 3, 4, 6, 7, 7, 7,          11, 12, 12, 12, 12, 12, 12, 12, 12,
         9, 9, 9, 10, 10, 10, 10, 10,  
         10, 10, 10, 10, 10, 10, 10, 10,  
         10, 11, 11, 11, 11, 11, 11, 12,  
69          12, 12, 12, 12, 12, 12, 12, 12,          12, 12, 12, 12, 12, 12, 12, 12,
70          12, 12, 12, 12, 12, 12, 12, 12,          12, 12, 12, 12, 12, 12, 12, 12,
71          12, 12, 12, 12, 12, 12, 12, 12, 12          12, 12, 12, 12, 12, 12, 12, 12,
72            12, 11, 11, 11, 11, 11, 11, 10,
73            10, 10, 10, 10, 10, 10, 10, 10,
74            10, 10, 10, 10, 10, 9, 9, 9,
75            7, 7, 7, 6, 4, 3, 2, 1
76  };  };
77    
78  static __inline uint32_t  static __inline uint32_t
79  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)
80  {  {
81          int bits;          unsigned int bits;
         const int q = (1 << (iFcode - 1)) - 1;  
82    
83          x <<= qpel;          x <<= qpel;
84          y <<= qpel;          y <<= qpel;
         if (rrv) { x = RRV_MV_SCALEDOWN(x); y = RRV_MV_SCALEDOWN(y); }  
85    
86          x -= pred.x;          x -= pred.x;
87          bits = (x != 0 ? iFcode:0);          bits = (x != 0 ? iFcode:0);
88          x = abs(x);          x = -abs(x);
         x += q;  
89          x >>= (iFcode - 1);          x >>= (iFcode - 1);
90          bits += mvtab[x];          bits += r_mvtab[x+64];
91    
92          y -= pred.y;          y -= pred.y;
93          bits += (y != 0 ? iFcode:0);          bits += (y != 0 ? iFcode:0);
94          y = abs(y);          y = -abs(y);
         y += q;  
95          y >>= (iFcode - 1);          y >>= (iFcode - 1);
96          bits += mvtab[y];          bits += r_mvtab[y+64];
97    
98          return bits;          return bits;
99  }  }
# Line 133  Line 123 
123          pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = zeroMV;          pMB->mvs[0] = pMB->mvs[1] = pMB->mvs[2] = pMB->mvs[3] = zeroMV;
124          pMB->qmvs[0] = pMB->qmvs[1] = pMB->qmvs[2] = pMB->qmvs[3] = zeroMV;          pMB->qmvs[0] = pMB->qmvs[1] = pMB->qmvs[2] = pMB->qmvs[3] = zeroMV;
125          pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = sad;          pMB->sad16 = pMB->sad8[0] = pMB->sad8[1] = pMB->sad8[2] = pMB->sad8[3] = sad;
126            pMB->mcsel = 0;
127            pMB->cbp = 0;
128  }  }
129    
130  /* check if given vector is equal to any vector checked before */  /* check if given vector is equal to any vector checked before */
131  static __inline int  static __inline int
132  vector_repeats(const VECTOR * const pmv, const int i)  vector_repeats(const VECTOR * const pmv, const unsigned int i)
133  {  {
134          unsigned int j;          unsigned int j;
135          for (j = 0; j < i; j++)          for (j = 0; j < i; j++)
# Line 148  Line 140 
140  /*      make a binary mask that prevents diamonds/squares  /*      make a binary mask that prevents diamonds/squares
141          from checking a vector which has been checked as a prediction */          from checking a vector which has been checked as a prediction */
142  static __inline int  static __inline int
143  make_mask(const VECTOR * const pmv, const int i, const int current)  make_mask(const VECTOR * const pmv, const unsigned int i, const unsigned int current)
144  {  {
145          unsigned int mask = 255, j;          unsigned int mask = 255, j;
146          for (j = 0; j < i; j++) {          for (j = 0; j < i; j++) {

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.5

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