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
406 }406 }
407 407
408 /* Fill in long-term refs */408 /* 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
410 dpb_slot_index = 0;414 dpb_slot_index = 0;
411 for (unsigned slot = 0; slot < H264_MAX_PICTURE_COUNT; slot++) {415 for (unsigned slot = 0; slot < 16; slot++) {
412 if (h->long_ref[i] == &h->DPB[slot]) {416 if (h->long_ref[r] == &h->DPB[slot]) {
413 dpb_slot_index = slot;417 dpb_slot_index = slot;
414 break;418 break;
415 }419 }
@@ -422,6 +426,7 @@ static int vk_h264_start_frame(AVCodecContext *avctx, · 6 unmodified lines
422 dpb_slot_index);426 dpb_slot_index);
423 if (err < 0)427 if (err < 0)
424 return err;428 return err;
429 i++;
425 }430 }
426 431
427 hp->h264pic = (StdVideoDecodeH264PictureInfo) {432 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