History

vulkan_h264: fix long-term ref handling

h->long_ref isn't guaranteed to be contiguously filled. Use the approach from both vaapi_h264 and vdpau_h264 which goes through the 16 frames in h->long_ref to find the LTR entries. Fixes MR2_MW_A.264 from JVT-AVC_V1.

Benjamin Cheng committed 3 years ago

Commit 4536de31 parent 1e63e241 file · +8 −3Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/vulkan_h264.c+8−3
@@ -406,10 +406,14 @@ static int vk_h264_start_frame(AVCodecContext *avctx, · 405 unmodified lines
406406 }
407407
408408 /* Fill in long-term refs */
409− for (int r = 0, i = h->short_ref_count; i < h->short_ref_count + h->long_ref_count; i++, r++) {
409+ for (int r = 0, i = h->short_ref_count; r < H264_MAX_DPB_FRAMES &&
410+ i < h->short_ref_count + h->long_ref_count; r++) {
411+ if (!h->long_ref[r])
412+ continue;
413+
410414 dpb_slot_index = 0;
411− for (unsigned slot = 0; slot < H264_MAX_PICTURE_COUNT; slot++) {
412− if (h->long_ref[i] == &h->DPB[slot]) {
415+ for (unsigned slot = 0; slot < 16; slot++) {
416+ if (h->long_ref[r] == &h->DPB[slot]) {
413417 dpb_slot_index = slot;
414418 break;
415419 }
@@ -422,6 +426,7 @@ static int vk_h264_start_frame(AVCodecContext *avctx, · 6 unmodified lines
422426 dpb_slot_index);
423427 if (err < 0)
424428 return err;
429+ i++;
425430 }
426431
427432 hp->h264pic = (StdVideoDecodeH264PictureInfo) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t