Commit 13bcfa0ea8 for aom
commit 13bcfa0ea8556f355b7bfa9158a473a1723c442b
Author: Wan-Teh Chang <wtc@google.com>
Date: Fri Oct 23 11:46:54 2026 -0700
Better modulo counter cm->frame_presentation_time
pts64 % modulus is negative when pts64 is negative. Although pts64 may
never be negative, it is better to avoid this issue by switching to the
expression pts64 & (modulus - 1). This works because modulus is a power
of 2.
Bug: b:444969593
Change-Id: I9b8b3a677d593c3b0bfc692795f598d06592eac8
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index 8889d7bb84..26ba6f2bef 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -1519,8 +1519,8 @@ int av1_encode_strategy(AV1_COMP *const cpi, size_t *const size,
ticks_to_timebase_units(timestamp_ratio, *time_stamp);
const int frame_presentation_time_length =
cm->seq_params->decoder_model_info.frame_presentation_time_length;
- const int64_t modulus = 1LL << frame_presentation_time_length;
- cm->frame_presentation_time = (uint32_t)(pts64 % modulus);
+ const int64_t pts_mask = (1LL << frame_presentation_time_length) - 1LL;
+ cm->frame_presentation_time = (uint32_t)(pts64 & pts_mask);
}
}