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 CE2874A881 for ; Thu, 18 Apr 2024 09:02:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2273768D46C; Thu, 18 Apr 2024 12:01:16 +0300 (EEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 865BD68D43E for ; Thu, 18 Apr 2024 12:01:06 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713430871; x=1744966871; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CELJPe4NDe4H0UYe3KLPgHmGtfG1MP+i7cLB1awv+MI=; b=RD314kXTNx72PGPJdBDnR5/9f8PekA2ZX+k0ufEdLxV+l0ZWfKugeL6+ ReHLxWOjfySu0bGB9MvV6ximPV5irj+kU7ZHrBQ/MU8dHwk+ALr1a5mt/ hrSNeBUJb3G8zXovzB7SI2skbhHhDgzl9JrUFiao8pKax2LXswOqN/mwJ DIRKX+LbtAN12ndVAFxd1nt7F+U1IoHbIYmJUgt5NURIeenRUXdqUXMDH NAcQ6NIitFfEA8/kvLx8edvvSqlxwRRpu2sSbMF2nmdBfiY283MDmJV4p DBm6eoVtr1AMG8a6Z2GZd65jJNfzuogGzYGlM2i2bd1iGMlBurZiYVjPM Q==; X-CSE-ConnectionGUID: r/rtieGxSWKMdyxv7XTavA== X-CSE-MsgGUID: bzdZ14ulT1CGLqK4LdSXqg== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="12748332" X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="12748332" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 02:00:55 -0700 X-CSE-ConnectionGUID: WkJ2ZwYWT2uhWokKrspBWQ== X-CSE-MsgGUID: l6H2Gy0MSJ2lAKA1YnS+Hw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="54127575" Received: from unknown (HELO localhost.localdomain) ([10.239.160.66]) by fmviesa001.fm.intel.com with ESMTP; 18 Apr 2024 02:00:50 -0700 From: tong1.wu-at-intel.com@ffmpeg.org To: ffmpeg-devel@ffmpeg.org Date: Thu, 18 Apr 2024 16:59:02 +0800 Message-ID: <20240418085910.547-8-tong1.wu@intel.com> X-Mailer: git-send-email 2.41.0.windows.1 In-Reply-To: <20240418085910.547-1-tong1.wu@intel.com> References: <20240418085910.547-1-tong1.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v8 08/15] avcodec/vaapi_encode: move two reconstructed frames parameters to base layer 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 Signed-off-by: Tong Wu --- libavcodec/hw_base_encode.h | 4 ++++ libavcodec/vaapi_encode.c | 22 +++++++++++----------- libavcodec/vaapi_encode.h | 4 ---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libavcodec/hw_base_encode.h b/libavcodec/hw_base_encode.h index 1f6d7882bc..3eea3ef998 100644 --- a/libavcodec/hw_base_encode.h +++ b/libavcodec/hw_base_encode.h @@ -134,6 +134,10 @@ typedef struct HWBaseEncodeContext { AVBufferRef *input_frames_ref; AVHWFramesContext *input_frames; + // The hardware frame context containing the reconstructed frames. + AVBufferRef *recon_frames_ref; + AVHWFramesContext *recon_frames; + // Current encoding window, in display (input) order. HWBaseEncodePicture *pic_start, *pic_end; // The next picture to use as the previous reference picture in diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 993b2640a9..8640a888b7 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -314,7 +314,7 @@ static int vaapi_encode_issue(AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "Input surface is %#x.\n", pic->input_surface); - err = av_hwframe_get_buffer(ctx->recon_frames_ref, base_pic->recon_image, 0); + err = av_hwframe_get_buffer(base_ctx->recon_frames_ref, base_pic->recon_image, 0); if (err < 0) { err = AVERROR(ENOMEM); goto fail; @@ -2149,19 +2149,19 @@ static av_cold int vaapi_encode_create_recon_frames(AVCodecContext *avctx) av_freep(&hwconfig); av_hwframe_constraints_free(&constraints); - ctx->recon_frames_ref = av_hwframe_ctx_alloc(base_ctx->device_ref); - if (!ctx->recon_frames_ref) { + base_ctx->recon_frames_ref = av_hwframe_ctx_alloc(base_ctx->device_ref); + if (!base_ctx->recon_frames_ref) { err = AVERROR(ENOMEM); goto fail; } - ctx->recon_frames = (AVHWFramesContext*)ctx->recon_frames_ref->data; + base_ctx->recon_frames = (AVHWFramesContext*)base_ctx->recon_frames_ref->data; - ctx->recon_frames->format = AV_PIX_FMT_VAAPI; - ctx->recon_frames->sw_format = recon_format; - ctx->recon_frames->width = ctx->surface_width; - ctx->recon_frames->height = ctx->surface_height; + base_ctx->recon_frames->format = AV_PIX_FMT_VAAPI; + base_ctx->recon_frames->sw_format = recon_format; + base_ctx->recon_frames->width = ctx->surface_width; + base_ctx->recon_frames->height = ctx->surface_height; - err = av_hwframe_ctx_init(ctx->recon_frames_ref); + err = av_hwframe_ctx_init(base_ctx->recon_frames_ref); if (err < 0) { av_log(avctx, AV_LOG_ERROR, "Failed to initialise reconstructed " "frame context: %d.\n", err); @@ -2269,7 +2269,7 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx) if (err < 0) goto fail; - recon_hwctx = ctx->recon_frames->hwctx; + recon_hwctx = base_ctx->recon_frames->hwctx; vas = vaCreateContext(ctx->hwctx->display, ctx->va_config, ctx->surface_width, ctx->surface_height, VA_PROGRESSIVE, @@ -2404,7 +2404,7 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) av_freep(&ctx->codec_picture_params); av_fifo_freep2(&base_ctx->encode_fifo); - av_buffer_unref(&ctx->recon_frames_ref); + av_buffer_unref(&base_ctx->recon_frames_ref); av_buffer_unref(&base_ctx->input_frames_ref); av_buffer_unref(&base_ctx->device_ref); diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h index 0d3d8e2ed0..76fb645d71 100644 --- a/libavcodec/vaapi_encode.h +++ b/libavcodec/vaapi_encode.h @@ -213,10 +213,6 @@ typedef struct VAAPIEncodeContext { AVVAAPIDeviceContext *hwctx; - // The hardware frame context containing the reconstructed frames. - AVBufferRef *recon_frames_ref; - AVHWFramesContext *recon_frames; - // Pool of (reusable) bitstream output buffers. struct FFRefStructPool *output_buffer_pool; -- 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".