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 CD8CF45F0B for ; Thu, 18 May 2023 06:56:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DC4BB68C152; Thu, 18 May 2023 09:55:51 +0300 (EEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 68E9F68C07A for ; Thu, 18 May 2023 09:55:45 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684392950; x=1715928950; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gvXMGNV1MCbm2YnqBXLmIRCR7oGnsty0e/0YsumtW+s=; b=FbM0thY49YmEP1fy98STgEMcqBeJ3YuLPnuaodO9kDBeZXUtV/FFJs7P jcM9mQF1rqXSInp7qeGKILdU5ym6GV/1yF2vyX993mHIRFya58O2wjSSX 9X2OqVDVwd93aWT/Pj13x83GRy/Hux+kIC1lRwb83s+4QrL3qe/QhBLHy PYHfbnJLxmz6DI1Ks/weyR/5SzlD6UrVpgQ0Ijp4CYWTzdScZEzCq6obk ArrIuDrvFCznR1rz9o6ZoEbovljx4K7ITrxPNDyddZQjpLD1SUrgpPLTX bxXRrjeLIba90XYXx8pz+ao/uOlzgtE2qTLrnKVA3y44ILcdbeH7FXnTw Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="380193451" X-IronPort-AV: E=Sophos;i="5.99,284,1677571200"; d="scan'208";a="380193451" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2023 23:55:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="846359898" X-IronPort-AV: E=Sophos;i="5.99,284,1677571200"; d="scan'208";a="846359898" Received: from xhh-tgl64.sh.intel.com ([10.238.2.19]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2023 23:55:12 -0700 From: "Xiang, Haihao" To: ffmpeg-devel@ffmpeg.org Date: Thu, 18 May 2023 14:54:37 +0800 Message-Id: <20230518065438.144156-2-haihao.xiang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230518065438.144156-1-haihao.xiang@intel.com> References: <20230518065438.144156-1-haihao.xiang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] lavc/qsvenc: avoid data copy if possible 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 The data copy is unnecessary for packed formats when frame width and height are aligned For example: $ ffmpeg -f lavfi -i testsrc=size=1920x1088 -vf "format=yuyv422" -c:v hevc_qsv -f null - Signed-off-by: Haihao Xiang --- libavcodec/qsvenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 2c38fbf0dc..b6813b3023 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -1910,7 +1910,8 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame, /* make a copy if the input is not padded as libmfx requires */ /* and to make allocation continious for data[0]/data[1] */ if ((frame->height & (q->height_align - 1) || frame->linesize[0] & (q->width_align - 1)) || - (frame->data[1] - frame->data[0] != frame->linesize[0] * FFALIGN(qf->frame->height, q->height_align))) { + ((frame->format == AV_PIX_FMT_NV12 || frame->format == AV_PIX_FMT_P010 || frame->format == AV_PIX_FMT_P012) && + (frame->data[1] - frame->data[0] != frame->linesize[0] * FFALIGN(qf->frame->height, q->height_align)))) { int tmp_w, tmp_h; qf->frame->height = tmp_h = FFALIGN(frame->height, q->height_align); qf->frame->width = tmp_w = FFALIGN(frame->width, q->width_align); -- 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".