Skip to content

upipe_h265f: declare one access unit of latency, consistently - #1248

Open
kierank wants to merge 1 commit into
Upipe:masterfrom
kierank:h265f-latency
Open

upipe_h265f: declare one access unit of latency, consistently#1248
kierank wants to merge 1 commit into
Upipe:masterfrom
kierank:h265f-latency

Conversation

@kierank

@kierank kierank commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

The framer's latency was declared differently at its two flow-def sites: the SPS-parse path declared duration*2 while the store_flow_def path declared duration - half a frame on progressive content, and that is the value a decoder downstream actually sees. Measured at the avcdec input on a 1080p59.94 stream: 0.5 frames.

The framer's real latency is one ACCESS UNIT - it cannot output a picture until the next AU begins - i.e. one coded picture: a frame when progressive, a field under field_seq_flag. Introduce au_duration holding exactly that and declare input_latency + au_duration at both sites.

Also fix the duration derivation it exposed: duration is kept in FIELD units for the pic_struct arithmetic in prepare_au, but the VUI clock tick is one coded picture - a field when field_seq_flag, a frame otherwise, unlike H.264 where it is always a field - so only the progressive case must halve. The previous unconditional halving made field-sequential durations half a field (and their pic_struct products wrong by 2x throughout).

The framer's latency was declared differently at its two flow-def
sites: the SPS-parse path declared duration*2 while the
store_flow_def path declared duration - half a frame on progressive
content, and that is the value a decoder downstream actually sees.
Measured at the avcdec input on a 1080p59.94 stream: 0.5 frames.

The framer's real latency is one ACCESS UNIT - it cannot output a
picture until the next AU begins - i.e. one coded picture: a frame
when progressive, a field under field_seq_flag. Introduce au_duration
holding exactly that and declare input_latency + au_duration at both
sites.

Also fix the duration derivation it exposed: duration is kept in
FIELD units for the pic_struct arithmetic in prepare_au, but the VUI
clock tick is one coded picture - a field when field_seq_flag, a
frame otherwise, unlike H.264 where it is always a field - so only
the progressive case must halve. The previous unconditional halving
made field-sequential durations half a field (and their pic_struct
products wrong by 2x throughout).
@kierank
kierank marked this pull request as ready for review September 4, 2026 15:58
@cmassiot
cmassiot requested a review from nto September 10, 2026 06:37
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.

1 participant