[FFmpeg-devel] [PATCH V3 2/2] avcodec: add av1 VAAPI decoder
James Almer
jamrial at gmail.com
Tue Sep 29 20:10:23 EEST 2020
On 9/9/2020 12:39 AM, Fei Wang wrote:
> +static int vaapi_av1_decode_slice(AVCodecContext *avctx,
> + const uint8_t *buffer,
> + uint32_t size)
> +{
> + const AV1DecContext *s = avctx->priv_data;
> + VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private;
> + VASliceParameterBufferAV1 slice_param;
> + uint32_t offset;
> + int err = 0;
> +
> + for (int i = s->tg_start; i <= s->tg_end; i++) {
> + memset(&slice_param, 0, sizeof(VASliceParameterBufferAV1));
> + offset = s->tile_group_info[i].tile_offset;
> +
> + slice_param = (VASliceParameterBufferAV1) {
> + .slice_data_size = s->tile_group_info[i].tile_size,
> + .slice_data_offset = 0,
> + .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
> + .tile_row = s->tile_group_info[i].tile_row,
> + .tile_column = s->tile_group_info[i].tile_column,
> + .tg_start = s->tg_start,
> + .tg_end = s->tg_end,
> + };
> +
> + err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param,
> + sizeof(VASliceParameterBufferAV1),
> + buffer + offset,
Could this be simplified by setting slice_param.slice_data_offset to
s->tile_group_info[i].tile_offset, and passing buffer here alone?
> + s->tile_group_info[i].tile_size);
> + if (err) {
> + ff_vaapi_decode_cancel(avctx, pic);
> + return err;
> + }
> + }
> +
> + return 0;
> +}
More information about the ffmpeg-devel
mailing list