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 3EC3645201 for ; Mon, 12 Jun 2023 08:16:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 511C868C3C7; Mon, 12 Jun 2023 11:15:55 +0300 (EEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A437268C372 for ; Mon, 12 Jun 2023 11:15:46 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686557751; x=1718093751; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dTJ53KhaHPiCEAs+t9gVjKzWjCT3+9GjyZ52E0WdtZs=; b=UxJK6Tc7hUoi7qIgT7oSRjujwrUVdUIzwJJ2OoK0WvTPZGwKVIdPkP+N hOH00KPcCE6H+jPsGRQJ1lt2nu1Io8ABuhxulc3xYbTbv9TRGF3ScHabx EER2gTkXqOZyL6tXbiNIamqOuAR7qsyg/sC1mxWZoyMNmbJQCDkzAcPnl Lg9Us2iabyPc07SOcMAHEF6PU3gYo+gLykbKEL3Igft45n+IlfmghNTZv FDAYYkQldytrSlKIdT1el0haIKwcSVzVJApMwsBc1bEXNjXZHODki73d8 Nn1bpQ+HdP20M4kHgZOh52p3cjy0+FGxZeiIDl2mwhacdrw8ZedBMQelI Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="386360234" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="386360234" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 01:15:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="711111620" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="711111620" Received: from xhh-tgl64.sh.intel.com ([10.238.2.19]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 01:15:43 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Mon, 12 Jun 2023 16:14:46 +0800 Message-Id: <20230612081448.936570-4-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612081448.936570-1-haihao.xiang@intel.com> References: <20230612081448.936570-1-haihao.xiang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/6] lavfi/qsvvpp: store a copy of the sequence parameters 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: Haihao Xiang 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: Haihao Xiang We will postpone the vpp session initialization to when input and output frames are ready, this copy of the sequence parameters will be used to initialize vpp session. Signed-off-by: Haihao Xiang --- libavfilter/qsvvpp.c | 42 ++++++++++++++++++++++++++---------------- libavfilter/qsvvpp.h | 7 ++++++- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index 8683a4f217..d168ab5d1d 100644 --- a/libavfilter/qsvvpp.c +++ b/libavfilter/qsvvpp.c @@ -767,28 +767,39 @@ int ff_qsvvpp_init(AVFilterContext *avctx, QSVVPPParam *param) goto failed; } + s->nb_seq_buffers = param->num_ext_buf; #if QSV_HAVE_OPAQUE - if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) { - s->nb_ext_buffers = param->num_ext_buf + 1; + if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) + s->nb_seq_buffers++; +#endif + + if (s->nb_seq_buffers) { + s->seq_buffers = av_calloc(s->nb_seq_buffers, sizeof(*s->seq_buffers)); + if (!s->seq_buffers) { + ret = AVERROR(ENOMEM); + goto failed; + } + + for (i = 0; i < param->num_ext_buf; i++) + s->seq_buffers[i] = param->ext_buf[i]; + +#if QSV_HAVE_OPAQUE + if (IS_OPAQUE_MEMORY(s->in_mem_mode) || IS_OPAQUE_MEMORY(s->out_mem_mode)) + s->seq_buffers[i] = (mfxExtBuffer *)&s->opaque_alloc; +#endif + + s->nb_ext_buffers = s->nb_seq_buffers; s->ext_buffers = av_calloc(s->nb_ext_buffers, sizeof(*s->ext_buffers)); if (!s->ext_buffers) { ret = AVERROR(ENOMEM); goto failed; } - s->ext_buffers[0] = (mfxExtBuffer *)&s->opaque_alloc; - for (i = 1; i < param->num_ext_buf; i++) - s->ext_buffers[i] = param->ext_buf[i - 1]; - s->vpp_param.ExtParam = s->ext_buffers; - s->vpp_param.NumExtParam = s->nb_ext_buffers; - } else { - s->vpp_param.NumExtParam = param->num_ext_buf; - s->vpp_param.ExtParam = param->ext_buf; + memcpy(s->ext_buffers, s->seq_buffers, s->nb_seq_buffers * sizeof(*s->seq_buffers)); } -#else - s->vpp_param.NumExtParam = param->num_ext_buf; - s->vpp_param.ExtParam = param->ext_buf; -#endif + + s->vpp_param.ExtParam = s->ext_buffers; + s->vpp_param.NumExtParam = s->nb_ext_buffers; s->got_frame = 0; @@ -861,9 +872,8 @@ int ff_qsvvpp_close(AVFilterContext *avctx) clear_frame_list(&s->out_frame_list); av_freep(&s->surface_ptrs_in); av_freep(&s->surface_ptrs_out); -#if QSV_HAVE_OPAQUE + av_freep(&s->seq_buffers); av_freep(&s->ext_buffers); -#endif av_freep(&s->frame_infos); av_fifo_freep2(&s->async_fifo); diff --git a/libavfilter/qsvvpp.h b/libavfilter/qsvvpp.h index 8851185ff3..073c89fe70 100644 --- a/libavfilter/qsvvpp.h +++ b/libavfilter/qsvvpp.h @@ -74,9 +74,14 @@ typedef struct QSVVPPContext { #if QSV_HAVE_OPAQUE /** MFXVPP extern parameters */ mfxExtOpaqueSurfaceAlloc opaque_alloc; +#endif + /** store sequence parameters */ + mfxExtBuffer **seq_buffers; + int nb_seq_buffers; + + /** store all parameters for vpp execution, including parameters per frame */ mfxExtBuffer **ext_buffers; int nb_ext_buffers; -#endif int got_frame; int async_depth; -- 2.34.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".