[cvs] / xvidcore / src / motion / gmc.c Repository:
ViewVC logotype

Diff of /xvidcore/src/motion/gmc.c

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

revision 1.1.2.1, Sat Jun 28 15:54:10 2003 UTC revision 1.1.2.3, Sat Aug 9 14:41:20 2003 UTC
# Line 23  Line 23 
23  #include "../global.h"  #include "../global.h"
24  #include "../encoder.h"  #include "../encoder.h"
25  #include "gmc.h"  #include "gmc.h"
 #include "motion_est.h"  
26    
27  #include <stdio.h>  #include <stdio.h>
28    
# Line 36  Line 35 
35  // of pixel 0,0), not the macroblock one.  // of pixel 0,0), not the macroblock one.
36  // Conversely, *dst is the macroblock top-left adress.  // Conversely, *dst is the macroblock top-left adress.
37    
   
38  void Predict_16x16_C(const NEW_GMC_DATA * const This,  void Predict_16x16_C(const NEW_GMC_DATA * const This,
39                       uint8_t *dst, const uint8_t *src,                       uint8_t *dst, const uint8_t *src,
40                       int dststride, int srcstride, int x, int y, int rounding)                       int dststride, int srcstride, int x, int y, int rounding)
# Line 57  Line 55 
55    int i, j;    int i, j;
56    
57    dst += 16;    dst += 16;
58    for (j=16; j>0; --j)          for (j=16; j>0; --j) {
   {  
59      int U = Uo, V = Vo;      int U = Uo, V = Vo;
60      Uo += dUy; Vo += dVy;      Uo += dUy; Vo += dVy;
61      for (i=-16; i<0; ++i)                  for (i=-16; i<0; ++i) {
62      {                          unsigned int f0, f1, ri = 16, rj = 16;
       unsigned int f0, f1, ri, rj;  
63        int Offset;        int Offset;
   
64        int u = ( U >> 16 ) << rho;        int u = ( U >> 16 ) << rho;
65        int v = ( V >> 16 ) << rho;        int v = ( V >> 16 ) << rho;
66    
67        U += dUx; V += dVx;        U += dUx; V += dVx;
68    
69        ri = 16;                          if (u > 0 && u <= W) { ri = MTab[u&15]; Offset = u>>4;  }
       if ((uint32_t)u<=(uint32_t)W) { ri = MTab[u&15]; Offset = u>>4;  }  
70        else if (u>W) Offset = W>>4;        else if (u>W) Offset = W>>4;
71        else Offset = -1;        else Offset = -1;
72    
73        rj = 16;                          if (v > 0 && v <= H) { rj = MTab[v&15]; Offset += (v>>4)*srcstride; }
       if ((uint32_t)v<=(uint32_t)H) { rj = MTab[v&15]; Offset += (v>>4)*srcstride; }  
74        else if (v>H) Offset += (H>>4)*srcstride;        else if (v>H) Offset += (H>>4)*srcstride;
75            else Offset -= srcstride;            else Offset -= srcstride;
76    
# Line 95  Line 89 
89    }    }
90  }  }
91    
   
92  void Predict_8x8_C(const NEW_GMC_DATA * const This,  void Predict_8x8_C(const NEW_GMC_DATA * const This,
93                     uint8_t *uDst, const uint8_t *uSrc,                     uint8_t *uDst, const uint8_t *uSrc,
94                     uint8_t *vDst, const uint8_t *vSrc,                     uint8_t *vDst, const uint8_t *vSrc,
# Line 118  Line 111 
111    
112    uDst += 8;    uDst += 8;
113    vDst += 8;    vDst += 8;
114    for (j=8; j>0; --j)          for (j=8; j>0; --j) {
   {  
115      int32_t U = Uo, V = Vo;      int32_t U = Uo, V = Vo;
116      Uo += dUy; Vo += dVy;      Uo += dUy; Vo += dVy;
117    
118      for (i=-8; i<0; ++i)                  for (i=-8; i<0; ++i) {
     {  
119        int Offset;        int Offset;
120        uint32_t f0, f1, ri, rj;        uint32_t f0, f1, ri, rj;
121        int32_t u, v;        int32_t u, v;
# Line 133  Line 124 
124        v = ( V >> 16 ) << rho;        v = ( V >> 16 ) << rho;
125        U += dUx; V += dVx;        U += dUx; V += dVx;
126    
127        if ((uint32_t)u<=(uint32_t)W) {                          if (u > 0 && u <= W) {
128          ri = MTab[u&15];          ri = MTab[u&15];
129          Offset = u>>4;          Offset = u>>4;
130        }                          } else {
       else {  
131          ri = 16;          ri = 16;
132          if (u>W) Offset = W>>4;          if (u>W) Offset = W>>4;
133          else Offset = -1;          else Offset = -1;
134        }        }
135        if ((uint32_t)v<=(uint32_t)H) {  
136                            if (v > 0 && v <= H) {
137          rj = MTab[v&15];          rj = MTab[v&15];
138          Offset += (v>>4)*srcstride;          Offset += (v>>4)*srcstride;
139        }                          } else {
       else {  
140          rj = 16;          rj = 16;
141          if (v>H) Offset += (H>>4)*srcstride;          if (v>H) Offset += (H>>4)*srcstride;
142                  else Offset -= srcstride;                  else Offset -= srcstride;
# Line 179  Line 169 
169    }    }
170  }  }
171    
172    void get_average_mv_C(const NEW_GMC_DATA * const Dsp, VECTOR * const mv,
 void get_average_mv_C(NEW_GMC_DATA *Dsp, VECTOR * const mv,  
173                        int x, int y, int qpel)                        int x, int y, int qpel)
174  {  {
175    int i, j;    int i, j;
# Line 209  Line 198 
198  //////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////
199  // simplified version for 1 warp point  // simplified version for 1 warp point
200    
   
201  void Predict_1pt_16x16_C(const NEW_GMC_DATA * const This,  void Predict_1pt_16x16_C(const NEW_GMC_DATA * const This,
202                           uint8_t *Dst, const uint8_t *Src,                           uint8_t *Dst, const uint8_t *Src,
203                           int dststride, int srcstride, int x, int y, int rounding)                           int dststride, int srcstride, int x, int y, int rounding)
# Line 255  Line 243 
243    }    }
244  }  }
245    
   
246  void Predict_1pt_8x8_C(const NEW_GMC_DATA * const This,  void Predict_1pt_8x8_C(const NEW_GMC_DATA * const This,
247                         uint8_t *uDst, const uint8_t *uSrc,                         uint8_t *uDst, const uint8_t *uSrc,
248                         uint8_t *vDst, const uint8_t *vSrc,                         uint8_t *vDst, const uint8_t *vSrc,
# Line 312  Line 299 
299    }    }
300  }  }
301    
302    void get_average_mv_1pt_C(const NEW_GMC_DATA * const Dsp, VECTOR * const mv,
 void get_average_mv_1pt_C(NEW_GMC_DATA *Dsp, VECTOR * const mv,  
303                            int x, int y, int qpel)                            int x, int y, int qpel)
304  {  {
305    mv->x = RSHIFT(Dsp->Uo<<qpel, 3);    mv->x = RSHIFT(Dsp->Uo<<qpel, 3);
# Line 419  Line 405 
405    
406  //////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////
407    
   
408  /* quick and dirty routine to generate the full warped image (pGMC != NULL)  /* quick and dirty routine to generate the full warped image (pGMC != NULL)
409          or just all average Motion Vectors (pGMC == NULL) */          or just all average Motion Vectors (pGMC == NULL) */
410    

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

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