[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.103, Tue Mar 30 12:31:52 2004 UTC revision 1.104, Sat Apr 3 10:41:42 2004 UTC
# Line 57  Line 57 
57                                            Bitstream * bs);                                            Bitstream * bs);
58    
59  static int FrameCodeP(Encoder * pEnc,  static int FrameCodeP(Encoder * pEnc,
60                                            Bitstream * bs,                                            Bitstream * bs);
                                           bool force_inter,  
                                           bool vol_header);  
61    
62  static void FrameCodeB(Encoder * pEnc,  static void FrameCodeB(Encoder * pEnc,
63                                             FRAMEINFO * frame,                                             FRAMEINFO * frame,
# Line 1091  Line 1089 
1089                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
1090                                  pEnc->mbParam.frame_drop_ratio = -1; /* it must be a coded vop */                                  pEnc->mbParam.frame_drop_ratio = -1; /* it must be a coded vop */
1091    
1092                                  FrameCodeP(pEnc, &bs, 1, 0);                                  FrameCodeP(pEnc, &bs);
1093    
1094    
1095                                  if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail==0) {                                  if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail==0) {
# Line 1343  Line 1341 
1341                                     pEnc->mbParam.edged_width, pEnc->mbParam.height);                                     pEnc->mbParam.edged_width, pEnc->mbParam.height);
1342                  }                  }
1343    
1344                  if ( FrameCodeP(pEnc, &bs, 1, 0) == 0 ) {                  if ( FrameCodeP(pEnc, &bs) == 0 ) {
1345                          /* N-VOP, we mustn't code b-frames yet */                          /* N-VOP, we mustn't code b-frames yet */
1346                          call_plugins(pEnc, pEnc->current, &pEnc->sOriginal, XVID_PLG_AFTER, 0, 0, stats);                          call_plugins(pEnc, pEnc->current, &pEnc->sOriginal, XVID_PLG_AFTER, 0, 0, stats);
1347                          goto done;                          goto done;
# Line 1525  Line 1523 
1523  /* FrameCodeP also handles S(GMC)-VOPs */  /* FrameCodeP also handles S(GMC)-VOPs */
1524  static int  static int
1525  FrameCodeP(Encoder * pEnc,  FrameCodeP(Encoder * pEnc,
1526                     Bitstream * bs,                     Bitstream * bs)
                    bool force_inter,  
                    bool vol_header)  
1527  {  {
1528          float fSigma;          float fSigma;
1529          int bits = BitstreamPos(bs);          int bits = BitstreamPos(bs);
# Line 1535  Line 1531 
1531          DECLARE_ALIGNED_MATRIX(dct_codes, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(dct_codes, 6, 64, int16_t, CACHE_LINE);
1532          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);
1533    
         int iLimit;  
1534          int x, y, k;          int x, y, k;
1535          int iSearchRange;          int iSearchRange;
1536          int bIntra=0, skip_possible;          int skip_possible;
1537          FRAMEINFO *const current = pEnc->current;          FRAMEINFO *const current = pEnc->current;
1538          FRAMEINFO *const reference = pEnc->reference;          FRAMEINFO *const reference = pEnc->reference;
1539          MBParam * const pParam = &pEnc->mbParam;          MBParam * const pParam = &pEnc->mbParam;
# Line 1569  Line 1564 
1564          current->rounding_type = pParam->m_rounding_type;          current->rounding_type = pParam->m_rounding_type;
1565          current->fcode = pParam->m_fcode;          current->fcode = pParam->m_fcode;
1566    
         if (!force_inter)  
                 iLimit = (int)(mb_width * mb_height *  INTRA_THRESHOLD);  
         else  
                 iLimit = mb_width * mb_height + 1;  
   
1567          if ((current->vop_flags & XVID_VOP_HALFPEL)) {          if ((current->vop_flags & XVID_VOP_HALFPEL)) {
1568                  if (reference->is_interpolated != current->rounding_type) {                  if (reference->is_interpolated != current->rounding_type) {
1569                          start_timer();                          start_timer();
# Line 1644  Line 1634 
1634                  }                  }
1635          }          }
1636    
         bIntra =  
1637                  MotionEstimation(&pEnc->mbParam, current, reference,                  MotionEstimation(&pEnc->mbParam, current, reference,
1638                                           &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,                                           &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,
1639                                           &pEnc->vGMC, iLimit);                                           &pEnc->vGMC, 256*4096);
1640    
1641    
1642          stop_motion_timer();          stop_motion_timer();
1643    
         if (bIntra == 1) return FrameCodeI(pEnc, bs);  
   
1644          set_timecodes(current,reference,pParam->fbase);          set_timecodes(current,reference,pParam->fbase);
         if (vol_header)  
         {       BitstreamWriteVolHeader(bs, &pEnc->mbParam, current);  
                 BitstreamPad(bs);  
         }  
1645    
1646          BitstreamWriteVopHeader(bs, &pEnc->mbParam, current, 1, current->mbs[0].quant);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, current, 1, current->mbs[0].quant);
1647    
# Line 1671  Line 1654 
1654                          MACROBLOCK *pMB =                          MACROBLOCK *pMB =
1655                                  &current->mbs[x + y * pParam->mb_width];                                  &current->mbs[x + y * pParam->mb_width];
1656    
1657                          bIntra = (pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q);                          int bIntra = (pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q);
1658    
1659                          if (bIntra) {                          if (bIntra) {
1660                                  CodeIntraMB(pEnc, pMB);                                  CodeIntraMB(pEnc, pMB);

Legend:
Removed from v.1.103  
changed lines
  Added in v.1.104

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