[FFmpeg-cvslog] lavc/vaapi_decode: Make it possible to send multiple slice params buffers

David Rosca git at videolan.org
Mon Aug 5 04:47:36 EEST 2024


ffmpeg | branch: release/7.0 | David Rosca <nowrep at gmail.com> | Wed May  8 09:11:11 2024 +0200| [345855af80abdb0638841697cf3e0364a80f191a] | committer: Haihao Xiang

lavc/vaapi_decode: Make it possible to send multiple slice params buffers

Reviewed-by: Neal Gompa <ngompa13 at gmail.com>
Signed-off-by: David Rosca <nowrep at gmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>
(cherry picked from commit fe9d889dcd79ea18d4dfaa39df4ddbd4c8c3b15c)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=345855af80abdb0638841697cf3e0364a80f191a
---

 libavcodec/vaapi_av1.c    | 2 +-
 libavcodec/vaapi_decode.c | 3 ++-
 libavcodec/vaapi_decode.h | 1 +
 libavcodec/vaapi_h264.c   | 2 +-
 libavcodec/vaapi_hevc.c   | 4 ++--
 libavcodec/vaapi_mjpeg.c  | 2 +-
 libavcodec/vaapi_mpeg2.c  | 2 +-
 libavcodec/vaapi_mpeg4.c  | 2 +-
 libavcodec/vaapi_vc1.c    | 2 +-
 libavcodec/vaapi_vp8.c    | 2 +-
 libavcodec/vaapi_vp9.c    | 2 +-
 11 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
index 5bf81fc97f..281cde27bc 100644
--- a/libavcodec/vaapi_av1.c
+++ b/libavcodec/vaapi_av1.c
@@ -409,7 +409,7 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
             .tg_end            = s->tg_end,
         };
 
-        err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param,
+        err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1,
                                                 sizeof(VASliceParameterBufferAV1),
                                                 buffer,
                                                 size);
diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index cca94b5336..cd11093fea 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -62,6 +62,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
 int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
                                       VAAPIDecodePicture *pic,
                                       const void *params_data,
+                                      int nb_params,
                                       size_t params_size,
                                       const void *slice_data,
                                       size_t slice_size)
@@ -87,7 +88,7 @@ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
 
     vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
                          VASliceParameterBufferType,
-                         params_size, 1, (void*)params_data,
+                         params_size, nb_params, (void*)params_data,
                          &pic->slice_buffers[index]);
     if (vas != VA_STATUS_SUCCESS) {
         av_log(avctx, AV_LOG_ERROR, "Failed to create slice "
diff --git a/libavcodec/vaapi_decode.h b/libavcodec/vaapi_decode.h
index 6beda14e52..702171e108 100644
--- a/libavcodec/vaapi_decode.h
+++ b/libavcodec/vaapi_decode.h
@@ -73,6 +73,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
 int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
                                       VAAPIDecodePicture *pic,
                                       const void *params_data,
+                                      int nb_params,
                                       size_t params_size,
                                       const void *slice_data,
                                       size_t slice_size);
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index 55cf5a05ee..b47531ce1c 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -375,7 +375,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx,
                                        slice_param.chroma_offset_l1);
 
     err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
-                                            &slice_param, sizeof(slice_param),
+                                            &slice_param, 1, sizeof(slice_param),
                                             buffer, size);
     if (err) {
         ff_vaapi_decode_cancel(avctx, pic);
diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
index 3bdd2dd1b8..3937b7574a 100644
--- a/libavcodec/vaapi_hevc.c
+++ b/libavcodec/vaapi_hevc.c
@@ -353,7 +353,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx)
     if (pic->last_size) {
         last_slice_param->LongSliceFlags.fields.LastSliceOfPic = 1;
         ret = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic,
-                                                &pic->last_slice_param, slice_param_size,
+                                                &pic->last_slice_param, 1, slice_param_size,
                                                 pic->last_buffer, pic->last_size);
         if (ret < 0)
             goto fail;
@@ -471,7 +471,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
 
     if (!sh->first_slice_in_pic_flag) {
         err = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic,
-                                                &pic->last_slice_param, slice_param_size,
+                                                &pic->last_slice_param, 1, slice_param_size,
                                                 pic->last_buffer, pic->last_size);
         pic->last_buffer = NULL;
         pic->last_size   = 0;
diff --git a/libavcodec/vaapi_mjpeg.c b/libavcodec/vaapi_mjpeg.c
index 5b8d47bb2a..9557cf5f9b 100644
--- a/libavcodec/vaapi_mjpeg.c
+++ b/libavcodec/vaapi_mjpeg.c
@@ -131,7 +131,7 @@ static int vaapi_mjpeg_decode_slice(AVCodecContext *avctx,
         sp.components[i].ac_table_selector  = s->ac_index[i];
     }
 
-    err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), buffer, size);
+    err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), buffer, size);
     if (err)
         goto fail;
 
diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index eeb4e87321..171a742c7f 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -162,7 +162,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
     };
 
     err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
-                                            &slice_param, sizeof(slice_param),
+                                            &slice_param, 1, sizeof(slice_param),
                                             buffer, size);
     if (err < 0) {
         ff_vaapi_decode_cancel(avctx, pic);
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
index 363b686e42..612de10cd7 100644
--- a/libavcodec/vaapi_mpeg4.c
+++ b/libavcodec/vaapi_mpeg4.c
@@ -169,7 +169,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
     };
 
     err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
-                                            &slice_param, sizeof(slice_param),
+                                            &slice_param, 1, sizeof(slice_param),
                                             buffer, size);
     if (err < 0) {
         ff_vaapi_decode_cancel(avctx, pic);
diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index 09a5c852fc..0339ccc043 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -489,7 +489,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
     };
 
     err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
-                                            &slice_param, sizeof(slice_param),
+                                            &slice_param, 1, sizeof(slice_param),
                                             buffer, size);
     if (err < 0) {
         ff_vaapi_decode_cancel(avctx, pic);
diff --git a/libavcodec/vaapi_vp8.c b/libavcodec/vaapi_vp8.c
index 31137a45bd..66fdde1f39 100644
--- a/libavcodec/vaapi_vp8.c
+++ b/libavcodec/vaapi_vp8.c
@@ -209,7 +209,7 @@ static int vaapi_vp8_decode_slice(AVCodecContext *avctx,
     for (i = 0; i < 8; i++)
         sp.partition_size[i+1] = s->coeff_partition_size[i];
 
-    err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), data, data_size);
+    err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), data, data_size);
     if (err)
         goto fail;
 
diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c
index 9dc7d5e72b..ff11022db7 100644
--- a/libavcodec/vaapi_vp9.c
+++ b/libavcodec/vaapi_vp9.c
@@ -158,7 +158,7 @@ static int vaapi_vp9_decode_slice(AVCodecContext *avctx,
     }
 
     err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
-                                            &slice_param, sizeof(slice_param),
+                                            &slice_param, 1, sizeof(slice_param),
                                             buffer, size);
     if (err) {
         ff_vaapi_decode_cancel(avctx, pic);



More information about the ffmpeg-cvslog mailing list