From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 4/9] avutil: introduce an Immersive Audio Model and Formats API
Date: Thu, 30 Nov 2023 10:01:16 -0300
Message-ID: <fb271c64-1862-4cf2-bae1-75b4eb84157b@gmail.com> (raw)
In-Reply-To: <170134209102.8914.7650187143643457061@lain.khirnov.net>
On 11/30/2023 8:01 AM, Anton Khirnov wrote:
> Quoting James Almer (2023-11-26 02:28:53)
>> diff --git a/libavutil/iamf.h b/libavutil/iamf.h
>> new file mode 100644
>> index 0000000000..1f4919efdb
>> --- /dev/null
>> +++ b/libavutil/iamf.h
>> +enum AVIAMFAudioElementType {
>> + AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL,
>> + AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE,
>
> 'audio' in the names is redundant and makes already long identifiers
> unnecessarily longer
I'm trying to keep everything namespaced. Audio Elements are not the
only part of the spec to use "element". See Submixes.
>
>> +};
>> +
>> +/**
>> + * @defgroup lavf_iamf_params Parameter Definition
>> + * @{
>> + * Parameters as defined in section 3.6.1 and 3.8
>
> of what?
Should i link https://aomediacodec.github.io/iamf/ somewhere?
>
>> +/**
>> + * Mix Gain Parameter Data as defined in section 3.8.1
>> + *
>> + * Subblocks in AVIAMFParamDefinition use this struct when the value or
>> + * @ref AVIAMFParamDefinition.param_definition_type param_definition_type is
>> + * AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN.
>> + */
>> +typedef struct AVIAMFMixGainParameterData {
>
> Does 'ParameterData' at the end really serve any purpose?
Follow the names as in
https://aomediacodec.github.io/iamf/#obu-parameterblock
I can change it to Parameters or Params, or just remove it.
>
>> + const AVClass *av_class;
>> +
>> + // AVOption enabled fields
>> + unsigned int subblock_duration;
>> + enum AVIAMFAnimationType animation_type;
>> + AVRational start_point_value;
>> + AVRational end_point_value;
>> + AVRational control_point_value;
>> + unsigned int control_point_relative_time;
>
> All these should really be documented. Also, some vertical alignment
> would improve readability.
>
>> +/**
>> + * Parameters as defined in section 3.6.1
>
> This really REALLY needs more documentation.
Yes, was keeping better documentation for last.
>
>> + */
>> +typedef struct AVIAMFParamDefinition {
>> + const AVClass *av_class;
>> +
>> + size_t subblocks_offset;
>> + size_t subblock_size;
>> +
>> + enum AVIAMFParamDefinitionType param_definition_type;
>> + unsigned int num_subblocks;
>
> We use nb_foo generally.
For these public fields i'm keeping the same name as they are in the
spec. I use nb_foo for arrays of structs in the demuxer/muxer patches.
But i can change it if you prefer.
>
>> +AVIAMFParamDefinition *av_iamf_param_definition_alloc(enum AVIAMFParamDefinitionType param_definition_type,
>> + AVDictionary **options,
>> + unsigned int num_subblocks, AVDictionary **subblock_options,
>
> What are the dicts for?
Setting AVOptions for the AVIAMFParamDefinition and each subblock,
respectively.
>
>> + *
>> + * When audio_element_type is AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL, this
>> + * corresponds to an Scalable Channel Layout layer as defined in section 3.6.2.
>> + * For AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE, it is an Ambisonics channel
>> + * layout as defined in section 3.6.3
>> + */
>> +typedef struct AVIAMFLayer {
>> + const AVClass *av_class;
>> +
>> + // AVOption enabled fields
>> + AVChannelLayout ch_layout;
>> +
>> + unsigned int recon_gain_is_present;
>
> Every time you dedicate 4 bytes to storing one bit, God kills a kitten.
I'll shave a few bytes.
>
>> + /**
>> + * Output gain flags as defined in section 3.6.2
>
> It would be really really nice if people could understand the struct
> contents without some external document.
>
>> + * This field is defined only if audio_element_type is
>
> presumably the parent's audio_element_type
Yes, forgot the @ref. Good catch.
>
>> + * AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL, must be 0 otherwise.
>> + */
>> + unsigned int output_gain_flags;
>> + /**
>> + * Output gain as defined in section 3.6.2
>> + *
>> + * Must be 0 if @ref output_gain_flags is 0.
>> + */
>> + AVRational output_gain;
>> + /**
>> + * Ambisonics mode as defined in section 3.6.3
>> + *
>> + * This field is defined only if audio_element_type is
>> + * AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE, must be 0 otherwise.
>> + *
>> + * If 0, channel_mapping is defined implicitly (Ambisonic Order)
>> + * or explicitly (Custom Order with ambi channels) in @ref ch_layout.
>> + * If 1, @ref demixing_matrix must be set.
>> + */
>> + enum AVIAMFAmbisonicsMode ambisonics_mode;
>> +
>> + // End of AVOption enabled fields
>
> What purpose does this comment serve?
It was a reminder for me of what could be set through AVOptions. I'll
remove it.
>
>> + /**
>> + * Demixing matrix as defined in section 3.6.3
>> + *
>> + * Set only if @ref ambisonics_mode == 1, must be NULL otherwise.
>> + */
>> + AVRational *demixing_matrix;
>
> Who sets this?
lavf for demuxing and the user for muxing, as usual. Will mention it.
>
>> +typedef struct AVIAMFAudioElement {
>> + const AVClass *av_class;
>> +
>> + AVIAMFLayer **layers;
>> + /**
>> + * Number of layers, or channel groups, in the Audio Element.
>> + * For audio_element_type AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE, there
>> + * may be exactly 1.
>> + *
>> + * Set by av_iamf_audio_element_add_layer(), must not be
>> + * modified by any other code.
>> + */
>> + unsigned int num_layers;
>> +
>> + unsigned int codec_config_id;
>
> ???
Ah, good catch. Need to remove this and adapt the muxer.
>
>> +int av_iamf_audio_element_add_layer(AVIAMFAudioElement *audio_element, AVDictionary **options);
>
> I would much prefer to have the caller call av_opt_set* manually rather
> than sprinkle AVDictionary function arguments everywhere.
> Do note that their usage in lavc and lavf APIs is out of necessity, not
> because it's very pretty.
Alright, will try to remove it from most of these.
_______________________________________________
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".
next prev parent reply other threads:[~2023-11-30 13:01 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-26 1:28 [FFmpeg-devel] [PATCH v5 0/9] avformat: introduce AVStreamGroup James Almer
2023-11-26 1:28 ` [FFmpeg-devel] [PATCH 1/9] avutil/mem: add av_dynarray2_add_nofree James Almer
2023-11-30 10:39 ` Anton Khirnov
2023-11-30 13:10 ` James Almer
2023-11-26 1:28 ` [FFmpeg-devel] [PATCH 2/9] avcodec/get_bits: add get_leb() James Almer
2023-11-26 13:40 ` Leo Izen
2023-11-26 13:43 ` James Almer
2023-11-30 10:40 ` Anton Khirnov
2023-11-30 12:49 ` Paul B Mahol
2023-11-30 13:08 ` James Almer
2023-11-26 1:28 ` [FFmpeg-devel] [PATCH 3/9] avformat/aviobuf: add ffio_read_leb() and ffio_write_leb() James Almer
2023-11-26 1:28 ` [FFmpeg-devel] [PATCH 4/9] avutil: introduce an Immersive Audio Model and Formats API James Almer
2023-11-30 11:01 ` Anton Khirnov
2023-11-30 13:01 ` James Almer [this message]
2023-11-30 13:47 ` Anton Khirnov
2023-11-30 14:27 ` James Almer
2023-11-30 14:30 ` Anton Khirnov
2023-11-26 1:28 ` [FFmpeg-devel] [PATCH 5/9] avformat: introduce AVStreamGroup James Almer
2023-11-26 1:28 ` [FFmpeg-devel] [PATCH 6/9] ffmpeg: add support for muxing AVStreamGroups James Almer
2023-11-26 1:28 ` [FFmpeg-devel] [PATCH 7/9] avcodec/packet: add IAMF Parameters side data types James Almer
2023-11-26 1:28 ` [FFmpeg-devel] [PATCH 8/9] avformat: Immersive Audio Model and Formats demuxer James Almer
2023-11-26 1:28 ` [FFmpeg-devel] [PATCH 9/9] avformat: Immersive Audio Model and Formats muxer James Almer
2023-11-27 18:43 ` [FFmpeg-devel] [PATCH 10/13] avcodec: add an Immersive Audio Model and Formats frame split bsf James Almer
2023-11-27 18:43 ` [FFmpeg-devel] [PATCH 11/13] avformat/demux: support inserting bitstream filters in demuxing scenarios James Almer
2023-11-28 4:00 ` Gyan Doshi
2023-11-29 21:55 ` James Almer
2023-11-30 4:01 ` Gyan Doshi
2023-11-27 18:43 ` [FFmpeg-devel] [PATCH 12/13] avformat/mov: make MOVStreamContext refcounted James Almer
2023-11-27 18:43 ` [FFmpeg-devel] [PATCH 13/13] avformat/mov: add support for Immersive Audio Model and Formats in ISOBMFF James Almer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb271c64-1862-4cf2-bae1-75b4eb84157b@gmail.com \
--to=jamrial@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git