[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 658, Tue Nov 19 13:04:35 2002 UTC revision 671, Sat Nov 23 14:57:09 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.19 2002-11-19 13:03:57 syskin Exp $   *  $Id: encoder.c,v 1.76.2.21 2002-11-23 14:57:09 syskin Exp $
43   *   *
44   ****************************************************************************/   ****************************************************************************/
45    
# Line 327  Line 327 
327          pEnc->global = pParam->global;          pEnc->global = pParam->global;
328          pEnc->mbParam.max_bframes = pParam->max_bframes;          pEnc->mbParam.max_bframes = pParam->max_bframes;
329          pEnc->bquant_ratio = pParam->bquant_ratio;          pEnc->bquant_ratio = pParam->bquant_ratio;
330            pEnc->bquant_offset = pParam->bquant_offset;
331          pEnc->frame_drop_ratio = pParam->frame_drop_ratio;          pEnc->frame_drop_ratio = pParam->frame_drop_ratio;
332          pEnc->bframes = NULL;          pEnc->bframes = NULL;
333    
# Line 728  Line 729 
729    
730                  BitstreamPad(&bs);                  BitstreamPad(&bs);
731                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
732                  pFrame->intra = 0;                  pFrame->intra = 2;
733    
734                  if (input_valid)                  if (input_valid)
735                          queue_image(pEnc, pFrame);                          queue_image(pEnc, pFrame);
# Line 763  Line 764 
764                          pEnc->current->seconds = tmp;                          pEnc->current->seconds = tmp;
765    
766                          pFrame->length = BitstreamLength(&bs);                          pFrame->length = BitstreamLength(&bs);
767                          pFrame->intra = 0;                          pFrame->intra = 4;
768    
769                          if (input_valid)                          if (input_valid)
770                                  queue_image(pEnc, pFrame);                                  queue_image(pEnc, pFrame);
# Line 839  Line 840 
840                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
841    
842                          BitstreamPutBits(&bs, 0x7f, 8);                          BitstreamPutBits(&bs, 0x7f, 8);
843                          pFrame->intra = 0;                          pFrame->intra = 5;
844                  }                  }
845    
846                  pFrame->length = BitstreamLength(&bs);                  pFrame->length = BitstreamLength(&bs);
# Line 926  Line 927 
927           * ivop/pvop/bvop selection           * ivop/pvop/bvop selection
928           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */           * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
929    
   
930          if (pEnc->iFrameNum == 0 || pFrame->intra == 1 || pEnc->bframenum_dx50bvop >= 0 ||          if (pEnc->iFrameNum == 0 || pFrame->intra == 1 || pEnc->bframenum_dx50bvop >= 0 ||
931                  (pFrame->intra < 0 && pEnc->iMaxKeyInterval > 0 &&                  (pFrame->intra < 0 && pEnc->iMaxKeyInterval > 0 &&
932                   pEnc->iFrameNum >= pEnc->iMaxKeyInterval)                   pEnc->iFrameNum >= pEnc->iMaxKeyInterval)
# Line 943  Line 943 
943                  else                  else
944                          pEnc->mbParam.m_quarterpel = 0;                          pEnc->mbParam.m_quarterpel = 0;
945    
946                    if (pEnc->current->global_flags & XVID_MPEGQUANT) pEnc->mbParam.m_quant_type = MPEG4_QUANT;
947    
948                  DPRINTF(DPRINTF_DEBUG,"*** IFRAME bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",                  DPRINTF(DPRINTF_DEBUG,"*** IFRAME bf: head=%i tail=%i   queue: head=%i tail=%i size=%i",
949                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
950                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size);
# Line 989  Line 991 
991                   *      go screwy with divx 5.00                   *      go screwy with divx 5.00
992                   */                   */
993          } else if (pEnc->bframenum_tail >= pEnc->mbParam.max_bframes || mode != 0) {          } else if (pEnc->bframenum_tail >= pEnc->mbParam.max_bframes || mode != 0) {
994    //      } else if (pFrame->intra == 0 || pEnc->bframenum_tail >= pEnc->mbParam.max_bframes || mode != 0) {
995                  /*                  /*
996                   * This will be coded as a Predicted Frame                   * This will be coded as a Predicted Frame
997                   */                   */
# Line 1022  Line 1025 
1025                  }                  }
1026    
1027                  if (pFrame->bquant < 1) {                  if (pFrame->bquant < 1) {
1028                          pEnc->current->quant =                          pEnc->current->quant = ((((pEnc->reference->quant + pEnc->current->quant) *
1029                                  ((pEnc->reference->quant +                                  pEnc->bquant_ratio) / 2) + pEnc->bquant_offset)/100;
1030                                    pEnc->current->quant) * pEnc->bquant_ratio) / 200;  
1031                  } else {                  } else {
1032                          pEnc->current->quant = pFrame->bquant;                          pEnc->current->quant = pFrame->bquant;
1033                  }                  }
1034    
1035                  if (pEnc->current->quant < 1)                  if (pEnc->current->quant < 1)
1036                          pEnc->current->quant = 1;                          pEnc->current->quant = 1;
1037                    else if (pEnc->current->quant > 31)
                 if (pEnc->current->quant > 31)  
1038                          pEnc->current->quant = 31;                          pEnc->current->quant = 31;
1039    
   
1040                          DPRINTF(DPRINTF_DEBUG,"*** BFRAME (store) bf: head=%i tail=%i   queue: head=%i tail=%i size=%i  quant=%i\n",                          DPRINTF(DPRINTF_DEBUG,"*** BFRAME (store) bf: head=%i tail=%i   queue: head=%i tail=%i size=%i  quant=%i\n",
1041                                  pEnc->bframenum_head, pEnc->bframenum_tail,                                  pEnc->bframenum_head, pEnc->bframenum_tail,
1042                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size,pEnc->current->quant);                                  pEnc->queue_head, pEnc->queue_tail, pEnc->queue_size,pEnc->current->quant);
1043    
   
   
1044                  /* store frame into bframe buffer & swap ref back to current */                  /* store frame into bframe buffer & swap ref back to current */
1045                  SWAP(pEnc->current, pEnc->bframes[pEnc->bframenum_tail]);                  SWAP(pEnc->current, pEnc->bframes[pEnc->bframenum_tail]);
1046                  SWAP(pEnc->current, pEnc->reference);                  SWAP(pEnc->current, pEnc->reference);
1047    
1048                  pEnc->bframenum_tail++;                  pEnc->bframenum_tail++;
1049    
1050                  pFrame->intra = 0;  // bframe report by koepi
1051                    pFrame->intra = 2;
1052                  pFrame->length = 0;                  pFrame->length = 0;
1053    
1054                  input_valid = 0;                  input_valid = 0;

Legend:
Removed from v.658  
changed lines
  Added in v.671

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