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

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

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

revision 573, Mon Sep 30 14:16:02 2002 UTC revision 577, Thu Oct 3 12:06:42 2002 UTC
# Line 39  Line 39 
39   *             MinChen <chenm001@163.com>   *             MinChen <chenm001@163.com>
40   *  14.04.2002 added FrameCodeB()   *  14.04.2002 added FrameCodeB()
41   *   *
42   *  $Id: encoder.c,v 1.76.2.8 2002-09-30 14:16:02 chl Exp $   *  $Id: encoder.c,v 1.76.2.11 2002-10-03 12:06:42 suxen_drol Exp $
43   *   *
44   ****************************************************************************/   ****************************************************************************/
45    
# Line 744  Line 744 
744          if (pEnc->bframenum_head > 0) {          if (pEnc->bframenum_head > 0) {
745                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;                  pEnc->bframenum_head = pEnc->bframenum_tail = 0;
746    
747                    /* write an empty marker to the bitstream.
748    
749                       for divx5 decoder compatibility, this marker must consist
750                       of a not-coded p-vop, with a time_base of zero, and time_increment
751                       indentical to the future-referece frame.
752                    */
753    
754                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {
755                            int tmp;
756    
757                          DPRINTF(DPRINTF_DEBUG,"*** EMPTY bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",                          DPRINTF(DPRINTF_DEBUG,"*** EMPTY bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
758                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
759                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
760    
                         set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);  
                         BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0);  
761                          BitstreamPad(&bs);                          BitstreamPad(&bs);
762                          BitstreamPutBits(&bs, 0x7f, 8);  
763                            tmp = pEnc->current->seconds;
764                            pEnc->current->seconds = 0; /* force time_base = 0 */
765                            BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0);
766                            pEnc->current->seconds = tmp;
767    
768                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
769                          pFrame->intra = 0;                          pFrame->intra = 0;
# Line 815  Line 825 
825                  pEnc->queue_head =  (pEnc->queue_head + 1) % pEnc->mbParam.max_bframes;                  pEnc->queue_head =  (pEnc->queue_head + 1) % pEnc->mbParam.max_bframes;
826                  pEnc->queue_size--;                  pEnc->queue_size--;
827    
828          } else if (BitstreamPos(&bs) == 0) {          } else {
829    
830                    /* if nothing was encoded, write an 'ignore this frame' flag
831                       to the bitstream */
832    
833                    if (BitstreamPos(&bs) == 0) {
834    
835                  DPRINTF(DPRINTF_DEBUG,"*** SKIP bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",                  DPRINTF(DPRINTF_DEBUG,"*** SKIP bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
836                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
837                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
838    
839                            BitstreamPutBits(&bs, 0x7f, 8);
840                  pFrame->intra = 0;                  pFrame->intra = 0;
841                    }
                 set_timecodes(pEnc->current,pEnc->reference,pEnc->mbParam.fbase);  
                 BitstreamWriteVopHeader(&bs, &pEnc->mbParam, pEnc->current, 0); // write N_VOP  
                 BitstreamPad(&bs);  
                 pFrame->length = BitstreamLength(&bs);  
   
                 return XVID_ERR_OK;  
   
         } else {  
842    
843                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
844                  return XVID_ERR_OK;                  return XVID_ERR_OK;
# Line 872  Line 880 
880    
881                  if ((pEnc->global & XVID_GLOBAL_DEBUG)) {                  if ((pEnc->global & XVID_GLOBAL_DEBUG)) {
882                          image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 5,                          image_printf(&pEnc->current->image, pEnc->mbParam.edged_width, pEnc->mbParam.height, 5, 5,
883                                  "%i  if:%i  st:%i:%i", pEnc->m_framenum++, pEnc->iFrameNum, pEnc->current->seconds, pEnc->current->ticks);                                  "%i  if:%i  st:%i", pEnc->m_framenum++, pEnc->iFrameNum, pEnc->current->stamp);
884                  }                  }
885    
886          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%          /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Line 963  Line 971 
971                  pEnc->flush_bframes = 1;                  pEnc->flush_bframes = 1;
972    
973                  if ((pEnc->global & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) {                  if ((pEnc->global & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0) {
974                          BitstreamPad(&bs);                          BitstreamPadAlways(&bs);
975                          input_valid = 0;                          input_valid = 0;
976                          goto ipvop_loop;                          goto ipvop_loop;
977                  }                  }
# Line 990  Line 998 
998                  pEnc->flush_bframes = 1;                  pEnc->flush_bframes = 1;
999    
1000                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {                  if ((pEnc->global & XVID_GLOBAL_PACKED)) {
1001                          BitstreamPad(&bs);                          BitstreamPadAlways(&bs);
1002                          input_valid = 0;                          input_valid = 0;
1003                          goto ipvop_loop;                          goto ipvop_loop;
1004                  }                  }
# Line 1605  Line 1613 
1613          start_timer();          start_timer();
1614          if (pEnc->current->global_flags & XVID_HINTEDME_SET) {          if (pEnc->current->global_flags & XVID_HINTEDME_SET) {
1615                  HintedMESet(pEnc, &bIntra);                  HintedMESet(pEnc, &bIntra);
1616                  if (bIntra == 0) MotionEstimationHinted(&pEnc->mbParam, pEnc->current, pEnc->reference,          if (bIntra == 0) {
1617                            pEnc->current->fcode = FindFcode(&pEnc->mbParam, pEnc->current);
1618                            MotionEstimationHinted(&pEnc->mbParam, pEnc->current, pEnc->reference,
1619                                                                                          &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV);                                                                                          &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV);
1620                    }
1621    
1622          } else {          } else {
1623    

Legend:
Removed from v.573  
changed lines
  Added in v.577

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