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 A96F9461CC for ; Thu, 8 Jun 2023 08:47:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8CF8868C1DE; Thu, 8 Jun 2023 11:47:50 +0300 (EEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 57B3768B22C for ; Thu, 8 Jun 2023 11:47:42 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686214068; x=1717750068; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=Zujd9myKlkqrKtXb+Nmzd3sph2RfAU5ROnY42UlnsFM=; b=jt2RbtCg7rbNJ+3pSYe7AgjxPQ8twfmq507dLictH0eOZOL4/fpZ2PSl 4J5JbULWgJhu5Vk1Yf6UUpSm9fEZCdJsUiFTmf6Zb7jyL1ST+vHsdzSTg exzGCA0dwo6UdfShrGtmVfDqlF7bViVIh8z+je/yU7SIq9ekIKPUztF1x ukO9iO1qKaCzmmBicfCTO1m/+6GHCrlUsKJw9MRyE22+wZ5Pl0PKLtBiX XnaQ56//MafLDP5XB4vxUVRsl/Bqq7RRLs6jjkq3UoNFRaLBjEosBRCYB L2QiBpPbF1QRIu7gZf15SS/E2xBxmr+Gdq1p94hoI+gk57ZhSkd+JMr1o w==; X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="359719815" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="359719815" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2023 01:47:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="834099227" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="834099227" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga004.jf.intel.com with ESMTP; 08 Jun 2023 01:47:40 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 8 Jun 2023 01:47:39 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 8 Jun 2023 01:47:39 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.173) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Thu, 8 Jun 2023 01:47:39 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dVfau0mhrFXVi6KAhCFIFKijGZV37lmL4vAYuX7MytUlOSJdcSo7aj/euVGMgzGwwQxfmViSrqb36JCXVkLHMtGZk7ODJJGygRZbRPVKSIOt5XBTD9L8TCM07tqeQ0A4hy0/IhLnbS8sDfHCz+4ZsT9mOoSob1ekK7CQuNLACJU15ZgXOssXFAPLfJ6rT5iCnekaiUbimmnefUqXlJ1L+k5xp2N/IoOu/mw+nJbY3YOGgzUmweRDEjZFraBsQZw3S76Q2nQaJT02oM2x1ZZuHYO6BTnOVMyUOQ/uwj6uxdB2O0Cpbx5Pfzsvw1XkkHSGbyKfGN+M5aBCVaz8SjVVUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gHlRCgO8glO4F7/CRRmjWqj95ZaPU19pjKWtAyUD8Xw=; b=Z89A/irQG21cPGIB4ToTZJtoTyAhI1tQG3H2n2KZM9mQbWMpNhZHm+ifmFqmx5GFIqQTXTC0J9fhNtu9mPgOYJ9aTcveGaLTes5zmpxNtBayGqLtLc9YLcZcqBU8rvzzHGsCpoSN9DwrqTSePvwPvxq3UHS2T1yINJ7Sl1eVS+c99cEV82sl9XXs2M8je1h22xKSPaFypNfGIWwWq1MUQt/bMU4OG9e78h3hb2BThmycOsU9algtLxb1bSgV5BpTNxQYGdIGlIGDCJM6G4Y6JYh7hXuSWs0aHaFrGyT/XqNVQKZxNPh3DU+CTuiK+f8sLz93as5McXDgpwVsXZydeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SN6PR11MB2990.namprd11.prod.outlook.com (2603:10b6:805:cf::21) by SA1PR11MB5802.namprd11.prod.outlook.com (2603:10b6:806:235::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Thu, 8 Jun 2023 08:47:39 +0000 Received: from SN6PR11MB2990.namprd11.prod.outlook.com ([fe80::cd4f:cf48:9c2e:95d3]) by SN6PR11MB2990.namprd11.prod.outlook.com ([fe80::cd4f:cf48:9c2e:95d3%4]) with mapi id 15.20.6455.030; Thu, 8 Jun 2023 08:47:37 +0000 From: "Wu, Tong1" To: FFmpeg development discussions and patches Thread-Topic: [FFmpeg-devel] [PATCH v5 5/5] lavfi/format: add a hwmap auto conversion filter Thread-Index: AQHZd0fHH1uO9C8K9EqDzIG5uUiPO69/S/8AgAGN6FA= Date: Thu, 8 Jun 2023 08:47:36 +0000 Message-ID: References: <20230425072620.512-1-tong1.wu@intel.com> <20230425072620.512-5-tong1.wu@intel.com> <7FA80446-9AA0-44CF-8135-10A06C4722E5@gmail.com> In-Reply-To: <7FA80446-9AA0-44CF-8135-10A06C4722E5@gmail.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR11MB2990:EE_|SA1PR11MB5802:EE_ x-ms-office365-filtering-correlation-id: 3450a12f-d90d-4c54-8ff3-08db67fd0266 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: abRPZrjEt1nLPAJWntTyN17rfAidbv/yj7gPv2j1IopRY4eO3uLalPTqr3WQRc7e21YjlE0VC+HGEEwYlLPXkFjdbDjS9gGi0Y6iOtML0gOmSrC7em4k5Xvl1B7Te2OiBlk7PL/voiX/IPStERwywPIDiwuN7jWTKZNazItHXZaIuz5ZViZ4UlKEnq3RXuBe62HXKc7UjIVbJ2DK6tw845qszcxpIHLv40fqB3VG4yhr8q2C4JlQiq0dL0x8t2B7lknFg87AxoDBRQeFOOIy5ZAFQ/i4KPPOXr41RBtfZ/500+/DXJExNamhdfgl9fBFyLJcAlDK8EiCCbozgC4nnqdrgbTWHisPtnHuOAKx4x+VeVznjmOWFuISGurzNqzwD13z0Sbx9+z3jCKmZDPxjbThyTv0Vs/1mS4fpaVMq6KDC8mHH3kXM+plmxloF+qKEGTQexOgXcSdleHLOQMkHiZA/8WYA2NQgjuCusOCgf4MoVUDuywzYAAbeYdOw9al4L2Xwif0q2gD7KnL2M/zuCBr6x5V5FeM0ahuunCdBFNc/Gbsvj3wAup4jxZGa5fwkDUhdx90b4cyAWWqFGPMgwq7Yan2xITESN57hhDkqmk= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB2990.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(346002)(136003)(39860400002)(376002)(396003)(451199021)(38070700005)(8676002)(8936002)(966005)(478600001)(55016003)(41300700001)(316002)(5660300002)(52536014)(7696005)(45080400002)(26005)(6916009)(186003)(76116006)(66476007)(66446008)(66556008)(66946007)(64756008)(71200400001)(66899021)(9686003)(6506007)(83380400001)(2906002)(38100700002)(122000001)(82960400001)(33656002)(86362001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0oKP68t5fq7bdB5PXaDNxa3dDgQIKa406qqbjn3WTg+rX/0TQSokLcaexWMe?= =?us-ascii?Q?By3flEj9FfG7jsw20Ftj7/bAlEWMQR6aIg3NsUxcHGBGlAwsvQSwRkrTYyUt?= =?us-ascii?Q?tERmA+Xt0SbE0Mikd+FDc836LUx8Qagmt4A0pVpN9f94wcKuGr2xOmHvW8vn?= =?us-ascii?Q?UNUEKkOjeBCgCudrHNKiRVr1VVk65ovjDmeILhAKH239Q536P9CfyHXjix8k?= =?us-ascii?Q?vFVPVMGZBUNPNhi9pMfEjnlJ3Ala3PuAvnBM5iOxo6GOGNRWmrXqSsbU6Xkn?= =?us-ascii?Q?5y0eZZZlaXuIEgZMEk8NHXtaN9SyInKIpKUDVQd8zTUa+sSZmM1t1GVdxZZn?= =?us-ascii?Q?0WY6jxVbKyUCVdY064nXXlVirg1wS1L0XGRV/7d4aCLaugqwTeEE26eQw4nv?= =?us-ascii?Q?Ie+DrgmqLRV1Wqaa2fL9/4dyOlx6gqgAP0fRN23bx7CgQRgighf3Hx62bGaP?= =?us-ascii?Q?Cka1A5AGS8CKc7Do97OofxUMZupfwUgrbowXk/E11WRCt4kGyAQaUhrHOoHl?= =?us-ascii?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stgc/dTzYFSfePR?= =?us-ascii?Q?m1c7nN1JZ43dr4vg8ETFcy0jqOaIKQg6eH5QIT3DWdXhxxGGXE2/+QyXOTEo?= =?us-ascii?Q?O++QTEUopDLW6pGRPJEwLLbVsgkpRWpMEmFvsUNgf8KqtP5V91FtPFdNbuJf?= =?us-ascii?Q?bKes20oX5JBQCEwhcZQ=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2990.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3450a12f-d90d-4c54-8ff3-08db67fd0266 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2023 08:47:36.7306 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: J8jbbMheXc4gzX8IJmZqnv9PvRqtI4Rh+y2N40TRTUZ1Lh9KwvzlGbb2mUHwlM38jT4ZyIbI2iswzs9+c/1sig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB5802 X-OriginatorOrg: intel.com Subject: Re: [FFmpeg-devel] [PATCH v5 5/5] lavfi/format: add a hwmap auto conversion filter 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 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: >On 25 Apr 2023, at 9:26, Tong Wu wrote: > >> When two formats lists cannot be merged, a scale filter is >> auto-inserted. However, when it comes to hardware map, we have to >> manually add a hwmap filter to do the conversion. This patch introduces >> an auto hwmap filter to do the hwmap conversion automatically. >> > >Thanks for trying to improve this! > >I've recently done quite a bit of experimentation with hardware >filters and at least for the Cuda - Vulkan - Cuda case, hwmap >was useless, and I was told I need to use hwupload instead, so I wonder >what cases this would help with? Thanks for the reply! Actually we are using hwmap filter to do vaapi<->qsv, d3d11<->qsv conversions. For the use case I have replied in another mail. I'll just copy here again. For example, ffmpeg -init_hw_device d3d11va=d3d11 -init_hw_device qsv=qsv@d3d11 - hwaccel d3d11va -hwaccel_output_format d3d11 -i input.mp4 -vf "hwmap=derive_device=qsv:extra_hw_frames=16,format=qsv" -c:v h264_qsv output.mp4 Now we don't have to explicitly specify hwmap. The auto filter mechanism will try to insert a hwmap filter automatically. The command line will be much simpler. ffmpeg -init_hw_device d3d11va=d3d11 -init_hw_device qsv=qsv@d3d11 - hwaccel d3d11va -hwaccel_output_format d3d11 -i input.mp4 -c:v h264_qsv output.mp4 > >I just fear that, especially given the bad error messages hwmap gives, >this will just implicitly insert it because it seemingly works but then >just fail to actually do the job and give an absolutely indescriptive >error to the user for a filter they did not even insert themselves. Yes I agree with that. However, we already have an auto scale filter in the framework. It will always be inserted when two filters cannot be linked. In my opinion, I'm just kinda appending another filter. It should be no harmful to the original framework. The only way you can get to this auto hwmap filter is that you already fail to insert scale filter and the program will return error. That's the current situation. With this patch set, those failed cmdlines could still fail but some cmdlines like above could pass. It just give it another chance to run and simplify the cmdlines. Regards, Tong > >> Signed-off-by: Tong Wu >> --- >> libavfilter/avfiltergraph.c | 3 ++- >> libavfilter/formats.c | 4 ++++ >> 2 files changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c >> index 8af0467bc5..b2b627ad6a 100644 >> --- a/libavfilter/avfiltergraph.c >> +++ b/libavfilter/avfiltergraph.c >> @@ -402,7 +402,8 @@ static int insert_auto_filter(AVFilterContext >**convert, AVFilterGraph *graph, >> AVFilterContext *ctx; >> AVFilterLink *inlink, *outlink; >> char inst_name[30]; >> - const char *opts = FF_FIELD_AT(char *, neg- >>conversion_filters[conv_step].conversion_opts_offset, *graph); >> + const char *opts = neg- >>conversion_filters[conv_step].conversion_opts_offset == 0 ? NULL : >> + FF_FIELD_AT(char *, neg- >>conversion_filters[conv_step].conversion_opts_offset, *graph); >> const char *name = neg->conversion_filters[conv_step].conversion_filter; >> >> if (!(filter = avfilter_get_by_name(name))) { >> diff --git a/libavfilter/formats.c b/libavfilter/formats.c >> index c8e20e5b20..fee10fa0ee 100644 >> --- a/libavfilter/formats.c >> +++ b/libavfilter/formats.c >> @@ -331,6 +331,10 @@ static const AVFilterFormatsFilter filters_video[] = { >> .conversion_filter = "scale", >> .conversion_opts_offset = offsetof(AVFilterGraph, scale_sws_opts), >> }, >> + { >> + .conversion_filter = "hwmap", >> + .conversion_opts_offset = 0, >> + } >> }; >> >> static const AVFilterFormatsFilter filters_audio[] = { >> -- >> 2.39.1.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". >_______________________________________________ >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". _______________________________________________ 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".