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.
Unified · Split
| @@ -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) { |