Commit 7e1bdf77 authored by David Reid's avatar David Reid

Update dr_flac and dr_mp3.

parent 1f295eba
This diff is collapsed.
/* /*
MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. MP3 audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_mp3 - v0.6.3 - 2020-04-13 dr_mp3 - v0.6.4 - 2020-04-19
David Reid - mackron@gmail.com David Reid - mackron@gmail.com
...@@ -669,6 +669,17 @@ static int drmp3_have_simd(void) ...@@ -669,6 +669,17 @@ static int drmp3_have_simd(void)
#endif #endif
#if defined(__ARM_ARCH) && (__ARM_ARCH >= 6) && !defined(__aarch64__)
#define DRMP3_HAVE_ARMV6 1
static __inline__ __attribute__((always_inline)) drmp32_int32 drmp3_clip_int16_arm(int32_t a)
{
drmp3_int32 x = 0;
__asm__ ("ssat %0, #16, %1" : "=r"(x) : "r"(a));
return x;
}
#endif
typedef struct typedef struct
{ {
const drmp3_uint8 *buf; const drmp3_uint8 *buf;
...@@ -1888,11 +1899,17 @@ typedef drmp3_int16 drmp3d_sample_t; ...@@ -1888,11 +1899,17 @@ typedef drmp3_int16 drmp3d_sample_t;
static drmp3_int16 drmp3d_scale_pcm(float sample) static drmp3_int16 drmp3d_scale_pcm(float sample)
{ {
drmp3_int16 s; drmp3_int16 s;
#if DRMP3_HAVE_ARMV6
drmp3_int32 s32 = (drmp3_int32)(sample + .5f);
s32 -= (s32 < 0);
s = (drmp3_int16)drmp3_clip_int16_arm(s32);
#else
if (sample >= 32766.5) return (drmp3_int16) 32767; if (sample >= 32766.5) return (drmp3_int16) 32767;
if (sample <= -32767.5) return (drmp3_int16)-32768; if (sample <= -32767.5) return (drmp3_int16)-32768;
s = (drmp3_int16)(sample + .5f); s = (drmp3_int16)(sample + .5f);
s -= (s < 0); /* away from zero, to be compliant */ s -= (s < 0); /* away from zero, to be compliant */
return (drmp3_int16)s; #endif
return s;
} }
#else #else
typedef float drmp3d_sample_t; typedef float drmp3d_sample_t;
...@@ -4343,6 +4360,9 @@ counts rather than sample counts. ...@@ -4343,6 +4360,9 @@ counts rather than sample counts.
/* /*
REVISION HISTORY REVISION HISTORY
================ ================
v0.6.4 - 2020-04-19
- Bring up to date with changes to minimp3.
v0.6.3 - 2020-04-13 v0.6.3 - 2020-04-13
- Fix some pedantic warnings. - Fix some pedantic warnings.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment