[xiph-commits] r16342 - branches/theora-thusnelda/lib/enc

tterribe at svn.xiph.org tterribe at svn.xiph.org
Sun Jul 26 21:23:20 PDT 2009


Author: tterribe
Date: 2009-07-26 21:23:20 -0700 (Sun, 26 Jul 2009)
New Revision: 16342

Modified:
   branches/theora-thusnelda/lib/enc/encode.c
Log:
More minor two-pass clean-ups.
Clients no longer have to keep calling TH_ENCCTL_2PASS_IN after each frame if
 they've already submitted all of the pass-1 data.


Modified: branches/theora-thusnelda/lib/enc/encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encode.c	2009-07-27 04:03:45 UTC (rev 16341)
+++ branches/theora-thusnelda/lib/enc/encode.c	2009-07-27 04:23:20 UTC (rev 16342)
@@ -1460,7 +1460,6 @@
   /*Step 1: validate parameters.*/
   if(_enc==NULL||_img==NULL)return TH_EFAULT;
   if(_enc->packet_state==OC_PACKET_DONE)return TH_EINVAL;
-  /*TODO: Fix this.*/
   if(_enc->rc.twopass&&_enc->rc.twopass_buffer_bytes==0)return TH_EINVAL;
   if((ogg_uint32_t)_img[0].width!=_enc->state.info.frame_width||
    (ogg_uint32_t)_img[0].height!=_enc->state.info.frame_height){
@@ -1537,6 +1536,10 @@
   _enc->prev_dup_count=_enc->nqueued_dups=_enc->dup_count;
   _enc->dup_count=0;
   _enc->rc.twopass_buffer_bytes=0;
+  /*In pass-2 mode, call TH_ENCCTL_2PASS_IN to update state, alleviating the
+     burden of clients being forced to keep calling it after they've fed in all
+     the data.*/
+  if(_enc->rc.twopass==2)th_encode_ctl(_enc,TH_ENCCTL_2PASS_IN,NULL,0);
 #if defined(OC_DUMP_IMAGES)
   oc_enc_set_granpos(_enc);
   oc_state_dump_frame(&_enc->state,OC_FRAME_IO,"src");



More information about the commits mailing list