From patchwork Wed May 25 13:32:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Izen X-Patchwork-Id: 34732 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6914:b0:82:6b11:2509 with SMTP id q20csp1072318pzj; Wed, 25 May 2022 06:33:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQq2HlFwUojInKUHWHu98vGly1XmlFeyNpz/h6O3+LTCxnRAPaMdRshsKJ2At6Cmnlik02 X-Received: by 2002:a05:6402:2d6:b0:42a:bb5f:a7d2 with SMTP id b22-20020a05640202d600b0042abb5fa7d2mr33755775edx.96.1653485596774; Wed, 25 May 2022 06:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653485596; cv=none; d=google.com; s=arc-20160816; b=lSNG+ptmD1f73ZUTZ5G5hr/wI+Rt7AtrlZUhfQKfNB6QfnxKxjAUo6Sd8+SCYu1uS1 RnMccfDf3nSvZnsEB4CW4zLF29pl2zJIl9qbSfCY/cN8L3rOgwhDtZivMiyXKNAPMh/4 6u4ze6fcF0w2R+HRHrFJ/iDMg1J5o2u4LBHdyorEaOdc8JbfNAuPX9cSBsXFd6eSXNWc XmeQUoYydAIBGBaaW+s2t8pD8MPIMF9uNfOR4KIy13A3SkmNfThXaeOcSsoAS0uFCxNp phxViPPiMmkuBRRuJrYZejznCSkZ3ehB3ARgXyPt4JV96u2f51XGkB5ZrnIAKtUbS7C5 PIeQ== 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:message-id:date:to:from :dkim-signature:delivered-to; bh=2z+zzpw9H5aMJuEkgZu+ngrPxfceUnGXejkL/lqpE6M=; b=yD9RO38wD5+oafEF4m+zYlLIJV2T2d/Wf64KVsU0XtjL1q6wO9zkM2qUORIrZ7hQrD rs+qpALGVp0K8V8IM/WapYuzs37WRqEeOWzwtqxbLgcgxPeCRlCxNRoc0a7yGdKvI2Ja 1VZW4eOQ9F7K6xmOC4HoCFt094WLylbXG4w5c6HoFK9uXkCLOgNdIDmWmccr3OaClPIa Reb3u+GNZywoBOYcgGLTwea4/KTKemazr3mfsGfg2T9lGXC7/bwrejmQgNKOC83cohtC 7dgl5RbwCC+Lbxw4mW9GVMvqjX9MFV2Cd0azQSMnVe4A9de0m9zJYHD63CE46lXgC7KG 6ysQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=PmlX5gFn; 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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q23-20020a50cc97000000b0042aafa2e87fsi19801945edi.629.2022.05.25.06.33.16; Wed, 25 May 2022 06:33:16 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=PmlX5gFn; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3B97968B50B; Wed, 25 May 2022 16:33:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 61DF568B354 for ; Wed, 25 May 2022 16:33:05 +0300 (EEST) Received: by mail-qk1-f178.google.com with SMTP id j6so17285930qkp.9 for ; Wed, 25 May 2022 06:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6PDCqz7F/56Go8GDifJAlQEflstN2RONcH40qfPxaSo=; b=PmlX5gFnO4RR3RLtEO6Lom88LPf7UEgazs4I+QcCEcmzKlP5pEH7soXuGHYXxbAh0a V7ZKYRCxeOqn9P42BCaDPALoQPqzBcZuOJ0sRtfcdY2eVWuc7lhCn4F/nGqMFECgC/wg HnS5PUHA2Q6x4tCjCgsVwQAXtvrOKzSVLnkGnk8lGihjrcUf/h6wPK9rolLry+a5gwov hn9VUjDhGr4eOZfeEpTXWX9RHApxLUX1GMtdy91gcYh3pQnVGxgiCbhMR4STGIio/SLF be7vmro93H290A14iRLa1E8hfJz3X19LuOefJPDu0bB1s/SAf3obQ8TgIACW+MLrGBA9 VN/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6PDCqz7F/56Go8GDifJAlQEflstN2RONcH40qfPxaSo=; b=vASBFnCWylCzDRzoJbM4VpsUfsVuqApfN2ejc+FuPFrl4Evahn+uR/7ToGby1xL0Oj Cb2YsA/qpyqCPLhx1tZQLMiqtAM83xQk70zUNNlpdOONxodA7cAYeN753bXugdHIo8Cf KlH6PuIGhFeW/d+/YqKBPaBWjICeRC1vXWHvGRaYPuFiKLSh9xSHfgPu2tmQC9WoHsNZ ywB5wUoFlyhDsvx0aa+tGtTGuYuTKsSWUC0Nd6GZmVI/sJcb7Tr56KODTqEOnFJMubSq jMN8XUed/mwldvTxFPE8r7E7MSL/cHBtXJpxkdII2f+WWOem6RetInpflXIWqAF8zTbd ++lw== X-Gm-Message-State: AOAM530XJvzIUOMxw3WC/hwB/7BKmhuqaFqzWl40ieXmmXOdzo9p0mRB SjSqQSIf7HNl92KUwd7w0nRUJmKb41sPZA== X-Received: by 2002:a37:2792:0:b0:6a3:94eb:7df3 with SMTP id n140-20020a372792000000b006a394eb7df3mr10099855qkn.344.1653485583569; Wed, 25 May 2022 06:33:03 -0700 (PDT) Received: from gauss.local (c-68-41-54-207.hsd1.mi.comcast.net. [68.41.54.207]) by smtp.gmail.com with ESMTPSA id x68-20020a376347000000b006a36b7e55b3sm1230093qkb.4.2022.05.25.06.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 May 2022 06:33:03 -0700 (PDT) From: Leo Izen To: ffmpeg-devel@ffmpeg.org Date: Wed, 25 May 2022 09:32:56 -0400 Message-Id: <20220525133257.829611-1-leo.izen@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 0/1] avutil/csp: create public API for colorspace structs 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: Leo Izen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: TlXNPaBfSx2m Changes in v6: - Reordered avutil/csp.h functions to be in alphabetical order, as requested by Lynne on IRC (which also matches the order they occur in csp.c) - Clarified that RGB->YUV matrix works for similar ones too e.g. YCoCg Changes in v5: - Unmark as [WIP], ready for review and merging - rename public functions to namespace them via av_csp_, as requested by Anton K - documented public API using Doxygen comments - remove abs() from denominator in abs_sub_q, assuming denom is positive, as requested by Andreas R Changes in v4: - Provide the patch with an AVCIExy struct so we can discuss its potential pros and cons Changes in v3: - increase precision for AVR() macro to 100k, at haasn's request - add #define AVUTIL_CSP_DENOM 100000 - add 0.5 to the AVR macro definition to get exact values from truncation Leo Izen (1): avutil/csp: create public API for colorspace structs libavfilter/colorspace.c | 143 ++++++++---------------------------- libavfilter/colorspace.h | 31 +------- libavfilter/fflcms2.c | 33 +++++---- libavfilter/fflcms2.h | 4 +- libavfilter/vf_colorspace.c | 37 +++++----- libavfilter/vf_iccdetect.c | 5 +- libavfilter/vf_tonemap.c | 17 +---- libavutil/Makefile | 2 + libavutil/csp.c | 128 ++++++++++++++++++++++++++++++++ libavutil/csp.h | 114 ++++++++++++++++++++++++++++ libavutil/version.h | 2 +- 11 files changed, 325 insertions(+), 191 deletions(-) create mode 100644 libavutil/csp.c create mode 100644 libavutil/csp.h