mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibAudio: Don't unnecessarily copy the passed decode buffer
This commit is contained in:
parent
0d28b6d236
commit
982529a948
Notes:
sideshowbarker
2024-07-17 22:40:41 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/982529a948b Pull-request: https://github.com/SerenityOS/serenity/pull/11285 Reviewed-by: https://github.com/bgianfo
2 changed files with 4 additions and 4 deletions
|
@ -610,7 +610,7 @@ ErrorOr<Vector<i32>, LoaderError> FlacLoaderPlugin::decode_custom_lpc(FlacSubfra
|
|||
|
||||
dbgln_if(AFLACLOADER_DEBUG, "{}-bit {} shift coefficients: {}", lpc_precision, lpc_shift, coefficients);
|
||||
|
||||
decoded = TRY(decode_residual(decoded, subframe, bit_input));
|
||||
TRY(decode_residual(decoded, subframe, bit_input));
|
||||
|
||||
// approximate the waveform with the predictor
|
||||
for (size_t i = subframe.order; i < m_current_frame->sample_count; ++i) {
|
||||
|
@ -680,7 +680,7 @@ ErrorOr<Vector<i32>, LoaderError> FlacLoaderPlugin::decode_fixed_lpc(FlacSubfram
|
|||
}
|
||||
|
||||
// Decode the residual, the "error" between the function approximation and the actual audio data
|
||||
ErrorOr<Vector<i32>, LoaderError> FlacLoaderPlugin::decode_residual(Vector<i32>& decoded, FlacSubframeHeader& subframe, InputBitStream& bit_input)
|
||||
MaybeLoaderError FlacLoaderPlugin::decode_residual(Vector<i32>& decoded, FlacSubframeHeader& subframe, InputBitStream& bit_input)
|
||||
{
|
||||
u8 residual_mode = static_cast<u8>(bit_input.read_bits_big_endian(2));
|
||||
u8 partition_order = static_cast<u8>(bit_input.read_bits_big_endian(4));
|
||||
|
@ -701,7 +701,7 @@ ErrorOr<Vector<i32>, LoaderError> FlacLoaderPlugin::decode_residual(Vector<i32>&
|
|||
} else
|
||||
return LoaderError { LoaderError::Category::Format, static_cast<size_t>(m_current_sample_or_frame), "Reserved residual coding method" };
|
||||
|
||||
return decoded;
|
||||
return {};
|
||||
}
|
||||
|
||||
// Decode a single Rice partition as part of the residual, every partition can have its own Rice parameter k
|
||||
|
|
|
@ -121,7 +121,7 @@ private:
|
|||
ErrorOr<Vector<i32>, LoaderError> decode_fixed_lpc(FlacSubframeHeader& subframe, InputBitStream& bit_input);
|
||||
ErrorOr<Vector<i32>, LoaderError> decode_verbatim(FlacSubframeHeader& subframe, InputBitStream& bit_input);
|
||||
ErrorOr<Vector<i32>, LoaderError> decode_custom_lpc(FlacSubframeHeader& subframe, InputBitStream& bit_input);
|
||||
ErrorOr<Vector<i32>, LoaderError> decode_residual(Vector<i32>& decoded, FlacSubframeHeader& subframe, InputBitStream& bit_input);
|
||||
MaybeLoaderError decode_residual(Vector<i32>& decoded, FlacSubframeHeader& subframe, InputBitStream& bit_input);
|
||||
// decode a single rice partition that has its own rice parameter
|
||||
ALWAYS_INLINE Vector<i32> decode_rice_partition(u8 partition_type, u32 partitions, u32 partition_index, FlacSubframeHeader& subframe, InputBitStream& bit_input);
|
||||
|
||||
|
|
Loading…
Reference in a new issue