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

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

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

revision 949, Wed Mar 26 14:56:49 2003 UTC revision 999, Sun Apr 27 21:18:49 2003 UTC
# Line 26  Line 26 
26   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
27   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
28   *   *
29   *  $Id: encoder.c,v 1.95.2.15 2003-03-26 14:56:10 edgomez Exp $   *  $Id: encoder.c,v 1.95.2.19 2003-04-27 21:18:49 edgomez Exp $
30   *   *
31   ****************************************************************************/   ****************************************************************************/
32    
# Line 151  Line 151 
151      if (pEnc->mbParam.fincr>0)      if (pEnc->mbParam.fincr>0)
152              simplify_time(&pEnc->mbParam.fincr, &pEnc->mbParam.fbase);              simplify_time(&pEnc->mbParam.fincr, &pEnc->mbParam.fbase);
153    
154      /* plugin */      /* plugins */
155        if(create->num_plugins > 0) {
156      pEnc->num_plugins = create->num_plugins;      pEnc->num_plugins = create->num_plugins;
157      pEnc->plugins = xvid_malloc(sizeof(xvid_enc_plugin_t) * pEnc->num_plugins, CACHE_LINE);      pEnc->plugins = xvid_malloc(sizeof(xvid_enc_plugin_t) * pEnc->num_plugins, CACHE_LINE);
158      if (pEnc->plugins == NULL)      if (pEnc->plugins == NULL)
159          goto xvid_err_memory0;          goto xvid_err_memory0;
160            } else {
161                    pEnc->num_plugins = 0;
162                    pEnc->plugins = NULL;
163            }
164    
165      for (n=0; n<pEnc->num_plugins;n++) {      for (n=0; n<pEnc->num_plugins;n++) {
166          xvid_plg_create_t pcreate;          xvid_plg_create_t pcreate;
# Line 202  Line 207 
207          pEnc->mbParam.frame_drop_ratio = MAX(create->frame_drop_ratio, 0);          pEnc->mbParam.frame_drop_ratio = MAX(create->frame_drop_ratio, 0);
208    
209      /* max keyframe interval */      /* max keyframe interval */
210      pEnc->mbParam.iMaxKeyInterval = create->max_key_interval <=0 ? 250 : create->max_key_interval;      pEnc->mbParam.iMaxKeyInterval = create->max_key_interval <= 0 ?
211      /*XXX: replace 250 hard code with "10seconds * framerate" */                  10 * pEnc->mbParam.fbase / pEnc->mbParam.fincr : create->max_key_interval;
212    
213          /* Bitrate allocator defaults          /* Bitrate allocator defaults
214    
# Line 598  Line 603 
603      }      }
604    
605    
606      if (pEnc->num_plugins>0)      if (pEnc->num_plugins>0) {
     {  
607          xvid_plg_destroy_t pdestroy;          xvid_plg_destroy_t pdestroy;
608          memset(&pdestroy, 0, sizeof(xvid_plg_destroy_t));          memset(&pdestroy, 0, sizeof(xvid_plg_destroy_t));
609    
# Line 1041  Line 1045 
1045                  }else{                  }else{
1046                          type = MEanalysis(&pEnc->reference->image, pEnc->current,                          type = MEanalysis(&pEnc->reference->image, pEnc->current,
1047                                          &pEnc->mbParam, pEnc->mbParam.iMaxKeyInterval,                                          &pEnc->mbParam, pEnc->mbParam.iMaxKeyInterval,
1048                                          pEnc->iFrameNum, pEnc->bframenum_tail);                                          pEnc->iFrameNum, pEnc->bframenum_tail, xFrame->bframe_threshold);
1049    
1050              if (type == B_VOP && !(pEnc->current->vop_flags & XVID_VOP_DYNAMIC_BFRAMES)) {              if (type == B_VOP && !(pEnc->current->vop_flags & XVID_VOP_DYNAMIC_BFRAMES)) {
1051                  type = P_VOP;   /* disable dynamic bframes */                  type = P_VOP;   /* disable dynamic bframes */
# Line 1353  Line 1357 
1357          }          }
1358          emms();          emms();
1359    
1360    /* XXX: Remove the two #if 0 blocks when we are sure we must always pad the stream */
1361    #if 0
1362          /* for divx5 compatibility, we must always pad between the packed p and b frames */          /* for divx5 compatibility, we must always pad between the packed p and b frames */
1363          if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0)          if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0)
1364    #endif
1365                  BitstreamPadAlways(bs);                  BitstreamPadAlways(bs);
1366    #if 0
1367          else          else
1368                  BitstreamPad(bs);                  BitstreamPad(bs);
1369    #endif
1370      pEnc->current->length = (BitstreamPos(bs) - bits) / 8;      pEnc->current->length = (BitstreamPos(bs) - bits) / 8;
1371    
1372          pEnc->fMvPrevSigma = -1;          pEnc->fMvPrevSigma = -1;
# Line 1754  Line 1763 
1763          }          }
1764          */          */
1765    
1766    /* XXX: Remove the two #if 0 blocks when we are sure we must always pad the stream */
1767    #if 0
1768          /* for divx5 compatibility, we must always pad between the packed p and b frames */          /* for divx5 compatibility, we must always pad between the packed p and b frames */
1769          if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0)          if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) && pEnc->bframenum_tail > 0)
1770    #endif
1771                  BitstreamPadAlways(bs);                  BitstreamPadAlways(bs);
1772    #if 0
1773          else          else
1774                  BitstreamPad(bs);                  BitstreamPad(bs);
1775    #endif
1776    
1777      pEnc->current->length = (BitstreamPos(bs) - bits) / 8;      pEnc->current->length = (BitstreamPos(bs) - bits) / 8;
1778    
# Line 1890  Line 1904 
1904    
1905          /* TODO: dynamic fcode/bcode ??? */          /* TODO: dynamic fcode/bcode ??? */
1906    
1907      BitstreamPad(bs);      BitstreamPadAlways(bs);
1908          frame->length = (BitstreamPos(bs) - bits) / 8;          frame->length = (BitstreamPos(bs) - bits) / 8;
1909    
1910  #ifdef BFRAMES_DEC_DEBUG  #ifdef BFRAMES_DEC_DEBUG

Legend:
Removed from v.949  
changed lines
  Added in v.999

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