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 D54BF4A887 for ; Thu, 18 Apr 2024 09:03:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5FE2268D438; Thu, 18 Apr 2024 12:01:17 +0300 (EEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A81C268D444 for ; Thu, 18 Apr 2024 12:01:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713430872; x=1744966872; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/6HYBdnCtOtrEAB4k5tUpQzcdA9JKNEdA2vLrZEyiB0=; b=ZsczS56N4kizx5myxb14ks4+xuw2a0Qc63XG7REh7/SDET8agaDImmOy xe7VcvkJA0/apCHcW73JLrGzeBdr8J3OsUKGmk8KdK3KxCZ7L5AYjauYd J3jgW6+mM3xipPYU6tjnnSOvKYFjmaC/bIj4ko4LEZkj7TTTkyYsDtkb1 X+bUUscsLztY9Uo108muJS9NxUy44nDUM8g22PwNkH28EfrPY1D1GuqCC GINwOtej32Chvf+GQSFSrA/Y7SD8KHdqkLIxOqbcgxDcds3FUEg4Yguuw iqHm1pGCwycOEHjTOVE+QsEA0bTsbpfLuiQ/7ELxc4zBt8vs1ag8ok4Z0 w==; X-CSE-ConnectionGUID: 8puUgVQuS5yWgSWDtmqrSA== X-CSE-MsgGUID: 1qGDqeaJQa+qqM+CKzfKlw== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="12748364" X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="12748364" 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:01:04 -0700 X-CSE-ConnectionGUID: LIb44nJYSym+Ebegy3Gj3Q== X-CSE-MsgGUID: d5A/SF8IQ7Co+Sr3n95MLA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,211,1708416000"; d="scan'208";a="54127622" Received: from unknown (HELO localhost.localdomain) ([10.239.160.66]) by fmviesa001.fm.intel.com with ESMTP; 18 Apr 2024 02:00:58 -0700 From: tong1.wu-at-intel.com@ffmpeg.org To: ffmpeg-devel@ffmpeg.org Date: Thu, 18 Apr 2024 16:59:06 +0800 Message-ID: <20240418085910.547-12-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 12/15] avcodec/vaapi_encode: extract a free funtion 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.c | 11 +++++++++++ libavcodec/hw_base_encode.h | 2 ++ libavcodec/vaapi_encode.c | 6 +----- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c index af85bb99aa..812668f3f2 100644 --- a/libavcodec/hw_base_encode.c +++ b/libavcodec/hw_base_encode.c @@ -751,6 +751,17 @@ fail: return err; } +int ff_hw_base_encode_free(AVCodecContext *avctx, HWBaseEncodePicture *pic) +{ + av_frame_free(&pic->input_image); + av_frame_free(&pic->recon_image); + + av_buffer_unref(&pic->opaque_ref); + av_freep(&pic->priv_data); + + return 0; +} + int ff_hw_base_encode_init(AVCodecContext *avctx) { HWBaseEncodeContext *ctx = avctx->priv_data; diff --git a/libavcodec/hw_base_encode.h b/libavcodec/hw_base_encode.h index 7686cf9501..d566980efc 100644 --- a/libavcodec/hw_base_encode.h +++ b/libavcodec/hw_base_encode.h @@ -222,6 +222,8 @@ int ff_hw_base_init_gop_structure(AVCodecContext *avctx, uint32_t ref_l0, uint32 int ff_hw_base_get_recon_format(AVCodecContext *avctx, const void *hwconfig, enum AVPixelFormat *fmt); +int ff_hw_base_encode_free(AVCodecContext *avctx, HWBaseEncodePicture *pic); + int ff_hw_base_encode_init(AVCodecContext *avctx); int ff_hw_base_encode_close(AVCodecContext *avctx); diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index ee4cf42baf..08792c07c5 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -878,17 +878,13 @@ static int vaapi_encode_free(AVCodecContext *avctx, av_freep(&pic->slices[i].codec_slice_params); } - av_frame_free(&base_pic->input_image); - av_frame_free(&base_pic->recon_image); - - av_buffer_unref(&base_pic->opaque_ref); + ff_hw_base_encode_free(avctx, base_pic); av_freep(&pic->param_buffers); av_freep(&pic->slices); // Output buffer should already be destroyed. av_assert0(pic->output_buffer == VA_INVALID_ID); - av_freep(&base_pic->priv_data); av_freep(&pic->codec_picture_params); av_freep(&pic->roi); -- 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".