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 B83C54243D for ; Sat, 18 Dec 2021 14:15:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 68E6368AE3C; Sat, 18 Dec 2021 16:15:24 +0200 (EET) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E051689734 for ; Sat, 18 Dec 2021 16:15:18 +0200 (EET) Received: from localhost (213-47-68-29.cable.dynamic.surfer.at [213.47.68.29]) (Authenticated sender: michael@niedermayer.cc) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 62213240002 for ; Sat, 18 Dec 2021 14:15:17 +0000 (UTC) Date: Sat, 18 Dec 2021 15:15:16 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20211218141516.GM2829255@pb2> References: <20211216132151.8216-1-jamrial@gmail.com> <92861361-f316-78a5-3c72-1e279d2a9f8c@passwd.hu> <20211217112417.GG2829255@pb2> <5d14188-a4b0-4978-104c-59595fed8137@passwd.hu> <20211218133612.GL2829255@pb2> MIME-Version: 1.0 In-Reply-To: <20211218133612.GL2829255@pb2> Subject: Re: [FFmpeg-devel] [PATCH 000/279 v2] New channel layout API 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: multipart/mixed; boundary="===============0828630076482828842==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0828630076482828842== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="P4tcY4YildKlmgfo" Content-Disposition: inline --P4tcY4YildKlmgfo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 18, 2021 at 02:36:12PM +0100, Michael Niedermayer wrote: > On Fri, Dec 17, 2021 at 07:04:08PM +0100, Marton Balint wrote: > >=20 > >=20 > > On Fri, 17 Dec 2021, Michael Niedermayer wrote: > >=20 > > > On Fri, Dec 17, 2021 at 01:04:19AM +0100, Marton Balint wrote: > > > >=20 > > > >=20 > > > > On Thu, 16 Dec 2021, James Almer wrote: > > > >=20 > > > > > Resending the first two patches only, since this is meant to > > > > > show the implementation of one of the several suggestions made > > > > > in the previous set that need to be discussed and hopefully > > > > > resolved in a call. > > > >=20 > > > > Can you push the full branch somewhere? > > > >=20 > > > > >=20 > > > > > The proposals so far to extend the API to support either custom > > > > > labels for channels are, or some form of extra user information. > > > > >=20 > > > > > - Fixed array of bytes to hold a label. Simple solution, but > > > > > the labels will have a hard limit that can only be extended > > > > > with a major bump. This is what i implemented in this version. > > > > > - "char *name" per channel that the user may allocate and the > > > > > API will manage, duplicate and free. Simple solution, and the > > > > > name can be arbitrarily long, but inefficient (av_strdup() per > > > > > channel with a custom label on layout copy). > > > > > - "const char *name" per channel for compile time constants, or > > > > > that the user may allocate and free. Very efficient, but for > > > > > non compile time strings ensuring they outlive the layout can > > > > > be tricky. > > > > > - Refcounted AVChannelCustom with a dictionary. This can't be > > > > > done with AVBufferRef, so it would require some other form > > > > > of reference counting. And a dictionary may add quite a bit of > > > > > complexity to the API, as you can set anything on them. > > > >=20 > > > > Until we have proper refcounting API we can make the AVBufferRef in > > > > AVChannelLayout a void *, and only allow channel_layout functions to > > > > dereference it as an AVBufferRef. This would mean adding some extra= helper > > > > functions to channel layout, but overall it is not unsolvable. > > > >=20 > > > > The real question is that if you want to use refcounting and add he= lpers to > > > > query / replace per-channel metadata, or you find the idea too heav= y weight > > > > and would like to stick to flat structs. > > >=20 > > > what is the advantage of refcounting for channel metadata ? > > > is it about the used memory, about the reduced need to copy ? > >=20 > > Basicly it is the ability to store per-channel metadata in avdictionary, > > because otherwise it would have to be copyed, and avdictionary is very > > ineffective at copying because of many mallocs. > >=20 > > >=20 > > > what kind of metadata and what size do you expect ? > > > bytes, kilobytes, megabytes, gigabytes per channel ? > >=20 > > Usually, nothing, because most format don't have support for per-channel > > metadata. In some cases it is going to be a couple of textual metadata > > key-value pairs, such as language, label, group, speaker, positon, so 4= -5 > > dynamically allocated string pairs, plus the AVDictionary itself, multi= plied > > by the number of channels in a layout. > >=20 > > >=20 > > > what is the overhead for dynamic allocation and ref counting? > > > that is at which point does it even make sense ? > >=20 > > I don't have exact measurements. It is generally felt that copying > > AVDictionary per-channel is a huge overhead for something as lightweigh= t as > > an audio frame which is a 2-4 kB per channel at most and only a couple = of > > allocs usually not dependant on the number of channels. That's why > > refcounting was proposed. >=20 > I was thinking more at a AVStream / AVCodecParameters level. > How will a demuxer transport such metadata over a AVPacket into a decoder > outputting metadata-filled AVFrames? or is this never needed ? thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Awnsering whenever a program halts or runs forever is On a turing machine, in general impossible (turings halting problem). On any real computer, always possible as a real computer has a finite number of states N, and will either halt in less than N cycles or never halt. --P4tcY4YildKlmgfo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYb3s8AAKCRBhHseHBAsP qx3hAJ940pgxDfIJMEADVKjeTqnY+RZx+QCePn0X373Bqe4+is64swTZgjFixHM= =bCaP -----END PGP SIGNATURE----- --P4tcY4YildKlmgfo-- --===============0828630076482828842== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============0828630076482828842==--