Update FLAC decoder.

This commit is contained in:
David Reid
2020-08-30 11:41:37 +10:00
parent 2012c93cc9
commit 6562e6a0c8
2 changed files with 18 additions and 9 deletions
+11 -5
View File
@@ -1,6 +1,6 @@
/* /*
FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file. FLAC audio decoder. Choice of public domain or MIT-0. See license statements at the end of this file.
dr_flac - v0.12.18 - 2020-08-14 dr_flac - v0.12.19 - 2020-08-30
David Reid - mackron@gmail.com David Reid - mackron@gmail.com
@@ -232,7 +232,7 @@ extern "C" {
#define DRFLAC_VERSION_MAJOR 0 #define DRFLAC_VERSION_MAJOR 0
#define DRFLAC_VERSION_MINOR 12 #define DRFLAC_VERSION_MINOR 12
#define DRFLAC_VERSION_REVISION 18 #define DRFLAC_VERSION_REVISION 19
#define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION) #define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION)
#include <stddef.h> /* For size_t. */ #include <stddef.h> /* For size_t. */
@@ -2389,7 +2389,6 @@ static DRFLAC_INLINE drflac_bool32 drflac__read_uint32(drflac_bs* bs, unsigned i
static drflac_bool32 drflac__read_int32(drflac_bs* bs, unsigned int bitCount, drflac_int32* pResult) static drflac_bool32 drflac__read_int32(drflac_bs* bs, unsigned int bitCount, drflac_int32* pResult)
{ {
drflac_uint32 result; drflac_uint32 result;
drflac_uint32 signbit;
DRFLAC_ASSERT(bs != NULL); DRFLAC_ASSERT(bs != NULL);
DRFLAC_ASSERT(pResult != NULL); DRFLAC_ASSERT(pResult != NULL);
@@ -2400,8 +2399,12 @@ static drflac_bool32 drflac__read_int32(drflac_bs* bs, unsigned int bitCount, dr
return DRFLAC_FALSE; return DRFLAC_FALSE;
} }
signbit = ((result >> (bitCount-1)) & 0x01); /* Do not attempt to shift by 32 as it's undefined. */
result |= (~signbit + 1) << bitCount; if (bitCount < 32) {
drflac_uint32 signbit;
signbit = ((result >> (bitCount-1)) & 0x01);
result |= (~signbit + 1) << bitCount;
}
*pResult = (drflac_int32)result; *pResult = (drflac_int32)result;
return DRFLAC_TRUE; return DRFLAC_TRUE;
@@ -11769,6 +11772,9 @@ DRFLAC_API drflac_bool32 drflac_next_cuesheet_track(drflac_cuesheet_track_iterat
/* /*
REVISION HISTORY REVISION HISTORY
================ ================
v0.12.19 - 2020-08-30
- Fix a bug due to an undefined 32-bit shift.
v0.12.18 - 2020-08-14 v0.12.18 - 2020-08-14
- Fix a crash when compiling with clang-cl. - Fix a crash when compiling with clang-cl.
+7 -4
View File
@@ -42951,7 +42951,7 @@ extern "C" {
#define DRFLAC_XSTRINGIFY(x) DRFLAC_STRINGIFY(x) #define DRFLAC_XSTRINGIFY(x) DRFLAC_STRINGIFY(x)
#define DRFLAC_VERSION_MAJOR 0 #define DRFLAC_VERSION_MAJOR 0
#define DRFLAC_VERSION_MINOR 12 #define DRFLAC_VERSION_MINOR 12
#define DRFLAC_VERSION_REVISION 18 #define DRFLAC_VERSION_REVISION 19
#define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION) #define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION)
#include <stddef.h> #include <stddef.h>
typedef signed char drflac_int8; typedef signed char drflac_int8;
@@ -51691,7 +51691,6 @@ static DRFLAC_INLINE drflac_bool32 drflac__read_uint32(drflac_bs* bs, unsigned i
static drflac_bool32 drflac__read_int32(drflac_bs* bs, unsigned int bitCount, drflac_int32* pResult) static drflac_bool32 drflac__read_int32(drflac_bs* bs, unsigned int bitCount, drflac_int32* pResult)
{ {
drflac_uint32 result; drflac_uint32 result;
drflac_uint32 signbit;
DRFLAC_ASSERT(bs != NULL); DRFLAC_ASSERT(bs != NULL);
DRFLAC_ASSERT(pResult != NULL); DRFLAC_ASSERT(pResult != NULL);
DRFLAC_ASSERT(bitCount > 0); DRFLAC_ASSERT(bitCount > 0);
@@ -51699,8 +51698,11 @@ static drflac_bool32 drflac__read_int32(drflac_bs* bs, unsigned int bitCount, dr
if (!drflac__read_uint32(bs, bitCount, &result)) { if (!drflac__read_uint32(bs, bitCount, &result)) {
return DRFLAC_FALSE; return DRFLAC_FALSE;
} }
signbit = ((result >> (bitCount-1)) & 0x01); if (bitCount < 32) {
result |= (~signbit + 1) << bitCount; drflac_uint32 signbit;
signbit = ((result >> (bitCount-1)) & 0x01);
result |= (~signbit + 1) << bitCount;
}
*pResult = (drflac_int32)result; *pResult = (drflac_int32)result;
return DRFLAC_TRUE; return DRFLAC_TRUE;
} }
@@ -62533,6 +62535,7 @@ v0.10.18 - TBD
- Change channel converter configs to use the default channel map instead of a blank channel map when no channel map is specified when initializing the - Change channel converter configs to use the default channel map instead of a blank channel map when no channel map is specified when initializing the
config. This fixes an issue where the optimized mono expansion path would never get used. config. This fixes an issue where the optimized mono expansion path would never get used.
- Use a more appropriate default format for FLAC decoders. This will now use ma_format_s16 when the FLAC is encoded as 16-bit. - Use a more appropriate default format for FLAC decoders. This will now use ma_format_s16 when the FLAC is encoded as 16-bit.
- Update FLAC decoder.
v0.10.17 - 2020-08-28 v0.10.17 - 2020-08-28
- Fix an error where the WAV codec is incorrectly excluded from the build depending on which compile time options are set. - Fix an error where the WAV codec is incorrectly excluded from the build depending on which compile time options are set.