[xiph-commits] r14705 - trunk/theora/lib/enc

tterribe at svn.xiph.org tterribe at svn.xiph.org
Thu Apr 10 21:35:52 PDT 2008


Author: tterribe
Date: 2008-04-10 21:35:52 -0700 (Thu, 10 Apr 2008)
New Revision: 14705

Modified:
   trunk/theora/lib/enc/encapiwrapper.c
Log:
Also copy back values in theora_info that theora_encode_init() can chnage in
 encapiwrapper.
This is needed to ensure the version numbers and granule shift match the values
 in the real encoder.


Modified: trunk/theora/lib/enc/encapiwrapper.c
===================================================================
--- trunk/theora/lib/enc/encapiwrapper.c	2008-04-11 04:19:43 UTC (rev 14704)
+++ trunk/theora/lib/enc/encapiwrapper.c	2008-04-11 04:35:52 UTC (rev 14705)
@@ -50,6 +50,14 @@
   _ci->sharpness=0;
 }
 
+static int _ilog(unsigned _v){
+  int ret;
+  for(ret=0;_v;ret++)_v>>=1;
+  return ret;
+}
+
+
+
 typedef struct th_enc_ctx{
   /*This is required at the start of the struct for the common functions to
      work.*/
@@ -68,7 +76,18 @@
     _ogg_free(enc);
     enc=NULL;
   }
-  else memcpy(&enc->info,_info,sizeof(enc->info));
+  else{
+    memcpy(&enc->info,_info,sizeof(enc->info));
+    /*Overwrite values theora_encode_init() can change; don't trust the user.*/
+    enc->info.version_major=ci.version_major;
+    enc->info.version_minor=ci.version_minor;
+    enc->info.version_subminor=ci.version_subminor;
+    enc->info.quality=ci.quality;
+    enc->info.target_bitrate=ci.target_bitrate;
+    enc->info.fps_numerator=ci.fps_numerator;
+    enc->info.fps_denominator=ci.fps_denominator;
+    enc->info.keyframe_granule_shift=_ilog(ci.keyframe_frequency_force-1);
+  }
   return enc;
 }
 



More information about the commits mailing list