From patchwork Wed Jun 29 10:12:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 36525 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8b27:b0:88:1bbf:7fd2 with SMTP id l39csp207070pzh; Wed, 29 Jun 2022 03:13:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v+0gl05wNBFMNK9rDet014POZ0XKKNGWLGQ1eFdV+AgcMLUw4OM6QdcScc9Syv2Va6rBnI X-Received: by 2002:a17:907:7603:b0:72a:4271:5cef with SMTP id jx3-20020a170907760300b0072a42715cefmr626563ejc.454.1656497619214; Wed, 29 Jun 2022 03:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656497619; cv=none; d=google.com; s=arc-20160816; b=W1XRY/BBkq6NpMQ4y+hY8a6cuiQYYbN9y0PYwLBJ2NU8aSdfTpo2XD0oseGO0Q6/DV mxi/Fm7TFxJWU45sR2xjoCCdRV8UWdUbaaMEhLeZ1tm7Y9A+Esjt/pGI955oSAke+NLS CpiWTgsAR2Q4YD9WyPajY45VdNy9/H713k2fAzOseeCXVJOpfVJkVL2IhRmg8IRhLy/A PQOQEy6ZStZW5nz0QJJ3kgx5/ZMpMyAWCgafItmHXfzILoTi80uV8g3kplB67lcWOGAC t2cz/npMRr7hLXEyLHkGzQzqPDKRx25NoRX+zcVmKUBOX1J+BS1L+yOsNsH83I6nQZdR 0AyA== 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=hnziGGk5j1KZPL+xwTag8nJ2s84yVylnIiuUg7EIS7kMmc5v2xnTMew6W6nBK2GLLy QferRFV2xYE5vQN1LUBGBuBkn5kfV7kZ6+p/u0i9CVXFI/xpczAf24HJSQdA+wMEOBv5 SXwME0t1lrEzw4sxSdeJMYJnWApGLNa3ofXumjzxpqkuuBho2R/wdBw6S3niD6Jqs9/3 aPFPWqPnO9ltD8WDfuQEIw+JEaYxyB1J3rTLkbTaf3QcFaS34TqmjQHDGE9tHH87M+Pm J+60pHENNXybdKOOjBg1PdGG8gGqcoFlbnTTasU/kKmeivx+1zOLMiXd35g8oZpYcr4l Fm1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b="P+Ws/+1l"; 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 gt43-20020a1709072dab00b007269f2170e3si11122768ejc.754.2022.06.29.03.13.38; Wed, 29 Jun 2022 03:13:39 -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="P+Ws/+1l"; 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 D519868B6B0; Wed, 29 Jun 2022 13:13:06 +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 9202C68B6A0 for ; Wed, 29 Jun 2022 13:12:58 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 4D89B4A7EB; Wed, 29 Jun 2022 12:12:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1656497578; bh=piXmwqSCDE0/pOS0s5u5bHu09a4hNKR8T94bx4HEGgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P+Ws/+1l69BUqz1AUJgDuakAntpKaHJ8tzUKo4WzBxqGqS/oC7XIp5HWPtheh7lqQ WljwO8J1xAOsl71lxWG9A5zGFOIEvp1k/3OABtYujzmSc3k+VWEKfmBZreBPSSZ/0J RHsHaQaYvRqf2yv1FWdQhCABFyfofWdLwS9qyJPc= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Wed, 29 Jun 2022 12:12:48 +0200 Message-Id: <20220629101251.13236-4-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220629101251.13236-1-ffmpeg@haasn.xyz> References: <20220629101251.13236-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 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: nUzmSy6raN83 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, \