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 C071049839 for ; Mon, 20 May 2024 14:54:35 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BB29268D21C; Mon, 20 May 2024 17:54:10 +0300 (EEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B685768D120 for ; Mon, 20 May 2024 17:54:03 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716216849; x=1747752849; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=k+Cd3SbMsZI2AOBFYmvXlX99kdjYu6SRZFiVO28Uq+c=; b=ngafrVbcSvJWAL9VtUfuGwon2jt7ShQykJSTxk2Ec7yTC5yFlIWuT5Dt egEQQFQKoL/Nx9hHg/bPY3u15j46roJZkV3zPsz4GFf02qMyrPoXWsamy rBAg4KCqUm2y8t68Y/D0Pbf3OiUnkHhL7NqGPQFyS/+I7zzwbkj1KVSnq 7sQnOx3A0ukaCri+PqLdbQuiK4QGEGoR22LhHdIChPU7op0lUEmgEPja8 pS+jFMo7YScCZIdXq2L2TOi88d8x7CQHD6iRQXyRV5wRgOz6N8Bxwuz/7 dr3y0vlNpJ8UOIp6OhpFFKGkN1wRwZdyAQ7zHmdoHBqH/VuR0lBcRXGgj A==; X-CSE-ConnectionGUID: BIoCS/EzTfWUweQJqm0fAw== X-CSE-MsgGUID: +Y+7OsuqT8myBPrTmm9IxA== X-IronPort-AV: E=McAfee;i="6600,9927,11078"; a="12197246" X-IronPort-AV: E=Sophos;i="6.08,175,1712646000"; d="scan'208";a="12197246" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2024 07:53:59 -0700 X-CSE-ConnectionGUID: XgwDwVBCRl6j+kkSrGTpaA== X-CSE-MsgGUID: nI5YP5JnQXygyAGGKU1SFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,175,1712646000"; d="scan'208";a="55787870" Received: from unknown (HELO localhost.localdomain) ([10.239.160.66]) by fmviesa002.fm.intel.com with ESMTP; 20 May 2024 07:53:58 -0700 From: tong1.wu-at-intel.com@ffmpeg.org To: ffmpeg-devel@ffmpeg.org Date: Mon, 20 May 2024 22:52:13 +0800 Message-ID: <20240520145222.291-4-tong1.wu@intel.com> X-Mailer: git-send-email 2.41.0.windows.1 In-Reply-To: <20240520145222.291-1-tong1.wu@intel.com> References: <20240520145222.291-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v9 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".