Skip to content

decoder: Clear sequence display extension flag on each sequence header - #43

Merged
harishdm merged 1 commit into
ittiam-systems:mainfrom
GeekQAQ:seq-hdr-disp-ext
Nov 23, 2026
Merged

harishdm merged 1 commit into
ittiam-systems:mainfrom
GeekQAQ:seq-hdr-disp-ext

Conversation

@GeekQAQ

@GeekQAQ GeekQAQ commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Decode one stream in which the first sequence has a sequence display extension and a later sequence (same picture size, so no IVD_RES_CHANGED and no reset) has none, then call IMPEG2D_CMD_CTL_GET_SEQ_INFO. It should report the unspecified values for the later sequence, as a new decoder does for that sequence alone (video format 5, colour primaries / transfer / matrix 2, display size = coded size). It still reports the earlier sequence's values: matrix_coefficients 1 (BT.709) instead of 2.

This is a follow-up to #37. That change clears u1_seq_disp_extn_present in impeg2d_api_reset(), which covers a new stream after a reset, but the flag is still kept across sequence headers within a stream. This change clears it at the start of impeg2d_dec_seq_hdr(); the extension that follows each sequence header sets it again, so streams that repeat the extension with every sequence header report the same values as before. The clear in the reset is kept as it is.

Tested on main (7c88238) with clang and AddressSanitizer: with the reproducer in this gist (https://gist.github.com/GeekQAQ/ab723979677865d84838fff898e2a7f0), GET_SEQ_INFO after the first sequence still reports matrix_coefficients 1, and after the second sequence it now reports 2, the same as a new decoder (it was 1 before). The reset case from #37 still reports the same values as a new decoder. The default CMake build (Release, gcc and clang) has no new warnings, and mpeg2dec gives byte-identical output before and after the change on 11 short test streams (including the two-sequence one; one of them is rejected as too small both before and after) with 1 core, and on 10 of them with 4 cores. The remaining stream starts with a B picture, and its 4-core output already varies from run to run on main, so it is not compared.

Copilot AI balanced review requested due to automatic review settings November 22, 2026 09:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

u1_seq_disp_extn_present is set when a sequence display extension is
parsed and was cleared only at init and on reset. If a stream has a
second sequence header that is not followed by a sequence display
extension, IMPEG2D_CMD_CTL_GET_SEQ_INFO kept returning the video
format, colour description and display size of the earlier sequence
instead of the unspecified values.

Clear the flag when a sequence header is parsed, so it only reflects
an extension that follows the current sequence header.
@harishdm
harishdm merged commit 57a679f into ittiam-systems:main Nov 23, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants