Remove common subexpr in aom_flat_block_finder_run Eliminate the common subexpression block[yi * block_size + xi] in the code that calculates `mean` and `var` in aom_flat_block_finder_run(). This works around what looks like a MSVC 2022 compiler optimization bug. Bug: aomedia:3365 Change-Id: I2492eea7a149128bd641433b29ddf9a38b3bf2d4 (cherry picked from commit 002e191faa88da2f224a357e66dd8b81e4986d6b)
diff --git a/aom_dsp/noise_model.c b/aom_dsp/noise_model.c index 70fdb7b..ed45087 100644 --- a/aom_dsp/noise_model.c +++ b/aom_dsp/noise_model.c
@@ -610,8 +610,9 @@ Gxy += gx * gy; Gyy += gy * gy; - mean += block[yi * block_size + xi]; - var += block[yi * block_size + xi] * block[yi * block_size + xi]; + const double value = block[yi * block_size + xi]; + mean += value; + var += value * value; } } mean /= (block_size - 2) * (block_size - 2);