Skip to content

Commit 9180cf1

Browse files
committed
VulkanVideoParser: preserve DPB slots for key frames with partial refresh
For AV1 key frames with show_frame=0 and refresh_frame_flags != 0xFF, preserve DPB slots that are not being refreshed. This allows subsequent inter frames to correctly reference existing decoded pictures that were not overwritten by the hidden key frame. Previously, all DPB slots could be invalidated on key frames, breaking references for inter frames following a key frame with partial refresh flags and show_frame=0.
1 parent 9d588d9 commit 9180cf1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

vk_video_decoder/libs/VkVideoParser/VulkanVideoParser.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,6 +1848,23 @@ uint32_t VulkanVideoParser::FillDpbAV1State(
18481848
printf("\n");
18491849
}
18501850

1851+
// For key frames with show_frame=0 and refresh_frame_flags!=0xFF,
1852+
// DPB slots not specified in the flags should remain valid so subsequent inter frames can reference them.
1853+
if (isKeyFrame && !pin->showFrame && pin->std_info.refresh_frame_flags != 0xFF) {
1854+
uint8_t preserveMask = ~pin->std_info.refresh_frame_flags;
1855+
for (uint32_t inIdx = 0; inIdx < STD_VIDEO_AV1_NUM_REF_FRAMES; inIdx++) {
1856+
if (preserveMask & (1 << inIdx)) {
1857+
int8_t picIdx = pin->pic_idx[inIdx];
1858+
if (picIdx >= 0) {
1859+
refDpbUsedAndValidMask |= (1 << picIdx);
1860+
if (m_dumpDpbData) {
1861+
printf("Preserving DPB slot %d for picIdx %d\n", inIdx, picIdx);
1862+
}
1863+
}
1864+
}
1865+
}
1866+
}
1867+
18511868
ResetPicDpbSlots(refDpbUsedAndValidMask);
18521869

18531870
// Take into account the reference picture now.

0 commit comments

Comments
 (0)