mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-01 20:10:28 +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
Notes:
sideshowbarker
2024-07-19 17:20:17 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/2ecd1151768 Pull-request: https://github.com/SerenityOS/serenity/pull/9194
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…
Reference in a new issue