Skip to content

Commit

Permalink
Add isLittleEndian() method to LpcmDecoderConfig.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 632531735
  • Loading branch information
trevorknight authored and jwcullen committed May 14, 2024
1 parent 3c280d8 commit 6aaf77a
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 157 deletions.
5 changes: 5 additions & 0 deletions iamf/obu/decoder_config/lpcm_decoder_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ absl::Status ValidateAudioRollDistance(int16_t audio_roll_distance) {

} // namespace

bool LpcmDecoderConfig::IsLittleEndian() const {
return sample_format_flags_bitmask_ &
LpcmDecoderConfig::LpcmFormatFlagsBitmask::kLpcmLittleEndian;
}

absl::Status LpcmDecoderConfig::ValidateAndWrite(int16_t audio_roll_distance,
WriteBitBuffer& wb) const {
RETURN_IF_NOT_OK(ValidateAudioRollDistance(audio_roll_distance));
Expand Down
3 changes: 3 additions & 0 deletions iamf/obu/decoder_config/lpcm_decoder_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class LpcmDecoderConfig {
friend bool operator==(const LpcmDecoderConfig& lhs,
const LpcmDecoderConfig& rhs) = default;

/*!\brief Returns true if the samples are encoded in little-endian format.*/
bool IsLittleEndian() const;

/*!\brief Validates and writes the `LpcmDecoderConfig` to a buffer.
*
* \param audio_roll_distance `audio_roll_distance` in the associated Codec
Expand Down
1 change: 1 addition & 0 deletions iamf/obu/decoder_config/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cc_test(
"//iamf/common/tests:test_utils",
"//iamf/obu/decoder_config:lpcm_decoder_config",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:status_matchers",
"@com_google_googletest//:gtest_main",
],
)
Expand Down
Loading

0 comments on commit 6aaf77a

Please sign in to comment.