Skip to content

Engage the dynamic-slicing slice-count cap that was never set - #4038

Open
ManoharPaturi wants to merge 1 commit into
cisco:masterfrom
ManoharPaturi:fix-dynamic-slicing-cap
Open

ManoharPaturi wants to merge 1 commit into
cisco:masterfrom
ManoharPaturi:fix-dynamic-slicing-cap

Conversation

@ManoharPaturi

Copy link
Copy Markdown

Problem

SSlice::bDynamicSlicingSliceSizeCtrlFlag is read in three places — DynSlcJudgeSliceBoundaryStepBack returns early when set (svc_encode_slice.cpp:1759), and the QP paths at :634 and :1946 force the max QP under size control — but an exhaustive search shows it is never assigned anywhere in the tree. The in-code comments around AddSliceBoundary ("tmp choice to avoid complex memory operation", "TODO: iSliceNumInFrame should match max slice num limitation") confirm the cap was intended and abandoned.

Consequence: the slice-count cap can never engage. Demonstrated against current master: a 4K encode with uiSliceSizeConstraint=401 and noisy input produces 1802 NALs in a single frame versus MAX_SLICES_NUM (38) and MAX_NAL_UNITS_IN_LAYER (128); growth is bounded only by per-frame buffer reallocation.

Fix

Set the flag when pSliceCtx->iSliceNumInFrame reaches iMaxSliceNumConstraint after a slice is added — engaging the three existing consumers of the flag.

Verification

Branch compiles clean; a regression test can assert iNalCount <= MAX_NAL_UNITS_IN_LAYER for a size-limited slice configuration (fails on master).

Copilot AI balanced review requested due to automatic review settings September 29, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 reached their quota limit.

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.

2 participants