shithub: libvpx

Download patch

ref: a1fdfbb174487e5efb76e6e77119d2e50840086e
parent: 338013712e516d07388651437918e6328ea909f5
author: Angie Chiang <angiebird@google.com>
date: Fri Jun 18 12:09:41 EDT 2021

Fix flaky assertions in SimpleEncode

Bug: webm:1731

Change-Id: Ieecb98a7ac19e6291acd5d51432dc6a3789e9552

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -3836,7 +3836,7 @@
   if (gop_command->use) {
     *coding_frame_count = gop_command_coding_frame_count(gop_command);
     *use_alt_ref = gop_command->use_alt_ref;
-    assert(*coding_frame_count < rc.frames_to_key);
+    assert(gop_command->show_frame_count <= rc.frames_to_key);
   } else {
     *coding_frame_count = vp9_get_gop_coding_frame_count(
         &cpi->oxcf, &cpi->twopass, &cpi->frame_info, &rc, *first_show_idx,
--- a/vp9/simple_encode.cc
+++ b/vp9/simple_encode.cc
@@ -1009,8 +1009,7 @@
 static GOP_COMMAND GetGopCommand(const std::vector<int> &gop_map,
                                  int start_show_index) {
   GOP_COMMAND gop_command;
-  if (gop_map.size() > 0) {
-    assert(static_cast<size_t>(start_show_index) < gop_map.size());
+  if (static_cast<size_t>(start_show_index) < gop_map.size()) {
     assert((gop_map[start_show_index] & kGopMapFlagStart) != 0);
     int end_show_index = start_show_index + 1;
     // gop_map[end_show_index] & kGopMapFlagStart == 0 means this is