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 902B148EA4 for ; Thu, 29 Feb 2024 05:34:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E48B568CEC6; Thu, 29 Feb 2024 07:34:50 +0200 (EET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8166C68CDE9 for ; Thu, 29 Feb 2024 07:34:44 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709184890; x=1740720890; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=MhGYmjrSIJhwaBO1+G1u5KC4a+QWum9OMkWvC+kJiEo=; b=RmQrqymlor49tMOe14MEm/wdxrLCtFPV8+sEuuWpEQvmaA5RKCyiaWMD A+HsJuba1CtLVnESyxGxFVaENcyn8TYobuMLTLk7XEsGj9iWPQyJEusOt VN1sF0Vu6/5Ql4yAMQDAerGjRhH2PcfagKjv5Dx0PneaLw6D3/bBpyRgE pTsqZHgTn7Rr8w5MHdlEWTbdkuXEoByPDttDUP6OhSl7aNEZV6ixYHe5i U5YiMLZGRt1ujP2WnOjWZx8z/jacT+WqmAG7TmBDJdAPgNJ96AIls/oid lzH4P0npSJVtsAEeEpl3oA3UBPCxQ6URKI18uyBZhrMCdLVtssE7QqS7O A==; X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="3797823" X-IronPort-AV: E=Sophos;i="6.06,192,1705392000"; d="scan'208";a="3797823" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 21:34:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,192,1705392000"; d="scan'208";a="30870228" Received: from desktop-qn7n0nf.sh.intel.com (HELO localhost.localdomain) ([10.239.160.66]) by fmviesa002.fm.intel.com with ESMTP; 28 Feb 2024 21:34:41 -0800 From: tong1.wu-at-intel.com@ffmpeg.org To: ffmpeg-devel@ffmpeg.org Date: Thu, 29 Feb 2024 13:33:17 +0800 Message-ID: <20240229053326.75-1-tong1.wu@intel.com> X-Mailer: git-send-email 2.41.0.windows.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 1/9] 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 808b79c0c7..bd29dbf0b4 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; @@ -1331,7 +1332,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); @@ -1344,7 +1345,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".