Skip to content

Commit b31ffc7

Browse files
yerorojwcullen
authored andcommitted
Adds test vector 1100
- Also adds some tests to ensure the value of `headphones_rendering_mode` is correctly written to the bitstream. - Drive-by: disables wav writing in encoder_main_lib_test's test suite for all test vectors. This suppresses the error message like "Permission denied [13]" PiperOrigin-RevId: 856640931
1 parent 9a14e65 commit b31ffc7

File tree

3 files changed

+203
-0
lines changed

3 files changed

+203
-0
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# Copyright (c) 2025, 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 using a Stereo layout and "
17+
"a Binaural output layout."
18+
file_name_prefix: "test_001100"
19+
is_valid: true
20+
is_valid_to_decode: true
21+
validate_user_loudness: false
22+
mp4_fixed_timestamp: "2026-01-13 00:00:00"
23+
test_repository_tags: [
24+
"github/aomediacodec/libiamf/main"
25+
]
26+
primary_tested_spec_sections: [
27+
"3.7.1/headphones_rendering_mode == 2",
28+
"3.7.5/layout_type == BINAURAL"
29+
]
30+
base_test: "test_000827"
31+
partition_mix_gain_parameter_blocks: false
32+
}
33+
34+
encoder_control_metadata {
35+
add_build_information_tag: false
36+
output_rendered_file_format: OUTPUT_FORMAT_WAV_BIT_DEPTH_AUTOMATIC
37+
}
38+
39+
ia_sequence_header_metadata {
40+
primary_profile: PROFILE_VERSION_BASE_ADVANCED
41+
additional_profile: PROFILE_VERSION_BASE_ADVANCED
42+
}
43+
44+
codec_config_metadata {
45+
codec_config_id: 200
46+
codec_config {
47+
codec_id: CODEC_ID_LPCM
48+
num_samples_per_frame: 1024
49+
audio_roll_distance: 0
50+
decoder_config_lpcm {
51+
sample_format_flags: LPCM_LITTLE_ENDIAN
52+
sample_size: 16
53+
sample_rate: 48000
54+
}
55+
}
56+
}
57+
58+
audio_element_metadata {
59+
audio_element_id: 300
60+
audio_element_type: AUDIO_ELEMENT_CHANNEL_BASED
61+
reserved: 0
62+
codec_config_id: 200
63+
audio_substream_ids: [0]
64+
scalable_channel_layout_config {
65+
reserved: 0
66+
channel_audio_layer_configs: [
67+
{
68+
loudspeaker_layout: LOUDSPEAKER_LAYOUT_STEREO
69+
output_gain_is_present_flag: 0
70+
recon_gain_is_present_flag: 0
71+
reserved_a: 0
72+
substream_count: 1
73+
coupled_substream_count: 1
74+
}
75+
]
76+
}
77+
}
78+
79+
mix_presentation_metadata {
80+
mix_presentation_id: 42
81+
annotations_language: ["en-us"]
82+
localized_presentation_annotations: ["test_mix_pres"]
83+
sub_mixes {
84+
audio_elements {
85+
audio_element_id: 300
86+
localized_element_annotations: ["test_sub_mix_0_audio_element_0"]
87+
rendering_config {
88+
headphones_rendering_mode: HEADPHONES_RENDERING_MODE_BINAURAL_HEAD_LOCKED
89+
}
90+
element_mix_gain {
91+
param_definition {
92+
parameter_id: 100
93+
parameter_rate: 48000
94+
param_definition_mode: 1
95+
reserved: 0
96+
}
97+
default_mix_gain: -768 # -3 dB.
98+
}
99+
}
100+
output_mix_gain {
101+
param_definition {
102+
parameter_id: 101
103+
parameter_rate: 48000
104+
param_definition_mode: 1
105+
reserved: 0
106+
}
107+
default_mix_gain: 0 # 0 dB.
108+
}
109+
layouts {
110+
loudness_layout {
111+
layout_type: LAYOUT_TYPE_LOUDSPEAKERS_SS_CONVENTION
112+
ss_layout {
113+
sound_system: SOUND_SYSTEM_A_0_2_0
114+
reserved: 0
115+
}
116+
}
117+
loudness {
118+
info_type_bit_masks: []
119+
}
120+
}
121+
layouts {
122+
loudness_layout {
123+
layout_type: LAYOUT_TYPE_BINAURAL
124+
reserved_or_binaural_layout: {
125+
reserved: 0
126+
}
127+
}
128+
loudness {
129+
info_type_bit_masks: []
130+
}
131+
}
132+
}
133+
134+
}
135+
136+
audio_frame_metadata {
137+
samples_to_trim_at_end_includes_padding: false
138+
samples_to_trim_at_start_includes_codec_delay: false
139+
wav_filename: "dialog_clip_stereo.wav"
140+
audio_element_id: 300
141+
channel_metadatas: [
142+
{ channel_id: 0 channel_label: CHANNEL_LABEL_L_2 },
143+
{ channel_id: 1 channel_label: CHANNEL_LABEL_R_2 }
144+
]
145+
}
146+
147+
temporal_delimiter_metadata {
148+
enable_temporal_delimiters: false
149+
}

iamf/cli/tests/encoder_main_lib_test.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ TEST_P(TestVector, ValidateTestSuite) {
303303
// these change over time.
304304
user_metadata.mutable_test_vector_metadata()->set_validate_user_loudness(
305305
false);
306+
// Skip wav writing entirely.
307+
user_metadata.mutable_encoder_control_metadata()
308+
->set_output_rendered_file_format(OUTPUT_FORMAT_NONE);
306309
ABSL_LOG(INFO) << "Testing with " << textproto_filename;
307310
const absl::Status result = iamf_tools::TestMain(
308311
user_metadata, wav_directory, std::string(kIgnoredOutputPath));
@@ -1318,6 +1321,9 @@ INSTANTIATE_TEST_SUITE_P(
13181321
Advanced2TwentyEightChannelsWith10_2_9_3AndFirstOrderAmbisonics, TestVector,
13191322
testing::Values("test_001019.textproto"));
13201323

1324+
INSTANTIATE_TEST_SUITE_P(RendererHeadLockedStereoToBinaural, TestVector,
1325+
testing::Values("test_001100.textproto"));
1326+
13211327
// TODO(b/308385831): Add more tests.
13221328

13231329
} // namespace

iamf/obu/tests/rendering_config_test.cc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,54 @@ TEST(ValidateAndWrite, WritesStereoRenderingConfig) {
5858
ValidateWriteResults(wb, kExpectedPayload);
5959
}
6060

61+
TEST(ValidateAndWrite, WritesBinauralWorldLockedRenderingConfig) {
62+
RenderingConfig rendering_config{
63+
.headphones_rendering_mode = kHeadphonesRenderingModeBinauralWorldLocked};
64+
constexpr auto kExpectedPayload = std::to_array<uint8_t>({
65+
// `headphones_rendering_mode` (2), reserved (6).
66+
RenderingConfig::kHeadphonesRenderingModeBinauralWorldLocked << 6,
67+
// `rendering_config_extension_size`.
68+
0,
69+
});
70+
71+
WriteBitBuffer wb(0);
72+
EXPECT_THAT(rendering_config.ValidateAndWrite(wb), IsOk());
73+
74+
ValidateWriteResults(wb, kExpectedPayload);
75+
}
76+
77+
TEST(ValidateAndWrite, WritesBinauralHeadLockedRenderingConfig) {
78+
RenderingConfig rendering_config{
79+
.headphones_rendering_mode = kHeadphonesRenderingModeBinauralHeadLocked};
80+
constexpr auto kExpectedPayload = std::to_array<uint8_t>({
81+
// `headphones_rendering_mode` (2), reserved (6).
82+
RenderingConfig::kHeadphonesRenderingModeBinauralHeadLocked << 6,
83+
// `rendering_config_extension_size`.
84+
0,
85+
});
86+
87+
WriteBitBuffer wb(0);
88+
EXPECT_THAT(rendering_config.ValidateAndWrite(wb), IsOk());
89+
90+
ValidateWriteResults(wb, kExpectedPayload);
91+
}
92+
93+
TEST(ValidateAndWrite, WritesReservedRenderingConfig) {
94+
RenderingConfig rendering_config{.headphones_rendering_mode =
95+
kHeadphonesRenderingModeReserved3};
96+
constexpr auto kExpectedPayload = std::to_array<uint8_t>({
97+
// `headphones_rendering_mode` (2), reserved (6).
98+
RenderingConfig::kHeadphonesRenderingModeReserved3 << 6,
99+
// `rendering_config_extension_size`.
100+
0,
101+
});
102+
103+
WriteBitBuffer wb(0);
104+
EXPECT_THAT(rendering_config.ValidateAndWrite(wb), IsOk());
105+
106+
ValidateWriteResults(wb, kExpectedPayload);
107+
}
108+
61109
TEST(ValidateAndWrite, CreateFailsWithOverflowReservedField) {
62110
RenderingConfig rendering_config{
63111
.headphones_rendering_mode = kHeadphonesRenderingModeBinauralWorldLocked,

0 commit comments

Comments
 (0)