summaryrefslogtreecommitdiff
path: root/libavcodec/vaapi_encode_h265.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-02-21 21:52:20 +0000
committerMark Thompson <sw@jkqxz.net>2018-02-21 21:52:20 +0000
commitf082dcab7cdf94b6268917a6dc472d594d7538f0 (patch)
treea613fa3618fbc0e2bd105f980c67281da631d872 /libavcodec/vaapi_encode_h265.c
parent9e3e9a37289c1a9cdfdb6c7389a3ece3cfa4749c (diff)
parent67eb2b16daa77f6ba3e04a28ca18e53193723b7f (diff)
Merge commit '67eb2b16daa77f6ba3e04a28ca18e53193723b7f'
* commit '67eb2b16daa77f6ba3e04a28ca18e53193723b7f': vaapi_h265: Mark unused entries in RefPicList[01] as explicitly invalid Merged-by: Mark Thompson <sw@jkqxz.net>
Diffstat (limited to 'libavcodec/vaapi_encode_h265.c')
-rw-r--r--libavcodec/vaapi_encode_h265.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index f3b4f6c7e2..5841ff7fbc 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -767,8 +767,6 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx,
.num_ref_idx_l0_active_minus1 = sh->num_ref_idx_l0_active_minus1,
.num_ref_idx_l1_active_minus1 = sh->num_ref_idx_l1_active_minus1,
- .ref_pic_list0[0] = vpic->reference_frames[0],
- .ref_pic_list1[0] = vpic->reference_frames[1],
.luma_log2_weight_denom = sh->luma_log2_weight_denom,
.delta_chroma_log2_weight_denom = sh->delta_chroma_log2_weight_denom,
@@ -802,6 +800,25 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx,
},
};
+ for (i = 0; i < FF_ARRAY_ELEMS(vslice->ref_pic_list0); i++) {
+ vslice->ref_pic_list0[i].picture_id = VA_INVALID_ID;
+ vslice->ref_pic_list0[i].flags = VA_PICTURE_HEVC_INVALID;
+ vslice->ref_pic_list1[i].picture_id = VA_INVALID_ID;
+ vslice->ref_pic_list1[i].flags = VA_PICTURE_HEVC_INVALID;
+ }
+
+ av_assert0(pic->nb_refs <= 2);
+ if (pic->nb_refs >= 1) {
+ // Backward reference for P- or B-frame.
+ av_assert0(pic->type == PICTURE_TYPE_P ||
+ pic->type == PICTURE_TYPE_B);
+ vslice->ref_pic_list0[0] = vpic->reference_frames[0];
+ }
+ if (pic->nb_refs >= 2) {
+ // Forward reference for B-frame.
+ av_assert0(pic->type == PICTURE_TYPE_B);
+ vslice->ref_pic_list1[0] = vpic->reference_frames[1];
+ }
return 0;
}