diff mbox series

[FFmpeg-devel,v2,2/2] avcodec/vaapi_encode_h265: use is_reference to fill reference_pic_flag

Message ID 20240305075740.1866-2-tong1.wu@intel.com
State New
Headers show
Series [FFmpeg-devel,v2,1/2] avcodec/vaapi_encode_h264: use is_reference to fill reference_pic_flag | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Wu, Tong1 March 5, 2024, 7:57 a.m. UTC
From: Tong Wu <tong1.wu@intel.com>

This codec supports FLAG_B_PICTURE_REFERENCES. We need to fill
reference_pic_flag with pic->is_reference.

Signed-off-by: Tong Wu <tong1.wu@intel.com>
---
 libavcodec/vaapi_encode_h265.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index c4aabbf5ed..bbd5e7d872 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -764,6 +764,7 @@  static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
     VAAPIEncodePicture              *prev = pic->prev;
     VAAPIEncodeH265Picture         *hprev = prev ? prev->priv_data : NULL;
     VAEncPictureParameterBufferHEVC *vpic = pic->codec_picture_params;
+    int is_ref = pic->is_reference;
     int i, j = 0;
 
     if (pic->type == PICTURE_TYPE_IDR) {
@@ -949,22 +950,22 @@  static int vaapi_encode_h265_init_picture_params(AVCodecContext *avctx,
     case PICTURE_TYPE_IDR:
         vpic->pic_fields.bits.idr_pic_flag       = 1;
         vpic->pic_fields.bits.coding_type        = 1;
-        vpic->pic_fields.bits.reference_pic_flag = 1;
+        vpic->pic_fields.bits.reference_pic_flag = is_ref;
         break;
     case PICTURE_TYPE_I:
         vpic->pic_fields.bits.idr_pic_flag       = 0;
         vpic->pic_fields.bits.coding_type        = 1;
-        vpic->pic_fields.bits.reference_pic_flag = 1;
+        vpic->pic_fields.bits.reference_pic_flag = is_ref;
         break;
     case PICTURE_TYPE_P:
         vpic->pic_fields.bits.idr_pic_flag       = 0;
         vpic->pic_fields.bits.coding_type        = 2;
-        vpic->pic_fields.bits.reference_pic_flag = 1;
+        vpic->pic_fields.bits.reference_pic_flag = is_ref;
         break;
     case PICTURE_TYPE_B:
         vpic->pic_fields.bits.idr_pic_flag       = 0;
         vpic->pic_fields.bits.coding_type        = 3;
-        vpic->pic_fields.bits.reference_pic_flag = 0;
+        vpic->pic_fields.bits.reference_pic_flag = is_ref;
         break;
     default:
         av_assert0(0 && "invalid picture type");