Skip to content

Commit e6947b1

Browse files
yerorojwcullen
authored andcommitted
Adds test vector 855
- Also supports live loudness info. PiperOrigin-RevId: 859466161
1 parent 33f51e7 commit e6947b1

File tree

7 files changed

+248
-11
lines changed

7 files changed

+248
-11
lines changed

iamf/cli/proto/mix_presentation.proto

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,13 @@ message AnchoredLoudness {
173173
}
174174

175175
enum LoudnessInfoTypeBitMask {
176+
option allow_alias = true;
177+
176178
LOUDNESS_INFO_TYPE_INVALID = 0;
177179
LOUDNESS_INFO_TYPE_TRUE_PEAK = 1;
178180
LOUDNESS_INFO_TYPE_ANCHORED_LOUDNESS = 2;
179-
LOUDNESS_INFO_TYPE_RESERVED_4 = 4;
181+
LOUDNESS_INFO_TYPE_RESERVED_4 = 4 [deprecated = true];
182+
LOUDNESS_INFO_TYPE_LIVE = 4;
180183
LOUDNESS_INFO_TYPE_RESERVED_8 = 8;
181184
LOUDNESS_INFO_TYPE_RESERVED_16 = 16;
182185
LOUDNESS_INFO_TYPE_RESERVED_32 = 32;

iamf/cli/proto_conversion/lookup_tables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class LookupTables {
208208
LoudnessInfo::InfoTypeBitmask>>(
209209
{{LOUDNESS_INFO_TYPE_TRUE_PEAK, kTruePeak},
210210
{LOUDNESS_INFO_TYPE_ANCHORED_LOUDNESS, kAnchoredLoudness},
211-
{LOUDNESS_INFO_TYPE_RESERVED_4, kInfoTypeBitMask4},
211+
{LOUDNESS_INFO_TYPE_LIVE, kLive},
212212
{LOUDNESS_INFO_TYPE_RESERVED_8, kInfoTypeBitMask8},
213213
{LOUDNESS_INFO_TYPE_RESERVED_16, kInfoTypeBitMask16},
214214
{LOUDNESS_INFO_TYPE_RESERVED_32, kInfoTypeBitMask32},

iamf/cli/proto_conversion/proto_to_obu/tests/mix_presentation_generator_test.cc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,20 @@ TEST(CopyUserAnchoredLoudness, IllegalUnknownAnchorElementEnum) {
16471647
.ok());
16481648
}
16491649

1650+
TEST(CopyUserLayoutExtension, LiveLoudnessInfoType) {
1651+
// `info_type` must be configured as a prerequisite.
1652+
LoudnessInfo output_loudness = {.info_type = LoudnessInfo::kLive};
1653+
1654+
// Configure user data to copy in.
1655+
iamf_tools_cli_proto::LoudnessInfo user_loudness;
1656+
user_loudness.set_info_type_bytes("");
1657+
1658+
EXPECT_THAT(MixPresentationGenerator::CopyUserLayoutExtension(
1659+
user_loudness, output_loudness),
1660+
IsOk());
1661+
EXPECT_TRUE(output_loudness.layout_extension.info_type_bytes.empty());
1662+
}
1663+
16501664
TEST(CopyUserLayoutExtension, AllInfoTypeExtensions) {
16511665
// `info_type` must be configured as a prerequisite.
16521666
LoudnessInfo output_loudness = {.info_type =
@@ -1665,7 +1679,8 @@ TEST(CopyUserLayoutExtension, AllInfoTypeExtensions) {
16651679

16661680
TEST(CopyUserLayoutExtension, OneInfoTypeExtension) {
16671681
// `info_type` must be configured as a prerequisite.
1668-
LoudnessInfo output_loudness = {.info_type = LoudnessInfo::kInfoTypeBitMask4};
1682+
LoudnessInfo output_loudness = {.info_type =
1683+
LoudnessInfo::kInfoTypeBitMask128};
16691684

16701685
// Configure user data to copy in.
16711686
iamf_tools_cli_proto::LoudnessInfo user_loudness;
@@ -1680,7 +1695,8 @@ TEST(CopyUserLayoutExtension, OneInfoTypeExtension) {
16801695

16811696
TEST(CopyUserLayoutExtension, IgnoresDeprecatedInfoTypeSizeField) {
16821697
// `info_type` must be configured as a prerequisite.
1683-
LoudnessInfo output_loudness = {.info_type = LoudnessInfo::kInfoTypeBitMask4};
1698+
LoudnessInfo output_loudness = {.info_type =
1699+
LoudnessInfo::kInfoTypeBitMask128};
16841700

16851701
// Configure user data to copy in.
16861702
iamf_tools_cli_proto::LoudnessInfo user_loudness;
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# Copyright (c) 2026, Alliance for Open Media. All rights reserved
2+
#
3+
# This source code is subject to the terms of the BSD 3-Clause Clear License
4+
# and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear
5+
# License was not distributed with this source code in the LICENSE file, you
6+
# can obtain it at www.aomedia.org/license/software-license/bsd-3-c-c. If the
7+
# Alliance for Open Media Patent License 1.0 was not distributed with this
8+
# source code in the PATENTS file, you can obtain it at
9+
# www.aomedia.org/license/patent.
10+
11+
# proto-file: iamf/cli/proto/user_metadata.proto
12+
# proto-message: UserMetadata
13+
14+
test_vector_metadata {
15+
human_readable_description:
16+
"A Base-Advanced Profile Stream with live loudness information"
17+
"provided"
18+
file_name_prefix: "test_000855"
19+
is_valid: true
20+
is_valid_to_decode: true
21+
validate_user_loudness: false
22+
mp4_fixed_timestamp: "2026-01-21 00:00:00"
23+
test_repository_tags: [
24+
"github/aomediacodec/libiamf/main"
25+
]
26+
primary_tested_spec_sections: [
27+
"3.7.6/info_type == LIVE"
28+
]
29+
base_test: "test_000854"
30+
partition_mix_gain_parameter_blocks: false
31+
}
32+
33+
encoder_control_metadata {
34+
add_build_information_tag: false
35+
output_rendered_file_format: OUTPUT_FORMAT_WAV_BIT_DEPTH_AUTOMATIC
36+
}
37+
38+
ia_sequence_header_metadata {
39+
primary_profile: PROFILE_VERSION_BASE_ADVANCED
40+
additional_profile: PROFILE_VERSION_BASE_ADVANCED
41+
}
42+
43+
codec_config_metadata {
44+
codec_config_id: 200
45+
codec_config {
46+
codec_id: CODEC_ID_LPCM
47+
num_samples_per_frame: 1024
48+
audio_roll_distance: 0
49+
decoder_config_lpcm {
50+
sample_format_flags: LPCM_LITTLE_ENDIAN
51+
sample_size: 16
52+
sample_rate: 48000
53+
}
54+
}
55+
}
56+
57+
audio_element_metadata {
58+
audio_element_id: 300
59+
audio_element_type: AUDIO_ELEMENT_CHANNEL_BASED
60+
reserved: 0
61+
codec_config_id: 200
62+
audio_substream_ids: [0]
63+
scalable_channel_layout_config {
64+
reserved: 0
65+
channel_audio_layer_configs: [
66+
{
67+
loudspeaker_layout: LOUDSPEAKER_LAYOUT_STEREO
68+
output_gain_is_present_flag: 0
69+
recon_gain_is_present_flag: 0
70+
reserved_a: 0
71+
substream_count: 1
72+
coupled_substream_count: 1
73+
}
74+
]
75+
}
76+
}
77+
78+
audio_element_metadata {
79+
audio_element_id: 301
80+
audio_element_type: AUDIO_ELEMENT_CHANNEL_BASED
81+
reserved: 0
82+
codec_config_id: 200
83+
audio_substream_ids: [1]
84+
scalable_channel_layout_config {
85+
reserved: 0
86+
channel_audio_layer_configs: [
87+
{
88+
loudspeaker_layout: LOUDSPEAKER_LAYOUT_STEREO
89+
output_gain_is_present_flag: 0
90+
recon_gain_is_present_flag: 0
91+
reserved_a: 0
92+
substream_count: 1
93+
coupled_substream_count: 1
94+
}
95+
]
96+
}
97+
}
98+
99+
mix_presentation_metadata {
100+
mix_presentation_id: 42
101+
annotations_language: ["en-us"]
102+
localized_presentation_annotations: ["test_mix_pres"]
103+
sub_mixes {
104+
audio_elements {
105+
audio_element_id: 300
106+
localized_element_annotations: ["test_sub_mix_0_audio_element_0"]
107+
rendering_config {
108+
headphones_rendering_mode: HEADPHONES_RENDERING_MODE_STEREO
109+
}
110+
element_mix_gain {
111+
param_definition {
112+
parameter_id: 100
113+
parameter_rate: 48000
114+
param_definition_mode: 1
115+
reserved: 0
116+
}
117+
default_mix_gain: -768 # -3 dB.
118+
}
119+
}
120+
audio_elements {
121+
audio_element_id: 301
122+
localized_element_annotations: ["test_sub_mix_0_audio_element_1"]
123+
rendering_config {
124+
headphones_rendering_mode: HEADPHONES_RENDERING_MODE_STEREO
125+
}
126+
element_mix_gain {
127+
param_definition {
128+
parameter_id: 100
129+
parameter_rate: 48000
130+
param_definition_mode: 1
131+
reserved: 0
132+
}
133+
default_mix_gain: -768 # -3 dB.
134+
}
135+
}
136+
output_mix_gain {
137+
param_definition {
138+
parameter_id: 101
139+
parameter_rate: 48000
140+
param_definition_mode: 1
141+
reserved: 0
142+
}
143+
default_mix_gain: 0 # 0 dB.
144+
}
145+
layouts {
146+
loudness_layout {
147+
layout_type: LAYOUT_TYPE_LOUDSPEAKERS_SS_CONVENTION
148+
ss_layout {
149+
sound_system: SOUND_SYSTEM_A_0_2_0
150+
reserved: 0
151+
}
152+
}
153+
loudness {
154+
info_type_bit_masks: [LOUDNESS_INFO_TYPE_LIVE]
155+
integrated_loudness: -4940
156+
digital_peak: -1018
157+
}
158+
}
159+
}
160+
}
161+
162+
audio_frame_metadata {
163+
samples_to_trim_at_end_includes_padding: false
164+
samples_to_trim_at_start_includes_codec_delay: false
165+
wav_filename: "dialog_clip_stereo.wav"
166+
audio_element_id: 300
167+
channel_metadatas: [
168+
{ channel_id: 0 channel_label: CHANNEL_LABEL_L_2 },
169+
{ channel_id: 1 channel_label: CHANNEL_LABEL_R_2 }
170+
]
171+
}
172+
173+
audio_frame_metadata {
174+
samples_to_trim_at_end_includes_padding: false
175+
samples_to_trim_at_start_includes_codec_delay: false
176+
wav_filename: "dialog_clip_stereo.wav"
177+
audio_element_id: 301
178+
channel_metadatas: [
179+
{ channel_id: 0 channel_label: CHANNEL_LABEL_L_2 },
180+
{ channel_id: 1 channel_label: CHANNEL_LABEL_R_2 }
181+
]
182+
}
183+
184+
temporal_delimiter_metadata {
185+
enable_temporal_delimiters: false
186+
}

iamf/cli/tests/encoder_main_lib_test.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,9 @@ INSTANTIATE_TEST_SUITE_P(BaseAdvancedElementGainOffsetConfigValueType,
11561156
INSTANTIATE_TEST_SUITE_P(BaseAdvancedElementGainOffsetConfigRangeType,
11571157
TestVector, testing::Values("test_000854.textproto"));
11581158

1159+
INSTANTIATE_TEST_SUITE_P(BaseAdvancedLiveLoudnessInfoType, TestVector,
1160+
testing::Values("test_000855.textproto"));
1161+
11591162
INSTANTIATE_TEST_SUITE_P(Advanced1Mono_AndFourObjects, TestVector,
11601163
testing::Values("test_000900.textproto"));
11611164

iamf/obu/mix_presentation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct LoudnessInfo {
9595
enum InfoTypeBitmask : uint8_t {
9696
kTruePeak = 0x01,
9797
kAnchoredLoudness = 0x02,
98-
kInfoTypeBitMask4 = 0x04,
98+
kLive = 0x04,
9999
kInfoTypeBitMask8 = 0x08,
100100
kInfoTypeBitMask16 = 0x10,
101101
kInfoTypeBitMask32 = 0x20,

iamf/obu/tests/mix_presentation_test.cc

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,37 @@ TEST_F(MixPresentationObuTest,
445445
EXPECT_FALSE(obu_->ValidateAndWriteObu(unused_wb).ok());
446446
}
447447

448+
TEST_F(MixPresentationObuTest, LiveLoudnessInfo) {
449+
sub_mixes_[0].layouts[0].loudness.info_type = LoudnessInfo::kLive;
450+
sub_mixes_[0].layouts[0].loudness.layout_extension = {.info_type_bytes{}};
451+
452+
expected_header_ = {kObuIaMixPresentation << 3, 46};
453+
expected_payload_ = {
454+
// Start Mix OBU.
455+
10, 1, 'e', 'n', '-', 'u', 's', '\0', 'M', 'i', 'x', ' ', '1', '\0', 1,
456+
// Start Submix 1
457+
1, 11, 'S', 'u', 'b', 'm', 'i', 'x', ' ', '1', '\0',
458+
// Start RenderingConfig.
459+
RenderingConfig::kHeadphonesRenderingModeStereo
460+
<< kHeadphonesRenderingModeBitShift,
461+
/*rendering_config_extension_size=*/0,
462+
// End RenderingConfig
463+
12, 13, 0x80, 0, 14, 15, 16, 0x80, 0, 17, 1,
464+
// Start Layout 1 (of Submix 1).
465+
(Layout::kLayoutTypeLoudspeakersSsConvention
466+
<< kHeadphonesRenderingModeBitShift) |
467+
LoudspeakersSsConventionLayout::kSoundSystemA_0_2_0,
468+
LoudnessInfo::kLive, 0, 18, // integrated_loudness == 18 (16 bits).
469+
0, 19, // digital_peak == 18 (16 bits).
470+
0 // info_type_size == 0.
471+
// End Mix OBU.
472+
};
473+
474+
InitAndTestWrite();
475+
}
476+
448477
TEST_F(MixPresentationObuTest, ExtensionLayoutZero) {
449-
sub_mixes_[0].layouts[0].loudness.info_type = 0x04;
478+
sub_mixes_[0].layouts[0].loudness.info_type = 0x80;
450479
sub_mixes_[0].layouts[0].loudness.layout_extension = {.info_type_bytes{}};
451480

452481
expected_header_ = {kObuIaMixPresentation << 3, 46};
@@ -465,7 +494,7 @@ TEST_F(MixPresentationObuTest, ExtensionLayoutZero) {
465494
(Layout::kLayoutTypeLoudspeakersSsConvention
466495
<< kHeadphonesRenderingModeBitShift) |
467496
LoudspeakersSsConventionLayout::kSoundSystemA_0_2_0,
468-
0x04, 0, 18, 0, 19, 0
497+
0x80, 0, 18, 0, 19, 0
469498
// End Mix OBU.
470499
};
471500

@@ -474,7 +503,7 @@ TEST_F(MixPresentationObuTest, ExtensionLayoutZero) {
474503

475504
TEST_F(MixPresentationObuTest, NonMinimalLebGeneratorAffectsAllLeb128s) {
476505
// Initialize a test has several `DecodedUleb128` explicitly in the bitstream.
477-
sub_mixes_[0].layouts[0].loudness.info_type = 0x04;
506+
sub_mixes_[0].layouts[0].loudness.info_type = 0x80;
478507
sub_mixes_[0].layouts[0].loudness.layout_extension = {.info_type_bytes{}};
479508

480509
sub_mixes_[0].audio_elements[0].rendering_config = {
@@ -527,7 +556,7 @@ TEST_F(MixPresentationObuTest, NonMinimalLebGeneratorAffectsAllLeb128s) {
527556
(Layout::kLayoutTypeLoudspeakersSsConvention
528557
<< kHeadphonesRenderingModeBitShift) |
529558
LoudspeakersSsConventionLayout::kSoundSystemA_0_2_0,
530-
0x04, 0, 18, 0, 19,
559+
0x80, 0, 18, 0, 19,
531560
// `info_type_size` is affected by the `LebGenerator`.
532561
0x80 | 0, 0x00
533562
// End Mix OBU.
@@ -537,7 +566,7 @@ TEST_F(MixPresentationObuTest, NonMinimalLebGeneratorAffectsAllLeb128s) {
537566
}
538567

539568
TEST_F(MixPresentationObuTest, ExtensionLayoutNonZero) {
540-
sub_mixes_[0].layouts[0].loudness.info_type = 0x04;
569+
sub_mixes_[0].layouts[0].loudness.info_type = 0x80;
541570
sub_mixes_[0].layouts[0].loudness.layout_extension = {
542571
.info_type_bytes{'e', 'x', 't', 'r', 'a'}};
543572

@@ -557,7 +586,7 @@ TEST_F(MixPresentationObuTest, ExtensionLayoutNonZero) {
557586
(Layout::kLayoutTypeLoudspeakersSsConvention
558587
<< kHeadphonesRenderingModeBitShift) |
559588
LoudspeakersSsConventionLayout::kSoundSystemA_0_2_0,
560-
0x04, 0, 18, 0, 19, 5, 'e', 'x', 't', 'r', 'a'
589+
0x80, 0, 18, 0, 19, 5, 'e', 'x', 't', 'r', 'a'
561590
// End Mix OBU.
562591
};
563592

0 commit comments

Comments
 (0)