From patchwork Tue Jun 28 13:41:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 36509 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8b27:b0:88:1bbf:7fd2 with SMTP id l39csp2661672pzh; Tue, 28 Jun 2022 06:42:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u77m+JNIS22fttbnYyTvv1Hi0X1iyC2+m4cQ5sV8Z5yshWoABxsoz7dhFfZCqfSSuhNwVq X-Received: by 2002:a05:6402:528f:b0:42a:c778:469e with SMTP id en15-20020a056402528f00b0042ac778469emr22978865edb.404.1656423769060; Tue, 28 Jun 2022 06:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656423769; cv=none; d=google.com; s=arc-20160816; b=Me+KchYUmvHGlqOaYHUx3zhl+PAYs+EPae4XIOTGuZKcpmSvAMa5i50idS67GuleOF c1vBYkx51qWXj/mdPXKIr8tjRU3DEae8BenheP2z+wM7B59+MgCA1ALU0bvgg1XdPcOA oy2k16yyg43H0EJalDIAKYRALh/3oSDwmPjiqnIgz77qQkxtUXcd1JOzr47FAvs2/+i9 Bp+ZJJgOwfM1Cpp+slTHrTzjlHqMJIu5W4ClTBiowMh6ECpE1CCyt2eyJgQUMaB75mDZ yG6BFaY+sucE9HTO6rmOX+a/HOTciVhonNWOO6BAoR01IfxYtpwxvvUVLkm+guUzUAAW 8RCA== 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:dkim-signature:delivered-to; bh=rNH8eupX5ug+TgOcqDUBvvZG25xnJu+sAMppxPpOo9M=; b=m/jSNk3lVNxPp4PpYX4w7GnotHdD13Mu8qA67Ub87wx9kJQ8dAORFE9bGXznlXBv1m BzDSh+sgT58EI63CFu7zQdDzl+8lpzQP4sW1jYqDvFHBLNW4/6IXDgmoluBnSLpeYnLR HUozPFuWPUFCAIrzm2W+xsEvcCD6m+1GeaHuC9nDAtS7PNAmv1oPXwrfKMtgGE+dCzWb ohrsR44IDDVrDtEH2A959HLBWNYnhl1uUkshX5RnSpHrU4dhe1XPhDlfR5i6ZvTBu0xO L0L2IVA9nsCHkGmXt86+686lKLadPg3YTkXdQJ5L3G6i3eSPzx1g+M8KaRKEZQxOjEOE AeNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=la823KNf; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a14-20020a170906368e00b006fdd67c8b07si3228662ejc.419.2022.06.28.06.42.48; Tue, 28 Jun 2022 06:42:49 -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=@haasn.xyz header.s=mail header.b=la823KNf; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2EA1C68B912; Tue, 28 Jun 2022 16:42:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2349F68B912 for ; Tue, 28 Jun 2022 16:42:17 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id DB4EE4A5E5; Tue, 28 Jun 2022 15:42:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1656423736; bh=piXmwqSCDE0/pOS0s5u5bHu09a4hNKR8T94bx4HEGgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=la823KNfNVt7bn7qXh0+cvc7NkvRNQRv89fIVSBZoChZR1VSii2i7tBOuFl6RVn8O LtGy6C8JqKGQWz2rj5fB+x8/q1HqnNiAly4zI1vseQOUo0lwJu4bqKpWIzMqTcEUDY Mi9z+5n7G8hwkfLDWNrciARw7eCqITyBXGVRM6og= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Tue, 28 Jun 2022 15:41:08 +0200 Message-Id: <20220628134110.87770-4-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628134110.87770-1-ffmpeg@haasn.xyz> References: <20220628134110.87770-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] avcodec: add API for automatic handling of icc profiles 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: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: VvKN5ilIpkik From: Niklas Haas This functionally already exists, but as pointed out in #9672 and #9673, requiring users to manually include filters is clumsy, error-prone and hard to use together with tools like ffplay. To streamline ICC profile support, add a new AVCodecContext option to globally enable reading and writing ICC profiles, automatically, for all appropriate media types. Note that this commit only includes the new API. The implementation is split off to separate commits for readability. Signed-off-by: Niklas Haas --- doc/APIchanges | 4 ++++ libavcodec/avcodec.h | 10 ++++++++++ libavcodec/version.h | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 20b944933a..b8acf86352 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,10 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-06-28 - xxxxxxxxx - lavc 59.35.100 - avcodec.h + Add the icc_profiles option to AVCodecContext, to enable automatic reading + and writing of embedded ICC profiles in image files. + 2022-06-12 - xxxxxxxxxx - lavf 59.25.100 - avio.h Add avio_vprintf(), similar to avio_printf() but allow to use it from within a function taking a variable argument list as input. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 4dae23d06e..8ee9be22d0 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -979,6 +979,16 @@ typedef struct AVCodecContext { */ enum AVChromaLocation chroma_sample_location; + /** + * Whether to decode/encode ICC profiles. If set, libavcodec will + * generate/parse ICC profiles as appropriate for the type of file. No + * effect on codecs which cannot contain embedded ICC profiles, or when + * compiled without support for lcms2. + * - encoding: Set by user + * - decoding: Set by user + */ + int icc_profiles; + /** * Number of slices. * Indicates number of picture subdivisions. Used for parallelized diff --git a/libavcodec/version.h b/libavcodec/version.h index 0ef6c991f3..1008fead27 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 34 +#define LIBAVCODEC_VERSION_MINOR 35 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \