From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B514C476D6 for ; Fri, 20 Oct 2023 14:02:06 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1CB9D68CAC9; Fri, 20 Oct 2023 17:02:04 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C8B6968C9F3 for ; Fri, 20 Oct 2023 17:01:57 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 8D818240498 for ; Fri, 20 Oct 2023 16:01:57 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id fdg_U6omdxpG for ; Fri, 20 Oct 2023 16:01:56 +0200 (CEST) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id CCCD22400FF for ; Fri, 20 Oct 2023 16:01:56 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id B608A1601B9; Fri, 20 Oct 2023 16:01:56 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: References: <20231013142706.23971-1-ffmpeg@haasn.xyz> <20231013142706.23971-3-ffmpeg@haasn.xyz> Mail-Followup-To: FFmpeg development discussions and patches Date: Fri, 20 Oct 2023 16:01:56 +0200 Message-ID: <169781051672.30698.6955880078531892265@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v2 02/13] avcodec: add extended AVCodec color metadata 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting Andreas Rheinhardt (2023-10-13 19:10:33) > Niklas Haas: > > From: Niklas Haas > > > > This is motivated primarily by a desire for YUVJ removal, which will > > require signalling the supported color ranges as part of the codec > > capabilities. But since we're here anyway, we might as well add all of > > the metadata, which I foresee seeing more use in the future (e.g. > > automatic conversion from HDR to SDR when encoding to formats that don't > > support AVCOL_TRC_SMPTE2084, ...) > > --- > > doc/APIchanges | 4 ++++ > > libavcodec/codec.h | 7 +++++++ > > libavcodec/version.h | 4 ++-- > > 3 files changed, 13 insertions(+), 2 deletions(-) > > > > diff --git a/doc/APIchanges b/doc/APIchanges > > index 9b109e6fa7..f91e855e70 100644 > > --- a/doc/APIchanges > > +++ b/doc/APIchanges > > @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09 > > > > API changes, most recent first: > > > > +2023-10-xx - xxxxxxxxxx - lavc 60.23.100 - avcodec.h > > + Add AVCodec.csps, AVCodec.color_ranges, AVCodec.chroma_locs, AVCodec.primaries, > > + AVCodec.trcs. > > + > > 2023-10-06 - xxxxxxxxxx - lavc 60.30.101 - avcodec.h > > AVCodecContext.coded_side_data may now be used during decoding, to be set > > by user before calling avcodec_open2() for initialization. > > diff --git a/libavcodec/codec.h b/libavcodec/codec.h > > index 8034f1a53c..5bc8f21868 100644 > > --- a/libavcodec/codec.h > > +++ b/libavcodec/codec.h > > @@ -235,6 +235,13 @@ typedef struct AVCodec { > > * Array of supported channel layouts, terminated with a zeroed layout. > > */ > > const AVChannelLayout *ch_layouts; > > + > > + /* Extended colorspace support metadata */ > > + const enum AVColorSpace *csps; ///< array of supported color spaces, or NULL if unknown, array is terminated by AVCOL_SPC_UNSPECIFIED > > + const enum AVColorRange *color_ranges; ///< array of supported color ranges, or NULL if unknown, array is terminated by 0 > > + const enum AVChromaLocation *chroma_locs; ///< array of supported chroma locations, or NULL if unknown, array is terminated by 0 > > + const enum AVColorPrimaries *primaries; ///< array of supported color primaries, or NULL if unknown, array is terminated by 0 > > + const enum AVColorTransferCharacteristic *trcs; ///< array of supported transfer characteristics, or NULL if known, array is terminated by 0 > > } AVCodec; > > > > This design has several drawbacks: > 1. It adds stuff that will only be set by a tiny minority of AVCodec's > to all of them. > 2. It is based around the underlying assumption that the set of > permissible states (tupels) is a cartesian product of a set of color > spaces, a set of color ranges etc. This is wrong: E.g. VP9 disallows > limited-range RGB (it is syntactically impossible to set the color range > when using RGB color space). > 3. I don't see how the MJPEG encoder behaviour where the valid formats > de facto depend upon strictness can be encoded in this way; isn't the > aim to get rid of the necessity of the workaround in ffmpeg cli? > > 1. and 2. suggests using some form of function that returns a list of > supported tupels; Another argument in favor of a function instead of arrays directly in AVCodec is that for some codecs this is determined at runtime. A function would allow us to get rid of FFCodec.init_static_data and make FFCodec const. -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".