Commit 8f12654451 for aom
commit 8f126544519961bb3d5afe83455f4caf5d312d05
Author: Wan-Teh Chang <wtc@google.com>
Date: Wed Oct 21 12:35:39 2026 -0700
Set cm->frame_presentation_time as modulo counter
Set cm->frame_presentation_time as a module counter according to the AV1
specification. Section 6.8.24. Temporal point info semantics says:
The syntax element is signaled as a fixed length unsigned integer with
a length in bits given by frame_presentation_time_length_minus_1 + 1.
The frame_presentation_time is the remainder of a modulo
1 << (frame_presentation_time_length_minus_1 + 1) counter.
Bug: b:444969593
Change-Id: Iee4784f135236732194664998b72c11b391e3a06
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index da273dd8bc..8889d7bb84 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -1517,9 +1517,10 @@ int av1_encode_strategy(AV1_COMP *const cpi, size_t *const size,
// only one operating point supported now
const int64_t pts64 =
ticks_to_timebase_units(timestamp_ratio, *time_stamp);
- if (pts64 < 0 || pts64 > UINT32_MAX) return AOM_CODEC_ERROR;
-
- cm->frame_presentation_time = (uint32_t)pts64;
+ 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);
}
}