Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions minimp3.h
Original file line number Diff line number Diff line change
Expand Up @@ -941,15 +941,16 @@ static void L3_stereo_top_band(const float *right, const uint8_t *sfb, int nband
static void L3_stereo_process(float *left, const uint8_t *ist_pos, const uint8_t *sfb, const uint8_t *hdr, int max_band[3], int mpeg2_sh)
{
static const float g_pan[7*2] = { 0,1,0.21132487f,0.78867513f,0.36602540f,0.63397460f,0.5f,0.5f,0.63397460f,0.36602540f,0.78867513f,0.21132487f,1,0 };
unsigned i, max_pos = HDR_TEST_MPEG1(hdr) ? 7 : 64;
const uint8_t mpeg1 = HDR_TEST_MPEG1(hdr);
unsigned i, max_pos = mpeg1 ? 7 : 64;

for (i = 0; sfb[i]; i++)
{
unsigned ipos = ist_pos[i];
if ((int)i > max_band[i % 3] && ipos < max_pos)
{
float kl, kr, s = HDR_TEST_MS_STEREO(hdr) ? 1.41421356f : 1;
if (HDR_TEST_MPEG1(hdr))
if (mpeg1)
{
kl = g_pan[2*ipos];
kr = g_pan[2*ipos + 1];
Expand Down Expand Up @@ -1769,7 +1770,7 @@ int mp3dec_decode_frame(mp3dec_t *dec, const uint8_t *mp3, int mp3_bytes, mp3d_s
{
for (igr = 0; igr < (HDR_TEST_MPEG1(hdr) ? 2 : 1); igr++, pcm += 576*info->channels)
{
memset(scratch.grbuf[0], 0, 576*2*sizeof(float));
memset(scratch.grbuf, 0, sizeof(scratch.grbuf));
L3_decode(dec, &scratch, scratch.gr_info + igr*info->channels, info->channels);
mp3d_synth_granule(dec->qmf_state, scratch.grbuf[0], 18, info->channels, pcm, scratch.syn[0]);
}
Expand All @@ -1783,15 +1784,15 @@ int mp3dec_decode_frame(mp3dec_t *dec, const uint8_t *mp3, int mp3_bytes, mp3d_s
L12_scale_info sci[1];
L12_read_scale_info(hdr, bs_frame, sci);

memset(scratch.grbuf[0], 0, 576*2*sizeof(float));
memset(scratch.grbuf, 0, sizeof(scratch.grbuf));
for (i = 0, igr = 0; igr < 3; igr++)
{
if (12 == (i += L12_dequantize_granule(scratch.grbuf[0] + i, bs_frame, sci, info->layer | 1)))
{
i = 0;
L12_apply_scf_384(sci, sci->scf + igr, scratch.grbuf[0]);
mp3d_synth_granule(dec->qmf_state, scratch.grbuf[0], 12, info->channels, pcm, scratch.syn[0]);
memset(scratch.grbuf[0], 0, 576*2*sizeof(float));
memset(scratch.grbuf, 0, sizeof(scratch.grbuf));
pcm += 384*info->channels;
}
if (bs_frame->pos > bs_frame->limit)
Expand Down