mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibAudio: Implement decoding verbatim blocks in FLAC
They're mostly used in literal random data, so it isn't like there is a high demand for it, but it's cool to have more complete implementation anyway. :^)
This commit is contained in:
parent
a086be993b
commit
1c65ee6edf
1 changed files with 10 additions and 3 deletions
|
@ -621,10 +621,17 @@ Vector<i32> FlacLoaderPlugin::parse_subframe(FlacSubframeHeader& subframe_header
|
|||
return resampler.resample(samples);
|
||||
}
|
||||
|
||||
// Decode a subframe that isn't actually encoded
|
||||
Vector<i32> FlacLoaderPlugin::decode_verbatim([[maybe_unused]] FlacSubframeHeader& subframe, [[maybe_unused]] InputBitStream& bit_input)
|
||||
// Decode a subframe that isn't actually encoded, usually seen in random data
|
||||
Vector<i32> FlacLoaderPlugin::decode_verbatim(FlacSubframeHeader& subframe, InputBitStream& bit_input)
|
||||
{
|
||||
TODO();
|
||||
Vector<i32> decoded;
|
||||
decoded.ensure_capacity(m_current_frame->sample_count);
|
||||
|
||||
for (size_t i = 0; i < m_current_frame->sample_count; ++i) {
|
||||
decoded.unchecked_append(sign_extend(bit_input.read_bits_big_endian(subframe.bits_per_sample - subframe.wasted_bits_per_sample), subframe.bits_per_sample - subframe.wasted_bits_per_sample));
|
||||
}
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
||||
// Decode a subframe encoded with a custom linear predictor coding, i.e. the subframe provides the polynomial order and coefficients
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue