mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-14 18:30:38 +00:00
LibAudio: Skip empty MP3 scale factor bands in stereo intensity process
These were intentionally set up to be at the end of the granule size, but since the stereo intensity loop is intentionally using a <= end comparison (that’s how the scale factor bands work), we must skip these dummy bands which would otherwise cause an out-of-bounds index.
This commit is contained in:
parent
24f5914d18
commit
a0bcc9dd83
Notes:
sideshowbarker
2024-07-17 05:05:51 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/a0bcc9dd83 Pull-request: https://github.com/SerenityOS/serenity/pull/20686 Reviewed-by: https://github.com/Hendiadyoin1
1 changed files with 3 additions and 0 deletions
|
@ -724,6 +724,9 @@ void MP3LoaderPlugin::process_stereo(MP3::MP3Frame& frame, size_t granule_index)
|
|||
|
||||
auto process_intensity_stereo = [&](MP3::Tables::ScaleFactorBand const& band, float intensity_stereo_ratio) {
|
||||
for (size_t i = band.start; i <= band.end; i++) {
|
||||
// Superflous empty scale factor band.
|
||||
if (i >= MP3::granule_size)
|
||||
continue;
|
||||
float const sample_left = granule_left.samples[i];
|
||||
float const coeff_l = intensity_stereo_ratio / (1 + intensity_stereo_ratio);
|
||||
float const coeff_r = 1 / (1 + intensity_stereo_ratio);
|
||||
|
|
Loading…
Reference in a new issue