[xiph-commits] r9037 - trunk/theora/lib

j at motherfish-iii.xiph.org j at motherfish-iii.xiph.org
Fri Mar 4 12:23:15 PST 2005


Author: j
Date: 2005-03-04 12:23:11 -0800 (Fri, 04 Mar 2005)
New Revision: 9037

Modified:
   trunk/theora/lib/encoder_toplevel.c
Log:
Here is a patch that fixes distortions that appear during scenes with no 
motion. Tbe problem was that UpdateFrame() was not being called when a 
MotionScore of 0 was computed. Since UpdateFrame() was not called the buffer
returned by theora_encode_packetout() would be the same buffer that was output
for the last frame that had a non-zero MotionScore. This is obviously incorrect
behavior. I've just moved the UpdateFrame() out of the (MotionScore > 0) 
conditional block. 

I've also included my change that prevents the encoder from spending WAY to
many bits on keyframes. This helps prevent the artifact where the video 
suddenly gets very clear when keyframes occur but gets progressively blurry
for interframes. This change helps minimize some of the drastic Q changes
that cause this artifact.

Aaron



Modified: trunk/theora/lib/encoder_toplevel.c
===================================================================
--- trunk/theora/lib/encoder_toplevel.c	2005-03-04 11:22:49 UTC (rev 9036)
+++ trunk/theora/lib/encoder_toplevel.c	2005-03-04 20:23:11 UTC (rev 9037)
@@ -739,12 +739,12 @@
     /* Increment the frames since last key frame count */
     cpi->LastKeyFrame++;
 
+    /* Proceed with the frame update. */
+    UpdateFrame(cpi);
+    
     if ( cpi->MotionScore > 0 ){
       cpi->DropCount = 0;
 
-      /* Proceed with the frame update. */
-      UpdateFrame(cpi);
-
       /* Note the Quantizer used for each block coded. */
       for ( i = 0; i < cpi->pb.UnitFragments; i++ ){
         if ( cpi->pb.display_fragments[i] ){
@@ -862,8 +862,8 @@
 
   /* Set key frame data rate target; this is nominal keyframe size */
   cpi->Configuration.KeyFrameDataTarget = (c->keyframe_data_target_bitrate *
-                                           c->fps_numerator /
-                                           c->fps_denominator ) / 8;
+                                           c->fps_denominator /
+                                           c->fps_numerator ) / 8;
 
   /* Note the height and width in the pre-processor control structure. */
   cpi->ScanConfig.VideoFrameHeight = cpi->pb.info.height;



More information about the commits mailing list