From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 33F3F498D4 for ; Wed, 22 May 2024 01:28:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B731968D41B; Wed, 22 May 2024 04:28:15 +0300 (EEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B20E168D3D0 for ; Wed, 22 May 2024 04:28:08 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716341294; x=1747877294; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=k+Cd3SbMsZI2AOBFYmvXlX99kdjYu6SRZFiVO28Uq+c=; b=b2BsZk5E+aovP9V6vq+DWMog2xUR1ll1b5crm8kpmzPt4yWfBtE+71+0 hMULF39FwhpSUC7FwKjBIliXB2KpjlbZWsQpbmet0XAmGWRl7Y0XoAZ9k zTPYJA86y0X05YtyGxZRiJ43gjCgy9FaA+a9k6reGQdAJH0BCtHRmGnmr 59XGZHm4Obz7E7KVXKLcTLEzXS3f6PP7NgXTgI+6VU58MiMr9LlAPf7rJ QtlimqkI0Oql8H6+JDneGoHtLbSd5gTfagoATcdJf4LK35n40XnfKsd00 vIGrj1D87sMdmbam8F8kZozx4nsF+3rHvv/+8nTtaaRri3Db2na28H1E6 g==; X-CSE-ConnectionGUID: cIOgi5i3QG2x6PEitcJ9mw== X-CSE-MsgGUID: k9i1fmfjQo+Aqy+1w7DPvg== X-IronPort-AV: E=McAfee;i="6600,9927,11079"; a="12797200" X-IronPort-AV: E=Sophos;i="6.08,179,1712646000"; d="scan'208";a="12797200" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 18:28:04 -0700 X-CSE-ConnectionGUID: 59kBYwqzQUW6uGVe8ierdw== X-CSE-MsgGUID: z4X7yHehS76v7fl96eo2qw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,179,1712646000"; d="scan'208";a="33537447" Received: from unknown (HELO localhost.localdomain) ([10.239.160.66]) by orviesa006.jf.intel.com with ESMTP; 21 May 2024 18:28:03 -0700 From: tong1.wu-at-intel.com@ffmpeg.org To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 May 2024 09:26:17 +0800 Message-ID: <20240522012627.1386-4-tong1.wu@intel.com> X-Mailer: git-send-email 2.41.0.windows.1 In-Reply-To: <20240522012627.1386-1-tong1.wu@intel.com> References: <20240522012627.1386-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 04/13] avcodec/vaapi_encode: move pic->input_surface initialization to encode_alloc X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Tong Wu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Tong Wu When allocating the VAAPIEncodePicture, pic->input_surface can be initialized right in the place. This movement simplifies the send_frame logic and is the preparation for moving vaapi_encode_send_frame to the base layer. Signed-off-by: Tong Wu --- libavcodec/vaapi_encode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 2d22e4bd85..227cccae64 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -878,7 +878,8 @@ static int vaapi_encode_discard(AVCodecContext *avctx, return 0; } -static VAAPIEncodePicture *vaapi_encode_alloc(AVCodecContext *avctx) +static VAAPIEncodePicture *vaapi_encode_alloc(AVCodecContext *avctx, + const AVFrame *frame) { VAAPIEncodeContext *ctx = avctx->priv_data; VAAPIEncodePicture *pic; @@ -895,7 +896,7 @@ static VAAPIEncodePicture *vaapi_encode_alloc(AVCodecContext *avctx) } } - pic->input_surface = VA_INVALID_ID; + pic->input_surface = (VASurfaceID)(uintptr_t)frame->data[3]; pic->recon_surface = VA_INVALID_ID; pic->output_buffer = VA_INVALID_ID; @@ -1332,7 +1333,7 @@ static int vaapi_encode_send_frame(AVCodecContext *avctx, AVFrame *frame) if (err < 0) return err; - pic = vaapi_encode_alloc(avctx); + pic = vaapi_encode_alloc(avctx, frame); if (!pic) return AVERROR(ENOMEM); @@ -1345,7 +1346,6 @@ static int vaapi_encode_send_frame(AVCodecContext *avctx, AVFrame *frame) if (ctx->input_order == 0 || frame->pict_type == AV_PICTURE_TYPE_I) pic->force_idr = 1; - pic->input_surface = (VASurfaceID)(uintptr_t)frame->data[3]; pic->pts = frame->pts; pic->duration = frame->duration; -- 2.41.0.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".