Do not skip mode if no valid mode has been found
Sometimes in fast speed settings, we may not find a valid
mode, resulting in the encoder going into an infinite loop.
This patch adds an exit to prevent this hanging behavior.
BUG=aomedia:2243
Change-Id: I85afe2faa3492e5a9cc034d80df9e3837a08df6c
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 96b8763..f9e8284 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -10970,6 +10970,11 @@
const MV_REFERENCE_FRAME *ref_frame = av1_mode_order[mode_index].ref_frame;
const PREDICTION_MODE this_mode = av1_mode_order[mode_index].mode;
int skip_motion_mode = 0;
+ // If no valid mode has been found so far in PARTITION_NONE when finding a
+ // valid partition is required, do not skip mode.
+ if (search_state->best_rd == INT64_MAX && mbmi->partition == PARTITION_NONE &&
+ x->must_find_valid_partition)
+ return 0;
if (mbmi->partition != PARTITION_NONE && mbmi->partition != PARTITION_SPLIT) {
const int ref_type = av1_ref_frame_type(ref_frame);
int skip_ref = ctx->skip_ref_frame_mask & (1 << ref_type);