ffmpeg-bb/tests/ref/fate/iamf-5_1_4
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

494 lines
12 KiB
Plaintext

7749af0b8f37c91e4cc0dbc6f31d7f67 *tests/data/fate/iamf-5_1_4.iamf
85603 tests/data/fate/iamf-5_1_4.iamf
#extradata 0: 34, 0xafa70d5e
#extradata 1: 34, 0xafa70d5e
#extradata 2: 34, 0xaf7b0d5c
#extradata 3: 34, 0xaf7b0d5c
#extradata 4: 34, 0xafa70d5e
#extradata 5: 34, 0xafa70d5e
#tb 0: 1/44100
#media_type 0: audio
#codec_id 0: flac
#sample_rate 0: 44100
#channel_layout_name 0: stereo
#tb 1: 1/44100
#media_type 1: audio
#codec_id 1: flac
#sample_rate 1: 44100
#channel_layout_name 1: stereo
#tb 2: 1/44100
#media_type 2: audio
#codec_id 2: flac
#sample_rate 2: 44100
#channel_layout_name 2: mono
#tb 3: 1/44100
#media_type 3: audio
#codec_id 3: flac
#sample_rate 3: 44100
#channel_layout_name 3: mono
#tb 4: 1/44100
#media_type 4: audio
#codec_id 4: flac
#sample_rate 4: 44100
#channel_layout_name 4: stereo
#tb 5: 1/44100
#media_type 5: audio
#codec_id 5: flac
#sample_rate 5: 44100
#channel_layout_name 5: stereo
0, 0, 0, 4608, 1399, 0x6e89566e
1, 0, 0, 4608, 1399, 0x6e89566e
2, 0, 0, 4608, 1396, 0x0dcb5677
3, 0, 0, 4608, 1396, 0x0dcb5677
4, 0, 0, 4608, 1399, 0x6e89566e
5, 0, 0, 4608, 1399, 0x6e89566e
0, 4608, 4608, 4608, 1442, 0x6c3c5b13
1, 4608, 4608, 4608, 1442, 0x6c3c5b13
2, 4608, 4608, 4608, 1439, 0xc46b5ac5
3, 4608, 4608, 4608, 1439, 0xc46b5ac5
4, 4608, 4608, 4608, 1442, 0x6c3c5b13
5, 4608, 4608, 4608, 1442, 0x6c3c5b13
0, 9216, 9216, 4608, 1380, 0xc497571b
1, 9216, 9216, 4608, 1380, 0xc497571b
2, 9216, 9216, 4608, 1377, 0x5b2a55fe
3, 9216, 9216, 4608, 1377, 0x5b2a55fe
4, 9216, 9216, 4608, 1380, 0xc497571b
5, 9216, 9216, 4608, 1380, 0xc497571b
0, 13824, 13824, 4608, 1383, 0x48e9510f
1, 13824, 13824, 4608, 1383, 0x48e9510f
2, 13824, 13824, 4608, 1380, 0x045550d3
3, 13824, 13824, 4608, 1380, 0x045550d3
4, 13824, 13824, 4608, 1383, 0x48e9510f
5, 13824, 13824, 4608, 1383, 0x48e9510f
0, 18432, 18432, 4608, 1572, 0x9a514719
1, 18432, 18432, 4608, 1572, 0x9a514719
2, 18432, 18432, 4608, 1568, 0xa2bc45f4
3, 18432, 18432, 4608, 1568, 0xa2bc45f4
4, 18432, 18432, 4608, 1572, 0x9a514719
5, 18432, 18432, 4608, 1572, 0x9a514719
0, 23040, 23040, 4608, 1391, 0x74ac5014
1, 23040, 23040, 4608, 1391, 0x74ac5014
2, 23040, 23040, 4608, 1388, 0x96c85007
3, 23040, 23040, 4608, 1388, 0x96c85007
4, 23040, 23040, 4608, 1391, 0x74ac5014
5, 23040, 23040, 4608, 1391, 0x74ac5014
0, 27648, 27648, 4608, 1422, 0x2f9d47c5
1, 27648, 27648, 4608, 1422, 0x2f9d47c5
2, 27648, 27648, 4608, 1419, 0x4d4d466a
3, 27648, 27648, 4608, 1419, 0x4d4d466a
4, 27648, 27648, 4608, 1422, 0x2f9d47c5
5, 27648, 27648, 4608, 1422, 0x2f9d47c5
0, 32256, 32256, 4608, 1768, 0x2a044b99
1, 32256, 32256, 4608, 1768, 0x2a044b99
2, 32256, 32256, 4608, 1765, 0xacb84b24
3, 32256, 32256, 4608, 1765, 0xacb84b24
4, 32256, 32256, 4608, 1768, 0x2a044b99
5, 32256, 32256, 4608, 1768, 0x2a044b99
0, 36864, 36864, 4608, 1534, 0xb0b35a3f
1, 36864, 36864, 4608, 1534, 0xb0b35a3f
2, 36864, 36864, 4608, 1531, 0x996458aa
3, 36864, 36864, 4608, 1531, 0x996458aa
4, 36864, 36864, 4608, 1534, 0xb0b35a3f
5, 36864, 36864, 4608, 1534, 0xb0b35a3f
0, 41472, 41472, 4608, 926, 0xc26a5eae
1, 41472, 41472, 4608, 926, 0xc26a5eae
2, 41472, 41472, 4608, 923, 0xa7225edf
3, 41472, 41472, 4608, 923, 0xa7225edf
4, 41472, 41472, 4608, 926, 0xc26a5eae
5, 41472, 41472, 4608, 926, 0xc26a5eae
[STREAM_GROUP]
index=0
id=0x1
nb_streams=6
type=IAMF Audio Element
[COMPONENT]
nb_layers=4
audio_element_type=0
default_w=10
[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]
channel_layout=8 channels (FL+FR+SL+SR+FC+LFE+TFL+TFR)
output_gain_flags=0
output_gain=0/1
[/SUBCOMPONENT]
[SUBCOMPONENT]
channel_layout=10 channels (FL+FR+SL+SR+FC+LFE+TFL+TFR+TBL+TBR)
output_gain_flags=0
output_gain=0/1
[/SUBCOMPONENT]
[SUBCOMPONENT]
name=demixing_info
nb_subblocks=1
type=1
parameter_id=998
parameter_rate=44100
duration=4608
constant_subblock_duration=4608
[PIECE]
subblock_duration=4608
dmixp_mode=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]
index=4
id=0x4
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=5
id=0x5
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=0x2
nb_streams=6
type=IAMF Mix Presentation
[COMPONENT]
nb_submixes=1
[SUBCOMPONENT]
en-us=Mix_Presentation
[/SUBCOMPONENT]
[SUBCOMPONENT]
nb_elements=1
nb_layouts=4
default_mix_gain=256/256
[PIECE]
stream_id=1
default_mix_gain=0/256
headphones_rendering_mode=0
[SUBPIECE]
en-us=Scalable_Submix
[/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=256/256
digital_peak=0/256
true_peak=0/1
dialogue_anchored_loudness=0/1
album_anchored_loudness=0/1
[/PIECE]
[PIECE]
sound_system=5.1(side)
integrated_loudness=0/256
digital_peak=0/256
true_peak=0/1
dialogue_anchored_loudness=0/1
album_anchored_loudness=0/1
[/PIECE]
[PIECE]
sound_system=5.1.2
integrated_loudness=0/256
digital_peak=0/256
true_peak=0/1
dialogue_anchored_loudness=0/1
album_anchored_loudness=0/1
[/PIECE]
[PIECE]
sound_system=5.1.4
integrated_loudness=0/256
digital_peak=0/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]
index=4
id=0x4
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=5
id=0x5
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]