mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
LibAudio: Expand FLAC loader debug messages
These are now indented to aid readability.
This commit is contained in:
parent
60f1472902
commit
252b1328ea
Notes:
sideshowbarker
2024-07-17 05:23:40 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/252b1328ea Pull-request: https://github.com/SerenityOS/serenity/pull/19790 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/alimpfard
@ -695,7 +695,7 @@ ErrorOr<void, LoaderError> FlacLoaderPlugin::parse_subframe(Vector<i64>& samples
|
||||
case FlacSubframeType::Constant: {
|
||||
// 11.26. SUBFRAME_CONSTANT
|
||||
u64 constant_value = TRY(bit_input.read_bits<u64>(subframe_header.bits_per_sample - subframe_header.wasted_bits_per_sample));
|
||||
dbgln_if(AFLACLOADER_DEBUG, "Constant subframe: {}", constant_value);
|
||||
dbgln_if(AFLACLOADER_DEBUG, " Constant subframe: {}", constant_value);
|
||||
|
||||
VERIFY(subframe_header.bits_per_sample - subframe_header.wasted_bits_per_sample != 0);
|
||||
i64 constant = sign_extend(static_cast<u64>(constant_value), subframe_header.bits_per_sample - subframe_header.wasted_bits_per_sample);
|
||||
@ -705,17 +705,17 @@ ErrorOr<void, LoaderError> FlacLoaderPlugin::parse_subframe(Vector<i64>& samples
|
||||
break;
|
||||
}
|
||||
case FlacSubframeType::Fixed: {
|
||||
dbgln_if(AFLACLOADER_DEBUG, "Fixed LPC subframe order {}", subframe_header.order);
|
||||
dbgln_if(AFLACLOADER_DEBUG, " Fixed LPC subframe order {}", subframe_header.order);
|
||||
samples = TRY(decode_fixed_lpc(subframe_header, bit_input));
|
||||
break;
|
||||
}
|
||||
case FlacSubframeType::Verbatim: {
|
||||
dbgln_if(AFLACLOADER_DEBUG, "Verbatim subframe");
|
||||
dbgln_if(AFLACLOADER_DEBUG, " Verbatim subframe");
|
||||
samples = TRY(decode_verbatim(subframe_header, bit_input));
|
||||
break;
|
||||
}
|
||||
case FlacSubframeType::LPC: {
|
||||
dbgln_if(AFLACLOADER_DEBUG, "Custom LPC subframe order {}", subframe_header.order);
|
||||
dbgln_if(AFLACLOADER_DEBUG, " Custom LPC subframe order {}", subframe_header.order);
|
||||
TRY(decode_custom_lpc(samples, subframe_header, bit_input));
|
||||
break;
|
||||
}
|
||||
@ -790,7 +790,7 @@ ErrorOr<void, LoaderError> FlacLoaderPlugin::decode_custom_lpc(Vector<i64>& deco
|
||||
coefficients.unchecked_append(coefficient);
|
||||
}
|
||||
|
||||
dbgln_if(AFLACLOADER_DEBUG, "{}-bit {} shift coefficients: {}", lpc_precision, lpc_shift, coefficients);
|
||||
dbgln_if(AFLACLOADER_DEBUG, " {}-bit {} shift coefficients: {}", lpc_precision, lpc_shift, coefficients);
|
||||
|
||||
TRY(decode_residual(decoded, subframe, bit_input));
|
||||
|
||||
@ -833,7 +833,7 @@ ErrorOr<Vector<i64>, LoaderError> FlacLoaderPlugin::decode_fixed_lpc(FlacSubfram
|
||||
|
||||
TRY(decode_residual(decoded, subframe, bit_input));
|
||||
|
||||
dbgln_if(AFLACLOADER_DEBUG, "decoded length {}, {} order predictor", decoded.size(), subframe.order);
|
||||
dbgln_if(AFLACLOADER_DEBUG, " decoded length {}, {} order predictor, now at file offset {:x}", decoded.size(), subframe.order, TRY(m_stream->tell()));
|
||||
|
||||
// Skip these comments if you don't care about the neat math behind fixed LPC :^)
|
||||
// These coefficients for the recursive prediction formula are the only ones that can be resolved to polynomial predictor functions.
|
||||
@ -893,6 +893,8 @@ MaybeLoaderError FlacLoaderPlugin::decode_residual(Vector<i64>& decoded, FlacSub
|
||||
u8 partition_order = TRY(bit_input.read_bits<u8>(4));
|
||||
size_t partitions = 1 << partition_order;
|
||||
|
||||
dbgln_if(AFLACLOADER_DEBUG, " {}-bit Rice partitions, {} total (order {})", residual_mode == FlacResidualMode::Rice4Bit ? "4"sv : "5"sv, partitions, partition_order);
|
||||
|
||||
if (partitions > m_current_frame->sample_count)
|
||||
return LoaderError { LoaderError::Category::Format, static_cast<size_t>(m_current_sample_or_frame), "Too many Rice partitions, each partition must contain at least one sample" };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user