ffmpeg-bb/tests/ref/fate/iamf-5_1-copy
James Almer cd2461e627 avformat/iamf: fix setting channel layout for Scalable layers
The way streams are coded in an IAMF struct follows a scalable model where the
channel layouts for each layer may not match the channel order our API can
represent in a Native order layout.

For example, an audio element may have six coded streams in the form of two
stereo streams, followed by two mono streams, and then by another two stereo
streams, for a total of 10 channels, and define for them four scalable layers
with loudspeaker_layout values "Stereo", "5.1ch", "5.1.2ch", and "5.1.4ch".
The first layer references the first stream, and each following layer will
reference all previous streams plus extra ones.
In this case, the "5.1ch" layer will reference four streams (the first two
stereo and the two mono) to encompass six channels, which does not match out
native layout 5.1(side) given that FC and LFE come after FL+FR but before
SL+SR, and here, they are at the end.

For this reason, we need to build Custom order layouts that properly represent
what we're exporting.

----
Before:

  Stream group #0:0[0x12c]: IAMF Audio Element:
    Layer 0: stereo
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
    Layer 1: 5.1(side)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
    Layer 2: 5.1.2
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
    Layer 3: 5.1.4
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:5[0x5]: Audio: opus, 48000 Hz, stereo, fltp (dependent)

----
AFter:

  Stream group #0:0[0x12c]: IAMF Audio Element:
    Layer 0: stereo
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
    Layer 1: 6 channels (FL+FR+SL+SR+FC+LFE)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
    Layer 2: 8 channels (FL+FR+SL+SR+FC+LFE+TFL+TFR)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
    Layer 3: 10 channels (FL+FR+SL+SR+FC+LFE+TFL+TFR+TBL+TBR)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:5[0x5]: Audio: opus, 48000 Hz, stereo, fltp (dependent)

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00

314 lines
6.2 KiB
Plaintext

#extradata 0: 19, 0x3a0e0490
#extradata 1: 19, 0x3a0e0490
#extradata 2: 19, 0x3a04048f
#extradata 3: 19, 0x3a04048f
#tb 0: 1/48000
#media_type 0: audio
#codec_id 0: opus
#sample_rate 0: 48000
#channel_layout_name 0: stereo
#tb 1: 1/48000
#media_type 1: audio
#codec_id 1: opus
#sample_rate 1: 48000
#channel_layout_name 1: stereo
#tb 2: 1/48000
#media_type 2: audio
#codec_id 2: opus
#sample_rate 2: 48000
#channel_layout_name 2: mono
#tb 3: 1/48000
#media_type 3: audio
#codec_id 3: opus
#sample_rate 3: 48000
#channel_layout_name 3: mono
[STREAM_GROUP]
index=0
id=0x12c
nb_streams=4
type=IAMF Audio Element
[COMPONENT]
nb_layers=2
audio_element_type=0
default_w=0
[SUBCOMPONENT]
channel_layout=stereo
output_gain_flags=0
output_gain=0/1
[/SUBCOMPONENT]
[SUBCOMPONENT]
channel_layout=6 channels (FL+FR+SL+SR+FC+LFE)
output_gain_flags=0
output_gain=0/1
[/SUBCOMPONENT]
[SUBCOMPONENT]
name=demixing_info
nb_subblocks=1
type=1
parameter_id=998
parameter_rate=48000
duration=960
constant_subblock_duration=960
[PIECE]
subblock_duration=960
dmixp_mode=1
[/PIECE]
[/SUBCOMPONENT]
[SUBCOMPONENT]
name=recon_gain_info
nb_subblocks=1
type=2
parameter_id=101
parameter_rate=48000
duration=960
constant_subblock_duration=960
[PIECE]
subblock_duration=960
[/PIECE]
[/SUBCOMPONENT]
[/COMPONENT]
[STREAM]
index=0
id=0x0
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:non_diegetic=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=0
DISPOSITION:still_image=0
DISPOSITION:multilayer=0
[/STREAM]
[STREAM]
index=1
id=0x1
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:non_diegetic=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=1
DISPOSITION:still_image=0
DISPOSITION:multilayer=0
[/STREAM]
[STREAM]
index=2
id=0x2
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:non_diegetic=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=1
DISPOSITION:still_image=0
DISPOSITION:multilayer=0
[/STREAM]
[STREAM]
index=3
id=0x3
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:non_diegetic=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=1
DISPOSITION:still_image=0
DISPOSITION:multilayer=0
[/STREAM]
[/STREAM_GROUP]
[STREAM_GROUP]
index=1
id=0x2a
nb_streams=4
type=IAMF Mix Presentation
[COMPONENT]
nb_submixes=1
[SUBCOMPONENT]
en-us=test_mix_pres
[/SUBCOMPONENT]
[SUBCOMPONENT]
nb_elements=1
nb_layouts=2
default_mix_gain=0/256
[PIECE]
stream_id=300
default_mix_gain=0/256
headphones_rendering_mode=0
[SUBPIECE]
en-us=test_sub_mix_0_audio_element_0
[/SUBPIECE]
[SUBPIECE]
name=element_mix_config
nb_subblocks=0
type=0
parameter_id=100
parameter_rate=48000
duration=0
constant_subblock_duration=0
[/SUBPIECE]
[/PIECE]
[PIECE]
name=output_mix_config
nb_subblocks=0
type=0
parameter_id=100
parameter_rate=48000
duration=0
constant_subblock_duration=0
[/PIECE]
[PIECE]
sound_system=stereo
integrated_loudness=-5273/256
digital_peak=-2197/256
true_peak=0/1
dialogue_anchored_loudness=0/1
album_anchored_loudness=0/1
[/PIECE]
[PIECE]
sound_system=5.1(side)
integrated_loudness=-5886/256
digital_peak=-2845/256
true_peak=0/1
dialogue_anchored_loudness=0/1
album_anchored_loudness=0/1
[/PIECE]
[/SUBCOMPONENT]
[/COMPONENT]
[STREAM]
index=0
id=0x0
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:non_diegetic=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=0
DISPOSITION:still_image=0
DISPOSITION:multilayer=0
[/STREAM]
[STREAM]
index=1
id=0x1
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:non_diegetic=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=1
DISPOSITION:still_image=0
DISPOSITION:multilayer=0
[/STREAM]
[STREAM]
index=2
id=0x2
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:non_diegetic=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=1
DISPOSITION:still_image=0
DISPOSITION:multilayer=0
[/STREAM]
[STREAM]
index=3
id=0x3
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
DISPOSITION:non_diegetic=0
DISPOSITION:captions=0
DISPOSITION:descriptions=0
DISPOSITION:metadata=0
DISPOSITION:dependent=1
DISPOSITION:still_image=0
DISPOSITION:multilayer=0
[/STREAM]
[/STREAM_GROUP]