Fix global motion + supertx
Previously, any uses of global motion inside supertx blocks were not
counted correctly. This caused encode/decode mismatches when every use
of global motion in a frame occurred inside supertx blocks.
This happened in, for example, AV1/ActiveMapTest.Test/0
This patch makes update_state_supertx count global motion usages in
the same way update_state does, and fixes the above problem.
Change-Id: Id500d5a24c565774fa3aa3b52cd3fdbeab75b486
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index ab1a1c9..7f6acb3 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1320,6 +1320,27 @@
if (!frame_is_intra_only(cm)) {
av1_update_mv_count(td);
+#if CONFIG_GLOBAL_MOTION
+ if (is_inter_block(mbmi)) {
+ if (bsize >= BLOCK_8X8) {
+ // TODO(sarahparker): global motion stats need to be handled per-tile
+ // to be compatible with tile-based threading.
+ update_global_motion_used(mbmi->mode, mbmi, (AV1_COMP *)cpi);
+ } else {
+ const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize];
+ const int num_4x4_h = num_4x4_blocks_high_lookup[bsize];
+ int idx, idy;
+ for (idy = 0; idy < 2; idy += num_4x4_h) {
+ for (idx = 0; idx < 2; idx += num_4x4_w) {
+ const int j = idy * 2 + idx;
+ update_global_motion_used(mi->bmi[j].as_mode, mbmi,
+ (AV1_COMP *)cpi);
+ }
+ }
+ }
+ }
+#endif // CONFIG_GLOBAL_MOTION
+
if (cm->interp_filter == SWITCHABLE
#if CONFIG_EXT_INTERP
&& av1_is_interp_needed(xd)