Fix segmentation fault when encoding all keyframes (kf-max-dist=0).
The issue was that:
- We call av1_setup_pre_planes() when this is not an intra-only frame,
but,
- But, we do motion vector search for any frame other than first frame
Doing both of these only when this is not an intra-only frames makes
logical sense and fixes the crash too.
This also avoids doing motion search for intra-only frames in the first
pass.
Verified that there is no change in compression performance for video,
as well as when forcing all keyframes.
BUG=aomedia:133
Change-Id: I7b18c0568eaa29c6c97f31f226243e5a9dbaecf1
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 32f1c5d..28eaf94 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -720,8 +720,7 @@
x->mv_col_min = -((mb_col * 16) + BORDER_MV_PIXELS_B16);
x->mv_col_max = ((cm->mb_cols - 1 - mb_col) * 16) + BORDER_MV_PIXELS_B16;
- // Other than for the first frame do a motion search.
- if (cm->current_video_frame > 0) {
+ if (!frame_is_intra_only(cm)) { // Do a motion search
int tmp_err, motion_error, raw_motion_error;
// Assume 0,0 motion with no mv overhead.
MV mv = { 0, 0 }, tmp_mv = { 0, 0 };