Use ROUND_POWER_OF_TWO() in av1_optimize_txb()
Bug: aomedia:375221136
Change-Id: I7c01a2267d5c62347796f817e065258f7ba50ad4
diff --git a/av1/encoder/txb_rdopt.c b/av1/encoder/txb_rdopt.c
index 68e3c3c..9c77012 100644
--- a/av1/encoder/txb_rdopt.c
+++ b/av1/encoder/txb_rdopt.c
@@ -12,6 +12,7 @@
#include "av1/encoder/txb_rdopt.h"
#include "av1/encoder/txb_rdopt_utils.h"
+#include "aom_ports/mem.h"
#include "av1/common/idct.h"
static inline void update_coeff_general(
@@ -342,13 +343,11 @@
// features (like repeating patterns and camera noise/film grain), which
// improves SSIMULACRA 2 scores.
const int rshift = cpi->oxcf.tune_cfg.tuning == AOM_TUNE_SSIMULACRA2 ? 4 : 2;
- const int rounding = (1 << rshift) >> 1;
- const int64_t rdmult =
- (((int64_t)x->rdmult *
- (plane_rd_mult[is_inter][plane_type] << (2 * (xd->bd - 8)))) +
- rounding) >>
- rshift;
+ const int64_t rdmult = ROUND_POWER_OF_TWO(
+ (int64_t)x->rdmult *
+ (plane_rd_mult[is_inter][plane_type] << (2 * (xd->bd - 8))),
+ rshift);
uint8_t levels_buf[TX_PAD_2D];
uint8_t *const levels = set_levels(levels_buf, height);