From patchwork Thu Nov 4 05:44:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenbin Chen X-Patchwork-Id: 31290 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:a610:0:0:0:0:0 with SMTP id q16csp146295ioi; Wed, 3 Nov 2021 22:48:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQrc0JxGhHHYAVsWDSBP5aafqN7iZ3XIK5AWhTqDtKQHi7+x1DWbuxyoF0vSB+mQQxLbxF X-Received: by 2002:aa7:db93:: with SMTP id u19mr66555380edt.179.1636004934688; Wed, 03 Nov 2021 22:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636004934; cv=none; d=google.com; s=arc-20160816; b=Vkn4Ti1lF7D63gm8FRNSJc190orEQXz4bcmHZYYDyzL/9aYRyLxv/pcsRktsAMFdxV 4jz2OSifgOjXYMmd8dDRjAGLj8kK68QKMP9Ok7+Qk2HlFgBLqhCdAAfR9BBaZcs5G9pL n3L7u7+ZAm23wZdajT21z/R102xcls5kzythOUEoNZaYkF8MQR3/H3MT4h0/G6UDFJt9 mQhGWQTyIYtBa8hb53vSH9cYMd9ZYZqbAuUFV1XlxGpvmRE2Bm8DAAqZO8t9w0mOT6tx iN56jS7yRiMFg8K5JK4lc+ul6OoVO+EmVmzEMnFt973PXbsMDP0ajCzWpfPo0GiDN6Ke Yf6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=jvwaXTdqQ9YhP1SPMHuF8JWPAnX5kGS26pZiTMDI/t8=; b=jOkpwB66AutFw0OqAvW+yLLwmdLceaxOjsGZHlaKxi7U40d1Z3fZmZo1QguTdB9bUN hT0/U3GDAoErRaBUe/eJe4jfzmHeEZ6a0d6aY/fFsWZ2PyTAz8VzLC8U0/2UPFA3uuGe OSF8zl3n5Hpx55JOfqI1xlx1QTq5LnLanFsXyfo2Ql4P0R5qh7uLUhQKkFLITbc7nMWZ cRHnfnSrTgNVUvy3PTyUy01i/4bA2LrLSyy+cfJeWtRa/749Vy/2PiJyx4Oed7Bkz0vR SPU1MKWxgRm4zExGvKmWjKdQkpc9HS0+2BYIz5sStZZKviIINMYCf0uCJBI+3sySyR/t KhBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dr15si9116436ejc.170.2021.11.03.22.48.54; Wed, 03 Nov 2021 22:48:54 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 50F1668AD5F; Thu, 4 Nov 2021 07:48:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E872A68AD0A for ; Thu, 4 Nov 2021 07:48:23 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10157"; a="212398287" X-IronPort-AV: E=Sophos;i="5.87,208,1631602800"; d="scan'208";a="212398287" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2021 22:48:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,208,1631602800"; d="scan'208";a="639158181" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by fmsmga001.fm.intel.com with ESMTP; 03 Nov 2021 22:48:19 -0700 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Nov 2021 13:44:02 +0800 Message-Id: <20211104054403.1251208-3-wenbin.chen@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211104054403.1251208-1-wenbin.chen@intel.com> References: <20211104054403.1251208-1-wenbin.chen@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] libavutil/hwcontext_qsv: fix a bug for mapping vaapi frame to qsv 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: Wenbin Chen , nyanmisaka Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6fxSmjLgF/RZ From: nyanmisaka The data stored in data[3] in VAAPI AVFrame is VASurfaceID while the data stored in pair->first is the pointer of VASurfaceID, so we need to do cast to make following commandline works: ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \ -hwaccel_output_format vaapi -i input.264 \ -vf "hwmap=derive_device=qsv,format=qsv" -c:v h264_qsv output.264 Signed-off-by: nyanmisaka Signed-off-by: Wenbin Chen --- libavutil/hwcontext_qsv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 5a285fd25b..8075c27862 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -1219,7 +1219,7 @@ static int qsv_map_to(AVHWFramesContext *dst_ctx, case AV_PIX_FMT_VAAPI: { mfxHDLPair *pair = (mfxHDLPair*)hwctx->surfaces[i].Data.MemId; - if (pair->first == src->data[3]) { + if (*(VASurfaceID*)pair->first == (VASurfaceID)src->data[3]) { index = i; break; }