Work around bug aomedia:3414
Reformat the code to work around what looks like a Clang optimization
bug for 32-bit x86.
Bug: aomedia:3414
Change-Id: Idc81771385e65f1578a67951329fd1266991a8dd
diff --git a/av1/encoder/encoder_utils.c b/av1/encoder/encoder_utils.c
index b43ef26..bc136b1 100644
--- a/av1/encoder/encoder_utils.c
+++ b/av1/encoder/encoder_utils.c
@@ -973,11 +973,10 @@
// Calculate % of palette mode to be chosen in a frame from mode decision.
const double palette_ratio =
(double)cpi->palette_pixel_num / (double)(cm->height * cm->width);
- const int is_sc_encoding_much_better =
- ((psnr_diff > STRICT_PSNR_DIFF_THRESH) || // psnr_diff is large
- ((palette_ratio < 0.0001) ? 0
- : (psnr_diff / (palette_ratio) >
- 4))); // psnr_diff/palette_ratio is large
+ const int psnr_diff_is_large = (psnr_diff > STRICT_PSNR_DIFF_THRESH);
+ const int ratio_is_large =
+ ((palette_ratio >= 0.0001) && ((psnr_diff / palette_ratio) > 4));
+ const int is_sc_encoding_much_better = (psnr_diff_is_large || ratio_is_large);
if (is_sc_encoding_much_better) {
// Use screen content tools, if we get coding gain.
features->allow_screen_content_tools = 1;