FFmpeg
Loading...
Searching...
No Matches
iamf.c
Go to the documentation of this file.
1/*
2 * Immersive Audio Model and Formats helper functions and defines
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <limits.h>
22#include <stddef.h>
23#include <stdint.h>
24
25#include "avassert.h"
26#include "error.h"
27#include "iamf.h"
28#include "log.h"
29#include "mem.h"
30#include "opt.h"
31
32#define IAMF_ADD_FUNC_TEMPLATE(parent_type, parent_name, child_type, child_name, suffix) \
33child_type *av_iamf_ ## parent_name ## _add_ ## child_name(parent_type *parent_name) \
34{ \
35 child_type **child_name ## suffix, *child_name; \
36 \
37 if (parent_name->nb_## child_name ## suffix == UINT_MAX) \
38 return NULL; \
39 \
40 child_name ## suffix = av_realloc_array(parent_name->child_name ## suffix, \
41 parent_name->nb_## child_name ## suffix + 1, \
42 sizeof(*parent_name->child_name ## suffix)); \
43 if (!child_name ## suffix) \
44 return NULL; \
45 \
46 parent_name->child_name ## suffix = child_name ## suffix; \
47 \
48 child_name = parent_name->child_name ## suffix[parent_name->nb_## child_name ## suffix] \
49 = av_mallocz(sizeof(*child_name)); \
50 if (!child_name) \
51 return NULL; \
52 \
53 child_name->av_class = &child_name ## _class; \
54 av_opt_set_defaults(child_name); \
55 parent_name->nb_## child_name ## suffix++; \
56 \
57 return child_name; \
58}
59
60#define FLAGS AV_OPT_FLAG_ENCODING_PARAM
61
62//
63// Param Definition
64//
65#define OFFSET(x) offsetof(AVIAMFMixGain, x)
66static const AVOption mix_gain_options[] = {
67 { "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), AV_OPT_TYPE_UINT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
68 { "animation_type", "set animation_type", OFFSET(animation_type), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, 2, FLAGS },
69 { "start_point_value", "set start_point_value", OFFSET(start_point_value), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
70 { "end_point_value", "set end_point_value", OFFSET(end_point_value), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
71 { "control_point_value", "set control_point_value", OFFSET(control_point_value), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
72 { "control_point_relative_time", "set control_point_relative_time", OFFSET(control_point_relative_time), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0.0, 1.0, FLAGS },
73 { NULL },
74};
75
76static const AVClass mix_gain_class = {
77 .class_name = "AVIAMFMixGain",
78 .item_name = av_default_item_name,
79 .version = LIBAVUTIL_VERSION_INT,
80 .option = mix_gain_options,
81};
82
83#undef OFFSET
84#define OFFSET(x) offsetof(AVIAMFDemixingInfo, x)
86 { "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), AV_OPT_TYPE_UINT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
87 { "dmixp_mode", "set dmixp_mode", OFFSET(dmixp_mode), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, 6, FLAGS },
88 { NULL },
89};
90
92 .class_name = "AVIAMFDemixingInfo",
93 .item_name = av_default_item_name,
94 .version = LIBAVUTIL_VERSION_INT,
95 .option = demixing_info_options,
96};
97
98#undef OFFSET
99#define OFFSET(x) offsetof(AVIAMFReconGain, x)
100static const AVOption recon_gain_options[] = {
101 { "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), AV_OPT_TYPE_UINT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
102 { NULL },
103};
104
105static const AVClass recon_gain_class = {
106 .class_name = "AVIAMFReconGain",
107 .item_name = av_default_item_name,
108 .version = LIBAVUTIL_VERSION_INT,
109 .option = recon_gain_options,
110};
111
112#undef OFFSET
113#define OFFSET(x) offsetof(AVIAMFParamDefinition, x)
115 { "parameter_id", "set parameter_id", OFFSET(parameter_id), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
116 { "parameter_rate", "set parameter_rate", OFFSET(parameter_rate), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
117 { "duration", "set duration", OFFSET(duration), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
118 { "constant_subblock_duration", "set constant_subblock_duration", OFFSET(constant_subblock_duration), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
119 { NULL },
120};
121
122static const AVClass *param_definition_child_iterate(void **opaque)
123{
124 uintptr_t i = (uintptr_t)*opaque;
125 const AVClass *ret = NULL;
126
127 switch(i) {
129 ret = &mix_gain_class;
130 break;
132 ret = &demixing_info_class;
133 break;
135 ret = &recon_gain_class;
136 break;
137 default:
138 break;
139 }
140
141 if (ret)
142 *opaque = (void*)(i + 1);
143 return ret;
144}
145
147 .class_name = "AVIAMFParamDefinition",
148 .item_name = av_default_item_name,
149 .version = LIBAVUTIL_VERSION_INT,
150 .option = param_definition_options,
151 .child_class_iterate = param_definition_child_iterate,
152};
153
158
160 unsigned int nb_subblocks, size_t *out_size)
161{
162
163 struct MixGainStruct {
166 };
167 struct DemixStruct {
170 };
171 struct ReconGainStruct {
174 };
175 size_t subblocks_offset, subblock_size;
176 size_t size;
178
179 switch (type) {
181 subblocks_offset = offsetof(struct MixGainStruct, m);
182 subblock_size = sizeof(AVIAMFMixGain);
183 break;
185 subblocks_offset = offsetof(struct DemixStruct, d);
186 subblock_size = sizeof(AVIAMFDemixingInfo);
187 break;
189 subblocks_offset = offsetof(struct ReconGainStruct, r);
190 subblock_size = sizeof(AVIAMFReconGain);
191 break;
192 default:
193 return NULL;
194 }
195
196 size = subblocks_offset;
197 if (nb_subblocks > (SIZE_MAX - size) / subblock_size)
198 return NULL;
199 size += subblock_size * nb_subblocks;
200
201 par = av_mallocz(size);
202 if (!par)
203 return NULL;
204
207
208 par->type = type;
209 par->nb_subblocks = nb_subblocks;
210 par->subblock_size = subblock_size;
211 par->subblocks_offset = subblocks_offset;
212
213 for (int i = 0; i < nb_subblocks; i++) {
214 void *subblock = av_iamf_param_definition_get_subblock(par, i);
215
216 switch (type) {
218 ((AVIAMFMixGain *)subblock)->av_class = &mix_gain_class;
219 break;
221 ((AVIAMFDemixingInfo *)subblock)->av_class = &demixing_info_class;
222 break;
224 ((AVIAMFReconGain *)subblock)->av_class = &recon_gain_class;
225 break;
226 default:
227 av_assert0(0);
228 }
229 }
230
231 if (out_size)
232 *out_size = size;
233
234 return par;
235}
236
237//
238// Audio Element
239//
240static const AVOptionArrayDef demixing_matrix_def = { .size_max = (255 + 255) * 255, .sep = '|' };
241
242#undef OFFSET
243#define OFFSET(x) offsetof(AVIAMFLayer, x)
244static const AVOption layer_options[] = {
245 { "ch_layout", "set ch_layout", OFFSET(ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL }, 0, 0, FLAGS },
246 { "flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS,
247 {.i64 = 0 }, 0, AV_IAMF_LAYER_FLAG_RECON_GAIN, FLAGS, .unit = "flags" },
248 {"recon_gain", "Recon gain is present", 0, AV_OPT_TYPE_CONST,
249 {.i64 = AV_IAMF_LAYER_FLAG_RECON_GAIN }, INT_MIN, INT_MAX, FLAGS, .unit = "flags"},
250 { "output_gain_flags", "set output_gain_flags", OFFSET(output_gain_flags), AV_OPT_TYPE_FLAGS,
251 {.i64 = 0 }, 0, (1 << 6) - 1, FLAGS, .unit = "output_gain_flags" },
252 {"FL", "Left channel", 0, AV_OPT_TYPE_CONST,
253 {.i64 = 1 << 5 }, INT_MIN, INT_MAX, FLAGS, .unit = "output_gain_flags"},
254 {"FR", "Right channel", 0, AV_OPT_TYPE_CONST,
255 {.i64 = 1 << 4 }, INT_MIN, INT_MAX, FLAGS, .unit = "output_gain_flags"},
256 {"BL", "Left surround channel", 0, AV_OPT_TYPE_CONST,
257 {.i64 = 1 << 3 }, INT_MIN, INT_MAX, FLAGS, .unit = "output_gain_flags"},
258 {"BR", "Right surround channel", 0, AV_OPT_TYPE_CONST,
259 {.i64 = 1 << 2 }, INT_MIN, INT_MAX, FLAGS, .unit = "output_gain_flags"},
260 {"TFL", "Left top front channel", 0, AV_OPT_TYPE_CONST,
261 {.i64 = 1 << 1 }, INT_MIN, INT_MAX, FLAGS, .unit = "output_gain_flags"},
262 {"TFR", "Right top front channel", 0, AV_OPT_TYPE_CONST,
263 {.i64 = 1 << 0 }, INT_MIN, INT_MAX, FLAGS, .unit = "output_gain_flags"},
264 { "output_gain", "set output_gain", OFFSET(output_gain), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
265 { "ambisonics_mode", "set ambisonics_mode", OFFSET(ambisonics_mode), AV_OPT_TYPE_INT,
268 { "mono", NULL, 0, AV_OPT_TYPE_CONST,
269 { .i64 = AV_IAMF_AMBISONICS_MODE_MONO }, .unit = "ambisonics_mode" },
270 { "projection", NULL, 0, AV_OPT_TYPE_CONST,
271 { .i64 = AV_IAMF_AMBISONICS_MODE_PROJECTION }, .unit = "ambisonics_mode" },
272 { "demixing_matrix", "set demixing_matrix", OFFSET(demixing_matrix), AV_OPT_TYPE_RATIONAL | AV_OPT_TYPE_FLAG_ARRAY,
273 { .arr = &demixing_matrix_def }, -1.0, 1.0, FLAGS },
274 { NULL },
275};
276
277static const AVClass layer_class = {
278 .class_name = "AVIAMFLayer",
279 .item_name = av_default_item_name,
280 .version = LIBAVUTIL_VERSION_INT,
281 .option = layer_options,
282};
283
284#undef OFFSET
285#define OFFSET(x) offsetof(AVIAMFAudioElement, x)
287 { "audio_element_type", "set audio_element_type", OFFSET(audio_element_type), AV_OPT_TYPE_INT,
290 { "channel", NULL, 0, AV_OPT_TYPE_CONST,
291 { .i64 = AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL }, .unit = "audio_element_type" },
292 { "scene", NULL, 0, AV_OPT_TYPE_CONST,
293 { .i64 = AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE }, .unit = "audio_element_type" },
294 { "default_w", "set default_w", OFFSET(default_w), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, 10, FLAGS },
295 { NULL },
296};
297
298static const AVClass *audio_element_child_iterate(void **opaque)
299{
300 uintptr_t i = (uintptr_t)*opaque;
301 const AVClass *ret = NULL;
302
303 if (i)
304 ret = &layer_class;
305
306 if (ret)
307 *opaque = (void*)(i + 1);
308 return ret;
309}
310
312 .class_name = "AVIAMFAudioElement",
313 .item_name = av_default_item_name,
314 .version = LIBAVUTIL_VERSION_INT,
315 .option = audio_element_options,
316 .child_class_iterate = audio_element_child_iterate,
317};
318
323
325{
326 AVIAMFAudioElement *audio_element = av_mallocz(sizeof(*audio_element));
327
328 if (audio_element) {
329 audio_element->av_class = &audio_element_class;
330 av_opt_set_defaults(audio_element);
331 }
332
333 return audio_element;
334}
335
337
339{
340 AVIAMFAudioElement *audio_element = *paudio_element;
341
342 if (!audio_element)
343 return;
344
345 for (int i = 0; i < audio_element->nb_layers; i++) {
346 AVIAMFLayer *layer = audio_element->layers[i];
347 av_opt_free(layer);
348 av_free(layer->demixing_matrix);
349 av_free(layer);
350 }
351 av_free(audio_element->layers);
352
353 av_free(audio_element->demixing_info);
354 av_free(audio_element->recon_gain_info);
355 av_freep(paudio_element);
356}
357
358//
359// Mix Presentation
360//
361#undef OFFSET
362#define OFFSET(x) offsetof(AVIAMFSubmixElement, x)
364 { "headphones_rendering_mode", "Headphones rendering mode", OFFSET(headphones_rendering_mode), AV_OPT_TYPE_INT,
366 AV_IAMF_HEADPHONES_MODE_STEREO, AV_IAMF_HEADPHONES_MODE_BINAURAL, FLAGS, .unit = "headphones_rendering_mode" },
367 { "stereo", NULL, 0, AV_OPT_TYPE_CONST,
368 { .i64 = AV_IAMF_HEADPHONES_MODE_STEREO }, .unit = "headphones_rendering_mode" },
369 { "binaural", NULL, 0, AV_OPT_TYPE_CONST,
370 { .i64 = AV_IAMF_HEADPHONES_MODE_BINAURAL }, .unit = "headphones_rendering_mode" },
371 { "default_mix_gain", "Default mix gain", OFFSET(default_mix_gain), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
372 { "annotations", "Annotations", OFFSET(annotations), AV_OPT_TYPE_DICT, { .str = NULL }, 0, 0, FLAGS },
373 { NULL },
374};
375
376static void *submix_element_child_next(void *obj, void *prev)
377{
378 AVIAMFSubmixElement *submix_element = obj;
379 if (!prev)
380 return submix_element->element_mix_config;
381
382 return NULL;
383}
384
385static const AVClass *submix_element_child_iterate(void **opaque)
386{
387 uintptr_t i = (uintptr_t)*opaque;
388 const AVClass *ret = NULL;
389
390 if (i)
392
393 if (ret)
394 *opaque = (void*)(i + 1);
395 return ret;
396}
397
398static const AVClass element_class = {
399 .class_name = "AVIAMFSubmixElement",
400 .item_name = av_default_item_name,
401 .version = LIBAVUTIL_VERSION_INT,
402 .option = submix_element_options,
403 .child_next = submix_element_child_next,
404 .child_class_iterate = submix_element_child_iterate,
405};
406
408
409#undef OFFSET
410#define OFFSET(x) offsetof(AVIAMFSubmixLayout, x)
412 { "layout_type", "Layout type", OFFSET(layout_type), AV_OPT_TYPE_INT,
415 { "loudspeakers", NULL, 0, AV_OPT_TYPE_CONST,
416 { .i64 = AV_IAMF_SUBMIX_LAYOUT_TYPE_LOUDSPEAKERS }, .unit = "layout_type" },
417 { "binaural", NULL, 0, AV_OPT_TYPE_CONST,
418 { .i64 = AV_IAMF_SUBMIX_LAYOUT_TYPE_BINAURAL }, .unit = "layout_type" },
419 { "sound_system", "Sound System", OFFSET(sound_system), AV_OPT_TYPE_CHLAYOUT, { .str = NULL }, 0, 0, FLAGS },
420 { "integrated_loudness", "Integrated loudness", OFFSET(integrated_loudness), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
421 { "digital_peak", "Digital peak", OFFSET(digital_peak), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
422 { "true_peak", "True peak", OFFSET(true_peak), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
423 { "dialog_anchored_loudness", "Anchored loudness (Dialog)", OFFSET(dialogue_anchored_loudness), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
424 { "album_anchored_loudness", "Anchored loudness (Album)", OFFSET(album_anchored_loudness), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
425 { NULL },
426};
427
428static const AVClass layout_class = {
429 .class_name = "AVIAMFSubmixLayout",
430 .item_name = av_default_item_name,
431 .version = LIBAVUTIL_VERSION_INT,
432 .option = submix_layout_options,
433};
434
436
437#undef OFFSET
438#define OFFSET(x) offsetof(AVIAMFSubmix, x)
440 { "default_mix_gain", "Default mix gain", OFFSET(default_mix_gain), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
441 { NULL },
442};
443
444static void *submix_presentation_child_next(void *obj, void *prev)
445{
446 AVIAMFSubmix *sub_mix = obj;
447 if (!prev)
448 return sub_mix->output_mix_config;
449
450 return NULL;
451}
452
453static const AVClass *submix_presentation_child_iterate(void **opaque)
454{
455 uintptr_t i = (uintptr_t)*opaque;
456 const AVClass *ret = NULL;
457
458 switch(i) {
459 case 0:
460 ret = &element_class;
461 break;
462 case 1:
463 ret = &layout_class;
464 break;
465 case 2:
467 break;
468 default:
469 break;
470 }
471
472 if (ret)
473 *opaque = (void*)(i + 1);
474 return ret;
475}
476
477static const AVClass submix_class = {
478 .class_name = "AVIAMFSubmix",
479 .item_name = av_default_item_name,
480 .version = LIBAVUTIL_VERSION_INT,
482 .child_next = submix_presentation_child_next,
483 .child_class_iterate = submix_presentation_child_iterate,
484};
485
486#undef OFFSET
487#define OFFSET(x) offsetof(AVIAMFMixPresentation, x)
489 { "annotations", "set annotations", OFFSET(annotations), AV_OPT_TYPE_DICT, {.str = NULL }, 0, 0, FLAGS },
490 { NULL },
491};
492
493#undef OFFSET
494#undef FLAGS
495
496static const AVClass *mix_presentation_child_iterate(void **opaque)
497{
498 uintptr_t i = (uintptr_t)*opaque;
499 const AVClass *ret = NULL;
500
501 if (i)
502 ret = &submix_class;
503
504 if (ret)
505 *opaque = (void*)(i + 1);
506 return ret;
507}
508
510 .class_name = "AVIAMFMixPresentation",
511 .item_name = av_default_item_name,
512 .version = LIBAVUTIL_VERSION_INT,
513 .option = mix_presentation_options,
514 .child_class_iterate = mix_presentation_child_iterate,
515};
516
521
523{
524 AVIAMFMixPresentation *mix_presentation = av_mallocz(sizeof(*mix_presentation));
525
526 if (mix_presentation) {
527 mix_presentation->av_class = &mix_presentation_class;
528 av_opt_set_defaults(mix_presentation);
529 }
530
531 return mix_presentation;
532}
533
534IAMF_ADD_FUNC_TEMPLATE(AVIAMFMixPresentation, mix_presentation, AVIAMFSubmix, submix, es)
535
537{
538 AVIAMFMixPresentation *mix_presentation = *pmix_presentation;
539
540 if (!mix_presentation)
541 return;
542
543 for (int i = 0; i < mix_presentation->nb_submixes; i++) {
544 AVIAMFSubmix *sub_mix = mix_presentation->submixes[i];
545 for (int j = 0; j < sub_mix->nb_elements; j++) {
546 AVIAMFSubmixElement *submix_element = sub_mix->elements[j];
547 av_opt_free(submix_element);
548 av_free(submix_element->element_mix_config);
549 av_free(submix_element);
550 }
551 av_free(sub_mix->elements);
552 for (int j = 0; j < sub_mix->nb_layouts; j++) {
553 AVIAMFSubmixLayout *submix_layout = sub_mix->layouts[j];
554 av_opt_free(submix_layout);
555 av_free(submix_layout);
556 }
557 av_free(sub_mix->layouts);
558 av_free(sub_mix->output_mix_config);
559 av_free(sub_mix);
560 }
561 av_opt_free(mix_presentation);
562 av_free(mix_presentation->submixes);
563
564 av_freep(pmix_presentation);
565}
static double output_gain(double lin_slope, double ratio, double thres, double knee, double knee_start, double knee_stop, double range, int mode)
Definition af_agate.c:120
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
error code definitions
static int64_t duration
Definition ffplay.c:330
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_FLAG_ARRAY
May be combined with another regular option type to declare an array option.
Definition opt.h:345
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
Definition opt.h:279
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition opt.h:254
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
Definition opt.h:330
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
Definition opt.h:289
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
Definition opt.h:334
const AVClass * av_iamf_audio_element_get_class(void)
Definition iamf.c:319
#define AV_IAMF_LAYER_FLAG_RECON_GAIN
Recon gain information for the layer is present in AVIAMFReconGain.
Definition iamf.h:280
void av_iamf_audio_element_free(AVIAMFAudioElement **paudio_element)
Free an AVIAMFAudioElement and all its contents.
Definition iamf.c:338
AVIAMFAudioElement * av_iamf_audio_element_alloc(void)
Allocates a AVIAMFAudioElement, and initializes its fields with default values.
Definition iamf.c:324
@ AV_IAMF_AMBISONICS_MODE_MONO
Definition iamf.h:273
@ AV_IAMF_AMBISONICS_MODE_PROJECTION
Definition iamf.h:274
@ AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE
Definition iamf.h:349
@ AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL
Definition iamf.h:348
void av_iamf_mix_presentation_free(AVIAMFMixPresentation **pmix_presentation)
Free an AVIAMFMixPresentation and all its contents.
Definition iamf.c:536
AVIAMFMixPresentation * av_iamf_mix_presentation_alloc(void)
Allocates a AVIAMFMixPresentation, and initializes its fields with default values.
Definition iamf.c:522
const AVClass * av_iamf_mix_presentation_get_class(void)
Definition iamf.c:517
@ AV_IAMF_HEADPHONES_MODE_STEREO
The referenced Audio Element shall be rendered to stereo loudspeakers.
Definition iamf.h:436
@ AV_IAMF_HEADPHONES_MODE_BINAURAL
The referenced Audio Element shall be rendered with a binaural renderer.
Definition iamf.h:440
@ AV_IAMF_SUBMIX_LAYOUT_TYPE_BINAURAL
The layout is binaural.
Definition iamf.h:508
@ AV_IAMF_SUBMIX_LAYOUT_TYPE_LOUDSPEAKERS
The layout follows the loudspeaker sound system convention of ITU-2051-3.
Definition iamf.h:501
static av_always_inline void * av_iamf_param_definition_get_subblock(const AVIAMFParamDefinition *par, unsigned int idx)
Get the subblock at the specified idx.
Definition iamf.h:260
AVIAMFParamDefinitionType
Definition iamf.h:169
const AVClass * av_iamf_param_definition_get_class(void)
Definition iamf.c:154
AVIAMFParamDefinition * av_iamf_param_definition_alloc(enum AVIAMFParamDefinitionType type, unsigned int nb_subblocks, size_t *out_size)
Allocates memory for AVIAMFParamDefinition, plus an array of nb_subblocks amount of subblocks of the ...
Definition iamf.c:159
@ AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN
Subblocks are of struct type AVIAMFReconGain.
Definition iamf.h:181
@ AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN
Subblocks are of struct type AVIAMFMixGain.
Definition iamf.h:173
@ AV_IAMF_PARAMETER_DEFINITION_DEMIXING
Subblocks are of struct type AVIAMFDemixingInfo.
Definition iamf.h:177
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
void av_opt_free(void *obj)
Free all allocated objects in obj.
Definition opt.c:2025
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
Definition opt.c:1754
cl_device_type type
#define r
Definition input.c:42
static const AVOption mix_gain_options[]
Definition iamf.c:66
static const AVClass demixing_info_class
Definition iamf.c:91
static const AVClass layer_class
Definition iamf.c:277
static const AVClass element_class
Definition iamf.c:398
static const AVClass submix_class
Definition iamf.c:477
static const AVClass * mix_presentation_child_iterate(void **opaque)
Definition iamf.c:496
static const AVOption submix_element_options[]
Definition iamf.c:363
static const AVOption param_definition_options[]
Definition iamf.c:114
static const AVOption submix_presentation_options[]
Definition iamf.c:439
#define IAMF_ADD_FUNC_TEMPLATE(parent_type, parent_name, child_type, child_name, suffix)
Definition iamf.c:32
static const AVClass recon_gain_class
Definition iamf.c:105
static const AVClass param_definition_class
Definition iamf.c:146
static const AVClass mix_gain_class
Definition iamf.c:76
static const AVClass * audio_element_child_iterate(void **opaque)
Definition iamf.c:298
static const AVClass * submix_element_child_iterate(void **opaque)
Definition iamf.c:385
static void * submix_element_child_next(void *obj, void *prev)
Definition iamf.c:376
static const AVOption audio_element_options[]
Definition iamf.c:286
static void * submix_presentation_child_next(void *obj, void *prev)
Definition iamf.c:444
static const AVClass * submix_presentation_child_iterate(void **opaque)
Definition iamf.c:453
static const AVOptionArrayDef demixing_matrix_def
Definition iamf.c:240
static const AVClass mix_presentation_class
Definition iamf.c:509
static const AVClass audio_element_class
Definition iamf.c:311
static const AVOption recon_gain_options[]
Definition iamf.c:100
static const AVOption mix_presentation_options[]
Definition iamf.c:488
static const AVClass * param_definition_child_iterate(void **opaque)
Definition iamf.c:122
#define OFFSET(x)
Definition iamf.c:65
static const AVOption submix_layout_options[]
Definition iamf.c:411
static const AVClass layout_class
Definition iamf.c:428
static const AVOption layer_options[]
Definition iamf.c:244
static const AVOption demixing_info_options[]
Definition iamf.c:85
Immersive Audio Model and Formats API header.
uint64_t layout
Memory handling functions.
AVOptions.
Describe the class of an AVClass context structure.
Definition log.h:76
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
Definition iamf.h:359
const AVClass * av_class
Definition iamf.h:360
AVIAMFParamDefinition * recon_gain_info
Recon gain information used to reconstruct a scalable channel audio representation.
Definition iamf.h:386
AVIAMFParamDefinition * demixing_info
Demixing information used to reconstruct a scalable channel audio representation.
Definition iamf.h:379
AVIAMFLayer ** layers
Definition iamf.h:362
unsigned int nb_layers
Number of layers, or channel groups, in the Audio Element.
Definition iamf.h:371
Demixing Info Parameter Data as defined in section 3.8.2 of IAMF.
Definition iamf.h:128
A layer defining a Channel Layout in the Audio Element.
Definition iamf.h:294
AVRational * demixing_matrix
Demixing matrix as defined in section 3.6.3 of IAMF.
Definition iamf.h:336
Mix Gain Parameter Data as defined in section 3.8.1 of IAMF.
Definition iamf.h:77
Information on how to render and mix one or more AVIAMFAudioElement to generate the final audio outpu...
Definition iamf.h:616
unsigned int nb_submixes
Number of submixes in the presentation.
Definition iamf.h:632
const AVClass * av_class
Definition iamf.h:617
AVIAMFSubmix ** submixes
Array of submixes.
Definition iamf.h:625
Parameters as defined in section 3.6.1 of IAMF.
Definition iamf.h:193
size_t subblocks_offset
Offset in bytes from the start of this struct, at which the subblocks array is located.
Definition iamf.h:200
const AVClass * av_class
Definition iamf.h:194
size_t subblock_size
Size in bytes of each element in the subblocks array.
Definition iamf.h:204
enum AVIAMFParamDefinitionType type
Parameters type.
Definition iamf.h:213
unsigned int nb_subblocks
Number of subblocks in the array.
Definition iamf.h:208
Recon Gain Info Parameter Data as defined in section 3.8.3 of IAMF.
Definition iamf.h:148
Submix element as defined in section 3.7 of IAMF.
Definition iamf.h:449
AVIAMFParamDefinition * element_mix_config
Information required required for applying any processing to the referenced and rendered Audio Elemen...
Definition iamf.h:464
Submix layout as defined in section 3.7.6 of IAMF.
Definition iamf.h:517
Submix layout as defined in section 3.7 of IAMF.
Definition iamf.h:559
unsigned int nb_elements
Number of elements in the submix.
Definition iamf.h:575
AVIAMFSubmixElement ** elements
Array of submix elements.
Definition iamf.h:568
AVIAMFSubmixLayout ** layouts
Array of submix layouts.
Definition iamf.h:583
AVIAMFParamDefinition * output_mix_config
Information required for post-processing the mixed audio signal to generate the audio signal for play...
Definition iamf.h:598
unsigned int nb_layouts
Number of layouts in the submix.
Definition iamf.h:590
May be set as default_val for AV_OPT_TYPE_FLAG_ARRAY options.
Definition opt.h:394
AVOption.
Definition opt.h:428
#define av_free(p)
#define av_mallocz(s)
#define av_freep(p)
static int out_size
Definition movenc.c:56
int size