[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.102.2.4, Sun Apr 4 03:07:11 2004 UTC revision 1.103, Tue Mar 30 12:31:52 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,
61                                              bool force_inter,
62                                              bool vol_header);
63    
64  static void FrameCodeB(Encoder * pEnc,  static void FrameCodeB(Encoder * pEnc,
65                                             FRAMEINFO * frame,                                             FRAMEINFO * frame,
# Line 1089  Line 1091 
1091                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
1092                                  pEnc->mbParam.frame_drop_ratio = -1; /* it must be a coded vop */                                  pEnc->mbParam.frame_drop_ratio = -1; /* it must be a coded vop */
1093    
1094                                  FrameCodeP(pEnc, &bs);                                  FrameCodeP(pEnc, &bs, 1, 0);
1095    
1096    
1097                                  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 1341  Line 1343 
1343                                     pEnc->mbParam.edged_width, pEnc->mbParam.height);                                     pEnc->mbParam.edged_width, pEnc->mbParam.height);
1344                  }                  }
1345    
1346                  if ( FrameCodeP(pEnc, &bs) == 0 ) {                  if ( FrameCodeP(pEnc, &bs, 1, 0) == 0 ) {
1347                          /* N-VOP, we mustn't code b-frames yet */                          /* N-VOP, we mustn't code b-frames yet */
1348                          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);
1349                          goto done;                          goto done;
# Line 1523  Line 1525 
1525  /* FrameCodeP also handles S(GMC)-VOPs */  /* FrameCodeP also handles S(GMC)-VOPs */
1526  static int  static int
1527  FrameCodeP(Encoder * pEnc,  FrameCodeP(Encoder * pEnc,
1528                     Bitstream * bs)                     Bitstream * bs,
1529                       bool force_inter,
1530                       bool vol_header)
1531  {  {
1532          float fSigma;          float fSigma;
1533          int bits = BitstreamPos(bs);          int bits = BitstreamPos(bs);
# Line 1531  Line 1535 
1535          DECLARE_ALIGNED_MATRIX(dct_codes, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(dct_codes, 6, 64, int16_t, CACHE_LINE);
1536          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);          DECLARE_ALIGNED_MATRIX(qcoeff, 6, 64, int16_t, CACHE_LINE);
1537    
1538            int iLimit;
1539          int x, y, k;          int x, y, k;
1540          int iSearchRange;          int iSearchRange;
1541          int skip_possible;          int bIntra=0, skip_possible;
1542          FRAMEINFO *const current = pEnc->current;          FRAMEINFO *const current = pEnc->current;
1543          FRAMEINFO *const reference = pEnc->reference;          FRAMEINFO *const reference = pEnc->reference;
1544          MBParam * const pParam = &pEnc->mbParam;          MBParam * const pParam = &pEnc->mbParam;
# Line 1564  Line 1569 
1569          current->rounding_type = pParam->m_rounding_type;          current->rounding_type = pParam->m_rounding_type;
1570          current->fcode = pParam->m_fcode;          current->fcode = pParam->m_fcode;
1571    
1572            if (!force_inter)
1573                    iLimit = (int)(mb_width * mb_height *  INTRA_THRESHOLD);
1574            else
1575                    iLimit = mb_width * mb_height + 1;
1576    
1577          if ((current->vop_flags & XVID_VOP_HALFPEL)) {          if ((current->vop_flags & XVID_VOP_HALFPEL)) {
1578                  if (reference->is_interpolated != current->rounding_type) {                  if (reference->is_interpolated != current->rounding_type) {
1579                          start_timer();                          start_timer();
# Line 1634  Line 1644 
1644                  }                  }
1645          }          }
1646    
1647            bIntra =
1648          MotionEstimation(&pEnc->mbParam, current, reference,          MotionEstimation(&pEnc->mbParam, current, reference,
1649                                           &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,                                           &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV,
1650                                           &pEnc->vGMC, 256*4096);                                           &pEnc->vGMC, iLimit);
1651    
1652    
1653          stop_motion_timer();          stop_motion_timer();
1654    
1655            if (bIntra == 1) return FrameCodeI(pEnc, bs);
1656    
1657          set_timecodes(current,reference,pParam->fbase);          set_timecodes(current,reference,pParam->fbase);
1658            if (vol_header)
1659            {       BitstreamWriteVolHeader(bs, &pEnc->mbParam, current);
1660                    BitstreamPad(bs);
1661            }
1662    
1663          BitstreamWriteVopHeader(bs, &pEnc->mbParam, current, 1, current->mbs[0].quant);          BitstreamWriteVopHeader(bs, &pEnc->mbParam, current, 1, current->mbs[0].quant);
1664    
# Line 1654  Line 1671 
1671                          MACROBLOCK *pMB =                          MACROBLOCK *pMB =
1672                                  &current->mbs[x + y * pParam->mb_width];                                  &current->mbs[x + y * pParam->mb_width];
1673    
1674                          int bIntra = (pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q);                          bIntra = (pMB->mode == MODE_INTRA) || (pMB->mode == MODE_INTRA_Q);
1675    
1676                          if (bIntra) {                          if (bIntra) {
1677                                  CodeIntraMB(pEnc, pMB);                                  CodeIntraMB(pEnc, pMB);
# Line 1856  Line 1873 
1873          DPRINTF(XVID_DEBUG_DEBUG, "kmu %i %i %i\n", current->sStat.kblks, current->sStat.mblks, current->sStat.ublks);          DPRINTF(XVID_DEBUG_DEBUG, "kmu %i %i %i\n", current->sStat.kblks, current->sStat.mblks, current->sStat.ublks);
1874  #endif  #endif
1875          if (current->sStat.kblks + current->sStat.mblks <=          if (current->sStat.kblks + current->sStat.mblks <=
1876                  (pParam->frame_drop_ratio * mb_width * mb_height) / 100 &&                  (pParam->frame_drop_ratio * mb_width * mb_height) / 100)
                 ( (pEnc->bframenum_head >= pEnc->bframenum_tail) || !(pEnc->mbParam.global_flags & XVID_GLOBAL_CLOSED_GOP)) )  
1877          {          {
1878                  current->sStat.kblks = current->sStat.mblks = 0;                  current->sStat.kblks = current->sStat.mblks = 0;
1879                  current->sStat.ublks = mb_width * mb_height;                  current->sStat.ublks = mb_width * mb_height;

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

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