[xiph-commits] r8012 - trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Fri Oct 15 05:57:09 PDT 2004


Author: illiminable
Date: 2004-10-15 05:57:08 -0700 (Fri, 15 Oct 2004)
New Revision: 8012

Modified:
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
Log:
* Fixed bug with encoding from video with non-integral frame-rates. New solution multiplies the avgTimePerFrame by 1000, and sets the denom to 1000... giving 3 dp of precision.

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp	2004-10-15 12:34:53 UTC (rev 8011)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp	2004-10-15 12:57:08 UTC (rev 8012)
@@ -1268,11 +1268,12 @@
 	
 
 	//HACK:::Bit of a hack to convert dshow nanos to a fps num/denom.
-	unsigned long locNum = (((double)10000000) / ((double)mVideoFormat->AvgTimePerFrame)) + (double)0.5;
+	//Now we multiply the numerator and denom by 1000, this gives us 3 d.p. of precision for framerate.
+	unsigned long locNum = (((double)10000000 * 1000) / ((double)mVideoFormat->AvgTimePerFrame)) + (double)0.5;
 
 	//debugLog<<"FPS = "<<locNum<<endl;
 	mTheoraInfo.fps_numerator = locNum;
-	mTheoraInfo.fps_denominator = 1;
+	mTheoraInfo.fps_denominator = 1000;
 	
 	mTheoraInfo.aspect_numerator=0;
 	mTheoraInfo.aspect_denominator=0;
@@ -1293,8 +1294,8 @@
 	mTheoraInfo.keyframe_mindistance=8;
 	mTheoraInfo.noise_sensitivity=1; 
 
-	((TheoraEncodeFilter*)mParentFilter)->mTheoraFormatBlock.frameRateNumerator = locNum;
-	((TheoraEncodeFilter*)mParentFilter)->mTheoraFormatBlock.frameRateDenominator = 1;
+	((TheoraEncodeFilter*)mParentFilter)->mTheoraFormatBlock.frameRateNumerator = mTheoraInfo.fps_numerator;
+	((TheoraEncodeFilter*)mParentFilter)->mTheoraFormatBlock.frameRateDenominator = mTheoraInfo.fps_denominator;
 	((TheoraEncodeFilter*)mParentFilter)->mTheoraFormatBlock.maxKeyframeInterval = 6;   //log2(keyframe_freq) from above
 	((TheoraEncodeFilter*)mParentFilter)->mTheoraFormatBlock.frameHeight = mHeight;
 	((TheoraEncodeFilter*)mParentFilter)->mTheoraFormatBlock.frameWidth = mWidth;



More information about the commits mailing list