mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +00:00
LibAudio: Make read samples signed when decoding fixed FLAC subframes
Prior this change, decoding fixed subframes produced "unpleasant crackling noices". While the type doesn't appear so often when using the default settings, encoding files in flac(1) with --fast option uses fixed subframes almost every time. This also applies the logic to the constant subframes, which isn't so important, as the type is generally for the silence, but let's use it as well to avoid inconsistency.
This commit is contained in:
parent
ad419a669d
commit
2ecd115176
1 changed files with 2 additions and 2 deletions
|
@ -597,7 +597,7 @@ Vector<i32> FlacLoaderPlugin::parse_subframe(FlacSubframeHeader& subframe_header
|
|||
|
||||
samples.ensure_capacity(m_current_frame->sample_count);
|
||||
for (u32 i = 0; i < m_current_frame->sample_count; ++i) {
|
||||
samples.unchecked_append(constant_value);
|
||||
samples.unchecked_append(sign_extend(constant_value, subframe_header.bits_per_sample));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -696,7 +696,7 @@ Vector<i32> FlacLoaderPlugin::decode_fixed_lpc(FlacSubframeHeader& subframe, Inp
|
|||
|
||||
// warm-up samples
|
||||
for (auto i = 0; i < subframe.order; ++i) {
|
||||
decoded.unchecked_append(bit_input.read_bits_big_endian(subframe.bits_per_sample - subframe.wasted_bits_per_sample));
|
||||
decoded.unchecked_append(sign_extend(bit_input.read_bits_big_endian(subframe.bits_per_sample - subframe.wasted_bits_per_sample), subframe.bits_per_sample));
|
||||
}
|
||||
|
||||
decode_residual(decoded, subframe, bit_input);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue