allow_warp: rectify mismatch between spec and code As per the spec, we must compare the scales at higher precision in this function to check if there is a rescale. So, we use the av1_is_scaled() function that looks at the fixed point scales. BUG=aomedia:2191 Change-Id: I9276dc6f54fe01deb98549ac4ebcc25fae462cf2
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c index 21d3534..f6e5b11 100644 --- a/av1/common/reconinter.c +++ b/av1/common/reconinter.c
@@ -35,10 +35,12 @@ int av1_allow_warp(const MB_MODE_INFO *const mbmi, const WarpTypesAllowed *const warp_types, const WarpedMotionParams *const gm_params, - int build_for_obmc, int x_scale, int y_scale, + int build_for_obmc, const struct scale_factors *const sf, WarpedMotionParams *final_warp_params) { - if (x_scale != SCALE_SUBPEL_SHIFTS || y_scale != SCALE_SUBPEL_SHIFTS) - return 0; + // Note: As per the spec, we must test the fixed point scales here, which are + // at a higher precision (1 << 14) than the xs and ys in subpel_params (that + // have 1 << 10 precision). + if (av1_is_scaled(sf)) return 0; if (final_warp_params != NULL) *final_warp_params = default_warp_params; @@ -75,8 +77,7 @@ const int do_warp = (w >= 8 && h >= 8 && av1_allow_warp(mi, warp_types, &xd->global_motion[mi->ref_frame[ref]], - build_for_obmc, subpel_params->xs, subpel_params->ys, - &final_warp_params)); + build_for_obmc, sf, &final_warp_params)); const int is_intrabc = mi->use_intrabc; assert(IMPLIES(is_intrabc, !do_warp));
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h index db86c77..b98b0ca 100644 --- a/av1/common/reconinter.h +++ b/av1/common/reconinter.h
@@ -355,7 +355,7 @@ int av1_allow_warp(const MB_MODE_INFO *const mbmi, const WarpTypesAllowed *const warp_types, const WarpedMotionParams *const gm_params, - int build_for_obmc, int x_scale, int y_scale, + int build_for_obmc, const struct scale_factors *const sf, WarpedMotionParams *final_warp_params); #ifdef __cplusplus
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index ae32a0b..f4aa4a3 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -789,8 +789,7 @@ int do_warp = (bw >= 8 && bh >= 8 && av1_allow_warp(mi, &warp_types, &xd->global_motion[mi->ref_frame[ref]], - build_for_obmc, subpel_params[ref].xs, - subpel_params[ref].ys, NULL)); + build_for_obmc, sf, NULL)); do_warp = (do_warp && xd->cur_frame_force_integer_mv == 0); extend_mc_border(sf, pre_buf, scaled_mv, block, subpel_x_mv, subpel_y_mv,