Skip to content

Commit 70e1cdc

Browse files
committed
Merged revision(s) 18570, 21443, 21446, 21451 from trunk/OpenMPT:
[Ref] minimp3: Silence warning. ........ [Var] minimp3: Update to fork <https://github.com/manxorist/minimp3/releases/tag/openmpt-2024-08-15-v2> commit 30b5aea9b6d000f197798ddd44476b641a4d0ba7 (2024-08-15). This applies the following pull requests: <lieff/minimp3#126>, <lieff/minimp3#96>, <lieff/minimp3#97>. ........ [Var] minimp3: Update to fork <https://github.com/manxorist/minimp3/releases/tag/openmpt-2024-08-15-v3> commit 2811a29e4115199209fe91ae5217c9c5fc611fa6 (2024-08-15). This applies the following pull requests: <lieff/minimp3#125>. ........ [Var] minimp3: Update to fork <https://github.com/manxorist/minimp3/releases/tag/openmpt-2024-08-15-v4> commit 2811a29e4115199209fe91ae5217c9c5fc611fa6 (2024-08-15). This applies the following pull requests: <lieff/minimp3#127>. ........ git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.30@24370 56274372-70c3-4bfc-bfc3-4c3a0b034d27
1 parent bd59879 commit 70e1cdc

File tree

2 files changed

+38
-12
lines changed

2 files changed

+38
-12
lines changed

include/minimp3/OpenMPT.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
minimp3 library from https://github.com/lieff/minimp3
2-
commit 50d2aaf360a53653b718fead8e258d654c3a7e41 (2021-11-27)
2+
Fork https://github.com/manxorist/minimp3/releases/tag/openmpt-2024-08-15-v4
3+
commit 2116754771b79347ad2f39127abace2a093c383e (2024-08-15)
34
The following changes have been made:
45
* minimp3.c has been added
6+
* The following pull rquests have been merged:
7+
* https://github.com/lieff/minimp3/pull/126
8+
* https://github.com/lieff/minimp3/pull/96
9+
* https://github.com/lieff/minimp3/pull/97
10+
* https://github.com/lieff/minimp3/pull/125
11+
* https://github.com/lieff/minimp3/pull/127
12+
* all modifications are marked by /* OpenMPT */

include/minimp3/minimp3.h

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
*/
99
#include <stdint.h>
1010

11+
#ifdef __cplusplus
12+
extern "C" {
13+
#endif /* __cplusplus */
14+
1115
#define MINIMP3_MAX_SAMPLES_PER_FRAME (1152*2)
1216

1317
typedef struct
@@ -22,10 +26,6 @@ typedef struct
2226
unsigned char header[4], reserv_buf[511];
2327
} mp3dec_t;
2428

25-
#ifdef __cplusplus
26-
extern "C" {
27-
#endif /* __cplusplus */
28-
2929
void mp3dec_init(mp3dec_t *dec);
3030
#ifndef MINIMP3_FLOAT_OUTPUT
3131
typedef int16_t mp3d_sample_t;
@@ -176,7 +176,7 @@ static int have_simd(void)
176176
#define VMUL_S(x, s) vmulq_f32(x, vmovq_n_f32(s))
177177
#define VREV(x) vcombine_f32(vget_high_f32(vrev64q_f32(x)), vget_low_f32(vrev64q_f32(x)))
178178
typedef float32x4_t f4;
179-
static int have_simd()
179+
static int have_simd(void)
180180
{ /* TODO: detect neon for !MINIMP3_ONLY_SIMD */
181181
return 1;
182182
}
@@ -191,7 +191,7 @@ static int have_simd()
191191
#define HAVE_SIMD 0
192192
#endif /* !defined(MINIMP3_NO_SIMD) */
193193

194-
#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64)
194+
#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__) && !defined(_M_ARM64) && !defined(__ARM_ARCH_6M__)
195195
#define HAVE_ARMV6 1
196196
static __inline__ __attribute__((always_inline)) int32_t minimp3_clip_int16_arm(int32_t a)
197197
{
@@ -941,15 +941,16 @@ static void L3_stereo_top_band(const float *right, const uint8_t *sfb, int nband
941941
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)
942942
{
943943
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 };
944-
unsigned i, max_pos = HDR_TEST_MPEG1(hdr) ? 7 : 64;
944+
const uint8_t mpeg1 = HDR_TEST_MPEG1(hdr);
945+
unsigned i, max_pos = mpeg1 ? 7 : 64;
945946

946947
for (i = 0; sfb[i]; i++)
947948
{
948949
unsigned ipos = ist_pos[i];
949950
if ((int)i > max_band[i % 3] && ipos < max_pos)
950951
{
951952
float kl, kr, s = HDR_TEST_MS_STEREO(hdr) ? 1.41421356f : 1;
952-
if (HDR_TEST_MPEG1(hdr))
953+
if (mpeg1)
953954
{
954955
kl = g_pan[2*ipos];
955956
kr = g_pan[2*ipos + 1];
@@ -1654,6 +1655,21 @@ static void mp3d_synth_granule(float *qmf_state, float *grbuf, int nbands, int n
16541655
}
16551656
}
16561657

1658+
static int hdr_is_tag(const uint8_t* hdr)
1659+
{
1660+
return hdr[0] == 'T' && hdr[1] == 'A' && hdr[2] == 'G' && hdr[3] == '\0';
1661+
}
1662+
1663+
static int hdr_is_null(const uint8_t* hdr)
1664+
{
1665+
return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\0' && hdr[3] == '\0';
1666+
}
1667+
1668+
static int hdr_is_null_or_tag(const uint8_t* hdr)
1669+
{
1670+
return hdr_is_tag(hdr) > 0 || hdr_is_null(hdr) > 0;
1671+
}
1672+
16571673
static int mp3d_match_frame(const uint8_t *hdr, int mp3_bytes, int frame_bytes)
16581674
{
16591675
int i, nmatch;
@@ -1662,6 +1678,8 @@ static int mp3d_match_frame(const uint8_t *hdr, int mp3_bytes, int frame_bytes)
16621678
i += hdr_frame_bytes(hdr + i, frame_bytes) + hdr_padding(hdr + i);
16631679
if (i + HDR_SIZE > mp3_bytes)
16641680
return nmatch > 0;
1681+
if (hdr_is_null_or_tag(hdr + i))
1682+
return nmatch > 0;
16651683
if (!hdr_compare(hdr, hdr + i))
16661684
return 0;
16671685
}
@@ -1769,7 +1787,7 @@ int mp3dec_decode_frame(mp3dec_t *dec, const uint8_t *mp3, int mp3_bytes, mp3d_s
17691787
{
17701788
for (igr = 0; igr < (HDR_TEST_MPEG1(hdr) ? 2 : 1); igr++, pcm += 576*info->channels)
17711789
{
1772-
memset(scratch.grbuf[0], 0, 576*2*sizeof(float));
1790+
memset(scratch.grbuf, 0, sizeof(scratch.grbuf));
17731791
L3_decode(dec, &scratch, scratch.gr_info + igr*info->channels, info->channels);
17741792
mp3d_synth_granule(dec->qmf_state, scratch.grbuf[0], 18, info->channels, pcm, scratch.syn[0]);
17751793
}
@@ -1783,15 +1801,15 @@ int mp3dec_decode_frame(mp3dec_t *dec, const uint8_t *mp3, int mp3_bytes, mp3d_s
17831801
L12_scale_info sci[1];
17841802
L12_read_scale_info(hdr, bs_frame, sci);
17851803

1786-
memset(scratch.grbuf[0], 0, 576*2*sizeof(float));
1804+
memset(scratch.grbuf, 0, sizeof(scratch.grbuf));
17871805
for (i = 0, igr = 0; igr < 3; igr++)
17881806
{
17891807
if (12 == (i += L12_dequantize_granule(scratch.grbuf[0] + i, bs_frame, sci, info->layer | 1)))
17901808
{
17911809
i = 0;
17921810
L12_apply_scf_384(sci, sci->scf + igr, scratch.grbuf[0]);
17931811
mp3d_synth_granule(dec->qmf_state, scratch.grbuf[0], 12, info->channels, pcm, scratch.syn[0]);
1794-
memset(scratch.grbuf[0], 0, 576*2*sizeof(float));
1812+
memset(scratch.grbuf, 0, sizeof(scratch.grbuf));
17951813
pcm += 384*info->channels;
17961814
}
17971815
if (bs_frame->pos > bs_frame->limit)

0 commit comments

Comments
 (0)