1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

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

Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Signed-off-by: David Rosca <nowrep@gmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
(cherry picked from commit fe9d889dcd79ea18d4dfaa39df4ddbd4c8c3b15c)
This commit is contained in:
David Rosca 2024-05-08 09:11:11 +02:00 committed by Haihao Xiang
parent 714635937a
commit 345855af80
11 changed files with 13 additions and 11 deletions

View File

@ -409,7 +409,7 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
.tg_end = s->tg_end, .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), sizeof(VASliceParameterBufferAV1),
buffer, buffer,
size); size);

View File

@ -62,6 +62,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
VAAPIDecodePicture *pic, VAAPIDecodePicture *pic,
const void *params_data, const void *params_data,
int nb_params,
size_t params_size, size_t params_size,
const void *slice_data, const void *slice_data,
size_t slice_size) 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, vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
VASliceParameterBufferType, VASliceParameterBufferType,
params_size, 1, (void*)params_data, params_size, nb_params, (void*)params_data,
&pic->slice_buffers[index]); &pic->slice_buffers[index]);
if (vas != VA_STATUS_SUCCESS) { if (vas != VA_STATUS_SUCCESS) {
av_log(avctx, AV_LOG_ERROR, "Failed to create slice " av_log(avctx, AV_LOG_ERROR, "Failed to create slice "

View File

@ -73,6 +73,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
VAAPIDecodePicture *pic, VAAPIDecodePicture *pic,
const void *params_data, const void *params_data,
int nb_params,
size_t params_size, size_t params_size,
const void *slice_data, const void *slice_data,
size_t slice_size); size_t slice_size);

View File

@ -375,7 +375,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx,
slice_param.chroma_offset_l1); slice_param.chroma_offset_l1);
err = ff_vaapi_decode_make_slice_buffer(avctx, pic, err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
&slice_param, sizeof(slice_param), &slice_param, 1, sizeof(slice_param),
buffer, size); buffer, size);
if (err) { if (err) {
ff_vaapi_decode_cancel(avctx, pic); ff_vaapi_decode_cancel(avctx, pic);

View File

@ -353,7 +353,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx)
if (pic->last_size) { if (pic->last_size) {
last_slice_param->LongSliceFlags.fields.LastSliceOfPic = 1; last_slice_param->LongSliceFlags.fields.LastSliceOfPic = 1;
ret = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic, 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); pic->last_buffer, pic->last_size);
if (ret < 0) if (ret < 0)
goto fail; goto fail;
@ -471,7 +471,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
if (!sh->first_slice_in_pic_flag) { if (!sh->first_slice_in_pic_flag) {
err = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic, 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, pic->last_size);
pic->last_buffer = NULL; pic->last_buffer = NULL;
pic->last_size = 0; pic->last_size = 0;

View File

@ -131,7 +131,7 @@ static int vaapi_mjpeg_decode_slice(AVCodecContext *avctx,
sp.components[i].ac_table_selector = s->ac_index[i]; 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) if (err)
goto fail; goto fail;

View File

@ -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, err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
&slice_param, sizeof(slice_param), &slice_param, 1, sizeof(slice_param),
buffer, size); buffer, size);
if (err < 0) { if (err < 0) {
ff_vaapi_decode_cancel(avctx, pic); ff_vaapi_decode_cancel(avctx, pic);

View File

@ -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, err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
&slice_param, sizeof(slice_param), &slice_param, 1, sizeof(slice_param),
buffer, size); buffer, size);
if (err < 0) { if (err < 0) {
ff_vaapi_decode_cancel(avctx, pic); ff_vaapi_decode_cancel(avctx, pic);

View File

@ -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, err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
&slice_param, sizeof(slice_param), &slice_param, 1, sizeof(slice_param),
buffer, size); buffer, size);
if (err < 0) { if (err < 0) {
ff_vaapi_decode_cancel(avctx, pic); ff_vaapi_decode_cancel(avctx, pic);

View File

@ -209,7 +209,7 @@ static int vaapi_vp8_decode_slice(AVCodecContext *avctx,
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
sp.partition_size[i+1] = s->coeff_partition_size[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) if (err)
goto fail; goto fail;

View File

@ -158,7 +158,7 @@ static int vaapi_vp9_decode_slice(AVCodecContext *avctx,
} }
err = ff_vaapi_decode_make_slice_buffer(avctx, pic, err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
&slice_param, sizeof(slice_param), &slice_param, 1, sizeof(slice_param),
buffer, size); buffer, size);
if (err) { if (err) {
ff_vaapi_decode_cancel(avctx, pic); ff_vaapi_decode_cancel(avctx, pic);