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

Diff of /trunk/xvidcore/src/encoder.c

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

revision 101, Fri Apr 5 14:40:36 2002 UTC revision 104, Sat Apr 6 05:33:44 2002 UTC
# Line 352  Line 352 
352  }  }
353    
354    
 static int FrameCodeI(Encoder * pEnc, Bitstream * bs, uint32_t *pBits)  
 {  
   
         DECLARE_ALIGNED_MATRIX(dct_codes, 6, 64, int16_t, CACHE_LINE);  
         DECLARE_ALIGNED_MATRIX(qcoeff,    6, 64, int16_t, CACHE_LINE);  
   
         uint16_t x, y;  
   
         pEnc->iFrameNum = 0;  
         pEnc->mbParam.rounding_type = 1;  
         pEnc->mbParam.coding_type = I_VOP;  
   
         BitstreamWriteVolHeader(bs, &pEnc->mbParam);  
         BitstreamWriteVopHeader(bs, &pEnc->mbParam);  
   
         *pBits = BitstreamPos(bs);  
   
         pEnc->sStat.iTextBits = 0;  
         pEnc->sStat.kblks = pEnc->mbParam.mb_width * pEnc->mbParam.mb_height;  
         pEnc->sStat.mblks = pEnc->sStat.ublks = 0;  
   
         for (y = 0; y < pEnc->mbParam.mb_height; y++)  
                 for (x = 0; x < pEnc->mbParam.mb_width; x++)  
                 {  
                         MACROBLOCK *pMB = &pEnc->pMBs[x + y * pEnc->mbParam.mb_width];  
   
                         CodeIntraMB(pEnc, pMB);  
   
                         MBTransQuantIntra(&pEnc->mbParam, pMB, x, y, dct_codes, qcoeff, &pEnc->sCurrent);  
   
                         start_timer();  
                         MBPrediction(&pEnc->mbParam, x, y, pEnc->mbParam.mb_width, qcoeff, pEnc->pMBs);  
                         stop_prediction_timer();  
   
                         start_timer();  
                         MBCoding(&pEnc->mbParam, pMB, qcoeff, bs, &pEnc->sStat);  
                         stop_coding_timer();  
                 }  
   
         emms();  
   
         *pBits = BitstreamPos(bs) - *pBits;  
         pEnc->sStat.fMvPrevSigma = -1;  
         pEnc->sStat.iMvSum = 0;  
         pEnc->sStat.iMvCount = 0;  
         pEnc->mbParam.fixed_code = 2;  
   
         return 1;                                        // intra  
 }  
   
   
355  #define FCODEBITS       3  #define FCODEBITS       3
356  #define MODEBITS        5  #define MODEBITS        5
357    
# Line 604  Line 553 
553  }  }
554    
555    
556    static int FrameCodeI(Encoder * pEnc, Bitstream * bs, uint32_t *pBits)
557    {
558    
559            DECLARE_ALIGNED_MATRIX(dct_codes, 6, 64, int16_t, CACHE_LINE);
560            DECLARE_ALIGNED_MATRIX(qcoeff,    6, 64, int16_t, CACHE_LINE);
561    
562            uint16_t x, y;
563    
564            pEnc->iFrameNum = 0;
565            pEnc->mbParam.rounding_type = 1;
566            pEnc->mbParam.coding_type = I_VOP;
567    
568            BitstreamWriteVolHeader(bs, &pEnc->mbParam);
569            BitstreamWriteVopHeader(bs, &pEnc->mbParam);
570    
571            *pBits = BitstreamPos(bs);
572    
573            pEnc->sStat.iTextBits = 0;
574            pEnc->sStat.kblks = pEnc->mbParam.mb_width * pEnc->mbParam.mb_height;
575            pEnc->sStat.mblks = pEnc->sStat.ublks = 0;
576    
577            for (y = 0; y < pEnc->mbParam.mb_height; y++)
578                    for (x = 0; x < pEnc->mbParam.mb_width; x++)
579                    {
580                            MACROBLOCK *pMB = &pEnc->pMBs[x + y * pEnc->mbParam.mb_width];
581    
582                            CodeIntraMB(pEnc, pMB);
583    
584                            MBTransQuantIntra(&pEnc->mbParam, pMB, x, y, dct_codes, qcoeff, &pEnc->sCurrent);
585    
586                            start_timer();
587                            MBPrediction(&pEnc->mbParam, x, y, pEnc->mbParam.mb_width, qcoeff, pEnc->pMBs);
588                            stop_prediction_timer();
589    
590                            start_timer();
591                            MBCoding(&pEnc->mbParam, pMB, qcoeff, bs, &pEnc->sStat);
592                            stop_coding_timer();
593                    }
594    
595            emms();
596    
597            *pBits = BitstreamPos(bs) - *pBits;
598            pEnc->sStat.fMvPrevSigma = -1;
599            pEnc->sStat.iMvSum = 0;
600            pEnc->sStat.iMvCount = 0;
601            pEnc->mbParam.fixed_code = 2;
602    
603            if (pEnc->mbParam.global_flags & XVID_HINTEDME_GET)
604            {
605                    HintedMEGet(pEnc, 1);
606            }
607    
608            return 1;                                        // intra
609    }
610    
611    
612  #define INTRA_THRESHOLD 0.5  #define INTRA_THRESHOLD 0.5
613    
614  static int FrameCodeP(Encoder * pEnc, Bitstream * bs, uint32_t *pBits, bool force_inter, bool vol_header)  static int FrameCodeP(Encoder * pEnc, Bitstream * bs, uint32_t *pBits, bool force_inter, bool vol_header)
# Line 660  Line 665 
665    
666          if (bIntra == 1)          if (bIntra == 1)
667          {          {
                 if (pEnc->mbParam.global_flags & XVID_HINTEDME_GET)  
                 {  
                         HintedMEGet(pEnc, 1);  
                 }  
668                  return FrameCodeI(pEnc, bs, pBits);                  return FrameCodeI(pEnc, bs, pBits);
669          }          }
670    

Legend:
Removed from v.101  
changed lines
  Added in v.104

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