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

Diff of /xvidcore/src/encoder.c

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

revision 1.113, Fri Dec 10 01:31:20 2004 UTC revision 1.114, Fri Dec 10 03:45:18 2004 UTC
# Line 1503  Line 1503 
1503          return 1;                                       /* intra */          return 1;                                       /* intra */
1504  }  }
1505    
1506    static __inline void
1507    updateFcode(Statistics * sStat, Encoder * pEnc)
1508    {
1509            float fSigma;
1510            int iSearchRange;
1511    
1512  #define INTRA_THRESHOLD 0.5          if (sStat->iMvCount == 0)
1513  #define BFRAME_SKIP_THRESHHOLD 30                  sStat->iMvCount = 1;
1514    
1515            fSigma = (float) sqrt((float) sStat->iMvSum / sStat->iMvCount);
1516    
1517            iSearchRange = 16 << pEnc->mbParam.m_fcode;
1518    
1519            if ((3.0 * fSigma > iSearchRange) && (pEnc->mbParam.m_fcode <= 5) )
1520                    pEnc->mbParam.m_fcode++;
1521    
1522            else if ((5.0 * fSigma < iSearchRange)
1523                               && (4.0 * pEnc->fMvPrevSigma < iSearchRange)
1524                               && (pEnc->mbParam.m_fcode >= 2) )
1525                    pEnc->mbParam.m_fcode--;
1526    
1527            pEnc->fMvPrevSigma = fSigma;
1528    }
1529    
1530    #define BFRAME_SKIP_THRESHHOLD 30
1531    
1532  /* FrameCodeP also handles S(GMC)-VOPs */  /* FrameCodeP also handles S(GMC)-VOPs */
1533  static int  static int
1534  FrameCodeP(Encoder * pEnc,  FrameCodeP(Encoder * pEnc,
1535                     Bitstream * bs)                     Bitstream * bs)
1536  {  {
         float fSigma;  
1537          int bits = BitstreamPos(bs);          int bits = BitstreamPos(bs);
1538    
1539          DECLARE_ALIGNED_MATRIX(dct_codes, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(dct_codes, 6, 64, int16_t, CACHE_LINE);
1540          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);
1541    
1542          int x, y, k;          int x, y, k;
         int iSearchRange;  
1543          int skip_possible;          int skip_possible;
1544          FRAMEINFO *const current = pEnc->current;          FRAMEINFO *const current = pEnc->current;
1545          FRAMEINFO *const reference = pEnc->reference;          FRAMEINFO *const reference = pEnc->reference;
# Line 1529  Line 1548 
1548          int mb_height = pParam->mb_height;          int mb_height = pParam->mb_height;
1549          int coded = 1;          int coded = 1;
1550    
   
         /* IMAGE *pCurrent = &current->image; */  
1551          IMAGE *pRef = &reference->image;          IMAGE *pRef = &reference->image;
1552    
1553          if (!reference->is_edged) {          if (!reference->is_edged) {
# Line 1798  Line 1815 
1815          }          }
1816    
1817          emms();          emms();
1818            updateFcode(&current->sStat, pEnc);
         if (current->sStat.iMvCount == 0)  
                 current->sStat.iMvCount = 1;  
   
         fSigma = (float) sqrt((float) current->sStat.iMvSum / current->sStat.iMvCount);  
   
         iSearchRange = 16 << pParam->m_fcode;  
   
         if ((3.0 * fSigma > iSearchRange) && (pParam->m_fcode <= 5) )  
                 pParam->m_fcode++;  
   
         else if ((5.0 * fSigma < iSearchRange)  
                            && (4.0 * pEnc->fMvPrevSigma < iSearchRange)  
                            && (pParam->m_fcode >= 2) )  /* minimum search range 32 */  
                 pParam->m_fcode--;  
   
         pEnc->fMvPrevSigma = fSigma;  
1819    
1820          /* frame drop code */          /* frame drop code */
1821  #if 0  #if 0

Legend:
Removed from v.1.113  
changed lines
  Added in v.1.114

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