From patchwork Mon Nov 21 00:27:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 39365 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1816325pzb; Sun, 20 Nov 2022 16:27:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf49UJaKCmrkNj//TgrfCva4COwh6I9G1K2PbtoC/wjN4VlqstW11GoVzofsLAncbcW9NSvG X-Received: by 2002:a05:6402:2024:b0:468:f633:9484 with SMTP id ay4-20020a056402202400b00468f6339484mr13087458edb.200.1668990443052; Sun, 20 Nov 2022 16:27:23 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q4-20020aa7cc04000000b00462847f2128si6877290edt.107.2022.11.20.16.27.22; Sun, 20 Nov 2022 16:27:23 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=f1HRpxVo; arc=fail (body hash mismatch); 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=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EAABA68BCC3; Mon, 21 Nov 2022 02:27:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075081.outbound.protection.outlook.com [40.92.75.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 74DD268BC91 for ; Mon, 21 Nov 2022 02:27:06 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q9q/oZm2SS99B56ah2ibLc4+ADoWKqifuNkJj5Xfe59OFUH1wUfXC+6s0terGT6y/msidTQuG+xgmGXQgQl5f1JpAjhWjHFAcLBbPTe3RET9gkGyGipt/MDzVakzT4qoQF1m+36GpFmMPyX/9cb23whK2VbxGORSRkro0vhFYoGcRD5qyYROSLI6qZYIHdHc52jsdV9FWie1aKrqRgqPGubAbuL2YBjo2EUe5MvDD3oCmW5tK2NffZBHEoHrXT/HGZRJmpp4LxYCo2CP10cifijYymaw+bbbtpwwxJN8f5hCPW4mFeWZ3Ck1wUEOXUs0lKzNjMZXpW9RWVFjjaavMQ== 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=bkktqO3ecxhEujdf+nKiJQRJhU1GOVG9mxg4OfzPKts=; b=YlksgKpjJVan7xVm2XKAAVRFG6ha0R9TrDgpUUxQjQl+m6l8GFv8L/jGGwWttx9dW9InFYMLDkL4MROaRe+WORlVnPPXVG4D9Wdr57E0tDXCorByPS2y2VUxn/gShou++T3ZadcK0y/5eZI0ox/98wnNvgW9YW9MXzhH9KwUlxvCRg8dlDpIP+b9gia6spoNujU+yqKSu9tYuvnN0Flw1J6Xdbe/j3n/EsiweB8R8Qu7GFGF/hlIC0kwCc/GA451PfOAoskMPecrC65rlj6wGG/vuy5UC7IExsPh6oKaTfSpu7wRWVhvK+ZA/Obvnb18qDOz6Km4gBrHHqYBOmu4Eg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bkktqO3ecxhEujdf+nKiJQRJhU1GOVG9mxg4OfzPKts=; b=f1HRpxVo4T+myGE/GfMJgzTVfWtsOPocLFPm0l0l89l8TloBsj6UX4fTmvtvsWfrhUj+9N0dv9gs348bMYxHTWCMkBY1YPGyXiJxC77ZgXOMN2kUgaYdNobVOwiADaDb4eyLKnQZN2Ts8IUJA0uggT2C2ino0O1mKYAK1TEFdzqr/Xy31L907ME0UJTeeCUp3jMrJPxEArfcyLYTyXL92SAAlns1V43lzMWQpBkBIo6paNNL/7vqpMtFn0RKeTQ5+Oo718QdanUJ3JKyhIANjXxEmwTPayOsioUGPCoK+xxGAi7ATVmeF4Uk+4E5eeLZ6A0FQZDLqs/WswKtMBxiDA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by AM8P250MB0198.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:325::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.9; Mon, 21 Nov 2022 00:26:54 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::c37:cabe:316a:60b2%4]) with mapi id 15.20.5834.011; Mon, 21 Nov 2022 00:26:54 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Nov 2022 01:27:00 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [kRJKRcB+i6Dt/hDYB8GX+7FriCNcb98+inBqzUQr0zg=] X-ClientProxiedBy: FR3P281CA0100.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a1::18) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221121002701.2127898-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|AM8P250MB0198:EE_ X-MS-Office365-Filtering-Correlation-Id: 5548ddf5-484c-4c10-76b5-08dacb57172b X-MS-Exchange-SLBlob-MailProps: V85gaVfRD4+BTCB+fx/5Y4R/SiVbuItAmokgVv8ssEBFirsUM1pg07q7QaZYo4lnQBxELuhRObsTaQsohIW9t/m0Inig0Pozv7aU6PEJuBU64aRg4VSWmL95Baf7glpaHEp0906l0Exy8QCyO0PC1YUSifYZOlbGKf2pO1Gno02dZfQByOP1sgQxuKkeMmZ+PR5cmcDZMLyipr60BkqsFa08S2y6iD5Ih46cHMoy+/pHVpsf8nK8g9B3bAuGsRSFkC3ALxc2hG/ibq++PMFyKXkMMP/ROSiBYi/dWxIpkXYMcKABnACKARcUo0D2gOnFzec73S9I9IrYcNefYTm8hPxKjMXk/FCnJVEETbk0Xn8oL7V9jkr1L44ZA2XAc64mK8qXS0bqeNiHq7puA8vFLHK8btIqSNf+N2EuRYf7JoriDiT/tY8bqqBJxxhYQTuEZFLUPnbwe83HGRxzEvXdnMSC0iBVc47GvCdwkB0cXEhjlGSMPvQbYOBltznX3Iy7TSoEwnfPEQ2Yz5frAJnniqASwpUC2cy2+2pQhcc8h4PsYnCYukI8EH+rv+TLJJgdprJplgZvzTLJNdbhS3bTx8bCeD9dGtYKBcPefBmBfubeyYRu42IKKroKUX6LD5aUBNxQ8mp9da9xP8dcmzL2unV3isjpnas4N25hVVNB3eS9xwV5RMwRwzux8os0L5v7DEKYyqgzC6JcyznNqF0yCu/8MHxLflOLtgSOyFKaZ0noF5Yz9FbgvKzEp+NcgQ+XV179bswLYcRdzxqkdMPI28hTSQBR4OGhND1VPhAPjzH+4p6fvabgqzVZBylt1PH+pWhD7YqBlb0s5h/qni3mVg== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EmfXq7jGrmGorTWkPSaigQhXLglqYy5q6URNcAi4a7WOKec1SLJwYK5eR/PRSWIbK7Cfvf4sKiXMuLUARB6MHRLep6UyIS4pqR1MW2IzOGWN2p/Td5wHeMIobVOusVHpaE+DrHDozg5PsmnTrwzoKe1oglV7Oz5K05nNmoTgx68C34hX/Y1GkBOaAEBZyDOCrzrUKNHQaJ2LQA25YxFr+AnPQskqNKNLxszCcbnZ1+eV87rHOgSO9tjgZAKQMXKo5O5vnYCHZDKRxpXhZflDfEnMY6VC35LSfD2RmED+NVtJcAUYAx7ooIFJ5zPi7W9z6mLWFN8GuZn5BtRSbDpFYN7owGn/tn0JXVRVbynTCemv3+NjCG3N7M2Ho8mXlk3n5hEoxOZL+hML97D4ELdnx7HvthSHI4JhR8kg1EVs94m/Pylo6dG2q9nQU2g7fnwC2h3EknFIk5e/C5ui1oIpuWXYr9pN6pl5GC4xuB/lAkZKYd1kmghK+Ct3a0LSkcgvnmItIfiKVCb8/ppA7BGpZxZiwgglgowq/72G5b2chxS3XWUi7br/XurhJ/Ym4LvE6m9nfSGVSla/Qm8v7PuxaoF2M6lgLdWpuxmjisSx0e+g9IDZfG07xC35FXHtPDKOqOfJ7hTKdomVQoHC//gt+VfkSLhw5xmqHzlhtXnsSW4= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 36gIQG+FrWkvs9lvbXp5oRgTGor7WJMG3XbeWbA0+An9Op8Yolf9zWoEYM43QitrvtS9EFECEEwz+9VheusoCYymYxPBOiWRQeNsrznwA2S+5/K5tG2+YgxwJqrZbPPUbHbF2hnfUi9Y5onleDQqx+i2eVlQ7D944T77Tip1+S2nvNrblPHBQ1nFXCtRjRKKHhlXRWuawfPZSDhhh8rlYY4o8668Sqj7bOQ7IVbRo7zjVxqmYSIqoXqAg2P9/ZuxvP04vL85GsZ+KdSe/KjTKewXJD/2JBOr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ant-Network-Message-Id: 5548ddf5-484c-4c10-76b5-08dacb57172b X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2022 00:26:53.9539 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P250MB0198 Subject: [FFmpeg-devel] [PATCH 5/6] swscale/utils: Derive range from YUVJ-pix-fmt only once 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: fSSSXgTZJzeD Currently, it is done once per slice-thread, leading to one warning per slice-thread in case a YUVJ pixel format has been originally used. This also fixes the anomaly that said parameter are only updated for the user-facing context (whose values are retrievable via av_opt_get()) if slice-threading is not in use. Signed-off-by: Andreas Rheinhardt --- libswscale/utils.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libswscale/utils.c b/libswscale/utils.c index cdd89e4b58..5a728afd89 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1277,8 +1277,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, int dstH = c->dstH; int dst_stride = FFALIGN(dstW * sizeof(int16_t) + 66, 16); int flags, cpu_flags; - enum AVPixelFormat srcFormat = c->srcFormat; - enum AVPixelFormat dstFormat = c->dstFormat; + enum AVPixelFormat srcFormat, dstFormat; const AVPixFmtDescriptor *desc_src; const AVPixFmtDescriptor *desc_dst; int ret = 0; @@ -1291,12 +1290,6 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, unscaled = (srcW == dstW && srcH == dstH); - c->srcRange |= handle_jpeg(&c->srcFormat); - c->dstRange |= handle_jpeg(&c->dstFormat); - - if(srcFormat!=c->srcFormat || dstFormat!=c->dstFormat) - av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n"); - if (!c->contrast && !c->saturation && !c->dstFormatBpp) sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], c->srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], @@ -2034,6 +2027,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) { static AVOnce rgb2rgb_once = AV_ONCE_INIT; + enum AVPixelFormat src_format, dst_format; int ret; c->frame_src = av_frame_alloc(); @@ -2044,6 +2038,14 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, if (ff_thread_once(&rgb2rgb_once, ff_sws_rgb2rgb_init) != 0) return AVERROR_UNKNOWN; + src_format = c->srcFormat; + dst_format = c->dstFormat; + c->srcRange |= handle_jpeg(&c->srcFormat); + c->dstRange |= handle_jpeg(&c->dstFormat); + + if (src_format != c->srcFormat || dst_format != c->dstFormat) + av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n"); + if (c->nb_threads != 1) { ret = context_init_threaded(c, srcFilter, dstFilter); if (ret < 0 || c->nb_threads > 1)