From patchwork Wed May  8 07:11:11 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: David Rosca <nowrep@gmail.com>
X-Patchwork-Id: 48663
Delivered-To: ffmpegpatchwork2@gmail.com
Received: by 2002:a05:6a20:9c8f:b0:1af:cdee:28c5 with SMTP id mj15csp25621pzb;
        Wed, 8 May 2024 00:13:15 -0700 (PDT)
X-Forwarded-Encrypted: i=2;
 AJvYcCWCijb8ZSk/y8BcczxdaxTNBz7xLlmGjenN9PJh0RzaUJGrdvM2Z+GAPh5e5kTeJCYeN8HiQuAyRm6Zzig7PSUIzb8PhAA2sq2Yzw==
X-Google-Smtp-Source: 
 AGHT+IHdqdMZBAjvbqLRYHa7Md6t9fwRSoJZl7CE/0w7QXsoqw/TDzXZ6Mpbl7AURm+q/U0l6qor
X-Received: by 2002:a50:8713:0:b0:572:689f:6380 with SMTP id
 4fb4d7f45d1cf-5731d9a29d8mr1644806a12.3.1715152394950;
        Wed, 08 May 2024 00:13:14 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1715152394; cv=none;
        d=google.com; s=arc-20160816;
        b=B6jZA/nq8Ym26kz7+ZsenrfiE6wW++e7SnAGUHwNm/gWod3Yl4PNnHvyeR8S5Zmw9O
         3V09Yv3C5LTean+x2RVayPx0AGzKudIRJyy5IM8OhUNm2W7gc1dSif9DZDSaAXZB+TU/
         ZDXUltX0Mb5q2WOCZvHtP97HInDnGH2/v+H17UVTJrGq3BCsV6G2RfHLMkyA1Bw2Kbvb
         JDY0R7esCGVoOeTw60KvlRCJZ4nl8rusR1F0ejIiy2T1+peYjxyBVTlcJSRp9qUKq2vx
         qi3YZo7KEJ4GvpWU6gaW+OR2j5IYi9hmTa6I2MBAC9MSaoPTY02I/45L5g8oHpwZSYhs
         voxw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20160816;
        h=sender:errors-to:content-transfer-encoding:cc:reply-to
         :list-subscribe:list-help:list-post:list-archive:list-unsubscribe
         :list-id:precedence:subject:mime-version:message-id:date:to:from
         :dkim-signature:delivered-to;
        bh=QyukGgEk1XAr25k9qbILTx4kdg6yKzLRJ3F+p3y8b8E=;
        fh=mbb85L8FZ404unHdLI+iF4ZFmTMGr6nZHIcfO/oKEvw=;
        b=0c8ndpLDPBOwZFnv/cS4Jq7WKrDe+E5pfeQvSMzpmBQnyQCuM4A1kVjtLtnmezYmBb
         FwKv+qTrH+qYcoDuDOhMc9q3xAU2PES61rIZZ6wCOxObyaI3I08j4Y717BOHqa6horAH
         yWxZwZ/AZVa3WjmYDVCGnYi1BVn2y7fDmeAP9Cm2eGBI96bqRZDFgI+ADa7grssNAyUP
         jY8IDHQXDbtIPR7YtOhvJQt9dkZrTuyGyz5hpeUbvxNvFj8uYJo2KOLsvbCBF7IVxj5+
         UxfiIJCu4qGBbz9nYGID0GXtK1+fJfRIk15S62z0pDULbeUHylcXJcXb3eMgWp9KtdnG
         8+ug==;
        dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=neutral (body hash did not verify) header.i=@gmail.com
 header.s=20230601 header.b=O+XtIIZD;
       spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org
 designates 79.124.17.100 as permitted sender)
 smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org;
       dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100])
        by mx.google.com with ESMTP id
 w18-20020a056402269200b00571b9f2bd09si7128266edd.34.2024.05.08.00.13.14;
        Wed, 08 May 2024 00:13:14 -0700 (PDT)
Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org
 designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100;
Authentication-Results: mx.google.com;
       dkim=neutral (body hash did not verify) header.i=@gmail.com
 header.s=20230601 header.b=O+XtIIZD;
       spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org
 designates 79.124.17.100 as permitted sender)
 smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org;
       dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ED92D68D4CA;
	Wed,  8 May 2024 10:13:10 +0300 (EEST)
X-Original-To: ffmpeg-devel@ffmpeg.org
Delivered-To: ffmpeg-devel@ffmpeg.org
Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com
 [209.85.167.44])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0F82168D48B
 for <ffmpeg-devel@ffmpeg.org>; Wed,  8 May 2024 10:13:04 +0300 (EEST)
Received: by mail-lf1-f44.google.com with SMTP id
 2adb3069b0e04-51fea3031c3so5148511e87.0
 for <ffmpeg-devel@ffmpeg.org>; Wed, 08 May 2024 00:13:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1715152383; x=1715757183; darn=ffmpeg.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=ffXg2XQu2Z246T8u+pR5mw8scM+kCnRnc2DEIwGVp5Y=;
 b=O+XtIIZD3mEw83APJDrBeFsRuzwVt3Kyyg3FuAhCXFxtdsjvkBCUAr7QxcnMv6WelI
 9waHWdeZ3Gr3gKWpesLlrvATXFJ0NXsZu78H9ddX0YWj/zrCU3bafwiQw8YqmuSxvQku
 tt2FxjepsnsddQ4Rd9xQQbixME7L88FlPIc5cUbSLO6kWAHWg4yrZ83OgHyoX3y+9tRE
 cAZq2q+ieBkSd58/Fi/bIad1FrvE2rHNjD2eC0z84uNjH46OiynFFdJZMBvwEoydjAYs
 FPch8HkUBtEcMFbY772efPUD1fUua4ZoJYkMJsU9wweRXf6fzWVs144L8UzMXffVJF7V
 /CuA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1715152383; x=1715757183;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=ffXg2XQu2Z246T8u+pR5mw8scM+kCnRnc2DEIwGVp5Y=;
 b=WORFsv2dMz6yM+ahOJTkfqEjGb37TOSJqIw2Nl55aCSFQOKvma/C8aKz4A1UlIeD6Y
 2QYcGwrGFxynBdkMT9+Sl1fZyhOdcYpYQwFMFtCvLJxUFlDWujzhk4lVjO/XSqJJMV1E
 rnMWVOlrkIuwmPnpa6yK8c+10Sq3stzeeOL2+oFcYVWZE6kQhEdEvFyCGAsdhNH0gDlm
 LwdTocOaNoI42/FrGVexOMgdRBEpfkrvPJILJR3AFDCwCJD0nFFx5lOh+soX09XC8l7Q
 RzaoeGq8qE2OR7TZKOBJiAXKPLFdAUm9Y1DNmS2jW5U3ndmVH/K7C3GbPfOGbICYcle6
 bpHg==
X-Gm-Message-State: AOJu0YxS6mZKvl8CFJt92+Sq4Bu0Q1qCEj4mRz+D6PCG+tLwamYoFb78
 7SVtiAxsN4Dvyx9PVifcgIXTj1m0AYmwl2tkchF4F+m3SH+lQHxh6Q6bpA==
X-Received: by 2002:ac2:4a71:0:b0:519:e878:9385 with SMTP id
 2adb3069b0e04-5217c5671a9mr1284790e87.18.1715152382619;
 Wed, 08 May 2024 00:13:02 -0700 (PDT)
Received: from mitsuki.. (ip-78-45-35-87.bb.vodafone.cz. [78.45.35.87])
 by smtp.gmail.com with ESMTPSA id
 t16-20020a170906609000b00a59d7505366sm2872828ejj.62.2024.05.08.00.13.02
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 08 May 2024 00:13:02 -0700 (PDT)
From: David Rosca <nowrep@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Date: Wed,  8 May 2024 09:11:11 +0200
Message-ID: <20240508071247.133615-2-nowrep@gmail.com>
X-Mailer: git-send-email 2.45.0
MIME-Version: 1.0
Subject: [FFmpeg-devel] [PATCH v2 1/2] lavc/vaapi_decode: Make it possible
 to send multiple slice params buffers
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: David Rosca <nowrep@gmail.com>
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
X-TUID: CXdjf/rnNjyo

---
v2: No changes

 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 1f563483b9..4a90db1e09 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 21b273cd0f..8e9f647c20 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -63,6 +63,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)
@@ -88,7 +89,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 5594118a69..abbe877dd8 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -490,7 +490,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 b8e760c807..a28fc75a59 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);
