Patch relating to Issue 1456.

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
This commit is contained in:
paulwilkins
2017-08-08 12:01:46 +01:00
parent 6843e7c7f3
commit db8fa86a6c

View 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;