Mark error-resilient switch frames as restricted#5094
Merged
Conversation
b4ca164 to
89e0550
Compare
urvangjoshi
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the encoder is run in error-resilient mode (
--global-error-resilient=1), switch frames are emitted without their reference frames being marked as restricted. This produces a bitstream that is not AV2-compliant and that decoders reject.This MR sets
restricted_prediction_switchfor error-resilient switch frames as well, so switch frames generated in that mode carry the correct restricted-reference semantics.In error-resilient mode (
--global-error-resilient=1), the current AVM encoder converts alt-ref–type frames (which are reordered/future frames) into switch frames. When such a switch is left unconstrained (non-restricted), the encoder can assign it a low display order hint (e.g. 1) while a frame with a higher display order hint (e.g. 4) has already been output, producing a non-monotonic output order. Because a non-restricted switch does not reset the OrderHint counter, this violates the conformance constraint below (AV2 spec §7.3.6, "Coded extended layer unit"):If monotonic_output_order_flag is equal to 0, it is a requirement of bitstream conformance that within a coded video sequence, for a given value of obu_xlayer_id and obu_mlayer_id, if a coded output frame unit X has an associated OrderHint value equal to ohX, there shall not be a coded output frame unit Y in the same extended layer and embedded layer that appears later than X in output order and has an associated OrderHint value less than or equal to ohX, unless a switch frame with restricted_prediction_switch equal to 1 appears between X and Y in coding order.NOTE: The value of OrderHint is reset at the start of a new coded video sequence and at a switch frame with restricted_prediction_switch equal to 1. In both cases, the OrderHint counter is effectively restarted, allowing OrderHint values to be reused in subsequent coded output frame units.