[xiph-commits] r17345 - experimental/derf/theora-ptalarbvorm/lib

tterribe at svn.xiph.org tterribe at svn.xiph.org
Fri Jul 23 06:58:46 PDT 2010


Author: tterribe
Date: 2010-07-23 06:58:46 -0700 (Fri, 23 Jul 2010)
New Revision: 17345

Modified:
   experimental/derf/theora-ptalarbvorm/lib/analyze.c
Log:
Ensure activity_avg is positive.
Otherise, flat regions will get an rd_scale of 0 in the next frame, which
 causes errors in the analysis.


Modified: experimental/derf/theora-ptalarbvorm/lib/analyze.c
===================================================================
--- experimental/derf/theora-ptalarbvorm/lib/analyze.c	2010-07-21 01:42:18 UTC (rev 17344)
+++ experimental/derf/theora-ptalarbvorm/lib/analyze.c	2010-07-23 13:58:46 UTC (rev 17345)
@@ -2703,7 +2703,11 @@
     We could use a Bessel follower here, but fast reaction is probably almost
      always best.*/
   _enc->activity_avg=
-   (unsigned)((activity_sum+(_enc->state.fplanes[0].nfrags>>1))/_enc->state.fplanes[0].nfrags);
+   (unsigned)((activity_sum+(_enc->state.fplanes[0].nfrags>>1))/
+   _enc->state.fplanes[0].nfrags);
+  /*activity_avg must be positive, or flat regions will get an rd_scale of 0
+     in the next frame, which breaks analysis.*/
+  if(_enc->activity_avg<=0)_enc->activity_avg=1;
   _enc->luma_avg=(unsigned)((luma_sum+(_enc->state.nmbs>>1))/_enc->state.nmbs);
   /*Finish filling in the reference frame borders.*/
   refi=_enc->state.ref_frame_idx[OC_FRAME_SELF];



More information about the commits mailing list