From patchwork Mon Mar 18 16:54:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 47180 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1139475pzb; Mon, 18 Mar 2024 09:57:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXeKOJ67nzZrO2u9wNvYmgiE7xx2qTWSzTXoKSPXB1XRmVSgFA0Zw1p1uXkQVZ/+5fBO8uchT4DUrR0beFZonv53poCoZs5Fx+CSw== X-Google-Smtp-Source: AGHT+IEoAFATe1qPq8V6VVoOfaZ1E0iEcEWJdIl9znRvITbbTRQeaiDX9sUEkyQm5ebcEnkP4fRI X-Received: by 2002:a05:6402:388a:b0:56b:8452:7690 with SMTP id fd10-20020a056402388a00b0056b84527690mr770056edb.3.1710781029801; Mon, 18 Mar 2024 09:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710781029; cv=none; d=google.com; s=arc-20160816; b=pzS/giTX1sRjH/286HBykzb2Td8e/K3zE2VpNMnZaWOtDWbOPpD7BUaZneZCUhEGxo EwNmatL3wc5VAVd4cjy3mTgNH//RA4jbX2e4t28fpVQvWd8oM7Dyt6O+b6DuoF260TBS olGLAUatP+VZq8Ef/hhrwaXUDAaxlyXATutYQqX4IwotXgiianyqVZ+G91UX4baYi9Fy E1+pvk943kt/oOJQH4oquT2bXvg9EwVeJgDGwFr/MYxeWjueZIq4fztDdTmTCbpHINJK Bh4ysawoTZrnWILK9rkEmo5xQd+O271vdv6Jnc0JuvzMan+yN565RHDyXY2uVzXAHKSG /gYw== 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=pyNQW9LwkuRt89gG7xUV1Thni35aZ6zqfXjFHAT+0JQ=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=Sff3GE7r3s3r/HC8C/vS8cshLGSs3rFg+bZntwABGWSOM5Ko+L70lhf7s5CODGQl/x N0I9Oy+mgCq9TYJrvVeNA+J8m6kAgcmzVajtogup/DGl1S9mnAB2B0mG3853Isy2Sdkk NJvBILfalWLOu2h6CtXUYreaIEFGbtwDx+QjOEJZvE1FV+Xe4xtZMkac6wjoymsDlRNu 1Et0RjI8Fg0KQwCS1CFmSKCzsV197R3bVm9v+MlTugL4+gkKFgXaPp9l3/IvlKTj2Uu7 soqThHyA99MQMiCctV0HoSW2m8gsoCcfKZoK1cXSiOvrrchXOf0vzRPY7f/9Nf0UkPzv z5qQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=MSG7VkJq; 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 r18-20020a056402235200b00568ab2bcafdsi3852814eda.359.2024.03.18.09.57.08; Mon, 18 Mar 2024 09:57:09 -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=MSG7VkJq; 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 7F20268D311; Mon, 18 Mar 2024 18:57:04 +0200 (EET) 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 CA06C68D263 for ; Mon, 18 Mar 2024 18:56:57 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1710781017; bh=Nu1UiSIm5pZnIpWaZpi7gCXzExQRLxaU73mP1jZjyf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MSG7VkJq9FNkd78eOYaeAxZIce5jlkQ3bL8IfSLn0mnli2Rl/XnyOf75pOOKJQ1xE r2mXRgk03kvJ5onzUHREapLLI8BBGhsiCfKvYN+14nxauhPCwfEO/UWF4DNH1GKQG4 0Cpcij3KZf8BwLozk5eldadZUWi1AL7fDN7sDXsM= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id F1E6A42922; Mon, 18 Mar 2024 17:56:56 +0100 (CET) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 17:54:09 +0100 Message-ID: <20240318165651.75520-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240318165651.75520-1-ffmpeg@haasn.xyz> References: <20240318165651.75520-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 01/13] avutil/film_grain_params: add metadata to common struct 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: SmzoD4XCyuXl From: Niklas Haas This is needed for AV1 film grain as well, when using AFGS1 streams. Also add extra width/height and subsampling information, which AFGS1 cares about, as part of the same API bump. (And in principle, H274 should also expose this information, since it is needed downstream to correctly adjust the chroma grain frequency to the subsampling ratio) Deprecate the equivalent H274-exclusive fields. To avoid breaking ABI, add the new fields after the union; but with enough of a paper trail to hopefully re-order them on the next bump. --- doc/APIchanges | 6 ++++ libavutil/film_grain_params.h | 57 +++++++++++++++++++++++++++++++++-- libavutil/version.h | 3 +- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index a44c8e4f108..256d9c7757a 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,12 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-03-xx - xxxxxxxxxx - lavu 59.3.100 - film_grain_params.h + Add AVFilmGrainParams.color_range, color_primaries, color_trc, color_space, + width, height, subsampling_x, subsampling_y, bit_depth_luma and + bit_depth_chroma. Deprecate the corresponding fields from + AVFilmGrainH274Params. + 2024-03-xx - xxxxxxxxxx - lavu 59.2.100 - channel_layout.h Add AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL. diff --git a/libavutil/film_grain_params.h b/libavutil/film_grain_params.h index f3bd0a4a6a3..a9f243351c9 100644 --- a/libavutil/film_grain_params.h +++ b/libavutil/film_grain_params.h @@ -136,20 +136,42 @@ typedef struct AVFilmGrainH274Params { */ int model_id; - /** - * Specifies the bit depth used for the luma component. - */ +#if FF_API_H274_FILM_GRAIN_VCS + /** + * TODO: On this ABI bump, please also re-order the fields in + * AVFilmGrainParams (see below) + */ + + /** + * Specifies the bit depth used for the luma component. + * + * @deprecated use AVFilmGrainParams.bit_depth_luma. + */ + attribute_deprecated int bit_depth_luma; /** * Specifies the bit depth used for the chroma components. + * + * @deprecated use AVFilmGrainParams.bit_depth_chroma. */ + attribute_deprecated int bit_depth_chroma; + /** + * Specifies the video signal characteristics. + * + * @deprecated use AVFilmGrainParams.color_{range,primaries,trc,space}. + */ + attribute_deprecated enum AVColorRange color_range; + attribute_deprecated enum AVColorPrimaries color_primaries; + attribute_deprecated enum AVColorTransferCharacteristic color_trc; + attribute_deprecated enum AVColorSpace color_space; +#endif /** * Specifies the blending mode used to blend the simulated film grain @@ -231,11 +253,40 @@ typedef struct AVFilmGrainParams { * Additional fields may be added both here and in any structure included. * If a codec's film grain structure differs slightly over another * codec's, fields within may change meaning depending on the type. + * + * TODO: Move this to the end of the structure, at the next ABI bump. */ union { AVFilmGrainAOMParams aom; AVFilmGrainH274Params h274; } codec; + + /** + * Intended display resolution. May be 0 if the codec does not specify + * any restrictions. + */ + + int width, height; + + /** + * Intended subsampling ratio, or 0 for luma-only streams. + */ + int subsampling_x, subsampling_y; + + /** + * Intended video signal characteristics. + */ + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace color_space; + + /** + * Intended bit depth, or 0 for unknown/unspecified. + */ + int bit_depth_luma; + int bit_depth_chroma; + } AVFilmGrainParams; /** diff --git a/libavutil/version.h b/libavutil/version.h index 57cad02ec0a..23351316b58 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 59 -#define LIBAVUTIL_VERSION_MINOR 2 +#define LIBAVUTIL_VERSION_MINOR 3 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -111,6 +111,7 @@ #define FF_API_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 60) #define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 60) #define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60) +#define FF_API_H274_FILM_GRAIN_VCS (LIBAVUTIL_VERSION_MAJOR < 60) /** * @}