Commit 44121a2955 for aom
commit 44121a2955e80dd72acf18f75b95b886afa23da6
Author: Wan-Teh Chang <wtc@google.com>
Date: Mon May 11 13:36:09 2026 -0700
Clean up AOM_EFLAG_FREEZE_INTERNAL_STATE
Document that AOM_EFLAG_FREEZE_INTERNAL_STATE requires g_lag_in_frames
to be zero.
Set ppi->b_freeze_internal_state after validating that
AOM_EFLAG_FREEZE_INTERNAL_STATE is set with a zero g_lag_in_frames.
Ensure ppi->b_freeze_internal_state is set to 1 (rather than just a
nonzero value) when AOM_EFLAG_FREEZE_INTERNAL_STATE is set.
Change-Id: I401b96238aa7de436702eabc5a3072b35186cfa9
diff --git a/aom/aom_encoder.h b/aom/aom_encoder.h
index fa5117a3e9..7c7579c1ff 100644
--- a/aom/aom_encoder.h
+++ b/aom/aom_encoder.h
@@ -380,7 +380,7 @@ typedef long aom_enc_frame_flags_t;
/*!\brief Calculate PSNR for this frame, requires g_lag_in_frames to be 0 */
#define AOM_EFLAG_CALCULATE_PSNR (1 << 1)
/*!\brief Freeze internal state, do not update reference buffers, entropy
- * tables, rate control state, etc. */
+ * tables, rate control state, etc. Requires g_lag_in_frames to be 0. */
#define AOM_EFLAG_FREEZE_INTERNAL_STATE (1 << 2)
/*!\brief Encoder configuration structure
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 324cecb906..e33e73dddd 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -3366,8 +3366,6 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
if (ppi->use_svc && ppi->cpi->svc.use_flexible_mode == 0 && flags == 0)
av1_set_svc_fixed_mode(ppi->cpi);
- ppi->b_freeze_internal_state = flags & AOM_EFLAG_FREEZE_INTERNAL_STATE;
-
// Note(yunqing): While applying encoding flags, always start from enabling
// all, and then modifying according to the flags. Previous frame's flags are
// overwritten.
@@ -3424,6 +3422,9 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
(flags & AOM_EFLAG_CALCULATE_PSNR);
#endif // CONFIG_INTERNAL_STATS
+ ppi->b_freeze_internal_state =
+ (flags & AOM_EFLAG_FREEZE_INTERNAL_STATE) != 0;
+
if (img != NULL) {
if (!ctx->pts_offset_initialized) {
ctx->pts_offset = ptsvol;