]> granicus.if.org Git - libvpx/commitdiff
Patch relating to Issue 1456.
authorpaulwilkins <paulwilkins@google.com>
Tue, 8 Aug 2017 11:01:46 +0000 (12:01 +0100)
committerpaulwilkins <paulwilkins@google.com>
Wed, 9 Aug 2017 15:34:43 +0000 (16:34 +0100)
Testing of 4k videos encoded with a fixed arbitrary chunking interval
uncovered a bug where by if a chunk ends 1 frame before a real scene cut,
the next chunk may be encoded with two consecutive key frames at the start
with the first being assigned 0 bits.

This fix insures that where there is a key frame group of length 1 it is
at least assigned 1 frames worth of bits not 0.

See also patch Change-Id: I692311a709ccdb6003e705103de9d05b59bf840a
which by virtue of allowing fast adaptation  of Q made this bug more visible.

BUG=webm:1456

Change-Id: Ic9e016cb66d489b829412052273238975dc6f6ab

vp9/encoder/vp9_firstpass.c

index a970f6d97a4b132c805678da133092812b4063f8..3fcb305660428c4d8938116c158f3f459ee89b68 100644 (file)
@@ -2126,7 +2126,7 @@ static int calculate_boost_bits(int frame_count, int boost,
   int allocation_chunks;
 
   // return 0 for invalid inputs (could arise e.g. through rounding errors)
-  if (!boost || (total_group_bits <= 0) || (frame_count <= 0)) return 0;
+  if (!boost || (total_group_bits <= 0) || (frame_count < 0)) return 0;
 
   allocation_chunks = (frame_count * 100) + boost;