Update several of the dependencies

- Updated libFLAC to the latest Git commit, post 1.3.4.
- Updated libid3tag to 0.16.1.
- Updated libopus to the latest Git commit.
- Updated my FFmpeg libfdk-aac patch. Previously was overwriting
  memory when it was supposed to be skipping samples.

Also added debug versions of several of the libraries, and changed
the library extractor script to unpack the debug libraries over the
release set to add the particular matching debug versions when
building a debug build.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
main
Christopher Snowhill 2022-07-12 23:03:07 -07:00
parent 4a5d21836a
commit 8d231d34d4
18 changed files with 138 additions and 396 deletions

4
.gitignore vendored
View File

@ -34,7 +34,7 @@ Xcode-config/DEVELOPMENT_TEAM.xcconfig
/ThirdParty/ffmpeg/lib/libavformat.59.dylib
/ThirdParty/ffmpeg/lib/libavutil.57.dylib
/ThirdParty/ffmpeg/lib/libswresample.4.dylib
/ThirdParty/flac/lib/libFLAC.8.dylib
/ThirdParty/flac/lib/libFLAC.12.dylib
/ThirdParty/libid3tag/lib/libid3tag.a
/ThirdParty/libmad/lib/libmad.a
/ThirdParty/libopenmpt/lib/libopenmpt.a
@ -47,3 +47,5 @@ Xcode-config/DEVELOPMENT_TEAM.xcconfig
/ThirdParty/opus/lib/libopus.0.dylib
/ThirdParty/opusfile/lib/libopusfile.0.dylib
/ThirdParty/speex/libspeex.a
/ThirdParty/vorbis/lib/libvorbisfile.3.dylib
/ThirdParty/vorbis/lib/libvorbis.0.dylib

View File

@ -135,7 +135,7 @@
836EF0C827BB91E600BF35B2 /* libogg.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C427BB919300BF35B2 /* libogg.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
836EF0C927BB91E900BF35B2 /* libvorbisfile.3.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C627BB91AB00BF35B2 /* libvorbisfile.3.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
836EF0CA27BB91EB00BF35B2 /* libvorbis.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C527BB91AB00BF35B2 /* libvorbis.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
836EF0CB27BB91EE00BF35B2 /* libFLAC.8.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C727BB91BC00BF35B2 /* libFLAC.8.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
836EF0CB27BB91EE00BF35B2 /* libFLAC.12.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0C727BB91BC00BF35B2 /* libFLAC.12.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
836EF0E027BB98A800BF35B2 /* libopus.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0CC27BB94E100BF35B2 /* libopus.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
836EF0E127BB98AB00BF35B2 /* libopusfile.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 836EF0CD27BB94F100BF35B2 /* libopusfile.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
836F462128207F43005B9B87 /* Plaque.png in Resources */ = {isa = PBXBuildFile; fileRef = 836F461D28207F43005B9B87 /* Plaque.png */; };
@ -726,7 +726,7 @@
files = (
836EF0E127BB98AB00BF35B2 /* libopusfile.0.dylib in CopyFiles */,
836EF0E027BB98A800BF35B2 /* libopus.0.dylib in CopyFiles */,
836EF0CB27BB91EE00BF35B2 /* libFLAC.8.dylib in CopyFiles */,
836EF0CB27BB91EE00BF35B2 /* libFLAC.12.dylib in CopyFiles */,
836EF0CA27BB91EB00BF35B2 /* libvorbis.0.dylib in CopyFiles */,
83256B69286661FC0036D9C0 /* libmpg123.0.dylib in CopyFiles */,
836EF0C927BB91E900BF35B2 /* libvorbisfile.3.dylib in CopyFiles */,
@ -975,7 +975,7 @@
836EF0C427BB919300BF35B2 /* libogg.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libogg.0.dylib; path = ThirdParty/ogg/lib/libogg.0.dylib; sourceTree = "<group>"; };
836EF0C527BB91AB00BF35B2 /* libvorbis.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbis.0.dylib; path = ThirdParty/vorbis/lib/libvorbis.0.dylib; sourceTree = "<group>"; };
836EF0C627BB91AB00BF35B2 /* libvorbisfile.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libvorbisfile.3.dylib; path = ThirdParty/vorbis/lib/libvorbisfile.3.dylib; sourceTree = "<group>"; };
836EF0C727BB91BC00BF35B2 /* libFLAC.8.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.8.dylib; path = ThirdParty/flac/lib/libFLAC.8.dylib; sourceTree = "<group>"; };
836EF0C727BB91BC00BF35B2 /* libFLAC.12.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.12.dylib; path = ThirdParty/flac/lib/libFLAC.12.dylib; sourceTree = "<group>"; };
836EF0CC27BB94E100BF35B2 /* libopus.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libopus.0.dylib; path = ThirdParty/opus/lib/libopus.0.dylib; sourceTree = "<group>"; };
836EF0CD27BB94F100BF35B2 /* libopusfile.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libopusfile.0.dylib; path = ThirdParty/opusfile/lib/libopusfile.0.dylib; sourceTree = "<group>"; };
836F461D28207F43005B9B87 /* Plaque.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Plaque.png; path = Images/Plaque.png; sourceTree = "<group>"; };
@ -1190,7 +1190,7 @@
835FAC7D27BCDF5B00BA8562 /* libavif.a */,
836EF0CD27BB94F100BF35B2 /* libopusfile.0.dylib */,
836EF0CC27BB94E100BF35B2 /* libopus.0.dylib */,
836EF0C727BB91BC00BF35B2 /* libFLAC.8.dylib */,
836EF0C727BB91BC00BF35B2 /* libFLAC.12.dylib */,
836EF0C527BB91AB00BF35B2 /* libvorbis.0.dylib */,
836EF0C627BB91AB00BF35B2 /* libvorbisfile.3.dylib */,
836EF0C427BB919300BF35B2 /* libogg.0.dylib */,

View File

@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
17C93F080B8FF67A008627D6 /* FlacDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 17C93F040B8FF67A008627D6 /* FlacDecoder.m */; };
8301C147287805F500651A6E /* NSDictionary+Merge.m in Sources */ = {isa = PBXBuildFile; fileRef = 8301C146287805F500651A6E /* NSDictionary+Merge.m */; };
836EF0DA27BB970B00BF35B2 /* libFLAC.8.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 836EF0D927BB970B00BF35B2 /* libFLAC.8.dylib */; };
836EF0DA27BB970B00BF35B2 /* libFLAC.12.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 836EF0D927BB970B00BF35B2 /* libFLAC.12.dylib */; };
83AA660B27B7DAE40098D4B8 /* cuesheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 83AA660A27B7DAE40098D4B8 /* cuesheet.m */; };
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
@ -38,7 +38,7 @@
8301C146287805F500651A6E /* NSDictionary+Merge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+Merge.m"; path = "../../Utils/NSDictionary+Merge.m"; sourceTree = "<group>"; };
834A42B4287AF7AA00EB9D9B /* AudioChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioChunk.h; path = ../../Audio/Chain/AudioChunk.h; sourceTree = "<group>"; };
8356BD1927B3CCBB0074E50C /* HTTPSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTTPSource.h; path = ../HTTPSource/HTTPSource.h; sourceTree = "<group>"; };
836EF0D927BB970B00BF35B2 /* libFLAC.8.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.8.dylib; path = ../../ThirdParty/flac/lib/libFLAC.8.dylib; sourceTree = "<group>"; };
836EF0D927BB970B00BF35B2 /* libFLAC.12.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.12.dylib; path = ../../ThirdParty/flac/lib/libFLAC.12.dylib; sourceTree = "<group>"; };
83747C4A2862DCF40021245F /* Shared.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Shared.xcconfig; sourceTree = "<group>"; };
8384912D180816C900E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
83AA660A27B7DAE40098D4B8 /* cuesheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = cuesheet.m; sourceTree = "<group>"; };
@ -52,7 +52,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
836EF0DA27BB970B00BF35B2 /* libFLAC.8.dylib in Frameworks */,
836EF0DA27BB970B00BF35B2 /* libFLAC.12.dylib in Frameworks */,
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -109,7 +109,7 @@
1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
836EF0D927BB970B00BF35B2 /* libFLAC.8.dylib */,
836EF0D927BB970B00BF35B2 /* libFLAC.12.dylib */,
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";

View File

@ -7,7 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
8301C14928780C1A00651A6E /* libFLAC.8.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8301C14828780C1A00651A6E /* libFLAC.8.dylib */; };
8301C14928780C1A00651A6E /* libFLAC.12.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8301C14828780C1A00651A6E /* libFLAC.12.dylib */; };
83186316285CEC91001422CC /* NSDictionary+Merge.m in Sources */ = {isa = PBXBuildFile; fileRef = 83186315285CEC91001422CC /* NSDictionary+Merge.m */; };
836EF0CF27BB952F00BF35B2 /* libopusfile.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 836EF0CE27BB952F00BF35B2 /* libopusfile.0.dylib */; };
8375B04017FFEA400092A79F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8375B03F17FFEA400092A79F /* Cocoa.framework */; };
@ -28,7 +28,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
8301C14828780C1A00651A6E /* libFLAC.8.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.8.dylib; path = ../../ThirdParty/flac/lib/libFLAC.8.dylib; sourceTree = "<group>"; };
8301C14828780C1A00651A6E /* libFLAC.12.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.12.dylib; path = ../../ThirdParty/flac/lib/libFLAC.12.dylib; sourceTree = "<group>"; };
83186314285CEC91001422CC /* NSDictionary+Merge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+Merge.h"; path = "../../../Utils/NSDictionary+Merge.h"; sourceTree = "<group>"; };
83186315285CEC91001422CC /* NSDictionary+Merge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+Merge.m"; path = "../../../Utils/NSDictionary+Merge.m"; sourceTree = "<group>"; };
833F68411CDBCABC00AFB9F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = "<group>"; };
@ -57,7 +57,7 @@
buildActionMask = 2147483647;
files = (
8375B04017FFEA400092A79F /* Cocoa.framework in Frameworks */,
8301C14928780C1A00651A6E /* libFLAC.8.dylib in Frameworks */,
8301C14928780C1A00651A6E /* libFLAC.12.dylib in Frameworks */,
836EF0CF27BB952F00BF35B2 /* libopusfile.0.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -95,7 +95,7 @@
8375B03E17FFEA400092A79F /* Frameworks */ = {
isa = PBXGroup;
children = (
8301C14828780C1A00651A6E /* libFLAC.8.dylib */,
8301C14828780C1A00651A6E /* libFLAC.12.dylib */,
836EF0CE27BB952F00BF35B2 /* libopusfile.0.dylib */,
8375B03F17FFEA400092A79F /* Cocoa.framework */,
8375B04117FFEA400092A79F /* Other Frameworks */,

View File

@ -8,7 +8,7 @@
/* Begin PBXBuildFile section */
17C93D360B8FDA66008627D6 /* VorbisDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 17C93D340B8FDA66008627D6 /* VorbisDecoder.m */; };
8301C14B287810F300651A6E /* libFLAC.8.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8301C14A287810F300651A6E /* libFLAC.8.dylib */; };
8301C14B287810F300651A6E /* libFLAC.12.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8301C14A287810F300651A6E /* libFLAC.12.dylib */; };
83186313285CEBD2001422CC /* NSDictionary+Merge.m in Sources */ = {isa = PBXBuildFile; fileRef = 83186312285CEBD2001422CC /* NSDictionary+Merge.m */; };
836EF0D627BB969D00BF35B2 /* libvorbisfile.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 836EF0D427BB969D00BF35B2 /* libvorbisfile.3.dylib */; };
836EF0DF27BB987000BF35B2 /* libvorbis.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 836EF0DE27BB987000BF35B2 /* libvorbis.0.dylib */; };
@ -25,7 +25,7 @@
17C93D330B8FDA66008627D6 /* VorbisDecoder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VorbisDecoder.h; sourceTree = "<group>"; };
17C93D340B8FDA66008627D6 /* VorbisDecoder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VorbisDecoder.m; sourceTree = "<group>"; };
32DBCF630370AF2F00C91783 /* VorbisPlugin_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VorbisPlugin_Prefix.pch; sourceTree = "<group>"; };
8301C14A287810F300651A6E /* libFLAC.8.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.8.dylib; path = ../../ThirdParty/flac/lib/libFLAC.8.dylib; sourceTree = "<group>"; };
8301C14A287810F300651A6E /* libFLAC.12.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libFLAC.12.dylib; path = ../../ThirdParty/flac/lib/libFLAC.12.dylib; sourceTree = "<group>"; };
83186311285CEBD2001422CC /* NSDictionary+Merge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+Merge.h"; path = "../../Utils/NSDictionary+Merge.h"; sourceTree = "<group>"; };
83186312285CEBD2001422CC /* NSDictionary+Merge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+Merge.m"; path = "../../Utils/NSDictionary+Merge.m"; sourceTree = "<group>"; };
834A42AB287AF0B000EB9D9B /* AudioChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioChunk.h; path = ../../Audio/Chain/AudioChunk.h; sourceTree = "<group>"; };
@ -48,7 +48,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8301C14B287810F300651A6E /* libFLAC.8.dylib in Frameworks */,
8301C14B287810F300651A6E /* libFLAC.12.dylib in Frameworks */,
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */,
836EF0DF27BB987000BF35B2 /* libvorbis.0.dylib in Frameworks */,
836EF0D627BB969D00BF35B2 /* libvorbisfile.3.dylib in Frameworks */,
@ -108,7 +108,7 @@
1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
8301C14A287810F300651A6E /* libFLAC.8.dylib */,
8301C14A287810F300651A6E /* libFLAC.12.dylib */,
836EF0DE27BB987000BF35B2 /* libvorbis.0.dylib */,
836EF0D427BB969D00BF35B2 /* libvorbisfile.3.dylib */,
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */,

View File

@ -2,6 +2,12 @@
BASEDIR=$(dirname "$0")
PREVIOUS_CONFIGURATION=$(cat "${BASEDIR}/../ThirdParty/libraries.updated")
if ( [[ "${CONFIGURATION}" = "Debug" ]] && [[ "${PREVIOUS_CONFIGURATION}" != "Debug" ]] ) || ( [[ "${CONFIGURATION}" != "Debug" ]] && [[ "${PREVIOUS_CONFIGURATION}" = "Debug" ]] ); then
rm -f "${BASEDIR}/../ThirdParty/libraries.updated"
fi
until [ ! -f "${BASEDIR}/../ThirdParty/libraries.extracting" ]
do
sleep 5
@ -10,7 +16,10 @@ done
if [ \( ! -f "${BASEDIR}/../ThirdParty/libraries.updated" \) -o \( "${BASEDIR}/../ThirdParty/libraries.updated" -ot "${BASEDIR}/../ThirdParty/libraries.tar.xz" \) ]; then
touch "${BASEDIR}/../ThirdParty/libraries.extracting"
tar -C "${BASEDIR}/../ThirdParty" -xvf "${BASEDIR}/../ThirdParty/libraries.tar.xz"
touch "${BASEDIR}/../ThirdParty/libraries.updated"
if [[ "${CONFIGURATION}" = "Debug" ]]; then
tar -C "${BASEDIR}/../ThirdParty" -xvf "${BASEDIR}/../ThirdParty/libraries-debug-overlay.tar.xz"
fi
echo "${CONFIGURATION}" > "${BASEDIR}/../ThirdParty/libraries.updated"
rm -f "${BASEDIR}/../ThirdParty/libraries.extracting"
fi

View File

@ -55,10 +55,10 @@ index 11eee51a98..9e199eb56f 100644
- memcpy(frame->extended_data[0], s->decoder_buffer + input_offset,
- avctx->ch_layout.nb_channels * frame->nb_samples *
- av_get_bytes_per_sample(avctx->sample_fmt));
+ const int count = avctx->channels * avctx->frame_size;
+ const int count = avctx->ch_layout.nb_channels * frame->nb_samples;
+ const float scale = 1.0f / (float)0x800000;
+ s->fmt_conv.int32_to_float_fmul_scalar((float *) frame->extended_data[0],
+ (INT_PCM *) s->decoder_buffer,
+ (INT_PCM *)s->decoder_buffer + input_offset,
+ scale, count);
*got_frame_ptr = 1;

View File

@ -7,14 +7,12 @@ cmake build-arm -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=
And some minor tweaks with `install_name_tool -id` to make sure that the
resulting libFLAC.8.dylib referred to itself with @rpath and not full
resulting libFLAC.12.dylib referred to itself with @rpath and not full
paths of the build directory, and imported libogg.0.dylib with an @rpath.
Version 1.3.4-0-g1151c93e was used from the following repository:
Version 1.3.3-235-g772efde6 was used from the following repository:
https://github.com/xiph/flac.git
A single patch was used, and is included. Affects x86_64, but not arm64.
x86_64 and arm64 were built separately, to allow for intrinsic functions
to be used for x86_64.
to be used for x86_64.

View File

@ -56,15 +56,22 @@
* \{
*/
#if defined(FLAC__NO_DLL)
#define FLAC_API
/* This has grown quite complicated. FLAC__NO_DLL is used by MSVC sln
* files and CMake, which build either static or shared. autotools can
* build static, shared or **both**. Therefore, DLL_EXPORT, which is set
* by libtool, must override FLAC__NO_DLL on building shared components
*/
#if defined(_WIN32)
#elif defined(_WIN32)
#if defined(FLAC__NO_DLL) && !(defined(DLL_EXPORT))
#define FLAC_API
#else
#ifdef FLAC_API_EXPORTS
#define FLAC_API __declspec(dllexport)
#else
#define FLAC_API __declspec(dllimport)
#endif
#endif
#elif defined(FLAC__USE_VISIBILITY_ATTR)
#define FLAC_API __attribute__ ((visibility ("default")))
@ -77,9 +84,9 @@
/** These \#defines will mirror the libtool-based library version number, see
* http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
*/
#define FLAC_API_VERSION_CURRENT 11
#define FLAC_API_VERSION_CURRENT 12
#define FLAC_API_VERSION_REVISION 0 /**< see above */
#define FLAC_API_VERSION_AGE 3 /**< see above */
#define FLAC_API_VERSION_AGE 0 /**< see above */
#ifdef __cplusplus
extern "C" {

View File

@ -113,19 +113,17 @@ extern "C" {
/** The maximum sample resolution permitted by libFLAC.
*
* \warning
* FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format. However,
* the reference encoder/decoder is currently limited to 24 bits because
* of prevalent 32-bit math, so make sure and use this value when
* appropriate.
* the reference encoder/decoder used to be limited to 24 bits. This
* value was used to signal that limit.
*/
#define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (24u)
#define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (32u)
/** The maximum sample rate permitted by the format. The value is
* ((2 ^ 16) - 1) * 10; see <A HREF="../format.html">FLAC format</A>
* as to why.
*/
#define FLAC__MAX_SAMPLE_RATE (655350u)
#define FLAC__MAX_SAMPLE_RATE (1048575u)
/** The maximum LPC order permitted by the format. */
#define FLAC__MAX_LPC_ORDER (32u)
@ -282,14 +280,24 @@ extern FLAC_API const char * const FLAC__SubframeTypeString[];
/** CONSTANT subframe. (c.f. <A HREF="../format.html#subframe_constant">format specification</A>)
*/
typedef struct {
FLAC__int32 value; /**< The constant signal value. */
FLAC__int64 value; /**< The constant signal value. */
} FLAC__Subframe_Constant;
/** An enumeration of the possible verbatim subframe data types. */
typedef enum {
FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT32, /**< verbatim subframe has 32-bit int */
FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT64 /**< verbatim subframe has 64-bit int */
} FLAC__VerbatimSubframeDataType;
/** VERBATIM subframe. (c.f. <A HREF="../format.html#subframe_verbatim">format specification</A>)
*/
typedef struct {
const FLAC__int32 *data; /**< A pointer to verbatim signal. */
union {
const FLAC__int32 *int32; /**< A FLAC__int32 pointer to verbatim signal. */
const FLAC__int64 *int64; /**< A FLAC__int64 pointer to verbatim signal. */
} data;
FLAC__VerbatimSubframeDataType data_type;
} FLAC__Subframe_Verbatim;
@ -302,7 +310,7 @@ typedef struct {
uint32_t order;
/**< The polynomial order. */
FLAC__int32 warmup[FLAC__MAX_FIXED_ORDER];
FLAC__int64 warmup[FLAC__MAX_FIXED_ORDER];
/**< Warmup samples to prime the predictor, length == order. */
const FLAC__int32 *residual;
@ -328,7 +336,7 @@ typedef struct {
FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER];
/**< FIR filter coefficients. */
FLAC__int32 warmup[FLAC__MAX_LPC_ORDER];
FLAC__int64 warmup[FLAC__MAX_LPC_ORDER];
/**< Warmup samples to prime the predictor, length == order. */
const FLAC__int32 *residual;

View File

@ -422,7 +422,11 @@ extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[];
* could be because the decoder encountered a valid frame made by a future
* version of the encoder which it cannot parse, or because of a false
* sync making it appear as though an encountered frame was generated by
* a future encoder.
* a future encoder. \c FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA is
* caused by finding data that doesn't fit a metadata block (too large
* or too small) or finding inconsistencies in the metadata, for example
* a PICTURE block with an image that exceeds the size of the metadata
* block.
*/
typedef enum {
@ -435,9 +439,12 @@ typedef enum {
FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH,
/**< The frame's data did not match the CRC in the footer. */
FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM,
/**< The decoder encountered reserved fields in use in the stream. */
FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA
/**< The decoder encountered a corrupted metadata block. */
} FLAC__StreamDecoderErrorStatus;
/** Maps a FLAC__StreamDecoderErrorStatus to a C string.
@ -1006,6 +1013,16 @@ FLAC_API uint32_t FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *
*/
FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position);
/** Return client_data from decoder.
* The data pointed to by the pointer should not be modified.
*
* \param decoder A decoder instance.
* \retval const void *
* The callee's client data set through FLAC__stream_decoder_init_*().
* Do not modify the contents.
*/
FLAC_API const void *FLAC__stream_decoder_get_client_data(FLAC__StreamDecoder *decoder);
/** Initialize the decoder instance to decode native FLAC streams.
*
* This flavor of initialization sets up the decoder to decode from a
@ -1263,11 +1280,14 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE(
/** Initialize the decoder instance to decode native FLAC files.
*
* This flavor of initialization sets up the decoder to decode from a plain
* native FLAC file. If POSIX fopen() semantics are not sufficient, (for
* example, with Unicode filenames on Windows), you must use
* FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream()
* native FLAC file. If POSIX fopen() semantics are not sufficient, you must
* use FLAC__stream_decoder_init_FILE(), or FLAC__stream_decoder_init_stream()
* and provide callbacks for the I/O.
*
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to a appropriate representation to use with
* _wfopen
*
* This function should be called after FLAC__stream_decoder_new() and
* FLAC__stream_decoder_set_*() but before any of the
* FLAC__stream_decoder_process_*() functions. Will set and return the
@ -1305,11 +1325,14 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file(
/** Initialize the decoder instance to decode Ogg FLAC files.
*
* This flavor of initialization sets up the decoder to decode from a plain
* Ogg FLAC file. If POSIX fopen() semantics are not sufficient, (for
* example, with Unicode filenames on Windows), you must use
* Ogg FLAC file. If POSIX fopen() semantics are not sufficient, you must use
* FLAC__stream_decoder_init_ogg_FILE(), or FLAC__stream_decoder_init_ogg_stream()
* and provide callbacks for the I/O.
*
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to a appropriate representation to use with
* _wfopen
*
* This function should be called after FLAC__stream_decoder_new() and
* FLAC__stream_decoder_set_*() but before any of the
* FLAC__stream_decoder_process_*() functions. Will set and return the
@ -1550,16 +1573,6 @@ FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *
*/
FLAC_API FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *decoder, FLAC__uint64 sample);
/** Return client_data from decoder.
* The data pointed to by the pointer should not be modified.
*
* \param decoder A decoder instance.
* \retval const void *
* The callee's client data set through FLAC__stream_decoder_init_*().
* Do not modify the contents.
*/
FLAC_API const void *FLAC__get_decoder_client_data(FLAC__StreamDecoder *decoder);
/* \} */
#ifdef __cplusplus

View File

@ -991,10 +991,6 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *
* coefficients, or \c 0 to let the encoder select it based on the
* blocksize.
*
* \note
* In the current implementation, qlp_coeff_precision + bits_per_sample must
* be less than 32.
*
* \default \c 0
* \param encoder An encoder instance to set.
* \param value See above.
@ -1202,6 +1198,24 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__Stream
*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, uint32_t num_blocks);
/** Set to \c true to make the encoder not output frames which contain
* only constant subframes. This is beneficial for streaming
* applications: very small frames can cause problems with buffering
* as bitrates can drop as low 1kbit/s for CDDA audio encoded within
* subset. The minimum bitrate for a FLAC file encoded with this
* function used is raised to 1bit/sample (i.e. 48kbit/s for 48kHz
* material).
*
* \default \c false
* \param encoder An encoder instance to set.
* \param value Flag value (see above).
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_limit_min_bitrate(FLAC__StreamEncoder *encoder, FLAC__bool value);
/** Get the current encoder state.
*
* \param encoder An encoder instance to query.
@ -1429,6 +1443,16 @@ FLAC_API uint32_t FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC
*/
FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder);
/** Get the "limit_min_bitrate" flag.
*
* \param encoder An encoder instance to query.
* \assert
* \code encoder != NULL \endcode
* \retval FLAC__bool
* See FLAC__stream_encoder_set_limit_min_bitrate().
*/
FLAC_API FLAC__bool FLAC__stream_encoder_get_limit_min_bitrate(const FLAC__StreamEncoder *encoder);
/** Initialize the encoder instance to encode native FLAC streams.
*
* This flavor of initialization sets up the encoder to encode to a
@ -1633,11 +1657,14 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE(FLAC__
/** Initialize the encoder instance to encode native FLAC files.
*
* This flavor of initialization sets up the encoder to encode to a plain
* FLAC file. If POSIX fopen() semantics are not sufficient (for example,
* with Unicode filenames on Windows), you must use
* FLAC file. If POSIX fopen() semantics are not sufficient you must use
* FLAC__stream_encoder_init_FILE(), or FLAC__stream_encoder_init_stream()
* and provide callbacks for the I/O.
*
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to a appropriate representation to use with
* _wfopen
*
* This function should be called after FLAC__stream_encoder_new() and
* FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
* or FLAC__stream_encoder_process_interleaved().
@ -1665,11 +1692,14 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file(FLAC__Stre
/** Initialize the encoder instance to encode Ogg FLAC files.
*
* This flavor of initialization sets up the encoder to encode to a plain
* Ogg FLAC file. If POSIX fopen() semantics are not sufficient (for example,
* with Unicode filenames on Windows), you must use
* Ogg FLAC file. If POSIX fopen() semantics are not sufficient, you must use
* FLAC__stream_encoder_init_ogg_FILE(), or FLAC__stream_encoder_init_ogg_stream()
* and provide callbacks for the I/O.
*
* On Windows, filename must be a UTF-8 encoded filename, which libFLAC
* internally translates to a appropriate representation to use with
* _wfopen
*
* This function should be called after FLAC__stream_encoder_new() and
* FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process()
* or FLAC__stream_encoder_process_interleaved().

View File

@ -1,327 +0,0 @@
diff --git a/src/libFLAC/bitreader.c b/src/libFLAC/bitreader.c
index 79cb5cc4..3ec9b90d 100644
--- a/src/libFLAC/bitreader.c
+++ b/src/libFLAC/bitreader.c
@@ -1098,3 +1098,238 @@ extern FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader
extern uint32_t FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br);
extern uint32_t FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br);
extern FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val);
+
+
+
+#ifdef FLAC__SUPPORT_LZCNT
+
+/*
+* === LZCNT ===
+*/
+#if defined __GNUC__ || defined __clang__
+#define __LZCNT__
+#include <x86intrin.h>
+#endif
+
+#undef COUNT_ZERO_MSBS
+#undef COUNT_ZERO_MSBS2
+
+#if (ENABLE_64_BIT_WORDS == 0)
+#ifdef _MSC_VER
+#define COUNT_ZERO_MSBS(word) __lzcnt(word)
+#define COUNT_ZERO_MSBS2(word) __lzcnt(word)
+#else
+#define COUNT_ZERO_MSBS(word) __lzcnt32(word)
+#define COUNT_ZERO_MSBS2(word) __lzcnt32(word)
+#endif
+#else
+#define COUNT_ZERO_MSBS(word) __lzcnt64(word)
+#define COUNT_ZERO_MSBS2(word) __lzcnt64(word)
+#endif
+
+
+#ifdef __clang__
+#pragma clang attribute push (__attribute__((target("lzcnt"))), apply_to=function)
+#endif
+FLAC__bool FLAC__bitreader_read_unary_unsigned__LZCNT(FLAC__BitReader* br, uint32_t* val)
+{
+ uint32_t i;
+
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+
+ *val = 0;
+ while(1) {
+ while(br->consumed_words < br->words) { /* if we've not consumed up to a partial tail word... */
+ brword b = br->buffer[br->consumed_words] << br->consumed_bits;
+ if(b) {
+ i = COUNT_ZERO_MSBS(b);
+ *val += i;
+ i++;
+ br->consumed_bits += i;
+ if (br->consumed_bits >= FLAC__BITS_PER_WORD) { /* faster way of testing if(br->consumed_bits == FLAC__BITS_PER_WORD) */
+ br->consumed_words++;
+ br->consumed_bits = 0;
+ }
+ return true;
+ } else {
+ *val += FLAC__BITS_PER_WORD - br->consumed_bits;
+ br->consumed_words++;
+ br->consumed_bits = 0;
+ /* didn't find stop bit yet, have to keep going... */
+ }
+ }
+ /* at this point we've eaten up all the whole words; have to try
+ * reading through any tail bytes before calling the read callback.
+ * this is a repeat of the above logic adjusted for the fact we
+ * don't have a whole word. note though if the client is feeding
+ * us data a byte at a time (unlikely), br->consumed_bits may not
+ * be zero.
+ */
+ if(br->bytes * 8 > br->consumed_bits) {
+ const uint32_t end = br->bytes * 8;
+ brword b = (br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES << (FLAC__BITS_PER_WORD - end))) << br->consumed_bits;
+ if(b) {
+ i = COUNT_ZERO_MSBS(b);
+ *val += i;
+ i++;
+ br->consumed_bits += i;
+ FLAC__ASSERT(br->consumed_bits < FLAC__BITS_PER_WORD);
+ return true;
+ } else {
+ *val += end - br->consumed_bits;
+ br->consumed_bits = end;
+ FLAC__ASSERT(br->consumed_bits < FLAC__BITS_PER_WORD);
+ /* didn't find stop bit yet, have to keep going... */
+ }
+ }
+ if(!bitreader_read_from_client_(br))
+ return false;
+ }
+}
+
+
+/* this is by far the most heavily used reader call. it ain't pretty but it's fast */
+FLAC__bool FLAC__bitreader_read_rice_signed_block__LZCNT(FLAC__BitReader* br, int vals[], uint32_t nvals, uint32_t parameter)
+{
+ /* try and get br->consumed_words and br->consumed_bits into register;
+ * must remember to flush them back to *br before calling other
+ * bitreader functions that use them, and before returning */
+ uint32_t cwords, words, lsbs, msbs, x, y;
+ uint32_t ucbits; /* keep track of the number of unconsumed bits in word */
+ brword b;
+ int* val, * end;
+
+ FLAC__ASSERT(0 != br);
+ FLAC__ASSERT(0 != br->buffer);
+ /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */
+ FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32);
+ FLAC__ASSERT(parameter < 32);
+ /* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */
+
+ val = vals;
+ end = vals + nvals;
+
+ if(parameter == 0) {
+ while(val < end) {
+ /* read the unary MSBs and end bit */
+ if(!FLAC__bitreader_read_unary_unsigned__LZCNT(br, &msbs))
+ return false;
+
+ *val++ = (int)(msbs >> 1) ^ -(int)(msbs & 1);
+ }
+
+ return true;
+ }
+
+ FLAC__ASSERT(parameter > 0);
+
+ cwords = br->consumed_words;
+ words = br->words;
+
+ /* if we've not consumed up to a partial tail word... */
+ if(cwords >= words) {
+ x = 0;
+ goto process_tail;
+ }
+
+ ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
+ b = br->buffer[cwords] << br->consumed_bits; /* keep unconsumed bits aligned to left */
+
+ while(val < end) {
+ /* read the unary MSBs and end bit */
+ x = y = COUNT_ZERO_MSBS2(b);
+ if (x == FLAC__BITS_PER_WORD) {
+ x = ucbits;
+ do {
+ /* didn't find stop bit yet, have to keep going... */
+ cwords++;
+ if (cwords >= words)
+ goto incomplete_msbs;
+ b = br->buffer[cwords];
+ y = COUNT_ZERO_MSBS2(b);
+ x += y;
+ } while(y == FLAC__BITS_PER_WORD);
+ }
+ b <<= y;
+ b <<= 1; /* account for stop bit */
+ ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD;
+ msbs = x;
+
+ /* read the binary LSBs */
+ x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit uint32_t */
+ if(parameter <= ucbits) {
+ ucbits -= parameter;
+ b <<= parameter;
+ } else {
+ /* there are still bits left to read, they will all be in the next word */
+ cwords++;
+ if (cwords >= words)
+ goto incomplete_lsbs;
+ b = br->buffer[cwords];
+ ucbits += FLAC__BITS_PER_WORD - parameter;
+ x |= (FLAC__uint32)(b >> ucbits);
+ b <<= FLAC__BITS_PER_WORD - ucbits;
+ }
+ lsbs = x;
+
+ /* compose the value */
+ x = (msbs << parameter) | lsbs;
+ *val++ = (int)(x >> 1) ^ -(int)(x & 1);
+
+ continue;
+
+ /* at this point we've eaten up all the whole words */
+ process_tail:
+ do {
+ if(0) {
+ incomplete_msbs:
+ br->consumed_bits = 0;
+ br->consumed_words = cwords;
+ }
+
+ /* read the unary MSBs and end bit */
+ if(!FLAC__bitreader_read_unary_unsigned__LZCNT(br, &msbs))
+ return false;
+ msbs += x;
+ x = ucbits = 0;
+
+ if(0) {
+ incomplete_lsbs:
+ br->consumed_bits = 0;
+ br->consumed_words = cwords;
+ }
+
+ /* read the binary LSBs */
+ if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter - ucbits))
+ return false;
+ lsbs = x | lsbs;
+
+ /* compose the value */
+ x = (msbs << parameter) | lsbs;
+ *val++ = (int)(x >> 1) ^ -(int)(x & 1);
+ x = 0;
+
+ cwords = br->consumed_words;
+ words = br->words;
+ ucbits = FLAC__BITS_PER_WORD - br->consumed_bits;
+ b = br->buffer[cwords] << br->consumed_bits;
+ } while(cwords >= words && val < end);
+ }
+
+ if(ucbits == 0 && cwords < words) {
+ /* don't leave the head word with no unconsumed bits */
+ cwords++;
+ ucbits = FLAC__BITS_PER_WORD;
+ }
+
+ br->consumed_bits = FLAC__BITS_PER_WORD - ucbits;
+ br->consumed_words = cwords;
+
+ return true;
+}
+#ifdef __clang__
+#pragma clang attribute pop
+#endif
+
+#endif // FLAC__SUPPORT_LZCNT
\ No newline at end of file
diff --git a/src/libFLAC/cpu.c b/src/libFLAC/cpu.c
index 8b92f4c7..c0924512 100644
--- a/src/libFLAC/cpu.c
+++ b/src/libFLAC/cpu.c
@@ -195,6 +195,9 @@ x86_cpu_info (FLAC__CPUInfo *info)
info->x86.avx2 = (flags_ebx & FLAC__CPUINFO_X86_CPUID_AVX2 ) ? true : false;
}
+ cpuinfo_x86(0x80000001, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx);
+ info->x86.lzcnt = (flags_ecx & (1 << 5)) ? true : false;
+
#if defined FLAC__CPU_IA32
dfprintf(stderr, "CPU info (IA-32):\n");
#else
diff --git a/src/libFLAC/include/private/bitreader.h b/src/libFLAC/include/private/bitreader.h
index 585a5db2..af37eb69 100644
--- a/src/libFLAC/include/private/bitreader.h
+++ b/src/libFLAC/include/private/bitreader.h
@@ -89,3 +89,9 @@ FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, uint32_t *v
FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, uint32_t *rawlen);
FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, uint32_t *rawlen);
#endif
+
+#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN
+#define FLAC__SUPPORT_LZCNT
+FLAC__bool FLAC__bitreader_read_unary_unsigned__LZCNT(FLAC__BitReader* br, uint32_t* val);
+FLAC__bool FLAC__bitreader_read_rice_signed_block__LZCNT(FLAC__BitReader* br, int vals[], uint32_t nvals, uint32_t parameter);
+#endif
\ No newline at end of file
diff --git a/src/libFLAC/include/private/cpu.h b/src/libFLAC/include/private/cpu.h
index 0b50839f..61b71a37 100644
--- a/src/libFLAC/include/private/cpu.h
+++ b/src/libFLAC/include/private/cpu.h
@@ -178,6 +178,7 @@ typedef struct {
FLAC__bool avx;
FLAC__bool avx2;
FLAC__bool fma;
+ FLAC__bool lzcnt;
} FLAC__CPUInfo_x86;
typedef struct {
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c
index 4380b486..b1c4ea5f 100644
--- a/src/libFLAC/stream_decoder.c
+++ b/src/libFLAC/stream_decoder.c
@@ -134,6 +134,9 @@ typedef struct FLAC__StreamDecoderPrivate {
void (*local_lpc_restore_signal_64bit)(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
/* for use when the signal is <= 16 bits-per-sample, or <= 15 bits-per-sample on a side channel (which requires 1 extra bit): */
void (*local_lpc_restore_signal_16bit)(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]);
+
+ FLAC__bool (*local_bitreader_read_rice_signed_block)(FLAC__BitReader* br, int vals[], uint32_t nvals, uint32_t parameter);
+
void *client_data;
FILE *file; /* only used if FLAC__stream_decoder_init_file()/FLAC__stream_decoder_init_file() called, else NULL */
FLAC__BitReader *input;
@@ -377,9 +380,18 @@ static FLAC__StreamDecoderInitStatus init_stream_internal_(
decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal;
decoder->private_->local_lpc_restore_signal_64bit = FLAC__lpc_restore_signal_wide;
decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal;
+ decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block;
+
/* now override with asm where appropriate */
#ifndef FLAC__NO_ASM
if(decoder->private_->cpuinfo.use_asm) {
+
+#ifdef FLAC__SUPPORT_LZCNT
+ if(decoder->private_->cpuinfo.x86.lzcnt) {
+ decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block__LZCNT;
+ }
+#endif
+
#ifdef FLAC__CPU_IA32
FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32);
#ifdef FLAC__HAS_NASM
@@ -2805,7 +2817,7 @@ FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, uint32_
if(rice_parameter < pesc) {
partitioned_rice_contents->raw_bits[partition] = 0;
u = (partition == 0) ? partition_samples - predictor_order : partition_samples;
- if(!FLAC__bitreader_read_rice_signed_block(decoder->private_->input, residual + sample, u, rice_parameter))
+ if(!decoder->private_->local_bitreader_read_rice_signed_block(decoder->private_->input, residual + sample, u, rice_parameter))
return false; /* read_callback_ sets the state for us */
sample += u;
}

View File

@ -25,6 +25,8 @@
# ifndef LIBID3TAG_ID3TAG_H
# define LIBID3TAG_ID3TAG_H
#include <stdint.h>
# ifdef __cplusplus
extern "C" {
# endif
@ -36,10 +38,10 @@ extern "C" {
typedef unsigned char id3_byte_t;
typedef unsigned long id3_length_t;
typedef unsigned long id3_ucs4_t;
typedef uint32_t id3_ucs4_t;
typedef unsigned char id3_latin1_t;
typedef unsigned short id3_utf16_t;
typedef uint16_t id3_utf16_t;
typedef signed char id3_utf8_t;
struct id3_tag {
@ -336,9 +338,9 @@ id3_ucs4_t *id3_utf8_ucs4duplicate(id3_utf8_t const *);
/* version interface */
# define ID3_VERSION_MAJOR 0
# define ID3_VERSION_MINOR 15
# define ID3_VERSION_MINOR 16
# define ID3_VERSION_PATCH 1
# define ID3_VERSION_EXTRA " (beta)"
# define ID3_VERSION_EXTRA ""
# define ID3_VERSION_STRINGIZE(str) #str
# define ID3_VERSION_STRING(num) ID3_VERSION_STRINGIZE(num)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.