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

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

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

revision 700, Sun Dec 8 14:57:09 2002 UTC revision 702, Tue Dec 10 11:13:50 2002 UTC
# Line 708  Line 708 
708    
709          const VECTOR zeroMV = { 0, 0 };          const VECTOR zeroMV = { 0, 0 };
710    
711            int mb_width = pParam->mb_width;
712            int mb_height = pParam->mb_height;
713    
714          uint32_t x, y;          uint32_t x, y;
715          uint32_t iIntra = 0;          uint32_t iIntra = 0;
716          int32_t InterBias, quant = current->quant, sad00;          int32_t InterBias, quant = current->quant, sad00;
# Line 729  Line 732 
732          Data.qpel = pParam->m_quarterpel;          Data.qpel = pParam->m_quarterpel;
733          Data.chroma = current->global_flags & XVID_ME_COLOUR;          Data.chroma = current->global_flags & XVID_ME_COLOUR;
734    
735            if ((current->global_flags & XVID_REDUCED))
736            {
737                    mb_width = (pParam->width + 31) / 32;
738                    mb_height = (pParam->height + 31) / 32;
739            }
740    
741          if((qimage = (uint8_t *) malloc(32 * pParam->edged_width)) == NULL)          if((qimage = (uint8_t *) malloc(32 * pParam->edged_width)) == NULL)
742                  return 1; // allocate some mem for qpel interpolated blocks                  return 1; // allocate some mem for qpel interpolated blocks
743                                    // somehow this is dirty since I think we shouldn't use malloc outside                                    // somehow this is dirty since I think we shouldn't use malloc outside
# Line 736  Line 745 
745          Data.RefQ = qimage;          Data.RefQ = qimage;
746          if (sadInit) (*sadInit) ();          if (sadInit) (*sadInit) ();
747    
748          for (y = 0; y < pParam->mb_height; y++) {          for (y = 0; y < mb_height; y++) {
749                  for (x = 0; x < pParam->mb_width; x++)  {                  for (x = 0; x < mb_width; x++)  {
750                          MACROBLOCK *pMB = &pMBs[x + y * pParam->mb_width];                          MACROBLOCK *pMB = &pMBs[x + y * pParam->mb_width];
751    
752                          pMB->sad16                          pMB->sad16
# Line 2053  Line 2062 
2062                          int intraCount, //number of non-I frames after last I frame; 0 if we force P/B frame                          int intraCount, //number of non-I frames after last I frame; 0 if we force P/B frame
2063                          int bCount) // number if B frames in a row                          int bCount) // number if B frames in a row
2064  {  {
2065            int mb_width = pParam->mb_width;
2066            int mb_height = pParam->mb_height;
2067    
2068          uint32_t x, y, intra = 0;          uint32_t x, y, intra = 0;
2069          int sSAD = 0;          int sSAD = 0;
2070          MACROBLOCK * const pMBs = Current->mbs;          MACROBLOCK * const pMBs = Current->mbs;
# Line 2068  Line 2080 
2080          Data.iFcode = Current->fcode;          Data.iFcode = Current->fcode;
2081          CheckCandidate = CheckCandidate16no4vI;          CheckCandidate = CheckCandidate16no4vI;
2082    
2083            if ((Current->global_flags & XVID_REDUCED))
2084            {
2085                    mb_width = (pParam->width + 31) / 32;
2086                    mb_height = (pParam->height + 31) / 32;
2087            }
2088    
2089    
2090          if (intraCount < 10) // we're right after an I frame          if (intraCount < 10) // we're right after an I frame
2091                  IntraThresh += 4 * (intraCount - 10) * (intraCount - 10);                  IntraThresh += 4 * (intraCount - 10) * (intraCount - 10);
2092          else          else
# Line 2080  Line 2099 
2099    
2100          if (sadInit) (*sadInit) ();          if (sadInit) (*sadInit) ();
2101    
2102          for (y = 1; y < pParam->mb_height-1; y++) {          for (y = 1; y < mb_height-1; y++) {
2103                  for (x = 1; x < pParam->mb_width-1; x++) {                  for (x = 1; x < mb_width-1; x++) {
2104                          int sad, dev;                          int sad, dev;
2105                          MACROBLOCK *pMB = &pMBs[x + y * pParam->mb_width];                          MACROBLOCK *pMB = &pMBs[x + y * pParam->mb_width];
2106    
# Line 2093  Line 2112 
2112                                                            pParam->edged_width);                                                            pParam->edged_width);
2113                                  if (dev + IntraThresh < sad) {                                  if (dev + IntraThresh < sad) {
2114                                          pMB->mode = MODE_INTRA;                                          pMB->mode = MODE_INTRA;
2115                                          if (++intra > (pParam->mb_height-2)*(pParam->mb_width-2)/2) return 2;  // I frame                                          if (++intra > (mb_height-2)*(mb_width-2)/2) return 2;  // I frame
2116                                  }                                  }
2117                          }                          }
2118                          sSAD += sad;                          sSAD += sad;
2119                  }                  }
2120          }          }
2121          sSAD /= (pParam->mb_height-2)*(pParam->mb_width-2);          sSAD /= (mb_height-2)*(mb_width-2);
2122          if (sSAD > InterThresh ) return 1; //P frame          if (sSAD > InterThresh ) return 1; //P frame
2123          emms();          emms();
2124          return 0; // B frame          return 0; // B frame
# Line 2110  Line 2129 
2129  FindFcode(      const MBParam * const pParam,  FindFcode(      const MBParam * const pParam,
2130                          const FRAMEINFO * const current)                          const FRAMEINFO * const current)
2131  {  {
2132            int mb_width = pParam->mb_width;
2133            int mb_height = pParam->mb_height;
2134    
2135          uint32_t x, y;          uint32_t x, y;
2136          int max = 0, min = 0, i;          int max = 0, min = 0, i;
2137    
2138          for (y = 0; y < pParam->mb_height; y++) {  
2139                  for (x = 0; x < pParam->mb_width; x++) {          if ((current->global_flags & XVID_REDUCED))
2140            {
2141                    mb_width = (pParam->width + 31) / 32;
2142                    mb_height = (pParam->height + 31) / 32;
2143            }
2144    
2145    
2146            for (y = 0; y < mb_height; y++) {
2147                    for (x = 0; x < mb_width; x++) {
2148    
2149                          MACROBLOCK *pMB = &current->mbs[x + y * pParam->mb_width];                          MACROBLOCK *pMB = &current->mbs[x + y * pParam->mb_width];
2150                          for(i = 0; i < (pMB->mode == MODE_INTER4V ? 4:1); i++) {                          for(i = 0; i < (pMB->mode == MODE_INTER4V ? 4:1); i++) {

Legend:
Removed from v.700  
changed lines
  Added in v.702

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