From 32a595222db0b627c402e03b6db252414c3dc32c Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 24 Jun 2022 14:40:44 -0700 Subject: [PATCH] [OpenMPT / vgmstream] Made libraries pre-built Made the OpenMPT / legacy OpenMPT and mpg123 libraries pre-built. Changed the OpenMPT and vgmstream plugins to import the libraries as they are now. Made mpg123 embedded and imported by the main binary, since it's now shared by two plugins. Signed-off-by: Christopher Snowhill --- Cog.xcodeproj/project.pbxproj | 8 + .../mpg123/mpg123.xcodeproj/project.pbxproj | 572 -- .../xcshareddata/xcschemes/mpg123.xcscheme | 76 - Frameworks/mpg123/mpg123/compat.c | 138 - Frameworks/mpg123/mpg123/compat.h | 183 - Frameworks/mpg123/mpg123/config.h | 457 -- Frameworks/mpg123/mpg123/dct64.c | 174 - Frameworks/mpg123/mpg123/debug.h | 171 - .../mpg123/mpg123/en.lproj/InfoPlist.strings | 2 - Frameworks/mpg123/mpg123/equalizer.c | 17 - .../mpg123/mpg123/es.lproj/InfoPlist.strings | 2 - Frameworks/mpg123/mpg123/feature.c | 106 - Frameworks/mpg123/mpg123/format.c | 521 -- Frameworks/mpg123/mpg123/frame.c | 1046 ---- Frameworks/mpg123/mpg123/icy.c | 32 - Frameworks/mpg123/mpg123/icy2utf8.c | 438 -- Frameworks/mpg123/mpg123/id3.c | 1124 ---- Frameworks/mpg123/mpg123/index.c | 134 - Frameworks/mpg123/mpg123/intsym.h | 271 - Frameworks/mpg123/mpg123/l12_integer_tables.h | 278 - Frameworks/mpg123/mpg123/l3_integer_tables.h | 1002 ---- Frameworks/mpg123/mpg123/layer1.c | 155 - Frameworks/mpg123/mpg123/layer2.c | 371 -- Frameworks/mpg123/mpg123/layer3.c | 2085 ------- Frameworks/mpg123/mpg123/lfs_alias.c | 222 - Frameworks/mpg123/mpg123/lfs_wrap.c | 751 --- Frameworks/mpg123/mpg123/libmpg123.c | 1606 ----- Frameworks/mpg123/mpg123/mangle.h | 94 - Frameworks/mpg123/mpg123/mpg123-Info.plist | 30 - Frameworks/mpg123/mpg123/mpg123.h | 1123 ---- Frameworks/mpg123/mpg123/ntom.c | 148 - Frameworks/mpg123/mpg123/optimize.c | 1107 ---- Frameworks/mpg123/mpg123/parse.c | 1183 ---- Frameworks/mpg123/mpg123/readers.c | 1237 ---- Frameworks/mpg123/mpg123/stringbuf.c | 186 - Frameworks/mpg123/mpg123/synth.c | 1002 ---- Frameworks/mpg123/mpg123/synth_real.c | 496 -- Frameworks/mpg123/mpg123/synth_s32.c | 506 -- Frameworks/mpg123/mpg123/tabinit.c | 300 - .../libvgmstream.xcodeproj/project.pbxproj | 154 +- .../OpenMPTOld.xcodeproj/project.pbxproj | 248 +- .../OpenMPT/OpenMPT.xcodeproj/project.pbxproj | 265 +- Plugins/OpenMPT/OpenMPT/OMPTContainer.mm | 2 +- Plugins/OpenMPT/OpenMPT/OMPTDecoder.h | 2 +- Plugins/OpenMPT/OpenMPT/OMPTMetadataReader.mm | 2 +- ThirdParty/libopenmpt/README.md | 10 + .../include/libopenmpt/libopenmpt.h | 1543 +++++ .../include/libopenmpt/libopenmpt.hpp | 1185 ++++ .../include/libopenmpt/libopenmpt_config.h | 205 + .../include/libopenmpt/libopenmpt_ext.h | 405 ++ .../include/libopenmpt/libopenmpt_ext.hpp | 404 ++ .../libopenmpt/libopenmpt_ext_impl.hpp | 122 + .../include/libopenmpt/libopenmpt_impl.hpp | 271 + .../include/libopenmpt/libopenmpt_internal.h | 25 + .../libopenmpt/libopenmpt_plugin_gui.hpp | 36 + .../libopenmpt/libopenmpt_plugin_settings.hpp | 130 + .../libopenmpt_stream_callbacks_buffer.h | 198 + .../libopenmpt_stream_callbacks_fd.h | 101 + .../libopenmpt_stream_callbacks_file.h | 132 + .../include/libopenmpt/libopenmpt_version.h | 79 + .../libopenmpt/include/libopenmpt/resource.h | 27 + ThirdParty/libopenmpt_old/README.md | 10 + .../include/libopenmpt/libopenmpt.h | 1542 +++++ .../include/libopenmpt/libopenmpt.hpp | 1172 ++++ .../include/libopenmpt/libopenmpt_config.h | 201 + .../include/libopenmpt/libopenmpt_ext.h | 318 + .../include/libopenmpt/libopenmpt_ext.hpp | 319 + .../libopenmpt/libopenmpt_ext_impl.hpp | 112 + .../include/libopenmpt/libopenmpt_impl.hpp | 260 + .../include/libopenmpt/libopenmpt_internal.h | 36 + .../libopenmpt/libopenmpt_plugin_gui.hpp | 37 + .../libopenmpt/libopenmpt_plugin_settings.hpp | 133 + .../libopenmpt_stream_callbacks_buffer.h | 198 + .../libopenmpt_stream_callbacks_fd.h | 101 + .../libopenmpt_stream_callbacks_file.h | 132 + .../include/libopenmpt/libopenmpt_version.h | 75 + .../include/libopenmpt/resource.h | 27 + ThirdParty/mpg123/README.md | 15 + .../mpg123/include/libmpg123}/abi_align.h | 32 +- ThirdParty/mpg123/include/libmpg123/costabs.h | 81 + ThirdParty/mpg123/include/libmpg123/debug.h | 132 + .../mpg123/include/libmpg123}/decode.h | 37 +- .../mpg123/include/libmpg123}/dither.h | 0 .../mpg123/include/libmpg123/dither_impl.h | 0 ThirdParty/mpg123/include/libmpg123/fmt123.h | 159 + .../mpg123/include/libmpg123}/frame.h | 43 +- .../mpg123/include/libmpg123}/gapless.h | 0 .../mpg123/include/libmpg123}/getbits.h | 45 +- .../mpg123/include/libmpg123}/getcpuflags.h | 42 + .../mpg123/include/libmpg123}/huffman.h | 0 .../mpg123/include/libmpg123}/icy.h | 0 .../mpg123/include/libmpg123}/icy2utf8.h | 0 .../mpg123/include/libmpg123}/id3.h | 0 .../mpg123/include/libmpg123}/index.h | 0 .../mpg123/include/libmpg123/init_costabs.h | 24 + .../mpg123/include/libmpg123/init_layer12.h | 58 + .../mpg123/include/libmpg123/init_layer3.h | 231 + ThirdParty/mpg123/include/libmpg123/l12tabs.h | 1224 ++++ .../mpg123/include/libmpg123}/l2tables.h | 3 + .../mpg123/include/libmpg123/l3bandgain.h | 94 + ThirdParty/mpg123/include/libmpg123/l3tabs.h | 5285 +++++++++++++++++ ThirdParty/mpg123/include/libmpg123/mangle.h | 199 + .../mpg123/include/libmpg123}/mpeghead.h | 2 +- ThirdParty/mpg123/include/libmpg123/mpg123.h | 2001 +++++++ .../include/libmpg123}/mpg123lib_intern.h | 92 +- .../mpg123/include/libmpg123}/newhuffman.h | 0 .../mpg123/include/libmpg123}/optimize.h | 22 +- .../mpg123/include/libmpg123}/parse.h | 2 +- .../mpg123/include/libmpg123}/reader.h | 3 + .../mpg123/include/libmpg123}/sample.h | 53 +- .../include/libmpg123/swap_bytes_impl.h | 103 + .../mpg123/include/libmpg123}/synth.h | 4 +- .../mpg123/include/libmpg123/synth_8bit.h | 86 + .../mpg123/include/libmpg123}/synth_mono.h | 2 +- .../mpg123/include/libmpg123}/synth_ntom.h | 8 +- .../mpg123/include/libmpg123/synth_sse3d.h | 268 + .../mpg123/include/libmpg123}/synths.h | 0 .../mpg123/include/libmpg123}/true.h | 1 + ThirdParty/mpg123/lib/libmpg123.0.dylib | Bin 0 -> 617632 bytes 119 files changed, 20309 insertions(+), 19615 deletions(-) delete mode 100644 Frameworks/mpg123/mpg123.xcodeproj/project.pbxproj delete mode 100644 Frameworks/mpg123/mpg123.xcodeproj/xcshareddata/xcschemes/mpg123.xcscheme delete mode 100644 Frameworks/mpg123/mpg123/compat.c delete mode 100644 Frameworks/mpg123/mpg123/compat.h delete mode 100644 Frameworks/mpg123/mpg123/config.h delete mode 100644 Frameworks/mpg123/mpg123/dct64.c delete mode 100644 Frameworks/mpg123/mpg123/debug.h delete mode 100644 Frameworks/mpg123/mpg123/en.lproj/InfoPlist.strings delete mode 100644 Frameworks/mpg123/mpg123/equalizer.c delete mode 100644 Frameworks/mpg123/mpg123/es.lproj/InfoPlist.strings delete mode 100644 Frameworks/mpg123/mpg123/feature.c delete mode 100644 Frameworks/mpg123/mpg123/format.c delete mode 100644 Frameworks/mpg123/mpg123/frame.c delete mode 100644 Frameworks/mpg123/mpg123/icy.c delete mode 100644 Frameworks/mpg123/mpg123/icy2utf8.c delete mode 100644 Frameworks/mpg123/mpg123/id3.c delete mode 100644 Frameworks/mpg123/mpg123/index.c delete mode 100644 Frameworks/mpg123/mpg123/intsym.h delete mode 100644 Frameworks/mpg123/mpg123/l12_integer_tables.h delete mode 100644 Frameworks/mpg123/mpg123/l3_integer_tables.h delete mode 100644 Frameworks/mpg123/mpg123/layer1.c delete mode 100644 Frameworks/mpg123/mpg123/layer2.c delete mode 100644 Frameworks/mpg123/mpg123/layer3.c delete mode 100644 Frameworks/mpg123/mpg123/lfs_alias.c delete mode 100644 Frameworks/mpg123/mpg123/lfs_wrap.c delete mode 100644 Frameworks/mpg123/mpg123/libmpg123.c delete mode 100644 Frameworks/mpg123/mpg123/mangle.h delete mode 100644 Frameworks/mpg123/mpg123/mpg123-Info.plist delete mode 100644 Frameworks/mpg123/mpg123/mpg123.h delete mode 100644 Frameworks/mpg123/mpg123/ntom.c delete mode 100644 Frameworks/mpg123/mpg123/optimize.c delete mode 100644 Frameworks/mpg123/mpg123/parse.c delete mode 100644 Frameworks/mpg123/mpg123/readers.c delete mode 100644 Frameworks/mpg123/mpg123/stringbuf.c delete mode 100644 Frameworks/mpg123/mpg123/synth.c delete mode 100644 Frameworks/mpg123/mpg123/synth_real.c delete mode 100644 Frameworks/mpg123/mpg123/synth_s32.c delete mode 100644 Frameworks/mpg123/mpg123/tabinit.c create mode 100644 ThirdParty/libopenmpt/README.md create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt.h create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt.hpp create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_config.h create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_ext.h create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_ext.hpp create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_ext_impl.hpp create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_impl.hpp create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_internal.h create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_plugin_gui.hpp create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_plugin_settings.hpp create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_stream_callbacks_buffer.h create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_stream_callbacks_fd.h create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_stream_callbacks_file.h create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/libopenmpt_version.h create mode 100644 ThirdParty/libopenmpt/include/libopenmpt/resource.h create mode 100644 ThirdParty/libopenmpt_old/README.md create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt.h create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt.hpp create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_config.h create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_ext.h create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_ext.hpp create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_ext_impl.hpp create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_impl.hpp create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_internal.h create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_plugin_gui.hpp create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_plugin_settings.hpp create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_stream_callbacks_buffer.h create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_stream_callbacks_fd.h create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_stream_callbacks_file.h create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/libopenmpt_version.h create mode 100644 ThirdParty/libopenmpt_old/include/libopenmpt/resource.h create mode 100644 ThirdParty/mpg123/README.md rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/abi_align.h (53%) create mode 100644 ThirdParty/mpg123/include/libmpg123/costabs.h create mode 100644 ThirdParty/mpg123/include/libmpg123/debug.h rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/decode.h (90%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/dither.h (100%) rename Frameworks/mpg123/mpg123/dither.c => ThirdParty/mpg123/include/libmpg123/dither_impl.h (100%) create mode 100644 ThirdParty/mpg123/include/libmpg123/fmt123.h rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/frame.h (91%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/gapless.h (100%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/getbits.h (68%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/getcpuflags.h (63%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/huffman.h (100%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/icy.h (100%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/icy2utf8.h (100%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/id3.h (100%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/index.h (100%) create mode 100644 ThirdParty/mpg123/include/libmpg123/init_costabs.h create mode 100644 ThirdParty/mpg123/include/libmpg123/init_layer12.h create mode 100644 ThirdParty/mpg123/include/libmpg123/init_layer3.h create mode 100644 ThirdParty/mpg123/include/libmpg123/l12tabs.h rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/l2tables.h (98%) create mode 100644 ThirdParty/mpg123/include/libmpg123/l3bandgain.h create mode 100644 ThirdParty/mpg123/include/libmpg123/l3tabs.h create mode 100644 ThirdParty/mpg123/include/libmpg123/mangle.h rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/mpeghead.h (98%) create mode 100644 ThirdParty/mpg123/include/libmpg123/mpg123.h rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/mpg123lib_intern.h (76%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/newhuffman.h (100%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/optimize.h (94%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/parse.h (93%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/reader.h (98%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/sample.h (74%) create mode 100644 ThirdParty/mpg123/include/libmpg123/swap_bytes_impl.h rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/synth.h (99%) create mode 100644 ThirdParty/mpg123/include/libmpg123/synth_8bit.h rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/synth_mono.h (98%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/synth_ntom.h (98%) create mode 100644 ThirdParty/mpg123/include/libmpg123/synth_sse3d.h rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/synths.h (100%) rename {Frameworks/mpg123/mpg123 => ThirdParty/mpg123/include/libmpg123}/true.h (94%) create mode 100755 ThirdParty/mpg123/lib/libmpg123.0.dylib diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index 5f5922682..3c08bc7d5 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -104,6 +104,8 @@ 831B99BF27C23E88005A969B /* Cog.sdef in Resources */ = {isa = PBXBuildFile; fileRef = 831B99BE27C23E88005A969B /* Cog.sdef */; }; 83229C9F283B0095004626A8 /* SpectrumWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83229C9D283B0095004626A8 /* SpectrumWindowController.m */; }; 83229CA0283B0095004626A8 /* SpectrumWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 83229C9E283B0095004626A8 /* SpectrumWindow.xib */; }; + 83256B68286661FC0036D9C0 /* libmpg123.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 83256B672866617F0036D9C0 /* libmpg123.0.dylib */; }; + 83256B69286661FC0036D9C0 /* libmpg123.0.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83256B672866617F0036D9C0 /* libmpg123.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 832923AF279FAC400048201E /* Cog.q1.json in Resources */ = {isa = PBXBuildFile; fileRef = 832923AE279FAC400048201E /* Cog.q1.json */; }; 83293070277886250010C07E /* OpenMPTOld.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8329306D277885790010C07E /* OpenMPTOld.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 832C1253180BD1E2005507C1 /* Cog.help in Resources */ = {isa = PBXBuildFile; fileRef = 832C1252180BD1E2005507C1 /* Cog.help */; }; @@ -738,6 +740,7 @@ 836EF0E027BB98A800BF35B2 /* libopus.0.dylib in CopyFiles */, 836EF0CB27BB91EE00BF35B2 /* libFLAC.8.dylib in CopyFiles */, 836EF0CA27BB91EB00BF35B2 /* libvorbis.0.dylib in CopyFiles */, + 83256B69286661FC0036D9C0 /* libmpg123.0.dylib in CopyFiles */, 836EF0C927BB91E900BF35B2 /* libvorbisfile.3.dylib in CopyFiles */, 836EF0C827BB91E600BF35B2 /* libogg.0.dylib in CopyFiles */, 83AA7D07279EBCAF00087AA4 /* libswresample.4.dylib in CopyFiles */, @@ -921,6 +924,7 @@ 83229C9C283B0095004626A8 /* SpectrumWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SpectrumWindowController.h; sourceTree = ""; }; 83229C9D283B0095004626A8 /* SpectrumWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SpectrumWindowController.m; sourceTree = ""; }; 83229C9E283B0095004626A8 /* SpectrumWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SpectrumWindow.xib; sourceTree = ""; }; + 83256B672866617F0036D9C0 /* libmpg123.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libmpg123.0.dylib; path = ThirdParty/mpg123/lib/libmpg123.0.dylib; sourceTree = ""; }; 832923AE279FAC400048201E /* Cog.q1.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Cog.q1.json; sourceTree = ""; }; 83293065277885790010C07E /* OpenMPTOld.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = OpenMPTOld.xcodeproj; path = Plugins/OpenMPT.old/OpenMPTOld.xcodeproj; sourceTree = ""; }; 832C1252180BD1E2005507C1 /* Cog.help */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Cog.help; sourceTree = ""; }; @@ -1096,6 +1100,7 @@ ED69CBC725BE32C00090B90D /* MASShortcut.framework in Frameworks */, 8355D6B8180613FB00D05687 /* Security.framework in Frameworks */, 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 83256B68286661FC0036D9C0 /* libmpg123.0.dylib in Frameworks */, 17BB5CED0B8A86010009ACB1 /* AudioToolbox.framework in Frameworks */, 835FAC7F27BCDF5B00BA8562 /* libavif.a in Frameworks */, 835FAC7E27BCDF5B00BA8562 /* libaom.a in Frameworks */, @@ -1155,6 +1160,7 @@ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { isa = PBXGroup; children = ( + 83256B672866617F0036D9C0 /* libmpg123.0.dylib */, 835FAC7C27BCDF5B00BA8562 /* libaom.a */, 835FAC7D27BCDF5B00BA8562 /* libavif.a */, 836EF0CD27BB94F100BF35B2 /* libopusfile.0.dylib */, @@ -2963,6 +2969,7 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/ThirdParty/avif/lib", + "$(PROJECT_DIR)/ThirdParty/mpg123/lib", ); MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = ( @@ -3015,6 +3022,7 @@ LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/ThirdParty/avif/lib", + "$(PROJECT_DIR)/ThirdParty/mpg123/lib", ); MACOSX_DEPLOYMENT_TARGET = 10.13; OTHER_CFLAGS = ( diff --git a/Frameworks/mpg123/mpg123.xcodeproj/project.pbxproj b/Frameworks/mpg123/mpg123.xcodeproj/project.pbxproj deleted file mode 100644 index c47e425e8..000000000 --- a/Frameworks/mpg123/mpg123.xcodeproj/project.pbxproj +++ /dev/null @@ -1,572 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 8313E31D1901FBDC00B4B6F1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8313E31B1901FBDC00B4B6F1 /* InfoPlist.strings */; }; - 8313E38A1901FC3800B4B6F1 /* abi_align.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3461901FC3800B4B6F1 /* abi_align.h */; }; - 8313E38B1901FC3800B4B6F1 /* compat.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3471901FC3800B4B6F1 /* compat.c */; }; - 8313E38C1901FC3800B4B6F1 /* compat.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3481901FC3800B4B6F1 /* compat.h */; }; - 8313E38D1901FC3800B4B6F1 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3491901FC3800B4B6F1 /* config.h */; }; - 8313E3911901FC3800B4B6F1 /* dct64.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E34D1901FC3800B4B6F1 /* dct64.c */; }; - 8313E3921901FC3800B4B6F1 /* debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E34E1901FC3800B4B6F1 /* debug.h */; }; - 8313E3931901FC3800B4B6F1 /* decode.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E34F1901FC3800B4B6F1 /* decode.h */; }; - 8313E3951901FC3800B4B6F1 /* dither.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3511901FC3800B4B6F1 /* dither.h */; }; - 8313E3961901FC3800B4B6F1 /* equalizer.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3521901FC3800B4B6F1 /* equalizer.c */; }; - 8313E3981901FC3800B4B6F1 /* format.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3541901FC3800B4B6F1 /* format.c */; }; - 8313E3991901FC3800B4B6F1 /* frame.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3551901FC3800B4B6F1 /* frame.c */; }; - 8313E39A1901FC3800B4B6F1 /* frame.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3561901FC3800B4B6F1 /* frame.h */; }; - 8313E39B1901FC3800B4B6F1 /* gapless.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3571901FC3800B4B6F1 /* gapless.h */; }; - 8313E39C1901FC3800B4B6F1 /* getbits.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3581901FC3800B4B6F1 /* getbits.h */; }; - 8313E39D1901FC3800B4B6F1 /* getcpuflags.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3591901FC3800B4B6F1 /* getcpuflags.h */; }; - 8313E39E1901FC3800B4B6F1 /* huffman.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E35A1901FC3800B4B6F1 /* huffman.h */; }; - 8313E3A01901FC3800B4B6F1 /* icy.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E35C1901FC3800B4B6F1 /* icy.h */; }; - 8313E3A21901FC3800B4B6F1 /* icy2utf8.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E35E1901FC3800B4B6F1 /* icy2utf8.h */; }; - 8313E3A31901FC3800B4B6F1 /* id3.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E35F1901FC3800B4B6F1 /* id3.c */; }; - 8313E3A41901FC3800B4B6F1 /* id3.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3601901FC3800B4B6F1 /* id3.h */; }; - 8313E3A51901FC3800B4B6F1 /* index.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3611901FC3800B4B6F1 /* index.c */; }; - 8313E3A61901FC3800B4B6F1 /* index.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3621901FC3800B4B6F1 /* index.h */; }; - 8313E3A71901FC3800B4B6F1 /* intsym.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3631901FC3800B4B6F1 /* intsym.h */; }; - 8313E3A81901FC3800B4B6F1 /* l2tables.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3641901FC3800B4B6F1 /* l2tables.h */; }; - 8313E3A91901FC3800B4B6F1 /* l3_integer_tables.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3651901FC3800B4B6F1 /* l3_integer_tables.h */; }; - 8313E3AA1901FC3800B4B6F1 /* l12_integer_tables.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3661901FC3800B4B6F1 /* l12_integer_tables.h */; }; - 8313E3B01901FC3800B4B6F1 /* libmpg123.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E36C1901FC3800B4B6F1 /* libmpg123.c */; }; - 8313E3B11901FC3800B4B6F1 /* mangle.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E36D1901FC3800B4B6F1 /* mangle.h */; }; - 8313E3B21901FC3800B4B6F1 /* mpeghead.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E36E1901FC3800B4B6F1 /* mpeghead.h */; }; - 8313E3B31901FC3800B4B6F1 /* mpg123.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E36F1901FC3800B4B6F1 /* mpg123.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8313E3B41901FC3800B4B6F1 /* mpg123lib_intern.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3701901FC3800B4B6F1 /* mpg123lib_intern.h */; }; - 8313E3B51901FC3800B4B6F1 /* newhuffman.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3711901FC3800B4B6F1 /* newhuffman.h */; }; - 8313E3B71901FC3800B4B6F1 /* optimize.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3731901FC3800B4B6F1 /* optimize.c */; }; - 8313E3B81901FC3800B4B6F1 /* optimize.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3741901FC3800B4B6F1 /* optimize.h */; }; - 8313E3B91901FC3800B4B6F1 /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3751901FC3800B4B6F1 /* parse.c */; }; - 8313E3BA1901FC3800B4B6F1 /* parse.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3761901FC3800B4B6F1 /* parse.h */; }; - 8313E3BB1901FC3800B4B6F1 /* reader.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3771901FC3800B4B6F1 /* reader.h */; }; - 8313E3BC1901FC3800B4B6F1 /* readers.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3781901FC3800B4B6F1 /* readers.c */; }; - 8313E3BD1901FC3800B4B6F1 /* sample.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3791901FC3800B4B6F1 /* sample.h */; }; - 8313E3C31901FC3800B4B6F1 /* synth_mono.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E37F1901FC3800B4B6F1 /* synth_mono.h */; }; - 8313E3C41901FC3800B4B6F1 /* synth_ntom.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3801901FC3800B4B6F1 /* synth_ntom.h */; }; - 8313E3C91901FC3800B4B6F1 /* synth.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3851901FC3800B4B6F1 /* synth.h */; }; - 8313E3CA1901FC3800B4B6F1 /* synths.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3861901FC3800B4B6F1 /* synths.h */; }; - 8313E3CB1901FC3800B4B6F1 /* tabinit.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3871901FC3800B4B6F1 /* tabinit.c */; }; - 8313E3CD1901FC3800B4B6F1 /* true.h in Headers */ = {isa = PBXBuildFile; fileRef = 8313E3891901FC3800B4B6F1 /* true.h */; }; - 8313E3D01902001600B4B6F1 /* icy.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3CE1902001600B4B6F1 /* icy.c */; }; - 8313E3D11902001600B4B6F1 /* icy2utf8.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3CF1902001600B4B6F1 /* icy2utf8.c */; }; - 8313E3DB1902003100B4B6F1 /* dither.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3D21902003100B4B6F1 /* dither.c */; }; - 8313E3DC1902003100B4B6F1 /* feature.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3D31902003100B4B6F1 /* feature.c */; }; - 8313E3DD1902003100B4B6F1 /* layer1.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3D41902003100B4B6F1 /* layer1.c */; }; - 8313E3DE1902003100B4B6F1 /* layer2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3D51902003100B4B6F1 /* layer2.c */; }; - 8313E3DF1902003100B4B6F1 /* layer3.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3D61902003100B4B6F1 /* layer3.c */; }; - 8313E3E01902003100B4B6F1 /* ntom.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3D71902003100B4B6F1 /* ntom.c */; }; - 8313E3E11902003100B4B6F1 /* stringbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3D81902003100B4B6F1 /* stringbuf.c */; }; - 8313E3E21902003100B4B6F1 /* synth_real.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3D91902003100B4B6F1 /* synth_real.c */; }; - 8313E3E31902003100B4B6F1 /* synth.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3DA1902003100B4B6F1 /* synth.c */; }; - 8313E3E5190200D000B4B6F1 /* synth_s32.c in Sources */ = {isa = PBXBuildFile; fileRef = 8313E3E4190200D000B4B6F1 /* synth_s32.c */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 8313E30F1901FBDC00B4B6F1 /* mpg123.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = mpg123.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 8313E31A1901FBDC00B4B6F1 /* mpg123-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "mpg123-Info.plist"; sourceTree = ""; }; - 8313E31C1901FBDC00B4B6F1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 8313E3461901FC3800B4B6F1 /* abi_align.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = abi_align.h; sourceTree = ""; }; - 8313E3471901FC3800B4B6F1 /* compat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compat.c; sourceTree = ""; }; - 8313E3481901FC3800B4B6F1 /* compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = ""; }; - 8313E3491901FC3800B4B6F1 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; - 8313E34D1901FC3800B4B6F1 /* dct64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dct64.c; sourceTree = ""; }; - 8313E34E1901FC3800B4B6F1 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = ""; }; - 8313E34F1901FC3800B4B6F1 /* decode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = decode.h; sourceTree = ""; }; - 8313E3511901FC3800B4B6F1 /* dither.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dither.h; sourceTree = ""; }; - 8313E3521901FC3800B4B6F1 /* equalizer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = equalizer.c; sourceTree = ""; }; - 8313E3541901FC3800B4B6F1 /* format.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = format.c; sourceTree = ""; }; - 8313E3551901FC3800B4B6F1 /* frame.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = frame.c; sourceTree = ""; }; - 8313E3561901FC3800B4B6F1 /* frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = frame.h; sourceTree = ""; }; - 8313E3571901FC3800B4B6F1 /* gapless.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gapless.h; sourceTree = ""; }; - 8313E3581901FC3800B4B6F1 /* getbits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getbits.h; sourceTree = ""; }; - 8313E3591901FC3800B4B6F1 /* getcpuflags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getcpuflags.h; sourceTree = ""; }; - 8313E35A1901FC3800B4B6F1 /* huffman.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = huffman.h; sourceTree = ""; }; - 8313E35C1901FC3800B4B6F1 /* icy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = icy.h; sourceTree = ""; }; - 8313E35E1901FC3800B4B6F1 /* icy2utf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = icy2utf8.h; sourceTree = ""; }; - 8313E35F1901FC3800B4B6F1 /* id3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = id3.c; sourceTree = ""; }; - 8313E3601901FC3800B4B6F1 /* id3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = id3.h; sourceTree = ""; }; - 8313E3611901FC3800B4B6F1 /* index.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = index.c; sourceTree = ""; }; - 8313E3621901FC3800B4B6F1 /* index.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = index.h; sourceTree = ""; }; - 8313E3631901FC3800B4B6F1 /* intsym.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intsym.h; sourceTree = ""; }; - 8313E3641901FC3800B4B6F1 /* l2tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = l2tables.h; sourceTree = ""; }; - 8313E3651901FC3800B4B6F1 /* l3_integer_tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = l3_integer_tables.h; sourceTree = ""; }; - 8313E3661901FC3800B4B6F1 /* l12_integer_tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = l12_integer_tables.h; sourceTree = ""; }; - 8313E36C1901FC3800B4B6F1 /* libmpg123.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = libmpg123.c; sourceTree = ""; }; - 8313E36D1901FC3800B4B6F1 /* mangle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mangle.h; sourceTree = ""; }; - 8313E36E1901FC3800B4B6F1 /* mpeghead.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpeghead.h; sourceTree = ""; }; - 8313E36F1901FC3800B4B6F1 /* mpg123.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpg123.h; sourceTree = ""; }; - 8313E3701901FC3800B4B6F1 /* mpg123lib_intern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpg123lib_intern.h; sourceTree = ""; }; - 8313E3711901FC3800B4B6F1 /* newhuffman.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = newhuffman.h; sourceTree = ""; }; - 8313E3731901FC3800B4B6F1 /* optimize.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = optimize.c; sourceTree = ""; }; - 8313E3741901FC3800B4B6F1 /* optimize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = optimize.h; sourceTree = ""; }; - 8313E3751901FC3800B4B6F1 /* parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = parse.c; sourceTree = ""; }; - 8313E3761901FC3800B4B6F1 /* parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parse.h; sourceTree = ""; }; - 8313E3771901FC3800B4B6F1 /* reader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reader.h; sourceTree = ""; }; - 8313E3781901FC3800B4B6F1 /* readers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = readers.c; sourceTree = ""; }; - 8313E3791901FC3800B4B6F1 /* sample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sample.h; sourceTree = ""; }; - 8313E37F1901FC3800B4B6F1 /* synth_mono.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = synth_mono.h; sourceTree = ""; }; - 8313E3801901FC3800B4B6F1 /* synth_ntom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = synth_ntom.h; sourceTree = ""; }; - 8313E3851901FC3800B4B6F1 /* synth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = synth.h; sourceTree = ""; }; - 8313E3861901FC3800B4B6F1 /* synths.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = synths.h; sourceTree = ""; }; - 8313E3871901FC3800B4B6F1 /* tabinit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tabinit.c; sourceTree = ""; }; - 8313E3891901FC3800B4B6F1 /* true.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = true.h; sourceTree = ""; }; - 8313E3CE1902001600B4B6F1 /* icy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = icy.c; sourceTree = ""; }; - 8313E3CF1902001600B4B6F1 /* icy2utf8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = icy2utf8.c; sourceTree = ""; }; - 8313E3D21902003100B4B6F1 /* dither.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dither.c; sourceTree = ""; }; - 8313E3D31902003100B4B6F1 /* feature.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = feature.c; sourceTree = ""; }; - 8313E3D41902003100B4B6F1 /* layer1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = layer1.c; sourceTree = ""; }; - 8313E3D51902003100B4B6F1 /* layer2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = layer2.c; sourceTree = ""; }; - 8313E3D61902003100B4B6F1 /* layer3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = layer3.c; sourceTree = ""; }; - 8313E3D71902003100B4B6F1 /* ntom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ntom.c; sourceTree = ""; }; - 8313E3D81902003100B4B6F1 /* stringbuf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stringbuf.c; sourceTree = ""; }; - 8313E3D91902003100B4B6F1 /* synth_real.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = synth_real.c; sourceTree = ""; }; - 8313E3DA1902003100B4B6F1 /* synth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = synth.c; sourceTree = ""; }; - 8313E3E4190200D000B4B6F1 /* synth_s32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = synth_s32.c; sourceTree = ""; }; - 833F684A1CDBCAC600AFB9F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8313E30B1901FBDC00B4B6F1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 8313E3051901FBDC00B4B6F1 = { - isa = PBXGroup; - children = ( - 8313E3181901FBDC00B4B6F1 /* mpg123 */, - 8313E3111901FBDC00B4B6F1 /* Frameworks */, - 8313E3101901FBDC00B4B6F1 /* Products */, - ); - sourceTree = ""; - }; - 8313E3101901FBDC00B4B6F1 /* Products */ = { - isa = PBXGroup; - children = ( - 8313E30F1901FBDC00B4B6F1 /* mpg123.framework */, - ); - name = Products; - sourceTree = ""; - }; - 8313E3111901FBDC00B4B6F1 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 8313E3141901FBDC00B4B6F1 /* Other Frameworks */, - ); - name = Frameworks; - sourceTree = ""; - }; - 8313E3141901FBDC00B4B6F1 /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 8313E3181901FBDC00B4B6F1 /* mpg123 */ = { - isa = PBXGroup; - children = ( - 8313E3E4190200D000B4B6F1 /* synth_s32.c */, - 8313E3D21902003100B4B6F1 /* dither.c */, - 8313E3D31902003100B4B6F1 /* feature.c */, - 8313E3D41902003100B4B6F1 /* layer1.c */, - 8313E3D51902003100B4B6F1 /* layer2.c */, - 8313E3D61902003100B4B6F1 /* layer3.c */, - 8313E3D71902003100B4B6F1 /* ntom.c */, - 8313E3D81902003100B4B6F1 /* stringbuf.c */, - 8313E3D91902003100B4B6F1 /* synth_real.c */, - 8313E3DA1902003100B4B6F1 /* synth.c */, - 8313E3CE1902001600B4B6F1 /* icy.c */, - 8313E3CF1902001600B4B6F1 /* icy2utf8.c */, - 8313E3461901FC3800B4B6F1 /* abi_align.h */, - 8313E3471901FC3800B4B6F1 /* compat.c */, - 8313E3481901FC3800B4B6F1 /* compat.h */, - 8313E3491901FC3800B4B6F1 /* config.h */, - 8313E34D1901FC3800B4B6F1 /* dct64.c */, - 8313E34E1901FC3800B4B6F1 /* debug.h */, - 8313E34F1901FC3800B4B6F1 /* decode.h */, - 8313E3511901FC3800B4B6F1 /* dither.h */, - 8313E3521901FC3800B4B6F1 /* equalizer.c */, - 8313E3541901FC3800B4B6F1 /* format.c */, - 8313E3551901FC3800B4B6F1 /* frame.c */, - 8313E3561901FC3800B4B6F1 /* frame.h */, - 8313E3571901FC3800B4B6F1 /* gapless.h */, - 8313E3581901FC3800B4B6F1 /* getbits.h */, - 8313E3591901FC3800B4B6F1 /* getcpuflags.h */, - 8313E35A1901FC3800B4B6F1 /* huffman.h */, - 8313E35C1901FC3800B4B6F1 /* icy.h */, - 8313E35E1901FC3800B4B6F1 /* icy2utf8.h */, - 8313E35F1901FC3800B4B6F1 /* id3.c */, - 8313E3601901FC3800B4B6F1 /* id3.h */, - 8313E3611901FC3800B4B6F1 /* index.c */, - 8313E3621901FC3800B4B6F1 /* index.h */, - 8313E3631901FC3800B4B6F1 /* intsym.h */, - 8313E3641901FC3800B4B6F1 /* l2tables.h */, - 8313E3651901FC3800B4B6F1 /* l3_integer_tables.h */, - 8313E3661901FC3800B4B6F1 /* l12_integer_tables.h */, - 8313E36C1901FC3800B4B6F1 /* libmpg123.c */, - 8313E36D1901FC3800B4B6F1 /* mangle.h */, - 8313E36E1901FC3800B4B6F1 /* mpeghead.h */, - 8313E36F1901FC3800B4B6F1 /* mpg123.h */, - 8313E3701901FC3800B4B6F1 /* mpg123lib_intern.h */, - 8313E3711901FC3800B4B6F1 /* newhuffman.h */, - 8313E3731901FC3800B4B6F1 /* optimize.c */, - 8313E3741901FC3800B4B6F1 /* optimize.h */, - 8313E3751901FC3800B4B6F1 /* parse.c */, - 8313E3761901FC3800B4B6F1 /* parse.h */, - 8313E3771901FC3800B4B6F1 /* reader.h */, - 8313E3781901FC3800B4B6F1 /* readers.c */, - 8313E3791901FC3800B4B6F1 /* sample.h */, - 8313E37F1901FC3800B4B6F1 /* synth_mono.h */, - 8313E3801901FC3800B4B6F1 /* synth_ntom.h */, - 8313E3851901FC3800B4B6F1 /* synth.h */, - 8313E3861901FC3800B4B6F1 /* synths.h */, - 8313E3871901FC3800B4B6F1 /* tabinit.c */, - 8313E3891901FC3800B4B6F1 /* true.h */, - 8313E3191901FBDC00B4B6F1 /* Supporting Files */, - ); - path = mpg123; - sourceTree = ""; - }; - 8313E3191901FBDC00B4B6F1 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 8313E31A1901FBDC00B4B6F1 /* mpg123-Info.plist */, - 8313E31B1901FBDC00B4B6F1 /* InfoPlist.strings */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 8313E30C1901FBDC00B4B6F1 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 8313E3B31901FC3800B4B6F1 /* mpg123.h in Headers */, - 8313E3A01901FC3800B4B6F1 /* icy.h in Headers */, - 8313E3B51901FC3800B4B6F1 /* newhuffman.h in Headers */, - 8313E3BB1901FC3800B4B6F1 /* reader.h in Headers */, - 8313E3A41901FC3800B4B6F1 /* id3.h in Headers */, - 8313E3B21901FC3800B4B6F1 /* mpeghead.h in Headers */, - 8313E3CA1901FC3800B4B6F1 /* synths.h in Headers */, - 8313E3B81901FC3800B4B6F1 /* optimize.h in Headers */, - 8313E3C31901FC3800B4B6F1 /* synth_mono.h in Headers */, - 8313E3C41901FC3800B4B6F1 /* synth_ntom.h in Headers */, - 8313E3A81901FC3800B4B6F1 /* l2tables.h in Headers */, - 8313E3A71901FC3800B4B6F1 /* intsym.h in Headers */, - 8313E39A1901FC3800B4B6F1 /* frame.h in Headers */, - 8313E3A91901FC3800B4B6F1 /* l3_integer_tables.h in Headers */, - 8313E3B11901FC3800B4B6F1 /* mangle.h in Headers */, - 8313E39C1901FC3800B4B6F1 /* getbits.h in Headers */, - 8313E3BD1901FC3800B4B6F1 /* sample.h in Headers */, - 8313E39E1901FC3800B4B6F1 /* huffman.h in Headers */, - 8313E39D1901FC3800B4B6F1 /* getcpuflags.h in Headers */, - 8313E3A61901FC3800B4B6F1 /* index.h in Headers */, - 8313E3C91901FC3800B4B6F1 /* synth.h in Headers */, - 8313E3921901FC3800B4B6F1 /* debug.h in Headers */, - 8313E38C1901FC3800B4B6F1 /* compat.h in Headers */, - 8313E3AA1901FC3800B4B6F1 /* l12_integer_tables.h in Headers */, - 8313E3951901FC3800B4B6F1 /* dither.h in Headers */, - 8313E3A21901FC3800B4B6F1 /* icy2utf8.h in Headers */, - 8313E3BA1901FC3800B4B6F1 /* parse.h in Headers */, - 8313E3B41901FC3800B4B6F1 /* mpg123lib_intern.h in Headers */, - 8313E38A1901FC3800B4B6F1 /* abi_align.h in Headers */, - 8313E3CD1901FC3800B4B6F1 /* true.h in Headers */, - 8313E3931901FC3800B4B6F1 /* decode.h in Headers */, - 8313E39B1901FC3800B4B6F1 /* gapless.h in Headers */, - 8313E38D1901FC3800B4B6F1 /* config.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 8313E30E1901FBDC00B4B6F1 /* mpg123 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 8313E3371901FBDC00B4B6F1 /* Build configuration list for PBXNativeTarget "mpg123" */; - buildPhases = ( - 8313E30A1901FBDC00B4B6F1 /* Sources */, - 8313E30B1901FBDC00B4B6F1 /* Frameworks */, - 8313E30C1901FBDC00B4B6F1 /* Headers */, - 8313E30D1901FBDC00B4B6F1 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = mpg123; - productName = mpg123; - productReference = 8313E30F1901FBDC00B4B6F1 /* mpg123.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 8313E3061901FBDC00B4B6F1 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1400; - ORGANIZATIONNAME = "Christopher Snowhill"; - TargetAttributes = { - 8313E30E1901FBDC00B4B6F1 = { - DevelopmentTeam = ""; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 8313E3091901FBDC00B4B6F1 /* Build configuration list for PBXProject "mpg123" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - es, - Base, - ); - mainGroup = 8313E3051901FBDC00B4B6F1; - productRefGroup = 8313E3101901FBDC00B4B6F1 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8313E30E1901FBDC00B4B6F1 /* mpg123 */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8313E30D1901FBDC00B4B6F1 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8313E31D1901FBDC00B4B6F1 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8313E30A1901FBDC00B4B6F1 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8313E3DE1902003100B4B6F1 /* layer2.c in Sources */, - 8313E3E21902003100B4B6F1 /* synth_real.c in Sources */, - 8313E3CB1901FC3800B4B6F1 /* tabinit.c in Sources */, - 8313E3961901FC3800B4B6F1 /* equalizer.c in Sources */, - 8313E3911901FC3800B4B6F1 /* dct64.c in Sources */, - 8313E3A51901FC3800B4B6F1 /* index.c in Sources */, - 8313E3E31902003100B4B6F1 /* synth.c in Sources */, - 8313E3A31901FC3800B4B6F1 /* id3.c in Sources */, - 8313E3B71901FC3800B4B6F1 /* optimize.c in Sources */, - 8313E3B01901FC3800B4B6F1 /* libmpg123.c in Sources */, - 8313E3DC1902003100B4B6F1 /* feature.c in Sources */, - 8313E3BC1901FC3800B4B6F1 /* readers.c in Sources */, - 8313E3DB1902003100B4B6F1 /* dither.c in Sources */, - 8313E3E01902003100B4B6F1 /* ntom.c in Sources */, - 8313E3D01902001600B4B6F1 /* icy.c in Sources */, - 8313E3B91901FC3800B4B6F1 /* parse.c in Sources */, - 8313E3DD1902003100B4B6F1 /* layer1.c in Sources */, - 8313E3981901FC3800B4B6F1 /* format.c in Sources */, - 8313E3991901FC3800B4B6F1 /* frame.c in Sources */, - 8313E3DF1902003100B4B6F1 /* layer3.c in Sources */, - 8313E3D11902001600B4B6F1 /* icy2utf8.c in Sources */, - 8313E3E11902003100B4B6F1 /* stringbuf.c in Sources */, - 8313E3E5190200D000B4B6F1 /* synth_s32.c in Sources */, - 8313E38B1901FC3800B4B6F1 /* compat.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 8313E31B1901FBDC00B4B6F1 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 8313E31C1901FBDC00B4B6F1 /* en */, - 833F684A1CDBCAC600AFB9F0 /* es */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 8313E3351901FBDC00B4B6F1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INSTALL_PATH = "@loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.13; - ONLY_ACTIVE_ARCH = YES; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 8313E3361901FBDC00B4B6F1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INSTALL_PATH = "@loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.13; - SKIP_INSTALL = YES; - }; - name = Release; - }; - 8313E3381901FBDC00B4B6F1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "-"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEAD_CODE_STRIPPING = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_WARN_INHIBIT_ALL_WARNINGS = YES; - INFOPLIST_FILE = "mpg123/mpg123-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "NoWork-Inc.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - WRAPPER_EXTENSION = framework; - }; - name = Debug; - }; - 8313E3391901FBDC00B4B6F1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "-"; - COMBINE_HIDPI_IMAGES = YES; - DEAD_CODE_STRIPPING = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_WARN_INHIBIT_ALL_WARNINGS = YES; - INFOPLIST_FILE = "mpg123/mpg123-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "NoWork-Inc.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = framework; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 8313E3091901FBDC00B4B6F1 /* Build configuration list for PBXProject "mpg123" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8313E3351901FBDC00B4B6F1 /* Debug */, - 8313E3361901FBDC00B4B6F1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 8313E3371901FBDC00B4B6F1 /* Build configuration list for PBXNativeTarget "mpg123" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8313E3381901FBDC00B4B6F1 /* Debug */, - 8313E3391901FBDC00B4B6F1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 8313E3061901FBDC00B4B6F1 /* Project object */; -} diff --git a/Frameworks/mpg123/mpg123.xcodeproj/xcshareddata/xcschemes/mpg123.xcscheme b/Frameworks/mpg123/mpg123.xcodeproj/xcshareddata/xcschemes/mpg123.xcscheme deleted file mode 100644 index 7a60f2687..000000000 --- a/Frameworks/mpg123/mpg123.xcodeproj/xcshareddata/xcschemes/mpg123.xcscheme +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Frameworks/mpg123/mpg123/compat.c b/Frameworks/mpg123/mpg123/compat.c deleted file mode 100644 index 18ea76ef6..000000000 --- a/Frameworks/mpg123/mpg123/compat.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - compat: Some compatibility functions. - - The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX. - So anything possibly somewhat advanced should be considered to be put here, with proper #ifdef;-) - - copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Thomas Orgis, Windows Unicode stuff by JonY. -*/ - -#include "config.h" -#include "compat.h" - -#ifdef _MSC_VER -#include -#else -#include -#endif -#include - -#ifdef WANT_WIN32_UNICODE -#include -#include -#include -#endif - -#include "debug.h" - -/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */ -void *safe_realloc(void *ptr, size_t size) -{ - if(ptr == NULL) return malloc(size); - else return realloc(ptr, size); -} - -#ifndef HAVE_STRERROR -const char *strerror(int errnum) -{ - extern int sys_nerr; - extern char *sys_errlist[]; - - return (errnum < sys_nerr) ? sys_errlist[errnum] : ""; -} -#endif - -#ifndef HAVE_STRDUP -char *strdup(const char *src) -{ - char *dest; - - if (!(dest = (char *) malloc(strlen(src)+1))) - return NULL; - else - return strcpy(dest, src); -} -#endif - -int compat_open(const char *filename, int flags) -{ - int ret; -#if defined (WANT_WIN32_UNICODE) - wchar_t *frag = NULL; - - ret = win32_utf8_wide(filename, &frag, NULL); - if ((frag == NULL) || (ret == 0)) goto fallback; /* Fallback to plain open when ucs-2 conversion fails */ - - ret = _wopen(frag, flags); /*Try _wopen */ - if (ret != -1 ) goto open_ok; /* msdn says -1 means failure */ - -fallback: -#endif - -#if (defined(WIN32) && !defined (__CYGWIN__)) /* MSDN says POSIX function is deprecated beginning in Visual C++ 2005 */ - ret = _open(filename, flags); /* Try plain old _open(), if it fails, do nothing */ -#else - /* On UNIX, we always add a default permission mask in case flags|O_CREAT. */ - ret = open(filename, flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); -#endif - -#if defined (WANT_WIN32_UNICODE) -open_ok: - free ((void *)frag); /* Freeing a NULL should be OK */ -#endif - - return ret; -} - -int compat_close(int infd) -{ -#if (defined(WIN32) && !defined (__CYGWIN__)) /* MSDN says POSIX function is deprecated beginning in Visual C++ 2005 */ - return _close(infd); -#else - return close(infd); -#endif -} - -/* Windows Unicode stuff */ - -#ifdef WANT_WIN32_UNICODE -int win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen) -{ - size_t len; - char *buf; - int ret = 0; - - len = WideCharToMultiByte(CP_UTF8, 0, wptr, -1, NULL, 0, NULL, NULL); /* Get utf-8 string length */ - buf = calloc(len + 1, sizeof (char)); /* Can we assume sizeof char always = 1? */ - - if(!buf) len = 0; - else { - if (len != 0) ret = WideCharToMultiByte(CP_UTF8, 0, wptr, -1, buf, len, NULL, NULL); /*Do actual conversion*/ - buf[len] = '0'; /* Must terminate */ - } - *mbptr = buf; /* Set string pointer to allocated buffer */ - if(buflen != NULL) *buflen = (len) * sizeof (char); /* Give length of allocated memory if needed. */ - return ret; -} - -int win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen) -{ - size_t len; - wchar_t *buf; - int ret = 0; - - len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, mbptr, -1, NULL, 0); /* Get converted size */ - buf = calloc(len + 1, sizeof (wchar_t)); /* Allocate memory accordingly */ - - if(!buf) len = 0; - else { - if (len != 0) ret = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS, mbptr, -1, buf, len); /* Do conversion */ - buf[len] = L'0'; /* Must terminate */ - } - *wptr = buf; /* Set string pointer to allocated buffer */ - if (buflen != NULL) *buflen = len * sizeof (wchar_t); /* Give length of allocated memory if needed. */ - return ret; /* Number of characters written */ -} -#endif diff --git a/Frameworks/mpg123/mpg123/compat.h b/Frameworks/mpg123/mpg123/compat.h deleted file mode 100644 index 2f3e116b6..000000000 --- a/Frameworks/mpg123/mpg123/compat.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - compat: Some compatibility functions and header inclusions. - Basic standard C stuff, that may barely be above/around C89. - - The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX. - It is envisioned to include this compat header instead of any of the "standard" headers, to catch compatibility issues. - So, don't include stdlib.h or string.h ... include compat.h. - - copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Thomas Orgis -*/ - -#ifndef MPG123_COMPAT_H -#define MPG123_COMPAT_H - -#include "config.h" -#include "intsym.h" - -#ifdef HAVE_STDLIB_H -/* realloc, size_t */ -#include -#endif - -#include -#include - -#ifdef HAVE_SIGNAL_H -#include -#else -#ifdef HAVE_SYS_SIGNAL_H -#include -#endif -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -/* Types, types, types. */ -/* Do we actually need these two in addition to sys/types.h? As replacement? */ -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_INTTYPES_H -#include -#endif -#ifdef HAVE_STDINT_H -#include -#endif -/* We want SIZE_MAX, etc. */ -#ifdef HAVE_LIMITS_H -#include -#endif - -#ifndef SIZE_MAX -#define SIZE_MAX ((size_t)-1) -#endif -#ifndef ULONG_MAX -#define ULONG_MAX ((unsigned long)-1) -#endif - -#ifdef HAVE_STRING_H -#include -#endif - -#ifdef OS2 -#include -#endif - -#ifdef HAVE_SYS_TIME_H -#include -#endif -/* For select(), I need select.h according to POSIX 2001, else: sys/time.h sys/types.h unistd.h */ -#ifdef HAVE_SYS_SELECT_H -#include -#endif - -/* compat_open makes little sense without */ -#include - -/* To parse big numbers... */ -#ifdef HAVE_ATOLL -#define atobigint atoll -#else -#define atobigint atol -#endif - -typedef unsigned char byte; - -/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */ -void *safe_realloc(void *ptr, size_t size); -#ifndef HAVE_STRERROR -const char *strerror(int errnum); -#endif - -#ifndef HAVE_STRDUP -char *strdup(const char *s); -#endif - -/* If we have the size checks enabled, try to derive some sane printfs. - Simple start: Use max integer type and format if long is not big enough. - I am hesitating to use %ll without making sure that it's there... */ -#if !(defined PLAIN_C89) && (defined SIZEOF_OFF_T) && (SIZEOF_OFF_T > SIZEOF_LONG) && (defined PRIiMAX) -# define OFF_P PRIiMAX -typedef intmax_t off_p; -#else -# define OFF_P "li" -typedef long off_p; -#endif - -#if !(defined PLAIN_C89) && (defined SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > SIZEOF_LONG) && (defined PRIuMAX) -# define SIZE_P PRIuMAX -typedef uintmax_t size_p; -#else -# define SIZE_P "lu" -typedef unsigned long size_p; -#endif - -#if !(defined PLAIN_C89) && (defined SIZEOF_SSIZE_T) && (SIZEOF_SSIZE_T > SIZEOF_LONG) && (defined PRIiMAX) -# define SSIZE_P PRIuMAX -typedef intmax_t ssize_p; -#else -# define SSIZE_P "li" -typedef long ssize_p; -#endif - -/** - * Opening a file handle can be different. - * This function here is defined to take a path in native encoding (ISO8859 / UTF-8 / ...), or, when MS Windows Unicode support is enabled, an UTF-8 string that will be converted back to native UCS-2 (wide character) before calling the system's open function. - * @param[in] wptr Pointer to wide string. - * @param[in] mbptr Pointer to multibyte string. - * @return file descriptor (>=0) or error code. - */ -int compat_open(const char *filename, int flags); - -/** - * Closing a file handle can be platform specific. - * This function takes a file descriptor that is to be closed. - * @param[in] infd File descriptor to be closed. - * @return 0 if the file was successfully closed. A return value of -1 indicates an error. - */ -int compat_close(int infd); - -/* Those do make sense in a separate file, but I chose to include them in compat.c because that's the one source whose object is shared between mpg123 and libmpg123 -- and both need the functionality internally. */ - -#ifdef WANT_WIN32_UNICODE -/** - * win32_uni2mbc - * Converts a null terminated UCS-2 string to a multibyte (UTF-8) equivalent. - * Caller is supposed to free allocated buffer. - * @param[in] wptr Pointer to wide string. - * @param[out] mbptr Pointer to multibyte string. - * @param[out] buflen Optional parameter for length of allocated buffer. - * @return status of WideCharToMultiByte conversion. - * - * WideCharToMultiByte - http://msdn.microsoft.com/en-us/library/dd374130(VS.85).aspx - */ -int win32_wide_utf8(const wchar_t * const wptr, char **mbptr, size_t * buflen); - -/** - * win32_mbc2uni - * Converts a null terminated UTF-8 string to a UCS-2 equivalent. - * Caller is supposed to free allocated buffer. - * @param[out] mbptr Pointer to multibyte string. - * @param[in] wptr Pointer to wide string. - * @param[out] buflen Optional parameter for length of allocated buffer. - * @return status of WideCharToMultiByte conversion. - * - * MultiByteToWideChar - http://msdn.microsoft.com/en-us/library/dd319072(VS.85).aspx - */ - -int win32_utf8_wide(const char *const mbptr, wchar_t **wptr, size_t *buflen); -#endif - -/* That one comes from Tellie on OS/2, needed in resolver. */ -#ifdef __KLIBC__ -typedef int socklen_t; -#endif - -#include "true.h" - -#endif diff --git a/Frameworks/mpg123/mpg123/config.h b/Frameworks/mpg123/mpg123/config.h deleted file mode 100644 index 65545f253..000000000 --- a/Frameworks/mpg123/mpg123/config.h +++ /dev/null @@ -1,457 +0,0 @@ -/* src/config.h. Generated from config.h.in by configure. */ -/* src/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if your architecture wants/needs/can use attribute_align_arg and - alignment checks. It is for 32bit x86... */ -/* #undef ABI_ALIGN_FUN */ - -/* Define to use proper rounding. */ -/* #undef ACCURATE_ROUNDING */ - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define if .balign is present. */ -#define ASMALIGN_BALIGN 1 - -/* Define if .align just takes byte count. */ -/* #undef ASMALIGN_BYTE */ - -/* Define if .align takes 3 for alignment of 2^3=8 bytes instead of 8. */ -/* #undef ASMALIGN_EXP */ - -/* Define if __attribute__((aligned(16))) shall be used */ -/* #undef CCALIGN */ - -/* Define if debugging is enabled. */ -/* #undef DEBUG */ - -/* The default audio output module(s) to use */ -#define DEFAULT_OUTPUT_MODULE "dummy" - -/* Define if building with dynamcally linked libmpg123 */ -#define DYNAMIC_BUILD 1 - -/* Use EFBIG as substitude for EOVERFLOW, mingw.org may lack the latter */ -/* #undef EOVERFLOW */ - -/* Define if FIFO support is enabled. */ -#define FIFO 1 - -/* Define if frame index should be used. */ -#define FRAME_INDEX 1 - -/* Define if gapless is enabled. */ -#define GAPLESS 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ALC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ALIB_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_AL_ALC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_AL_AL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_AL_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ASM_AUDIOIO_H */ - -/* Define to 1 if you have the `atoll' function. */ -#define HAVE_ATOLL 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_AUDIOS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_AUDIOTOOLBOX_AUDIOTOOLBOX_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_AUDIOUNIT_AUDIOUNIT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_CORESERVICES_CORESERVICES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_CULIB_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define if getaddrinfo accepts the AI_ADDRCONFIG flag */ -#define HAVE_GAI_ADDRCONFIG 1 - -/* Define to 1 if you have the `getaddrinfo' function. */ -#define HAVE_GETADDRINFO 1 - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define to 1 if you have the `getuid' function. */ -#define HAVE_GETUID 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LANGINFO_H 1 - -/* Define to 1 if you have the `m' library (-lm). */ -#define HAVE_LIBM 1 - -/* Define to 1 if you have the `mx' library (-lmx). */ -/* #undef HAVE_LIBMX */ - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LINUX_SOUNDCARD_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if libltdl is available */ -/* #undef HAVE_LTDL */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MACHINE_SOUNDCARD_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mkfifo' function. */ -#define HAVE_MKFIFO 1 - -/* Define to 1 if you have a working `mmap' system call. */ -#define HAVE_MMAP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_NETDB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETINET_TCP_H */ - -/* Define to 1 if you have the `nl_langinfo' function. */ -#define HAVE_NL_LANGINFO 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_OPENAL_ALC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_OPENAL_AL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_OS2ME_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_OS2_H */ - -/* Define to 1 if you have the `random' function. */ -#define HAVE_RANDOM 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SCHED_H 1 - -/* Define to 1 if you have the `sched_setscheduler' function. */ -#define HAVE_SCHED_SETSCHEDULER 1 - -/* Define to 1 if you have the `setlocale' function. */ -#define HAVE_SETLOCALE 1 - -/* Define to 1 if you have the `setpriority' function. */ -#define HAVE_SETPRIORITY 1 - -/* Define to 1 if you have the `setuid' function. */ -#define HAVE_SETUID 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SIGNAL_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SNDIO_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SUN_AUDIOIO_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_AUDIOIO_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_AUDIO_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_RESOURCE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SIGNAL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SOUNDCARD_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define this if you have the POSIX termios library */ -#define HAVE_TERMIOS 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_WINDOWS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_WS2TCPIP_H */ - -/* Define to indicate that float storage follows IEEE754. */ -#define IEEE_FLOAT 1 - -/* size of the frame index seek table */ -#define INDEX_SIZE 1000 - -/* Define if IPV6 support is enabled. */ -#define IPV6 1 - -/* Define this to the size of native offset type in bits, used for LFS alias - functions. */ -#define LFS_ALIAS_BITS 32 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* The suffix for module files. */ -#define MODULE_FILE_SUFFIX ".la" - -/* Define if network support is enabled. */ -/* #undef NETWORK */ - -/* Define to disable 16 bit integer output. */ -/* #undef NO_16BIT */ - -/* Define to disable 32 bit and 24 bit integer output. */ -/* #undef NO_32BIT */ - -/* Define to disable 8 bit integer output. */ -#define NO_8BIT - -/* Define to disable downsampled decoding. */ -#define NO_DOWNSAMPLE - -/* Define to disable error messages in combination with a return value (the - return is left intact). */ -/* #undef NO_ERETURN */ - -/* Define to disable error messages. */ -/* #undef NO_ERRORMSG */ - -/* Define to disable feeder and buffered readers. */ -/* #undef NO_FEEDER */ - -/* Define to disable ICY handling. */ -#define NO_ICY - -/* Define to disable ID3v2 parsing. */ -#define NO_ID3V2 - -/* Define to disable layer I. */ -/* #undef NO_LAYER1 */ - -/* Define to disable layer II. */ -/* #undef NO_LAYER2 */ - -/* Define to disable layer III. */ -/* #undef NO_LAYER3 */ - -/* Define to disable ntom resampling. */ -/* #undef NO_NTOM */ - -/* Define to disable real output. */ -/* #undef NO_REAL */ - -/* Define to disable string functions. */ -/* #undef NO_STRING */ - -/* Define to disable warning messages. */ -/* #undef NO_WARNING */ - -/* Name of package */ -#define PACKAGE "mpg123" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "mpg123-devel@lists.sourceforge.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "mpg123" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "mpg123 1.16.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "mpg123" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.16.0" - -/* Define if portaudio v18 API is wanted. */ -/* #undef PORTAUDIO18 */ - -/* The size of `int32_t', as computed by sizeof. */ -#define SIZEOF_INT32_T 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 8 - -/* The size of `off_t', as computed by sizeof. */ -#define SIZEOF_OFF_T 8 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 8 - -/* The size of `ssize_t', as computed by sizeof. */ -#define SIZEOF_SSIZE_T 8 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if modules are enabled */ -/* #undef USE_MODULES */ - -/* Define for new Huffman decoding scheme. */ -#define USE_NEW_HUFFTABLE 1 - -/* Define to use yasm for assemble AVX sources. */ -/* #undef USE_YASM_FOR_AVX */ - -/* Version number of package */ -#define VERSION "1.16.0" - -/* Define to use Win32 named pipes */ -/* #undef WANT_WIN32_FIFO */ - -/* Define to use Win32 sockets */ -/* #undef WANT_WIN32_SOCKETS */ - -/* Define to use Unicode for Windows */ -/* #undef WANT_WIN32_UNICODE */ - -/* WinXP and above for ipv6 */ -/* #undef WINVER */ - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Enable large inode numbers on Mac OS X 10.5. */ -#ifndef _DARWIN_USE_64_BIT_INODE -# define _DARWIN_USE_64_BIT_INODE 1 -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* WinXP and above for ipv6 */ -/* #undef _WIN32_WINNT */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to `short' if does not define. */ -/* #undef int16_t */ - -/* Define to `int' if does not define. */ -/* #undef int32_t */ - -/* Define to the native offset type (long or actually off_t). */ -#define lfs_alias_t off_t - -/* Define to `long int' if does not define. */ -/* #undef off_t */ - -/* Define to `unsigned long' if does not define. */ -/* #undef size_t */ - -/* Define to `long' if does not define. */ -/* #undef ssize_t */ - -/* Define to `unsigned short' if does not define. */ -/* #undef uint16_t */ - -/* Define to `unsigned int' if does not define. */ -/* #undef uint32_t */ - -/* Define to `unsigned long' if does not define. */ -/* #undef uintptr_t */ - -#define OPT_GENERIC diff --git a/Frameworks/mpg123/mpg123/dct64.c b/Frameworks/mpg123/mpg123/dct64.c deleted file mode 100644 index a25047a3c..000000000 --- a/Frameworks/mpg123/mpg123/dct64.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - dct64.c: DCT64, the plain C version - - copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Michael Hipp -*/ - -/* - * Discrete Cosine Tansform (DCT) for subband synthesis - * - * -funroll-loops (for gcc) will remove the loops for better performance - * using loops in the source-code enhances readabillity - * - * - * TODO: write an optimized version for the down-sampling modes - * (in these modes the bands 16-31 (2:1) or 8-31 (4:1) are zero - */ - -#include "mpg123lib_intern.h" - -void dct64(real *out0,real *out1,real *samples) -{ - real bufs[64]; - - { - register int i,j; - register real *b1,*b2,*bs,*costab; - - b1 = samples; - bs = bufs; - costab = pnts[0]+16; - b2 = b1 + 32; - - for(i=15;i>=0;i--) - *bs++ = (*b1++ + *--b2); - for(i=15;i>=0;i--) - *bs++ = REAL_MUL((*--b2 - *b1++), *--costab); - - b1 = bufs; - costab = pnts[1]+8; - b2 = b1 + 16; - - { - for(i=7;i>=0;i--) - *bs++ = (*b1++ + *--b2); - for(i=7;i>=0;i--) - *bs++ = REAL_MUL((*--b2 - *b1++), *--costab); - b2 += 32; - costab += 8; - for(i=7;i>=0;i--) - *bs++ = (*b1++ + *--b2); - for(i=7;i>=0;i--) - *bs++ = REAL_MUL((*b1++ - *--b2), *--costab); - b2 += 32; - } - - bs = bufs; - costab = pnts[2]; - b2 = b1 + 8; - - for(j=2;j;j--) - { - for(i=3;i>=0;i--) - *bs++ = (*b1++ + *--b2); - for(i=3;i>=0;i--) - *bs++ = REAL_MUL((*--b2 - *b1++), costab[i]); - b2 += 16; - for(i=3;i>=0;i--) - *bs++ = (*b1++ + *--b2); - for(i=3;i>=0;i--) - *bs++ = REAL_MUL((*b1++ - *--b2), costab[i]); - b2 += 16; - } - - b1 = bufs; - costab = pnts[3]; - b2 = b1 + 4; - - for(j=4;j;j--) - { - *bs++ = (*b1++ + *--b2); - *bs++ = (*b1++ + *--b2); - *bs++ = REAL_MUL((*--b2 - *b1++), costab[1]); - *bs++ = REAL_MUL((*--b2 - *b1++), costab[0]); - b2 += 8; - *bs++ = (*b1++ + *--b2); - *bs++ = (*b1++ + *--b2); - *bs++ = REAL_MUL((*b1++ - *--b2), costab[1]); - *bs++ = REAL_MUL((*b1++ - *--b2), costab[0]); - b2 += 8; - } - bs = bufs; - costab = pnts[4]; - - for(j=8;j;j--) - { - real v0,v1; - v0=*b1++; v1 = *b1++; - *bs++ = (v0 + v1); - *bs++ = REAL_MUL((v0 - v1), (*costab)); - v0=*b1++; v1 = *b1++; - *bs++ = (v0 + v1); - *bs++ = REAL_MUL((v1 - v0), (*costab)); - } - - } - - - { - register real *b1; - register int i; - - for(b1=bufs,i=8;i;i--,b1+=4) - b1[2] += b1[3]; - - for(b1=bufs,i=4;i;i--,b1+=8) - { - b1[4] += b1[6]; - b1[6] += b1[5]; - b1[5] += b1[7]; - } - - for(b1=bufs,i=2;i;i--,b1+=16) - { - b1[8] += b1[12]; - b1[12] += b1[10]; - b1[10] += b1[14]; - b1[14] += b1[9]; - b1[9] += b1[13]; - b1[13] += b1[11]; - b1[11] += b1[15]; - } - } - - - out0[0x10*16] = REAL_SCALE_DCT64(bufs[0]); - out0[0x10*15] = REAL_SCALE_DCT64(bufs[16+0] + bufs[16+8]); - out0[0x10*14] = REAL_SCALE_DCT64(bufs[8]); - out0[0x10*13] = REAL_SCALE_DCT64(bufs[16+8] + bufs[16+4]); - out0[0x10*12] = REAL_SCALE_DCT64(bufs[4]); - out0[0x10*11] = REAL_SCALE_DCT64(bufs[16+4] + bufs[16+12]); - out0[0x10*10] = REAL_SCALE_DCT64(bufs[12]); - out0[0x10* 9] = REAL_SCALE_DCT64(bufs[16+12] + bufs[16+2]); - out0[0x10* 8] = REAL_SCALE_DCT64(bufs[2]); - out0[0x10* 7] = REAL_SCALE_DCT64(bufs[16+2] + bufs[16+10]); - out0[0x10* 6] = REAL_SCALE_DCT64(bufs[10]); - out0[0x10* 5] = REAL_SCALE_DCT64(bufs[16+10] + bufs[16+6]); - out0[0x10* 4] = REAL_SCALE_DCT64(bufs[6]); - out0[0x10* 3] = REAL_SCALE_DCT64(bufs[16+6] + bufs[16+14]); - out0[0x10* 2] = REAL_SCALE_DCT64(bufs[14]); - out0[0x10* 1] = REAL_SCALE_DCT64(bufs[16+14] + bufs[16+1]); - out0[0x10* 0] = REAL_SCALE_DCT64(bufs[1]); - - out1[0x10* 0] = REAL_SCALE_DCT64(bufs[1]); - out1[0x10* 1] = REAL_SCALE_DCT64(bufs[16+1] + bufs[16+9]); - out1[0x10* 2] = REAL_SCALE_DCT64(bufs[9]); - out1[0x10* 3] = REAL_SCALE_DCT64(bufs[16+9] + bufs[16+5]); - out1[0x10* 4] = REAL_SCALE_DCT64(bufs[5]); - out1[0x10* 5] = REAL_SCALE_DCT64(bufs[16+5] + bufs[16+13]); - out1[0x10* 6] = REAL_SCALE_DCT64(bufs[13]); - out1[0x10* 7] = REAL_SCALE_DCT64(bufs[16+13] + bufs[16+3]); - out1[0x10* 8] = REAL_SCALE_DCT64(bufs[3]); - out1[0x10* 9] = REAL_SCALE_DCT64(bufs[16+3] + bufs[16+11]); - out1[0x10*10] = REAL_SCALE_DCT64(bufs[11]); - out1[0x10*11] = REAL_SCALE_DCT64(bufs[16+11] + bufs[16+7]); - out1[0x10*12] = REAL_SCALE_DCT64(bufs[7]); - out1[0x10*13] = REAL_SCALE_DCT64(bufs[16+7] + bufs[16+15]); - out1[0x10*14] = REAL_SCALE_DCT64(bufs[15]); - out1[0x10*15] = REAL_SCALE_DCT64(bufs[16+15]); - -} - - diff --git a/Frameworks/mpg123/mpg123/debug.h b/Frameworks/mpg123/mpg123/debug.h deleted file mode 100644 index 32d471cb4..000000000 --- a/Frameworks/mpg123/mpg123/debug.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - debug.h: - if DEBUG defined: debugging macro fprintf wrappers - else: macros defined to do nothing - That saves typing #ifdef DEBUG all the time and still preserves - lean code without debugging. - - public domain (or LGPL / GPL, if you like that more;-) - generated by debugdef.pl, what was - trivially written by Thomas Orgis -*/ - -#include "config.h" - -/* - I could do that with variadic macros available: - #define sdebug(me, s) fprintf(stderr, "[location] " s "\n") - #define debug(me, s, ...) fprintf(stderr, "[location] " s "}n", __VA_ARGS__) - - Variadic macros are a C99 feature... - Now just predefining stuff non-variadic for up to 15 arguments. - It's cumbersome to have them all with different names, though... -*/ - -#ifdef DEBUG -#include -#define debug(s) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__) -#define debug1(s, a) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a) -#define debug2(s, a, b) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b) -#define debug3(s, a, b, c) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c) -#define debug4(s, a, b, c, d) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d) -#define debug5(s, a, b, c, d, e) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e) -#define debug6(s, a, b, c, d, e, f) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f) -#define debug7(s, a, b, c, d, e, f, g) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g) -#define debug8(s, a, b, c, d, e, f, g, h) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h) -#define debug9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i) -#define debug10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j) -#define debug11(s, a, b, c, d, e, f, g, h, i, j, k) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k) -#define debug12(s, a, b, c, d, e, f, g, h, i, j, k, l) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l) -#define debug13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m) -#define debug14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n) -#define debug15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -#else -#define debug(s) -#define debug1(s, a) -#define debug2(s, a, b) -#define debug3(s, a, b, c) -#define debug4(s, a, b, c, d) -#define debug5(s, a, b, c, d, e) -#define debug6(s, a, b, c, d, e, f) -#define debug7(s, a, b, c, d, e, f, g) -#define debug8(s, a, b, c, d, e, f, g, h) -#define debug9(s, a, b, c, d, e, f, g, h, i) -#define debug10(s, a, b, c, d, e, f, g, h, i, j) -#define debug11(s, a, b, c, d, e, f, g, h, i, j, k) -#define debug12(s, a, b, c, d, e, f, g, h, i, j, k, l) -#define debug13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) -#define debug14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) -#define debug15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -#endif - -/* warning macros also here... */ -#ifndef NO_WARNING -#define warning(s) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__) -#define warning1(s, a) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a) -#define warning2(s, a, b) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b) -#define warning3(s, a, b, c) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c) -#define warning4(s, a, b, c, d) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d) -#define warning5(s, a, b, c, d, e) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e) -#define warning6(s, a, b, c, d, e, f) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f) -#define warning7(s, a, b, c, d, e, f, g) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g) -#define warning8(s, a, b, c, d, e, f, g, h) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h) -#define warning9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i) -#define warning10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j) -#define warning11(s, a, b, c, d, e, f, g, h, i, j, k) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k) -#define warning12(s, a, b, c, d, e, f, g, h, i, j, k, l) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l) -#define warning13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m) -#define warning14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n) -#define warning15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -#else -#define warning(s) -#define warning1(s, a) -#define warning2(s, a, b) -#define warning3(s, a, b, c) -#define warning4(s, a, b, c, d) -#define warning5(s, a, b, c, d, e) -#define warning6(s, a, b, c, d, e, f) -#define warning7(s, a, b, c, d, e, f, g) -#define warning8(s, a, b, c, d, e, f, g, h) -#define warning9(s, a, b, c, d, e, f, g, h, i) -#define warning10(s, a, b, c, d, e, f, g, h, i, j) -#define warning11(s, a, b, c, d, e, f, g, h, i, j, k) -#define warning12(s, a, b, c, d, e, f, g, h, i, j, k, l) -#define warning13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) -#define warning14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) -#define warning15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -#endif - -/* error macros also here... */ -#ifndef NO_ERRORMSG -#define error(s) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__) -#define error1(s, a) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a) -#define error2(s, a, b) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b) -#define error3(s, a, b, c) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c) -#define error4(s, a, b, c, d) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d) -#define error5(s, a, b, c, d, e) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e) -#define error6(s, a, b, c, d, e, f) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f) -#define error7(s, a, b, c, d, e, f, g) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g) -#define error8(s, a, b, c, d, e, f, g, h) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h) -#define error9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i) -#define error10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j) -#define error11(s, a, b, c, d, e, f, g, h, i, j, k) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k) -#define error12(s, a, b, c, d, e, f, g, h, i, j, k, l) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l) -#define error13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m) -#define error14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n) -#define error15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -#else -#define error(s) -#define error1(s, a) -#define error2(s, a, b) -#define error3(s, a, b, c) -#define error4(s, a, b, c, d) -#define error5(s, a, b, c, d, e) -#define error6(s, a, b, c, d, e, f) -#define error7(s, a, b, c, d, e, f, g) -#define error8(s, a, b, c, d, e, f, g, h) -#define error9(s, a, b, c, d, e, f, g, h, i) -#define error10(s, a, b, c, d, e, f, g, h, i, j) -#define error11(s, a, b, c, d, e, f, g, h, i, j, k) -#define error12(s, a, b, c, d, e, f, g, h, i, j, k, l) -#define error13(s, a, b, c, d, e, f, g, h, i, j, k, l, m) -#define error14(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) -#define error15(s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -#endif - -/* ereturn macros also here... */ -#ifndef NO_ERETURN -#define ereturn(rv, s) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__); return rv; }while(0) -#define ereturn1(rv, s, a) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a); return rv; }while(0) -#define ereturn2(rv, s, a, b) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b); return rv; }while(0) -#define ereturn3(rv, s, a, b, c) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c); return rv; }while(0) -#define ereturn4(rv, s, a, b, c, d) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d); return rv; }while(0) -#define ereturn5(rv, s, a, b, c, d, e) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e); return rv; }while(0) -#define ereturn6(rv, s, a, b, c, d, e, f) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f); return rv; }while(0) -#define ereturn7(rv, s, a, b, c, d, e, f, g) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g); return rv; }while(0) -#define ereturn8(rv, s, a, b, c, d, e, f, g, h) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h); return rv; }while(0) -#define ereturn9(rv, s, a, b, c, d, e, f, g, h, i) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i); return rv; }while(0) -#define ereturn10(rv, s, a, b, c, d, e, f, g, h, i, j) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j); return rv; }while(0) -#define ereturn11(rv, s, a, b, c, d, e, f, g, h, i, j, k) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k); return rv; }while(0) -#define ereturn12(rv, s, a, b, c, d, e, f, g, h, i, j, k, l) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l); return rv; }while(0) -#define ereturn13(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m); return rv; }while(0) -#define ereturn14(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n); return rv; }while(0) -#define ereturn15(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) do{ fprintf(stderr, "[" __FILE__ ":%i] ereturn: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); return rv; }while(0) -#else -#define ereturn(rv, s) return rv -#define ereturn1(rv, s, a) return rv -#define ereturn2(rv, s, a, b) return rv -#define ereturn3(rv, s, a, b, c) return rv -#define ereturn4(rv, s, a, b, c, d) return rv -#define ereturn5(rv, s, a, b, c, d, e) return rv -#define ereturn6(rv, s, a, b, c, d, e, f) return rv -#define ereturn7(rv, s, a, b, c, d, e, f, g) return rv -#define ereturn8(rv, s, a, b, c, d, e, f, g, h) return rv -#define ereturn9(rv, s, a, b, c, d, e, f, g, h, i) return rv -#define ereturn10(rv, s, a, b, c, d, e, f, g, h, i, j) return rv -#define ereturn11(rv, s, a, b, c, d, e, f, g, h, i, j, k) return rv -#define ereturn12(rv, s, a, b, c, d, e, f, g, h, i, j, k, l) return rv -#define ereturn13(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m) return rv -#define ereturn14(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n) return rv -#define ereturn15(rv, s, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) return rv -#endif diff --git a/Frameworks/mpg123/mpg123/en.lproj/InfoPlist.strings b/Frameworks/mpg123/mpg123/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff8..000000000 --- a/Frameworks/mpg123/mpg123/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/Frameworks/mpg123/mpg123/equalizer.c b/Frameworks/mpg123/mpg123/equalizer.c deleted file mode 100644 index bc5d5d935..000000000 --- a/Frameworks/mpg123/mpg123/equalizer.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - equalizer.c: equalizer settings - - copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Michael Hipp -*/ - - -#include "mpg123lib_intern.h" - -void do_equalizer(real *bandPtr,int channel, real equalizer[2][32]) -{ - int i; - for(i=0;i<32;i++) - bandPtr[i] = REAL_MUL(bandPtr[i], equalizer[channel][i]); -} diff --git a/Frameworks/mpg123/mpg123/es.lproj/InfoPlist.strings b/Frameworks/mpg123/mpg123/es.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff8..000000000 --- a/Frameworks/mpg123/mpg123/es.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/Frameworks/mpg123/mpg123/feature.c b/Frameworks/mpg123/mpg123/feature.c deleted file mode 100644 index 19723884f..000000000 --- a/Frameworks/mpg123/mpg123/feature.c +++ /dev/null @@ -1,106 +0,0 @@ -#include "mpg123lib_intern.h" - -int mpg123_feature(const enum mpg123_feature_set key) -{ - switch(key) - { - case MPG123_FEATURE_ABI_UTF8OPEN: -#ifdef WANT_WIN32_UNICODE - return 1; -#else - return 0; -#endif /* WANT_WIN32_UNICODE */ - - case MPG123_FEATURE_OUTPUT_8BIT: -#ifdef NO_8BIT - return 0; -#else - return 1; -#endif /* mpg123_output_8bit */ - - case MPG123_FEATURE_OUTPUT_16BIT: -#ifdef NO_16BIT - return 0; -#else - return 1; -#endif /* mpg123_output_16bit */ - - case MPG123_FEATURE_OUTPUT_32BIT: -#ifdef NO_32BIT - return 0; -#else - return 1; -#endif /* mpg123_output_32bit */ - - case MPG123_FEATURE_PARSE_ID3V2: -#ifdef NO_ID3V2 - return 0; -#else - return 1; -#endif /* NO_ID3V2 */ - - case MPG123_FEATURE_DECODE_LAYER1: -#ifdef NO_LAYER1 - return 0; -#else - return 1; -#endif /* NO_LAYER1 */ - - case MPG123_FEATURE_DECODE_LAYER2: -#ifdef NO_LAYER2 - return 0; -#else - return 1; -#endif /* NO_LAYER2 */ - - case MPG123_FEATURE_DECODE_LAYER3: -#ifdef NO_LAYER3 - return 0; -#else - return 1; -#endif /* NO_LAYER3 */ - - case MPG123_FEATURE_DECODE_ACCURATE: -#ifdef ACCURATE_ROUNDING - return 1; -#else - return 0; -#endif /* ACCURATE_ROUNDING */ - - case MPG123_FEATURE_DECODE_DOWNSAMPLE: -#ifdef NO_DOWNSAMPLE - return 0; -#else - return 1; -#endif /* NO_DOWNSAMPLE */ - - case MPG123_FEATURE_DECODE_NTOM: -#ifdef NO_NTOM - return 0; -#else - return 1; -#endif /* NO_NTOM */ - - case MPG123_FEATURE_PARSE_ICY: -#ifdef NO_ICY - return 0; -#else - return 1; -#endif /* NO_ICY */ - - case MPG123_FEATURE_INDEX: -#ifdef FRAME_INDEX - return 1; -#else - return 0; -#endif /* FRAME_INDEX */ - case MPG123_FEATURE_TIMEOUT_READ: -#ifdef TIMEOUT_READ - return 1; -#else - return 0; -#endif - - default: return 0; - } -} diff --git a/Frameworks/mpg123/mpg123/format.c b/Frameworks/mpg123/mpg123/format.c deleted file mode 100644 index 1f4d49ee0..000000000 --- a/Frameworks/mpg123/mpg123/format.c +++ /dev/null @@ -1,521 +0,0 @@ -/* - format:routines to deal with audio (output) format - - copyright 2008-9 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Thomas Orgis, starting with parts of the old audio.c, with only faintly manage to show now -*/ - -#include "mpg123lib_intern.h" -#include "debug.h" - -/* static int chans[NUM_CHANNELS] = { 1 , 2 }; */ -static const long my_rates[MPG123_RATES] = /* only the standard rates */ -{ - 8000, 11025, 12000, - 16000, 22050, 24000, - 32000, 44100, 48000, -}; - -static const int my_encodings[MPG123_ENCODINGS] = -{ - MPG123_ENC_SIGNED_16, - MPG123_ENC_UNSIGNED_16, - MPG123_ENC_SIGNED_32, - MPG123_ENC_UNSIGNED_32, - MPG123_ENC_SIGNED_24, - MPG123_ENC_UNSIGNED_24, - /* Floating point range, see below. */ - MPG123_ENC_FLOAT_32, - MPG123_ENC_FLOAT_64, - /* 8 bit range, see below. */ - MPG123_ENC_SIGNED_8, - MPG123_ENC_UNSIGNED_8, - MPG123_ENC_ULAW_8, - MPG123_ENC_ALAW_8 -}; - -/* Make that match the above table. - And yes, I still don't like this kludgy stuff. */ -/* range[0] <= i < range[1] for forced floating point */ -static const int enc_float_range[2] = { 6, 8 }; -/* same for 8 bit encodings */ -static const int enc_8bit_range[2] = { 8, 12 }; - -/* Only one type of float is supported. */ -# ifdef REAL_IS_FLOAT -# define MPG123_FLOAT_ENC MPG123_ENC_FLOAT_32 -# else -# define MPG123_FLOAT_ENC MPG123_ENC_FLOAT_64 -# endif - -/* The list of actually possible encodings. */ -static const int good_encodings[] = -{ -#ifndef NO_16BIT - MPG123_ENC_SIGNED_16, - MPG123_ENC_UNSIGNED_16, -#endif -#ifndef NO_32BIT - MPG123_ENC_SIGNED_32, - MPG123_ENC_UNSIGNED_32, - MPG123_ENC_SIGNED_24, - MPG123_ENC_UNSIGNED_24, -#endif -#ifndef NO_REAL - MPG123_FLOAT_ENC, -#endif -#ifndef NO_8BIT - MPG123_ENC_SIGNED_8, - MPG123_ENC_UNSIGNED_8, - MPG123_ENC_ULAW_8, - MPG123_ENC_ALAW_8 -#endif -}; - -/* Check if encoding is a valid one in this build. - ...lazy programming: linear search. */ -static int good_enc(const int enc) -{ - size_t i; - for(i=0; iforce_rate != 0 && mp->force_rate == r) return MPG123_RATES; -#endif - - return -1; -} - -static int enc2num(int encoding) -{ - int i; - for(i=0;ichannels-1; - int rn = rate2num(&fr->p, nf->rate); - if(rn >= 0) for(i=f0;ip.audio_caps[c][rn][i]) - { - nf->encoding = my_encodings[i]; - return 1; - } - } - return 0; -} - -static int freq_fit(mpg123_handle *fr, struct audioformat *nf, int f0, int f2) -{ - nf->rate = frame_freq(fr)>>fr->p.down_sample; - if(cap_fit(fr,nf,f0,f2)) return 1; - if(fr->p.flags & MPG123_AUTO_RESAMPLE) - { - nf->rate>>=1; - if(cap_fit(fr,nf,f0,f2)) return 1; - nf->rate>>=1; - if(cap_fit(fr,nf,f0,f2)) return 1; - } -#ifndef NO_NTOM - /* If nothing worked, try the other rates, only without constrains from user. - In case you didn't guess: We enable flexible resampling if we find a working rate. */ - if( fr->p.flags & MPG123_AUTO_RESAMPLE && - !fr->p.force_rate && fr->p.down_sample == 0) - { - int i; - int c = nf->channels-1; - int rn = rate2num(&fr->p, frame_freq(fr)); - int rrn; - if(rn < 0) return 0; - /* Try higher rates first. */ - for(i=f0;ip.audio_caps[c][rrn][i]) - { - nf->rate = my_rates[rrn]; - nf->encoding = my_encodings[i]; - return 1; - } - /* Then lower rates. */ - for(i=f0;i=0; --rrn) - if(fr->p.audio_caps[c][rrn][i]) - { - nf->rate = my_rates[rrn]; - nf->encoding = my_encodings[i]; - return 1; - } - } -#endif - - return 0; -} - -/* match constraints against supported audio formats, store possible setup in frame - return: -1: error; 0: no format change; 1: format change */ -int frame_output_format(mpg123_handle *fr) -{ - struct audioformat nf; - int f0=0; - int f2=MPG123_ENCODINGS; /* Omit the 32bit and float encodings. */ - mpg123_pars *p = &fr->p; - /* initialize new format, encoding comes later */ - nf.channels = fr->stereo; - - /* All this forcing should be removed in favour of the capabilities table... */ - if(p->flags & MPG123_FORCE_8BIT) - { - f0 = enc_8bit_range[0]; - f2 = enc_8bit_range[1]; - } - if(p->flags & MPG123_FORCE_FLOAT) - { - f0 = enc_float_range[0]; - f2 = enc_float_range[1]; - } - - /* force stereo is stronger */ - if(p->flags & MPG123_FORCE_MONO) nf.channels = 1; - if(p->flags & MPG123_FORCE_STEREO) nf.channels = 2; - -#ifndef NO_NTOM - if(p->force_rate) - { - nf.rate = p->force_rate; - if(cap_fit(fr,&nf,f0,2)) goto end; /* 16bit encodings */ - if(cap_fit(fr,&nf,f0<=2 ? 2 : f0,f2)) goto end; /* 8bit encodings */ - - /* try again with different stereoness */ - if(nf.channels == 2 && !(p->flags & MPG123_FORCE_STEREO)) nf.channels = 1; - else if(nf.channels == 1 && !(p->flags & MPG123_FORCE_MONO)) nf.channels = 2; - - if(cap_fit(fr,&nf,f0,2)) goto end; /* 16bit encodings */ - if(cap_fit(fr,&nf,f0<=2 ? 2 : f0,f2)) goto end; /* 8bit encodings */ - - if(NOQUIET) - error3( "Unable to set up output format! Constraints: %s%s%liHz.", - ( p->flags & MPG123_FORCE_STEREO ? "stereo, " : - (p->flags & MPG123_FORCE_MONO ? "mono, " : "") ), - (p->flags & MPG123_FORCE_8BIT ? "8bit, " : ""), - p->force_rate ); -/* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */ - - fr->err = MPG123_BAD_OUTFORMAT; - return -1; - } -#endif - - if(freq_fit(fr, &nf, f0, 2)) goto end; /* try rates with 16bit */ - if(freq_fit(fr, &nf, f0<=2 ? 2 : f0, f2)) goto end; /* ... 8bit */ - - /* try again with different stereoness */ - if(nf.channels == 2 && !(p->flags & MPG123_FORCE_STEREO)) nf.channels = 1; - else if(nf.channels == 1 && !(p->flags & MPG123_FORCE_MONO)) nf.channels = 2; - - if(freq_fit(fr, &nf, f0, 2)) goto end; /* try rates with 16bit */ - if(freq_fit(fr, &nf, f0<=2 ? 2 : f0, f2)) goto end; /* ... 8bit */ - - /* Here is the _bad_ end. */ - if(NOQUIET) - { - error5( "Unable to set up output format! Constraints: %s%s%li, %li or %liHz.", - ( p->flags & MPG123_FORCE_STEREO ? "stereo, " : - (p->flags & MPG123_FORCE_MONO ? "mono, " : "") ), - (p->flags & MPG123_FORCE_8BIT ? "8bit, " : ""), - frame_freq(fr), frame_freq(fr)>>1, frame_freq(fr)>>2 ); - } -/* if(NOQUIET && p->verbose <= 1) print_capabilities(fr); */ - - fr->err = MPG123_BAD_OUTFORMAT; - return -1; - -end: /* Here is the _good_ end. */ - /* we had a successful match, now see if there's a change */ - if(nf.rate == fr->af.rate && nf.channels == fr->af.channels && nf.encoding == fr->af.encoding) - { - debug2("Old format with %i channels, and FORCE_MONO=%li", nf.channels, p->flags & MPG123_FORCE_MONO); - return 0; /* the same format as before */ - } - else /* a new format */ - { - debug1("New format with %i channels!", nf.channels); - fr->af.rate = nf.rate; - fr->af.channels = nf.channels; - fr->af.encoding = nf.encoding; - /* Cache the size of one sample in bytes, for ease of use. */ - fr->af.encsize = mpg123_encsize(fr->af.encoding); - if(fr->af.encsize < 1) - { - if(NOQUIET) error1("Some unknown encoding??? (%i)", fr->af.encoding); - - fr->err = MPG123_BAD_OUTFORMAT; - return -1; - } - return 1; - } -} - -int attribute_align_arg mpg123_format_none(mpg123_handle *mh) -{ - int r; - if(mh == NULL) return MPG123_ERR; - - r = mpg123_fmt_none(&mh->p); - if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; } - - return r; -} - -int attribute_align_arg mpg123_fmt_none(mpg123_pars *mp) -{ - if(mp == NULL) return MPG123_BAD_PARS; - - if(PVERB(mp,3)) fprintf(stderr, "Note: Disabling all formats.\n"); - - memset(mp->audio_caps,0,sizeof(mp->audio_caps)); - return MPG123_OK; -} - -int attribute_align_arg mpg123_format_all(mpg123_handle *mh) -{ - int r; - if(mh == NULL) return MPG123_ERR; - - r = mpg123_fmt_all(&mh->p); - if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; } - - return r; -} - -int attribute_align_arg mpg123_fmt_all(mpg123_pars *mp) -{ - size_t rate, ch, enc; - if(mp == NULL) return MPG123_BAD_PARS; - - if(PVERB(mp,3)) fprintf(stderr, "Note: Enabling all formats.\n"); - - for(ch=0; ch < NUM_CHANNELS; ++ch) - for(rate=0; rate < MPG123_RATES+1; ++rate) - for(enc=0; enc < MPG123_ENCODINGS; ++enc) - mp->audio_caps[ch][rate][enc] = good_enc(my_encodings[enc]) ? 1 : 0; - - return MPG123_OK; -} - -int attribute_align_arg mpg123_format(mpg123_handle *mh, long rate, int channels, int encodings) -{ - int r; - if(mh == NULL) return MPG123_ERR; - r = mpg123_fmt(&mh->p, rate, channels, encodings); - if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; } - - return r; -} - -int attribute_align_arg mpg123_fmt(mpg123_pars *mp, long rate, int channels, int encodings) -{ - int ie, ic, ratei; - int ch[2] = {0, 1}; - if(mp == NULL) return MPG123_BAD_PARS; - if(!(channels & (MPG123_MONO|MPG123_STEREO))) return MPG123_BAD_CHANNEL; - - if(PVERB(mp,3)) fprintf(stderr, "Note: Want to enable format %li/%i for encodings 0x%x.\n", rate, channels, encodings); - - if(!(channels & MPG123_STEREO)) ch[1] = 0; /* {0,0} */ - else if(!(channels & MPG123_MONO)) ch[0] = 1; /* {1,1} */ - ratei = rate2num(mp, rate); - if(ratei < 0) return MPG123_BAD_RATE; - - /* now match the encodings */ - for(ic = 0; ic < 2; ++ic) - { - for(ie = 0; ie < MPG123_ENCODINGS; ++ie) - if(good_enc(my_encodings[ie]) && ((my_encodings[ie] & encodings) == my_encodings[ie])) - mp->audio_caps[ch[ic]][ratei][ie] = 1; - - if(ch[0] == ch[1]) break; /* no need to do it again */ - } - - return MPG123_OK; -} - -int attribute_align_arg mpg123_format_support(mpg123_handle *mh, long rate, int encoding) -{ - if(mh == NULL) return 0; - else return mpg123_fmt_support(&mh->p, rate, encoding); -} - -int attribute_align_arg mpg123_fmt_support(mpg123_pars *mp, long rate, int encoding) -{ - int ch = 0; - int ratei, enci; - ratei = rate2num(mp, rate); - enci = enc2num(encoding); - if(mp == NULL || ratei < 0 || enci < 0) return 0; - if(mp->audio_caps[0][ratei][enci]) ch |= MPG123_MONO; - if(mp->audio_caps[1][ratei][enci]) ch |= MPG123_STEREO; - return ch; -} - -/* Call this one to ensure that any valid format will be something different than this. */ -void invalidate_format(struct audioformat *af) -{ - af->encoding = 0; - af->rate = 0; - af->channels = 0; -} - -/* Consider 24bit output needing 32bit output as temporary storage. */ -off_t samples_to_storage(mpg123_handle *fr, off_t s) -{ - if(fr->af.encoding & MPG123_ENC_24) - return s*4*fr->af.channels; /* 4 bytes per sample */ - else - return samples_to_bytes(fr, s); -} - -/* take into account: channels, bytes per sample -- NOT resampling!*/ -off_t samples_to_bytes(mpg123_handle *fr , off_t s) -{ - return s * fr->af.encsize * fr->af.channels; -} - -off_t bytes_to_samples(mpg123_handle *fr , off_t b) -{ - return b / fr->af.encsize / fr->af.channels; -} - - -#ifndef NO_32BIT -/* Remove every fourth byte, facilitating conversion from 32 bit to 24 bit integers. - This has to be aware of endianness, of course. */ -static void chop_fourth_byte(struct outbuffer *buf) -{ - unsigned char *wpos = buf->data; - unsigned char *rpos = buf->data; -#ifdef WORDS_BIGENDIAN - while((size_t) (rpos - buf->data + 4) <= buf->fill) - { - /* Really stupid: Copy, increment. Byte per byte. */ - *wpos = *rpos; - wpos++; rpos++; - *wpos = *rpos; - wpos++; rpos++; - *wpos = *rpos; - wpos++; rpos++; - rpos++; /* Skip the lowest byte (last). */ - } -#else - while((size_t) (rpos - buf->data + 4) <= buf->fill) - { - /* Really stupid: Copy, increment. Byte per byte. */ - rpos++; /* Skip the lowest byte (first). */ - *wpos = *rpos; - wpos++; rpos++; - *wpos = *rpos; - wpos++; rpos++; - *wpos = *rpos; - wpos++; rpos++; - } -#endif - buf->fill = wpos-buf->data; -} -#endif - -void postprocess_buffer(mpg123_handle *fr) -{ - /* Handle unsigned output formats via reshifting after decode here. - Also handle conversion to 24 bit. */ -#ifndef NO_32BIT - if(fr->af.encoding == MPG123_ENC_UNSIGNED_32 || fr->af.encoding == MPG123_ENC_UNSIGNED_24) - { /* 32bit signed -> unsigned */ - size_t i; - int32_t *ssamples; - uint32_t *usamples; - ssamples = (int32_t*)fr->buffer.data; - usamples = (uint32_t*)fr->buffer.data; - debug("converting output to unsigned 32 bit integer"); - for(i=0; ibuffer.fill/sizeof(int32_t); ++i) - { - /* Different strategy since we don't have a larger type at hand. - Also watch out for silly +-1 fun because integer constants are signed in C90! */ - if(ssamples[i] >= 0) - usamples[i] = (uint32_t)ssamples[i] + 2147483647+1; - /* The smalles value goes zero. */ - else if(ssamples[i] == ((int32_t)-2147483647-1)) - usamples[i] = 0; - /* Now -value is in the positive range of signed int ... so it's a possible value at all. */ - else - usamples[i] = (uint32_t)2147483647+1 - (uint32_t)(-ssamples[i]); - } - /* Dumb brute force: A second pass for hacking off the last byte. */ - if(fr->af.encoding == MPG123_ENC_UNSIGNED_24) - chop_fourth_byte(&fr->buffer); - } - else if(fr->af.encoding == MPG123_ENC_SIGNED_24) - { - /* We got 32 bit signed ... chop off for 24 bit signed. */ - chop_fourth_byte(&fr->buffer); - } -#endif -#ifndef NO_16BIT - if(fr->af.encoding == MPG123_ENC_UNSIGNED_16) - { - size_t i; - short *ssamples; - unsigned short *usamples; - ssamples = (short*)fr->buffer.data; - usamples = (unsigned short*)fr->buffer.data; - debug("converting output to unsigned 16 bit integer"); - for(i=0; ibuffer.fill/sizeof(short); ++i) - { - long tmp = (long)ssamples[i]+32768; - usamples[i] = (unsigned short)tmp; - } - } -#endif -} diff --git a/Frameworks/mpg123/mpg123/frame.c b/Frameworks/mpg123/mpg123/frame.c deleted file mode 100644 index 03fa2889d..000000000 --- a/Frameworks/mpg123/mpg123/frame.c +++ /dev/null @@ -1,1046 +0,0 @@ -/* - frame: Heap of routines dealing with the core mpg123 data structure. - - copyright 2008-2010 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Thomas Orgis -*/ - -#include "mpg123lib_intern.h" -#include "getcpuflags.h" -#include "debug.h" - -static void frame_fixed_reset(mpg123_handle *fr); - -/* that's doubled in decode_ntom.c */ -#define NTOM_MUL (32768) - -#define aligned_pointer(p, type, alignment) align_the_pointer(p, alignment) -static void *align_the_pointer(void *base, unsigned int alignment) -{ - /* - Work in unsigned integer realm, explicitly. - Tricking the compiler into integer operations like % by invoking base-NULL is dangerous: It results into ptrdiff_t, which gets negative on big addresses. Big screw up, that. - I try to do it "properly" here: Casting only to uintptr_t and no artihmethic with void*. - */ - uintptr_t baseval = (uintptr_t)(char*)base; - uintptr_t aoff = baseval % alignment; - - debug3("align_the_pointer: pointer %p is off by %u from %u", - base, (unsigned int)aoff, alignment); - - if(aoff) return (char*)base+alignment-aoff; - else return base; -} - -static void frame_default_pars(mpg123_pars *mp) -{ - mp->outscale = 1.0; - mp->flags = 0; -#ifdef GAPLESS - mp->flags |= MPG123_GAPLESS; -#endif - mp->flags |= MPG123_AUTO_RESAMPLE; -#ifndef NO_NTOM - mp->force_rate = 0; -#endif - mp->down_sample = 0; - mp->rva = 0; - mp->halfspeed = 0; - mp->doublespeed = 0; - mp->verbose = 0; -#ifndef NO_ICY - mp->icy_interval = 0; -#endif - mp->timeout = 0; - mp->resync_limit = 1024; -#ifdef FRAME_INDEX - mp->index_size = INDEX_SIZE; -#endif - mp->preframes = 4; /* That's good for layer 3 ISO compliance bitstream. */ - mpg123_fmt_all(mp); - /* Default of keeping some 4K buffers at hand, should cover the "usual" use case (using 16K pipe buffers as role model). */ -#ifndef NO_FEEDER - mp->feedpool = 5; - mp->feedbuffer = 4096; -#endif -} - -void frame_init(mpg123_handle *fr) -{ - frame_init_par(fr, NULL); -} - -void frame_init_par(mpg123_handle *fr, mpg123_pars *mp) -{ - fr->own_buffer = TRUE; - fr->buffer.data = NULL; - fr->buffer.rdata = NULL; - fr->buffer.fill = 0; - fr->buffer.size = 0; - fr->rawbuffs = NULL; - fr->rawbuffss = 0; - fr->rawdecwin = NULL; - fr->rawdecwins = 0; -#ifndef NO_8BIT - fr->conv16to8_buf = NULL; -#endif -#ifdef OPT_DITHER - fr->dithernoise = NULL; -#endif - fr->layerscratch = NULL; - fr->xing_toc = NULL; - //fr->cpu_opts.type = defdec(); - //fr->cpu_opts.class = decclass(fr->cpu_opts.type); -#ifndef NO_NTOM - /* these two look unnecessary, check guarantee for synth_ntom_set_step (in control_generic, even)! */ - fr->ntom_val[0] = NTOM_MUL>>1; - fr->ntom_val[1] = NTOM_MUL>>1; - fr->ntom_step = NTOM_MUL; -#endif - /* unnecessary: fr->buffer.size = fr->buffer.fill = 0; */ - mpg123_reset_eq(fr); - init_icy(&fr->icy); - init_id3(fr); - /* frame_outbuffer is missing... */ - /* frame_buffers is missing... that one needs cpu opt setting! */ - /* after these... frame_reset is needed before starting full decode */ - invalidate_format(&fr->af); - fr->rdat.r_read = NULL; - fr->rdat.r_lseek = NULL; - fr->rdat.iohandle = NULL; - fr->rdat.r_read_handle = NULL; - fr->rdat.r_lseek_handle = NULL; - fr->rdat.cleanup_handle = NULL; - fr->wrapperdata = NULL; - fr->wrapperclean = NULL; - fr->decoder_change = 1; - fr->err = MPG123_OK; - if(mp == NULL) frame_default_pars(&fr->p); - else memcpy(&fr->p, mp, sizeof(struct mpg123_pars_struct)); - -#ifndef NO_FEEDER - bc_prepare(&fr->rdat.buffer, fr->p.feedpool, fr->p.feedbuffer); -#endif - - fr->down_sample = 0; /* Initialize to silence harmless errors when debugging. */ - frame_fixed_reset(fr); /* Reset only the fixed data, dynamic buffers are not there yet! */ - fr->synth = NULL; - fr->synth_mono = NULL; - fr->make_decode_tables = NULL; -#ifdef FRAME_INDEX - fi_init(&fr->index); - frame_index_setup(fr); /* Apply the size setting. */ -#endif -} - -#ifdef OPT_DITHER -/* Also, only allocate the memory for the table on demand. - In future, one could create special noise for different sampling frequencies(?). */ -int frame_dither_init(mpg123_handle *fr) -{ - /* run-time dither noise table generation */ - if(fr->dithernoise == NULL) - { - fr->dithernoise = malloc(sizeof(float)*DITHERSIZE); - if(fr->dithernoise == NULL) return 0; - - dither_table_init(fr->dithernoise); - } - return 1; -} -#endif - -mpg123_pars attribute_align_arg *mpg123_new_pars(int *error) -{ - mpg123_pars *mp = malloc(sizeof(struct mpg123_pars_struct)); - if(mp != NULL){ frame_default_pars(mp); if(error != NULL) *error = MPG123_OK; } - else if(error != NULL) *error = MPG123_OUT_OF_MEM; - return mp; -} - -void attribute_align_arg mpg123_delete_pars(mpg123_pars* mp) -{ - if(mp != NULL) free(mp); -} - -int attribute_align_arg mpg123_reset_eq(mpg123_handle *mh) -{ - int i; - mh->have_eq_settings = 0; - for(i=0; i < 32; ++i) mh->equalizer[0][i] = mh->equalizer[1][i] = DOUBLE_TO_REAL(1.0); - - return MPG123_OK; -} - -int frame_outbuffer(mpg123_handle *fr) -{ - size_t size = fr->outblock; - if(!fr->own_buffer) - { - if(fr->buffer.size < size) - { - fr->err = MPG123_BAD_BUFFER; - if(NOQUIET) error2("have external buffer of size %"SIZE_P", need %"SIZE_P, (size_p)fr->buffer.size, (size_p)size); - - return MPG123_ERR; - } - } - - debug1("need frame buffer of %"SIZE_P, (size_p)size); - if(fr->buffer.rdata != NULL && fr->buffer.size != size) - { - free(fr->buffer.rdata); - fr->buffer.rdata = NULL; - } - fr->buffer.size = size; - fr->buffer.data = NULL; - /* be generous: use 16 byte alignment */ - if(fr->buffer.rdata == NULL) fr->buffer.rdata = (unsigned char*) malloc(fr->buffer.size+15); - if(fr->buffer.rdata == NULL) - { - fr->err = MPG123_OUT_OF_MEM; - return MPG123_ERR; - } - fr->buffer.data = aligned_pointer(fr->buffer.rdata, unsigned char*, 16); - fr->own_buffer = TRUE; - fr->buffer.fill = 0; - return MPG123_OK; -} - -int attribute_align_arg mpg123_replace_buffer(mpg123_handle *mh, unsigned char *data, size_t size) -{ - debug2("replace buffer with %p size %"SIZE_P, data, (size_p)size); - /* Will accept any size, the error comes later... */ - if(data == NULL) - { - mh->err = MPG123_BAD_BUFFER; - return MPG123_ERR; - } - if(mh->buffer.rdata != NULL) free(mh->buffer.rdata); - mh->own_buffer = FALSE; - mh->buffer.rdata = NULL; - mh->buffer.data = data; - mh->buffer.size = size; - mh->buffer.fill = 0; - return MPG123_OK; -} - -#ifdef FRAME_INDEX -int frame_index_setup(mpg123_handle *fr) -{ - int ret = MPG123_ERR; - if(fr->p.index_size >= 0) - { /* Simple fixed index. */ - fr->index.grow_size = 0; - debug1("resizing index to %li", fr->p.index_size); - ret = fi_resize(&fr->index, (size_t)fr->p.index_size); - debug2("index resized... %lu at %p", (unsigned long)fr->index.size, (void*)fr->index.data); - } - else - { /* A growing index. We give it a start, though. */ - fr->index.grow_size = (size_t)(- fr->p.index_size); - if(fr->index.size < fr->index.grow_size) - ret = fi_resize(&fr->index, fr->index.grow_size); - else - ret = MPG123_OK; /* We have minimal size already... and since growing is OK... */ - } - debug2("set up frame index of size %lu (ret=%i)", (unsigned long)fr->index.size, ret); - - return ret; -} -#endif - -static void frame_decode_buffers_reset(mpg123_handle *fr) -{ - memset(fr->rawbuffs, 0, fr->rawbuffss); -} - -int frame_buffers(mpg123_handle *fr) -{ - int buffssize = 0; - debug1("frame %p buffer", (void*)fr); -/* - the used-to-be-static buffer of the synth functions, has some subtly different types/sizes - - 2to1, 4to1, ntom, generic, i386: real[2][2][0x110] - mmx, sse: short[2][2][0x110] - i586(_dither): 4352 bytes; int/long[2][2][0x110] - i486: int[2][2][17*FIR_BUFFER_SIZE] - altivec: static real __attribute__ ((aligned (16))) buffs[4][4][0x110] - - Huh, altivec looks like fun. Well, let it be large... then, the 16 byte alignment seems to be implicit on MacOSX malloc anyway. - Let's make a reasonable attempt to allocate enough memory... - Keep in mind: biggest ones are i486 and altivec (mutually exclusive!), then follows i586 and normal real. - mmx/sse use short but also real for resampling. - Thus, minimum is 2*2*0x110*sizeof(real). -*/ - if(fr->cpu_opts.type == altivec) buffssize = 4*4*0x110*sizeof(real); -#ifdef OPT_I486 - else if(fr->cpu_opts.type == ivier) buffssize = 2*2*17*FIR_BUFFER_SIZE*sizeof(int); -#endif - else if(fr->cpu_opts.type == ifuenf || fr->cpu_opts.type == ifuenf_dither || fr->cpu_opts.type == dreidnow) - buffssize = 2*2*0x110*4; /* don't rely on type real, we need 4352 bytes */ - - if(2*2*0x110*sizeof(real) > buffssize) - buffssize = 2*2*0x110*sizeof(real); - buffssize += 15; /* For 16-byte alignment (SSE likes that). */ - - if(fr->rawbuffs != NULL && fr->rawbuffss != buffssize) - { - free(fr->rawbuffs); - fr->rawbuffs = NULL; - } - - if(fr->rawbuffs == NULL) fr->rawbuffs = (unsigned char*) malloc(buffssize); - if(fr->rawbuffs == NULL) return -1; - fr->rawbuffss = buffssize; - fr->short_buffs[0][0] = aligned_pointer(fr->rawbuffs,short,16); - fr->short_buffs[0][1] = fr->short_buffs[0][0] + 0x110; - fr->short_buffs[1][0] = fr->short_buffs[0][1] + 0x110; - fr->short_buffs[1][1] = fr->short_buffs[1][0] + 0x110; - fr->real_buffs[0][0] = aligned_pointer(fr->rawbuffs,real,16); - fr->real_buffs[0][1] = fr->real_buffs[0][0] + 0x110; - fr->real_buffs[1][0] = fr->real_buffs[0][1] + 0x110; - fr->real_buffs[1][1] = fr->real_buffs[1][0] + 0x110; -#ifdef OPT_I486 - if(fr->cpu_opts.type == ivier) - { - fr->int_buffs[0][0] = (int*) fr->rawbuffs; - fr->int_buffs[0][1] = fr->int_buffs[0][0] + 17*FIR_BUFFER_SIZE; - fr->int_buffs[1][0] = fr->int_buffs[0][1] + 17*FIR_BUFFER_SIZE; - fr->int_buffs[1][1] = fr->int_buffs[1][0] + 17*FIR_BUFFER_SIZE; - } -#endif -#ifdef OPT_ALTIVEC - if(fr->cpu_opts.type == altivec) - { - int i,j; - fr->areal_buffs[0][0] = (real*) fr->rawbuffs; - for(i=0; i<4; ++i) for(j=0; j<4; ++j) - fr->areal_buffs[i][j] = fr->areal_buffs[0][0] + (i*4+j)*0x110; - } -#endif - /* now the different decwins... all of the same size, actually */ - /* The MMX ones want 32byte alignment, which I'll try to ensure manually */ - { - int decwin_size = (512+32)*sizeof(real); -#ifdef OPT_MMXORSSE -#ifdef OPT_MULTI - if(fr->cpu_opts.class == mmxsse) - { -#endif - /* decwin_mmx will share, decwins will be appended ... sizeof(float)==4 */ - if(decwin_size < (512+32)*4) decwin_size = (512+32)*4; - - /* the second window + alignment zone -- we align for 32 bytes for SSE as - requirement, 64 byte for matching cache line size (that matters!) */ - decwin_size += (512+32)*4 + 63; - /* (512+32)*4/32 == 2176/32 == 68, so one decwin block retains alignment for 32 or 64 bytes */ -#ifdef OPT_MULTI - } -#endif -#endif -#if defined(OPT_ALTIVEC) || defined(OPT_ARM) - /* sizeof(real) >= 4 ... yes, it could be 8, for example. - We got it intialized to at least (512+32)*sizeof(real).*/ - decwin_size += 512*sizeof(real); -#endif - /* Hm, that's basically realloc() ... */ - if(fr->rawdecwin != NULL && fr->rawdecwins != decwin_size) - { - free(fr->rawdecwin); - fr->rawdecwin = NULL; - } - - if(fr->rawdecwin == NULL) - fr->rawdecwin = (unsigned char*) malloc(decwin_size); - - if(fr->rawdecwin == NULL) return -1; - - fr->rawdecwins = decwin_size; - fr->decwin = (real*) fr->rawdecwin; -#ifdef OPT_MMXORSSE -#ifdef OPT_MULTI - if(fr->cpu_opts.class == mmxsse) - { -#endif - /* align decwin, assign that to decwin_mmx, append decwins */ - /* I need to add to decwin what is missing to the next full 64 byte -- also I want to make gcc -pedantic happy... */ - fr->decwin = aligned_pointer(fr->rawdecwin,real,64); - debug1("aligned decwin: %p", (void*)fr->decwin); - fr->decwin_mmx = (float*)fr->decwin; - fr->decwins = fr->decwin_mmx+512+32; -#ifdef OPT_MULTI - } - else debug("no decwins/decwin_mmx for that class"); -#endif -#endif - } - - /* Layer scratch buffers are of compile-time fixed size, so allocate only once. */ - if(fr->layerscratch == NULL) - { - /* Allocate specific layer1/2/3 buffers, so that we know they'll work for SSE. */ - size_t scratchsize = 0; - real *scratcher; -#ifndef NO_LAYER1 - scratchsize += sizeof(real) * 2 * SBLIMIT; -#endif -#ifndef NO_LAYER2 - scratchsize += sizeof(real) * 2 * 4 * SBLIMIT; -#endif -#ifndef NO_LAYER3 - scratchsize += sizeof(real) * 2 * SBLIMIT * SSLIMIT; /* hybrid_in */ - scratchsize += sizeof(real) * 2 * SSLIMIT * SBLIMIT; /* hybrid_out */ -#endif - /* - Now figure out correct alignment: - We need 16 byte minimum, smallest unit of the blocks is 2*SBLIMIT*sizeof(real), which is 64*4=256. Let's do 64bytes as heuristic for cache line (as proven useful in buffs above). - */ - fr->layerscratch = malloc(scratchsize+63); - if(fr->layerscratch == NULL) return -1; - - /* Get aligned part of the memory, then divide it up. */ - scratcher = aligned_pointer(fr->layerscratch,real,64); - /* Those funky pointer casts silence compilers... - One might change the code at hand to really just use 1D arrays, but in practice, that would not make a (positive) difference. */ -#ifndef NO_LAYER1 - fr->layer1.fraction = (real(*)[SBLIMIT])scratcher; - scratcher += 2 * SBLIMIT; -#endif -#ifndef NO_LAYER2 - fr->layer2.fraction = (real(*)[4][SBLIMIT])scratcher; - scratcher += 2 * 4 * SBLIMIT; -#endif -#ifndef NO_LAYER3 - fr->layer3.hybrid_in = (real(*)[SBLIMIT][SSLIMIT])scratcher; - scratcher += 2 * SBLIMIT * SSLIMIT; - fr->layer3.hybrid_out = (real(*)[SSLIMIT][SBLIMIT])scratcher; - scratcher += 2 * SSLIMIT * SBLIMIT; -#endif - /* Note: These buffers don't need resetting here. */ - } - - /* Only reset the buffers we created just now. */ - frame_decode_buffers_reset(fr); - - debug1("frame %p buffer done", (void*)fr); - return 0; -} - -int frame_buffers_reset(mpg123_handle *fr) -{ - fr->buffer.fill = 0; /* hm, reset buffer fill... did we do a flush? */ - fr->bsnum = 0; - /* Wondering: could it be actually _wanted_ to retain buffer contents over different files? (special gapless / cut stuff) */ - fr->bsbuf = fr->bsspace[1]; - fr->bsbufold = fr->bsbuf; - fr->bitreservoir = 0; - frame_decode_buffers_reset(fr); - memset(fr->bsspace, 0, 2*(MAXFRAMESIZE+512)); - memset(fr->ssave, 0, 34); - fr->hybrid_blc[0] = fr->hybrid_blc[1] = 0; - memset(fr->hybrid_block, 0, sizeof(real)*2*2*SBLIMIT*SSLIMIT); - return 0; -} - -static void frame_icy_reset(mpg123_handle* fr) -{ -#ifndef NO_ICY - if(fr->icy.data != NULL) free(fr->icy.data); - fr->icy.data = NULL; - fr->icy.interval = 0; - fr->icy.next = 0; -#endif -} - -static void frame_free_toc(mpg123_handle *fr) -{ - if(fr->xing_toc != NULL){ free(fr->xing_toc); fr->xing_toc = NULL; } -} - -/* Just copy the Xing TOC over... */ -int frame_fill_toc(mpg123_handle *fr, unsigned char* in) -{ - if(fr->xing_toc == NULL) fr->xing_toc = malloc(100); - if(fr->xing_toc != NULL) - { - memcpy(fr->xing_toc, in, 100); -#ifdef DEBUG - debug("Got a TOC! Showing the values..."); - { - int i; - for(i=0; i<100; ++i) - debug2("entry %i = %i", i, fr->xing_toc[i]); - } -#endif - return TRUE; - } - return FALSE; -} - -/* Prepare the handle for a new track. - Reset variables, buffers... */ -int frame_reset(mpg123_handle* fr) -{ - frame_buffers_reset(fr); - frame_fixed_reset(fr); - frame_free_toc(fr); -#ifdef FRAME_INDEX - fi_reset(&fr->index); -#endif - - return 0; -} - -/* Reset everythign except dynamic memory. */ -static void frame_fixed_reset(mpg123_handle *fr) -{ - frame_icy_reset(fr); - open_bad(fr); - fr->to_decode = FALSE; - fr->to_ignore = FALSE; - fr->metaflags = 0; - fr->outblock = 0; /* This will be set before decoding! */ - fr->num = -1; - fr->input_offset = -1; - fr->playnum = -1; - fr->state_flags = FRAME_ACCURATE; - fr->silent_resync = 0; - fr->audio_start = 0; - fr->clip = 0; - fr->oldhead = 0; - fr->firsthead = 0; - fr->vbr = MPG123_CBR; - fr->abr_rate = 0; - fr->track_frames = 0; - fr->track_samples = -1; - fr->framesize=0; - fr->mean_frames = 0; - fr->mean_framesize = 0; - fr->freesize = 0; - fr->lastscale = -1; - fr->rva.level[0] = -1; - fr->rva.level[1] = -1; - fr->rva.gain[0] = 0; - fr->rva.gain[1] = 0; - fr->rva.peak[0] = 0; - fr->rva.peak[1] = 0; - fr->fsizeold = 0; - fr->firstframe = 0; - fr->ignoreframe = fr->firstframe-fr->p.preframes; - fr->lastframe = -1; - fr->fresh = 1; - fr->new_format = 0; -#ifdef GAPLESS - frame_gapless_init(fr,-1,0,0); - fr->lastoff = 0; - fr->firstoff = 0; -#endif -#ifdef OPT_I486 - fr->i486bo[0] = fr->i486bo[1] = FIR_SIZE-1; -#endif - fr->bo = 1; /* the usual bo */ -#ifdef OPT_DITHER - fr->ditherindex = 0; -#endif - reset_id3(fr); - reset_icy(&fr->icy); - /* ICY stuff should go into icy.c, eh? */ -#ifndef NO_ICY - fr->icy.interval = 0; - fr->icy.next = 0; -#endif - fr->halfphase = 0; /* here or indeed only on first-time init? */ - fr->error_protection = 0; - fr->freeformat_framesize = -1; -} - -static void frame_free_buffers(mpg123_handle *fr) -{ - if(fr->rawbuffs != NULL) free(fr->rawbuffs); - fr->rawbuffs = NULL; - fr->rawbuffss = 0; - if(fr->rawdecwin != NULL) free(fr->rawdecwin); - fr->rawdecwin = NULL; - fr->rawdecwins = 0; -#ifndef NO_8BIT - if(fr->conv16to8_buf != NULL) free(fr->conv16to8_buf); - fr->conv16to8_buf = NULL; -#endif - if(fr->layerscratch != NULL) free(fr->layerscratch); -} - -void frame_exit(mpg123_handle *fr) -{ - if(fr->buffer.rdata != NULL) - { - debug1("freeing buffer at %p", (void*)fr->buffer.rdata); - free(fr->buffer.rdata); - } - fr->buffer.rdata = NULL; - frame_free_buffers(fr); - frame_free_toc(fr); -#ifdef FRAME_INDEX - fi_exit(&fr->index); -#endif -#ifdef OPT_DITHER - if(fr->dithernoise != NULL) - { - free(fr->dithernoise); - fr->dithernoise = NULL; - } -#endif - exit_id3(fr); - clear_icy(&fr->icy); - /* Clean up possible mess from LFS wrapper. */ - if(fr->wrapperclean != NULL) - { - fr->wrapperclean(fr->wrapperdata); - fr->wrapperdata = NULL; - } -#ifndef NO_FEEDER - bc_cleanup(&fr->rdat.buffer); -#endif -} - -int attribute_align_arg mpg123_info(mpg123_handle *mh, struct mpg123_frameinfo *mi) -{ - if(mh == NULL) return MPG123_ERR; - if(mi == NULL) - { - mh->err = MPG123_ERR_NULL; - return MPG123_ERR; - } - mi->version = mh->mpeg25 ? MPG123_2_5 : (mh->lsf ? MPG123_2_0 : MPG123_1_0); - mi->layer = mh->lay; - mi->rate = frame_freq(mh); - switch(mh->mode) - { - case 0: mi->mode = MPG123_M_STEREO; break; - case 1: mi->mode = MPG123_M_JOINT; break; - case 2: mi->mode = MPG123_M_DUAL; break; - case 3: mi->mode = MPG123_M_MONO; break; - default: error("That mode cannot be!"); - } - mi->mode_ext = mh->mode_ext; - mi->framesize = mh->framesize+4; /* Include header. */ - mi->flags = 0; - if(mh->error_protection) mi->flags |= MPG123_CRC; - if(mh->copyright) mi->flags |= MPG123_COPYRIGHT; - if(mh->extension) mi->flags |= MPG123_PRIVATE; - if(mh->original) mi->flags |= MPG123_ORIGINAL; - mi->emphasis = mh->emphasis; - mi->bitrate = frame_bitrate(mh); - mi->abr_rate = mh->abr_rate; - mi->vbr = mh->vbr; - return MPG123_OK; -} - -int attribute_align_arg mpg123_framedata(mpg123_handle *mh, unsigned long *header, unsigned char **bodydata, size_t *bodybytes) -{ - if(mh == NULL) return MPG123_ERR; - if(!mh->to_decode) return MPG123_ERR; - - if(header != NULL) *header = mh->oldhead; - if(bodydata != NULL) *bodydata = mh->bsbuf; - if(bodybytes != NULL) *bodybytes = mh->framesize; - - return MPG123_OK; -} - -/* - Fuzzy frame offset searching (guessing). - When we don't have an accurate position, we may use an inaccurate one. - Possibilities: - - use approximate positions from Xing TOC (not yet parsed) - - guess wildly from mean framesize and offset of first frame / beginning of file. -*/ - -static off_t frame_fuzzy_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame) -{ - /* Default is to go to the beginning. */ - off_t ret = fr->audio_start; - *get_frame = 0; - - /* But we try to find something better. */ - /* Xing VBR TOC works with relative positions, both in terms of audio frames and stream bytes. - Thus, it only works when whe know the length of things. - Oh... I assume the offsets are relative to the _total_ file length. */ - if(fr->xing_toc != NULL && fr->track_frames > 0 && fr->rdat.filelen > 0) - { - /* One could round... */ - int toc_entry = (int) ((double)want_frame*100./fr->track_frames); - /* It is an index in the 100-entry table. */ - if(toc_entry < 0) toc_entry = 0; - if(toc_entry > 99) toc_entry = 99; - - /* Now estimate back what frame we get. */ - *get_frame = (off_t) ((double)toc_entry/100. * fr->track_frames); - fr->state_flags &= ~FRAME_ACCURATE; - fr->silent_resync = 1; - /* Question: Is the TOC for whole file size (with/without ID3) or the "real" audio data only? - ID3v1 info could also matter. */ - ret = (off_t) ((double)fr->xing_toc[toc_entry]/256.* fr->rdat.filelen); - } - else if(fr->mean_framesize > 0) - { /* Just guess with mean framesize (may be exact with CBR files). */ - /* Query filelen here or not? */ - fr->state_flags &= ~FRAME_ACCURATE; /* Fuzzy! */ - fr->silent_resync = 1; - *get_frame = want_frame; - ret = (off_t) (fr->audio_start+fr->mean_framesize*want_frame); - } - debug5("fuzzy: want %li of %li, get %li at %li B of %li B", - (long)want_frame, (long)fr->track_frames, (long)*get_frame, (long)ret, (long)(fr->rdat.filelen-fr->audio_start)); - return ret; -} - -/* - find the best frame in index just before the wanted one, seek to there - then step to just before wanted one with read_frame - do not care tabout the stuff that was in buffer but not played back - everything that left the decoder is counted as played - - Decide if you want low latency reaction and accurate timing info or stable long-time playback with buffer! -*/ - -off_t frame_index_find(mpg123_handle *fr, off_t want_frame, off_t* get_frame) -{ - /* default is file start if no index position */ - off_t gopos = 0; - *get_frame = 0; -#ifdef FRAME_INDEX - /* Possibly use VBRI index, too? I'd need an example for this... */ - if(fr->index.fill) - { - /* find in index */ - size_t fi; - /* at index fi there is frame step*fi... */ - fi = want_frame/fr->index.step; - if(fi >= fr->index.fill) /* If we are beyond the end of frame index...*/ - { - /* When fuzzy seek is allowed, we have some limited tolerance for the frames we want to read rather then jump over. */ - if(fr->p.flags & MPG123_FUZZY && want_frame - (fr->index.fill-1)*fr->index.step > 10) - { - gopos = frame_fuzzy_find(fr, want_frame, get_frame); - if(gopos > fr->audio_start) return gopos; /* Only in that case, we have a useful guess. */ - /* Else... just continue, fuzzyness didn't help. */ - } - /* Use the last available position, slowly advancing from that one. */ - fi = fr->index.fill - 1; - } - /* We have index position, that yields frame and byte offsets. */ - *get_frame = fi*fr->index.step; - gopos = fr->index.data[fi]; - fr->state_flags |= FRAME_ACCURATE; /* When using the frame index, we are accurate. */ - } - else - { -#endif - if(fr->p.flags & MPG123_FUZZY) - return frame_fuzzy_find(fr, want_frame, get_frame); - /* A bit hackish here... but we need to be fresh when looking for the first header again. */ - fr->firsthead = 0; - fr->oldhead = 0; -#ifdef FRAME_INDEX - } -#endif - debug2("index: 0x%lx for frame %li", (unsigned long)gopos, (long) *get_frame); - return gopos; -} - -off_t frame_ins2outs(mpg123_handle *fr, off_t ins) -{ - off_t outs = 0; - switch(fr->down_sample) - { - case 0: -# ifndef NO_DOWNSAMPLE - case 1: - case 2: -# endif - outs = ins>>fr->down_sample; - break; -# ifndef NO_NTOM - case 3: outs = ntom_ins2outs(fr, ins); break; -# endif - default: error1("Bad down_sample (%i) ... should not be possible!!", fr->down_sample); - } - return outs; -} - -off_t frame_outs(mpg123_handle *fr, off_t num) -{ - off_t outs = 0; - switch(fr->down_sample) - { - case 0: -# ifndef NO_DOWNSAMPLE - case 1: - case 2: -# endif - outs = (spf(fr)>>fr->down_sample)*num; - break; -#ifndef NO_NTOM - case 3: outs = ntom_frmouts(fr, num); break; -#endif - default: error1("Bad down_sample (%i) ... should not be possible!!", fr->down_sample); - } - return outs; -} - -/* Compute the number of output samples we expect from this frame. - This is either simple spf() or a tad more elaborate for ntom. */ -off_t frame_expect_outsamples(mpg123_handle *fr) -{ - off_t outs = 0; - switch(fr->down_sample) - { - case 0: -# ifndef NO_DOWNSAMPLE - case 1: - case 2: -# endif - outs = spf(fr)>>fr->down_sample; - break; -#ifndef NO_NTOM - case 3: outs = ntom_frame_outsamples(fr); break; -#endif - default: error1("Bad down_sample (%i) ... should not be possible!!", fr->down_sample); - } - return outs; -} - -off_t frame_offset(mpg123_handle *fr, off_t outs) -{ - off_t num = 0; - switch(fr->down_sample) - { - case 0: -# ifndef NO_DOWNSAMPLE - case 1: - case 2: -# endif - num = outs/(spf(fr)>>fr->down_sample); - break; -#ifndef NO_NTOM - case 3: num = ntom_frameoff(fr, outs); break; -#endif - default: error("Bad down_sample ... should not be possible!!"); - } - return num; -} - -#ifdef GAPLESS -/* input in _input_ samples */ -void frame_gapless_init(mpg123_handle *fr, off_t framecount, off_t bskip, off_t eskip) -{ - debug3("frame_gaples_init: given %"OFF_P" frames, skip %"OFF_P" and %"OFF_P, (off_p)framecount, (off_p)bskip, (off_p)eskip); - fr->gapless_frames = framecount; - if(fr->gapless_frames > 0) - { - fr->begin_s = bskip+GAPLESS_DELAY; - fr->end_s = framecount*spf(fr)-eskip+GAPLESS_DELAY; - } - else fr->begin_s = fr->end_s = 0; - /* These will get proper values later, from above plus resampling info. */ - fr->begin_os = 0; - fr->end_os = 0; - fr->fullend_os = 0; - debug2("frame_gapless_init: from %"OFF_P" to %"OFF_P" samples", (off_p)fr->begin_s, (off_p)fr->end_s); -} - -void frame_gapless_realinit(mpg123_handle *fr) -{ - fr->begin_os = frame_ins2outs(fr, fr->begin_s); - fr->end_os = frame_ins2outs(fr, fr->end_s); - fr->fullend_os = frame_ins2outs(fr, fr->gapless_frames*spf(fr)); - debug2("frame_gapless_realinit: from %"OFF_P" to %"OFF_P" samples", (off_p)fr->begin_os, (off_p)fr->end_os); -} - -/* At least note when there is trouble... */ -void frame_gapless_update(mpg123_handle *fr, off_t total_samples) -{ - off_t gapless_samples = fr->gapless_frames*spf(fr); - debug2("gapless update with new sample count %"OFF_P" as opposed to known %"OFF_P, total_samples, gapless_samples); - if(NOQUIET && total_samples != gapless_samples) - fprintf(stderr, "\nWarning: Real sample count differs from given gapless sample count. Frankenstein stream?\n"); - - if(gapless_samples > total_samples) - { - if(NOQUIET) error2("End sample count smaller than gapless end! (%"OFF_P" < %"OFF_P"). Disabling gapless mode from now on.", (off_p)total_samples, (off_p)fr->end_s); - /* This invalidates the current position... but what should I do? */ - frame_gapless_init(fr, -1, 0, 0); - frame_gapless_realinit(fr); - fr->lastframe = -1; - fr->lastoff = 0; - } -} - -#endif - -/* Compute the needed frame to ignore from, for getting accurate/consistent output for intended firstframe. */ -static off_t ignoreframe(mpg123_handle *fr) -{ - off_t preshift = fr->p.preframes; - /* Layer 3 _really_ needs at least one frame before. */ - if(fr->lay==3 && preshift < 1) preshift = 1; - /* Layer 1 & 2 reall do not need more than 2. */ - if(fr->lay!=3 && preshift > 2) preshift = 2; - - return fr->firstframe - preshift; -} - -/* The frame seek... This is not simply the seek to fe*spf(fr) samples in output because we think of _input_ frames here. - Seek to frame offset 1 may be just seek to 200 samples offset in output since the beginning of first frame is delay/padding. - Hm, is that right? OK for the padding stuff, but actually, should the decoder delay be better totally hidden or not? - With gapless, even the whole frame position could be advanced further than requested (since Homey don't play dat). */ -void frame_set_frameseek(mpg123_handle *fr, off_t fe) -{ - fr->firstframe = fe; -#ifdef GAPLESS - if(fr->p.flags & MPG123_GAPLESS && fr->gapless_frames > 0) - { - /* Take care of the beginning... */ - off_t beg_f = frame_offset(fr, fr->begin_os); - if(fe <= beg_f) - { - fr->firstframe = beg_f; - fr->firstoff = fr->begin_os - frame_outs(fr, beg_f); - } - else fr->firstoff = 0; - /* The end is set once for a track at least, on the frame_set_frameseek called in get_next_frame() */ - if(fr->end_os > 0) - { - fr->lastframe = frame_offset(fr,fr->end_os); - fr->lastoff = fr->end_os - frame_outs(fr, fr->lastframe); - } else {fr->lastframe = -1; fr->lastoff = 0; } - } else { fr->firstoff = fr->lastoff = 0; fr->lastframe = -1; } -#endif - fr->ignoreframe = ignoreframe(fr); -#ifdef GAPLESS - debug5("frame_set_frameseek: begin at %li frames and %li samples, end at %li and %li; ignore from %li", - (long) fr->firstframe, (long) fr->firstoff, - (long) fr->lastframe, (long) fr->lastoff, (long) fr->ignoreframe); -#else - debug3("frame_set_frameseek: begin at %li frames, end at %li; ignore from %li", - (long) fr->firstframe, (long) fr->lastframe, (long) fr->ignoreframe); -#endif -} - -void frame_skip(mpg123_handle *fr) -{ -#ifndef NO_LAYER3 - if(fr->lay == 3) set_pointer(fr, 512); -#endif -} - -/* Sample accurate seek prepare for decoder. */ -/* This gets unadjusted output samples and takes resampling into account */ -void frame_set_seek(mpg123_handle *fr, off_t sp) -{ - fr->firstframe = frame_offset(fr, sp); - debug1("frame_set_seek: from %"OFF_P, fr->num); -#ifndef NO_NTOM - if(fr->down_sample == 3) ntom_set_ntom(fr, fr->firstframe); -#endif - fr->ignoreframe = ignoreframe(fr); -#ifdef GAPLESS /* The sample offset is used for non-gapless mode, too! */ - fr->firstoff = sp - frame_outs(fr, fr->firstframe); - debug5("frame_set_seek: begin at %li frames and %li samples, end at %li and %li; ignore from %li", - (long) fr->firstframe, (long) fr->firstoff, - (long) fr->lastframe, (long) fr->lastoff, (long) fr->ignoreframe); -#else - debug3("frame_set_seek: begin at %li frames, end at %li; ignore from %li", - (long) fr->firstframe, (long) fr->lastframe, (long) fr->ignoreframe); -#endif -} - -int attribute_align_arg mpg123_volume_change(mpg123_handle *mh, double change) -{ - if(mh == NULL) return MPG123_ERR; - return mpg123_volume(mh, change + (double) mh->p.outscale); -} - -int attribute_align_arg mpg123_volume(mpg123_handle *mh, double vol) -{ - if(mh == NULL) return MPG123_ERR; - - if(vol >= 0) mh->p.outscale = vol; - else mh->p.outscale = 0.; - - do_rva(mh); - return MPG123_OK; -} - -static int get_rva(mpg123_handle *fr, double *peak, double *gain) -{ - double p = -1; - double g = 0; - int ret = 0; - if(fr->p.rva) - { - int rt = 0; - /* Should one assume a zero RVA as no RVA? */ - if(fr->p.rva == 2 && fr->rva.level[1] != -1) rt = 1; - if(fr->rva.level[rt] != -1) - { - p = fr->rva.peak[rt]; - g = fr->rva.gain[rt]; - ret = 1; /* Success. */ - } - } - if(peak != NULL) *peak = p; - if(gain != NULL) *gain = g; - return ret; -} - -/* adjust the volume, taking both fr->outscale and rva values into account */ -void do_rva(mpg123_handle *fr) -{ - double peak = 0; - double gain = 0; - double newscale; - double rvafact = 1; - if(get_rva(fr, &peak, &gain)) - { - if(NOQUIET && fr->p.verbose > 1) fprintf(stderr, "Note: doing RVA with gain %f\n", gain); - rvafact = pow(10,gain/20); - } - - newscale = fr->p.outscale*rvafact; - - /* if peak is unknown (== 0) this check won't hurt */ - if((peak*newscale) > 1.0) - { - newscale = 1.0/peak; - warning2("limiting scale value to %f to prevent clipping with indicated peak factor of %f", newscale, peak); - } - /* first rva setting is forced with fr->lastscale < 0 */ - if(newscale != fr->lastscale || fr->decoder_change) - { - debug3("changing scale value from %f to %f (peak estimated to %f)", fr->lastscale != -1 ? fr->lastscale : fr->p.outscale, newscale, (double) (newscale*peak)); - fr->lastscale = newscale; - /* It may be too early, actually. */ - if(fr->make_decode_tables != NULL) fr->make_decode_tables(fr); /* the actual work */ - } -} - - -int attribute_align_arg mpg123_getvolume(mpg123_handle *mh, double *base, double *really, double *rva_db) -{ - if(mh == NULL) return MPG123_ERR; - if(base) *base = mh->p.outscale; - if(really) *really = mh->lastscale; - get_rva(mh, NULL, rva_db); - return MPG123_OK; -} - -off_t attribute_align_arg mpg123_framepos(mpg123_handle *mh) -{ - if(mh == NULL) return MPG123_ERR; - - return mh->input_offset; -} diff --git a/Frameworks/mpg123/mpg123/icy.c b/Frameworks/mpg123/mpg123/icy.c deleted file mode 100644 index dca2c5dd6..000000000 --- a/Frameworks/mpg123/mpg123/icy.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - icy: Puny code to pretend for a serious ICY data structure. - - copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Thomas Orgis -*/ - -#include "icy.h" - -void init_icy(struct icy_meta *icy) -{ - icy->data = NULL; -} - -void clear_icy(struct icy_meta *icy) -{ - if(icy->data != NULL) free(icy->data); - init_icy(icy); -} - -void reset_icy(struct icy_meta *icy) -{ - clear_icy(icy); - init_icy(icy); -} -/*void set_icy(struct icy_meta *icy, char* new_data) -{ - if(icy->data) free(icy->data); - icy->data = new_data; - icy->changed = 1; -}*/ diff --git a/Frameworks/mpg123/mpg123/icy2utf8.c b/Frameworks/mpg123/mpg123/icy2utf8.c deleted file mode 100644 index 4e72162bb..000000000 --- a/Frameworks/mpg123/mpg123/icy2utf8.c +++ /dev/null @@ -1,438 +0,0 @@ -/* mpg123 note: This is BSD-licensed code that is no problem for mpg123 usage under LGPL. - It's Free, understood? ;-) */ - -/* Another note: This code is basically written by Thorsten Glaser, - Thomas Orgis did just some rearrangements and comments. */ - -/*- - * Copyright (c) 2008 - * Thorsten Glaser - * - * Provided that these terms and disclaimer and all copyright notices - * are retained or reproduced in an accompanying document, permission - * is granted to deal in this work without restriction, including un- - * limited rights to use, publicly perform, distribute, sell, modify, - * merge, give away, or sublicence. - * - * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to - * the utmost extent permitted by applicable law, neither express nor - * implied; without malicious intent or gross negligence. In no event - * may a licensor, author or contributor be held liable for indirect, - * direct, other damage, loss, or other issues arising in any way out - * of dealing in the work, even if advised of the possibility of such - * damage or existence of a defect, except proven that it results out - * of said person's immediate fault when using the work as intended. - *- - * Convert from ICY encoding (windows-1252 codepage) to UTF-8 - */ - -/* Includes string and stdlib headers... */ -#include "compat.h" - -/* ThOr: too lazy for this type check; also we use char/short all around anyway. - Of cource, it would be the proper way to use _these_ kind of types all around. */ -#define uint8_t unsigned char -#define uint16_t unsigned short - -static const uint8_t cp1252_utf8[] = { - /* 0x00 @ 0 */ 0x00, - /* 0x01 @ 1 */ 0x01, - /* 0x02 @ 2 */ 0x02, - /* 0x03 @ 3 */ 0x03, - /* 0x04 @ 4 */ 0x04, - /* 0x05 @ 5 */ 0x05, - /* 0x06 @ 6 */ 0x06, - /* 0x07 @ 7 */ 0x07, - /* 0x08 @ 8 */ 0x08, - /* 0x09 @ 9 */ 0x09, - /* 0x0A @ 10 */ 0x0A, - /* 0x0B @ 11 */ 0x0B, - /* 0x0C @ 12 */ 0x0C, - /* 0x0D @ 13 */ 0x0D, - /* 0x0E @ 14 */ 0x0E, - /* 0x0F @ 15 */ 0x0F, - /* 0x10 @ 16 */ 0x10, - /* 0x11 @ 17 */ 0x11, - /* 0x12 @ 18 */ 0x12, - /* 0x13 @ 19 */ 0x13, - /* 0x14 @ 20 */ 0x14, - /* 0x15 @ 21 */ 0x15, - /* 0x16 @ 22 */ 0x16, - /* 0x17 @ 23 */ 0x17, - /* 0x18 @ 24 */ 0x18, - /* 0x19 @ 25 */ 0x19, - /* 0x1A @ 26 */ 0x1A, - /* 0x1B @ 27 */ 0x1B, - /* 0x1C @ 28 */ 0x1C, - /* 0x1D @ 29 */ 0x1D, - /* 0x1E @ 30 */ 0x1E, - /* 0x1F @ 31 */ 0x1F, - /* 0x20 @ 32 */ 0x20, - /* 0x21 @ 33 */ 0x21, - /* 0x22 @ 34 */ 0x22, - /* 0x23 @ 35 */ 0x23, - /* 0x24 @ 36 */ 0x24, - /* 0x25 @ 37 */ 0x25, - /* 0x26 @ 38 */ 0x26, - /* 0x27 @ 39 */ 0x27, - /* 0x28 @ 40 */ 0x28, - /* 0x29 @ 41 */ 0x29, - /* 0x2A @ 42 */ 0x2A, - /* 0x2B @ 43 */ 0x2B, - /* 0x2C @ 44 */ 0x2C, - /* 0x2D @ 45 */ 0x2D, - /* 0x2E @ 46 */ 0x2E, - /* 0x2F @ 47 */ 0x2F, - /* 0x30 @ 48 */ 0x30, - /* 0x31 @ 49 */ 0x31, - /* 0x32 @ 50 */ 0x32, - /* 0x33 @ 51 */ 0x33, - /* 0x34 @ 52 */ 0x34, - /* 0x35 @ 53 */ 0x35, - /* 0x36 @ 54 */ 0x36, - /* 0x37 @ 55 */ 0x37, - /* 0x38 @ 56 */ 0x38, - /* 0x39 @ 57 */ 0x39, - /* 0x3A @ 58 */ 0x3A, - /* 0x3B @ 59 */ 0x3B, - /* 0x3C @ 60 */ 0x3C, - /* 0x3D @ 61 */ 0x3D, - /* 0x3E @ 62 */ 0x3E, - /* 0x3F @ 63 */ 0x3F, - /* 0x40 @ 64 */ 0x40, - /* 0x41 @ 65 */ 0x41, - /* 0x42 @ 66 */ 0x42, - /* 0x43 @ 67 */ 0x43, - /* 0x44 @ 68 */ 0x44, - /* 0x45 @ 69 */ 0x45, - /* 0x46 @ 70 */ 0x46, - /* 0x47 @ 71 */ 0x47, - /* 0x48 @ 72 */ 0x48, - /* 0x49 @ 73 */ 0x49, - /* 0x4A @ 74 */ 0x4A, - /* 0x4B @ 75 */ 0x4B, - /* 0x4C @ 76 */ 0x4C, - /* 0x4D @ 77 */ 0x4D, - /* 0x4E @ 78 */ 0x4E, - /* 0x4F @ 79 */ 0x4F, - /* 0x50 @ 80 */ 0x50, - /* 0x51 @ 81 */ 0x51, - /* 0x52 @ 82 */ 0x52, - /* 0x53 @ 83 */ 0x53, - /* 0x54 @ 84 */ 0x54, - /* 0x55 @ 85 */ 0x55, - /* 0x56 @ 86 */ 0x56, - /* 0x57 @ 87 */ 0x57, - /* 0x58 @ 88 */ 0x58, - /* 0x59 @ 89 */ 0x59, - /* 0x5A @ 90 */ 0x5A, - /* 0x5B @ 91 */ 0x5B, - /* 0x5C @ 92 */ 0x5C, - /* 0x5D @ 93 */ 0x5D, - /* 0x5E @ 94 */ 0x5E, - /* 0x5F @ 95 */ 0x5F, - /* 0x60 @ 96 */ 0x60, - /* 0x61 @ 97 */ 0x61, - /* 0x62 @ 98 */ 0x62, - /* 0x63 @ 99 */ 0x63, - /* 0x64 @ 100 */ 0x64, - /* 0x65 @ 101 */ 0x65, - /* 0x66 @ 102 */ 0x66, - /* 0x67 @ 103 */ 0x67, - /* 0x68 @ 104 */ 0x68, - /* 0x69 @ 105 */ 0x69, - /* 0x6A @ 106 */ 0x6A, - /* 0x6B @ 107 */ 0x6B, - /* 0x6C @ 108 */ 0x6C, - /* 0x6D @ 109 */ 0x6D, - /* 0x6E @ 110 */ 0x6E, - /* 0x6F @ 111 */ 0x6F, - /* 0x70 @ 112 */ 0x70, - /* 0x71 @ 113 */ 0x71, - /* 0x72 @ 114 */ 0x72, - /* 0x73 @ 115 */ 0x73, - /* 0x74 @ 116 */ 0x74, - /* 0x75 @ 117 */ 0x75, - /* 0x76 @ 118 */ 0x76, - /* 0x77 @ 119 */ 0x77, - /* 0x78 @ 120 */ 0x78, - /* 0x79 @ 121 */ 0x79, - /* 0x7A @ 122 */ 0x7A, - /* 0x7B @ 123 */ 0x7B, - /* 0x7C @ 124 */ 0x7C, - /* 0x7D @ 125 */ 0x7D, - /* 0x7E @ 126 */ 0x7E, - /* 0x7F @ 127 */ 0x7F, - /* 0x80 @ 128 */ 0xE2, 0x82, 0xAC, - /* 0x81 @ 131 */ 0xEF, 0xBF, 0xBD, - /* 0x82 @ 134 */ 0xE2, 0x80, 0x9A, - /* 0x83 @ 137 */ 0xC6, 0x92, - /* 0x84 @ 139 */ 0xE2, 0x80, 0x9E, - /* 0x85 @ 142 */ 0xE2, 0x80, 0xA6, - /* 0x86 @ 145 */ 0xE2, 0x80, 0xA0, - /* 0x87 @ 148 */ 0xE2, 0x80, 0xA1, - /* 0x88 @ 151 */ 0xCB, 0x86, - /* 0x89 @ 153 */ 0xE2, 0x80, 0xB0, - /* 0x8A @ 156 */ 0xC5, 0xA0, - /* 0x8B @ 158 */ 0xE2, 0x80, 0xB9, - /* 0x8C @ 161 */ 0xC5, 0x92, - /* 0x8D @ 163 */ 0xEF, 0xBF, 0xBD, - /* 0x8E @ 166 */ 0xC5, 0xBD, - /* 0x8F @ 168 */ 0xEF, 0xBF, 0xBD, - /* 0x90 @ 171 */ 0xEF, 0xBF, 0xBD, - /* 0x91 @ 174 */ 0xE2, 0x80, 0x98, - /* 0x92 @ 177 */ 0xE2, 0x80, 0x99, - /* 0x93 @ 180 */ 0xE2, 0x80, 0x9C, - /* 0x94 @ 183 */ 0xE2, 0x80, 0x9D, - /* 0x95 @ 186 */ 0xE2, 0x80, 0xA2, - /* 0x96 @ 189 */ 0xE2, 0x80, 0x93, - /* 0x97 @ 192 */ 0xE2, 0x80, 0x94, - /* 0x98 @ 195 */ 0xCB, 0x9C, - /* 0x99 @ 197 */ 0xE2, 0x84, 0xA2, - /* 0x9A @ 200 */ 0xC5, 0xA1, - /* 0x9B @ 202 */ 0xE2, 0x80, 0xBA, - /* 0x9C @ 205 */ 0xC5, 0x93, - /* 0x9D @ 207 */ 0xEF, 0xBF, 0xBD, - /* 0x9E @ 210 */ 0xC5, 0xBE, - /* 0x9F @ 212 */ 0xC5, 0xB8, - /* 0xA0 @ 214 */ 0xC2, 0xA0, - /* 0xA1 @ 216 */ 0xC2, 0xA1, - /* 0xA2 @ 218 */ 0xC2, 0xA2, - /* 0xA3 @ 220 */ 0xC2, 0xA3, - /* 0xA4 @ 222 */ 0xC2, 0xA4, - /* 0xA5 @ 224 */ 0xC2, 0xA5, - /* 0xA6 @ 226 */ 0xC2, 0xA6, - /* 0xA7 @ 228 */ 0xC2, 0xA7, - /* 0xA8 @ 230 */ 0xC2, 0xA8, - /* 0xA9 @ 232 */ 0xC2, 0xA9, - /* 0xAA @ 234 */ 0xC2, 0xAA, - /* 0xAB @ 236 */ 0xC2, 0xAB, - /* 0xAC @ 238 */ 0xC2, 0xAC, - /* 0xAD @ 240 */ 0xC2, 0xAD, - /* 0xAE @ 242 */ 0xC2, 0xAE, - /* 0xAF @ 244 */ 0xC2, 0xAF, - /* 0xB0 @ 246 */ 0xC2, 0xB0, - /* 0xB1 @ 248 */ 0xC2, 0xB1, - /* 0xB2 @ 250 */ 0xC2, 0xB2, - /* 0xB3 @ 252 */ 0xC2, 0xB3, - /* 0xB4 @ 254 */ 0xC2, 0xB4, - /* 0xB5 @ 256 */ 0xC2, 0xB5, - /* 0xB6 @ 258 */ 0xC2, 0xB6, - /* 0xB7 @ 260 */ 0xC2, 0xB7, - /* 0xB8 @ 262 */ 0xC2, 0xB8, - /* 0xB9 @ 264 */ 0xC2, 0xB9, - /* 0xBA @ 266 */ 0xC2, 0xBA, - /* 0xBB @ 268 */ 0xC2, 0xBB, - /* 0xBC @ 270 */ 0xC2, 0xBC, - /* 0xBD @ 272 */ 0xC2, 0xBD, - /* 0xBE @ 274 */ 0xC2, 0xBE, - /* 0xBF @ 276 */ 0xC2, 0xBF, - /* 0xC0 @ 278 */ 0xC3, 0x80, - /* 0xC1 @ 280 */ 0xC3, 0x81, - /* 0xC2 @ 282 */ 0xC3, 0x82, - /* 0xC3 @ 284 */ 0xC3, 0x83, - /* 0xC4 @ 286 */ 0xC3, 0x84, - /* 0xC5 @ 288 */ 0xC3, 0x85, - /* 0xC6 @ 290 */ 0xC3, 0x86, - /* 0xC7 @ 292 */ 0xC3, 0x87, - /* 0xC8 @ 294 */ 0xC3, 0x88, - /* 0xC9 @ 296 */ 0xC3, 0x89, - /* 0xCA @ 298 */ 0xC3, 0x8A, - /* 0xCB @ 300 */ 0xC3, 0x8B, - /* 0xCC @ 302 */ 0xC3, 0x8C, - /* 0xCD @ 304 */ 0xC3, 0x8D, - /* 0xCE @ 306 */ 0xC3, 0x8E, - /* 0xCF @ 308 */ 0xC3, 0x8F, - /* 0xD0 @ 310 */ 0xC3, 0x90, - /* 0xD1 @ 312 */ 0xC3, 0x91, - /* 0xD2 @ 314 */ 0xC3, 0x92, - /* 0xD3 @ 316 */ 0xC3, 0x93, - /* 0xD4 @ 318 */ 0xC3, 0x94, - /* 0xD5 @ 320 */ 0xC3, 0x95, - /* 0xD6 @ 322 */ 0xC3, 0x96, - /* 0xD7 @ 324 */ 0xC3, 0x97, - /* 0xD8 @ 326 */ 0xC3, 0x98, - /* 0xD9 @ 328 */ 0xC3, 0x99, - /* 0xDA @ 330 */ 0xC3, 0x9A, - /* 0xDB @ 332 */ 0xC3, 0x9B, - /* 0xDC @ 334 */ 0xC3, 0x9C, - /* 0xDD @ 336 */ 0xC3, 0x9D, - /* 0xDE @ 338 */ 0xC3, 0x9E, - /* 0xDF @ 340 */ 0xC3, 0x9F, - /* 0xE0 @ 342 */ 0xC3, 0xA0, - /* 0xE1 @ 344 */ 0xC3, 0xA1, - /* 0xE2 @ 346 */ 0xC3, 0xA2, - /* 0xE3 @ 348 */ 0xC3, 0xA3, - /* 0xE4 @ 350 */ 0xC3, 0xA4, - /* 0xE5 @ 352 */ 0xC3, 0xA5, - /* 0xE6 @ 354 */ 0xC3, 0xA6, - /* 0xE7 @ 356 */ 0xC3, 0xA7, - /* 0xE8 @ 358 */ 0xC3, 0xA8, - /* 0xE9 @ 360 */ 0xC3, 0xA9, - /* 0xEA @ 362 */ 0xC3, 0xAA, - /* 0xEB @ 364 */ 0xC3, 0xAB, - /* 0xEC @ 366 */ 0xC3, 0xAC, - /* 0xED @ 368 */ 0xC3, 0xAD, - /* 0xEE @ 370 */ 0xC3, 0xAE, - /* 0xEF @ 372 */ 0xC3, 0xAF, - /* 0xF0 @ 374 */ 0xC3, 0xB0, - /* 0xF1 @ 376 */ 0xC3, 0xB1, - /* 0xF2 @ 378 */ 0xC3, 0xB2, - /* 0xF3 @ 380 */ 0xC3, 0xB3, - /* 0xF4 @ 382 */ 0xC3, 0xB4, - /* 0xF5 @ 384 */ 0xC3, 0xB5, - /* 0xF6 @ 386 */ 0xC3, 0xB6, - /* 0xF7 @ 388 */ 0xC3, 0xB7, - /* 0xF8 @ 390 */ 0xC3, 0xB8, - /* 0xF9 @ 392 */ 0xC3, 0xB9, - /* 0xFA @ 394 */ 0xC3, 0xBA, - /* 0xFB @ 396 */ 0xC3, 0xBB, - /* 0xFC @ 398 */ 0xC3, 0xBC, - /* 0xFD @ 400 */ 0xC3, 0xBD, - /* 0xFE @ 402 */ 0xC3, 0xBE, - /* 0xFF @ 404 */ 0xC3, 0xBF, -}; - -static const uint16_t tblofs[257] = { - /* 0x00 */ 0, 1, 2, 3, 4, 5, 6, 7, - /* 0x08 */ 8, 9, 10, 11, 12, 13, 14, 15, - /* 0x10 */ 16, 17, 18, 19, 20, 21, 22, 23, - /* 0x18 */ 24, 25, 26, 27, 28, 29, 30, 31, - /* 0x20 */ 32, 33, 34, 35, 36, 37, 38, 39, - /* 0x28 */ 40, 41, 42, 43, 44, 45, 46, 47, - /* 0x30 */ 48, 49, 50, 51, 52, 53, 54, 55, - /* 0x38 */ 56, 57, 58, 59, 60, 61, 62, 63, - /* 0x40 */ 64, 65, 66, 67, 68, 69, 70, 71, - /* 0x48 */ 72, 73, 74, 75, 76, 77, 78, 79, - /* 0x50 */ 80, 81, 82, 83, 84, 85, 86, 87, - /* 0x58 */ 88, 89, 90, 91, 92, 93, 94, 95, - /* 0x60 */ 96, 97, 98, 99, 100, 101, 102, 103, - /* 0x68 */ 104, 105, 106, 107, 108, 109, 110, 111, - /* 0x70 */ 112, 113, 114, 115, 116, 117, 118, 119, - /* 0x78 */ 120, 121, 122, 123, 124, 125, 126, 127, - /* 0x80 */ 128, 131, 134, 137, 139, 142, 145, 148, - /* 0x88 */ 151, 153, 156, 158, 161, 163, 166, 168, - /* 0x90 */ 171, 174, 177, 180, 183, 186, 189, 192, - /* 0x98 */ 195, 197, 200, 202, 205, 207, 210, 212, - /* 0xA0 */ 214, 216, 218, 220, 222, 224, 226, 228, - /* 0xA8 */ 230, 232, 234, 236, 238, 240, 242, 244, - /* 0xB0 */ 246, 248, 250, 252, 254, 256, 258, 260, - /* 0xB8 */ 262, 264, 266, 268, 270, 272, 274, 276, - /* 0xC0 */ 278, 280, 282, 284, 286, 288, 290, 292, - /* 0xC8 */ 294, 296, 298, 300, 302, 304, 306, 308, - /* 0xD0 */ 310, 312, 314, 316, 318, 320, 322, 324, - /* 0xD8 */ 326, 328, 330, 332, 334, 336, 338, 340, - /* 0xE0 */ 342, 344, 346, 348, 350, 352, 354, 356, - /* 0xE8 */ 358, 360, 362, 364, 366, 368, 370, 372, - /* 0xF0 */ 374, 376, 378, 380, 382, 384, 386, 388, - /* 0xF8 */ 390, 392, 394, 396, 398, 400, 402, 404, - /* sizeof (cp1252_utf8) */ 406 -}; - -/* Check if a string qualifies as UTF-8. */ -static int -is_utf8(const char* src) -{ - uint8_t ch; - size_t i; - const uint8_t* s = (const uint8_t*) src; - - /* We make a loop over every character, until we find a null one. - Remember: The string is supposed to end with a NUL, so ahead checks are safe. */ - while ((ch = *s++)) { - /* Ye olde 7bit ASCII chars 'rr fine for anything */ - if(ch < 0x80) continue; - - /* Now, we watch out for non-UTF conform sequences. */ - else if ((ch < 0xC2) || (ch > 0xFD)) - return 0; - /* check for some misformed sequences */ - if (((ch == 0xC2) && (s[0] < 0xA0)) || - ((ch == 0xEF) && (s[0] == 0xBF) && (s[1] > 0xBD))) - /* XXX add more for outside the BMP */ - return 0; - - /* Check the continuation bytes. */ - if (ch < 0xE0) i = 1; - else if (ch < 0xF0) i = 2; - else if (ch < 0xF8) i = 3; - else if (ch < 0xFC) i = 4; - else - i = 5; - - while (i--) - if ((*s++ & 0xC0) != 0x80) - return 0; - } - - /* If no check failed, the string indeed looks like valid UTF-8. */ - return 1; -} - -/* The main conversion routine. - ICY in CP-1252 (or UTF-8 alreay) to UTF-8 encoded string. - If force is applied, it will always encode to UTF-8, without checking. */ -char * -icy2utf8(const char *src, int force) -{ - const uint8_t *s = (const uint8_t *)src; - size_t srclen, dstlen, i, k; - uint8_t ch, *d; - char *dst; - - /* Some funny streams from Apple/iTunes give ICY info in UTF-8 already. - So, be prepared and don't try to re-encode such. Unless forced. */ - if(!force && is_utf8(src)) return (strdup(src)); - - srclen = strlen(src) + 1; - /* allocate conservatively */ - if ((d = malloc(srclen * 3)) == NULL) - return (NULL); - - i = 0; - dstlen = 0; - while (i < srclen) { - ch = s[i++]; - k = tblofs[ch]; - while (k < tblofs[ch + 1]) - d[dstlen++] = cp1252_utf8[k++]; - } - - /* dstlen includes trailing NUL since srclen also does */ - if ((dst = realloc(d, dstlen)) == NULL) { - free(d); - return (NULL); - } - return (dst); -} - -/* This stuff is for testing only. */ -#ifdef TEST -static const char intext[] = "\225 Gr\374\337e kosten 0,55 \200\205"; - -#include - -int -main(void) -{ - char *t, *t2; - - if ((t = icy2utf8(intext, 0)) == NULL) { - fprintf(stderr, "out of memory\n"); - return (1); - } - - /* make sure it won't be converted twice */ - if ((t2 = icy2utf8(t), 0) == NULL) { - fprintf(stderr, "out of memory\n"); - return (1); - } - - printf("Result is:\t\343\200\214%s\343\200\215\n" - "\t\t\343\200\214%s\343\200\215\n", t, t2); - - free(t); - free(t2); - return (0); -} -#endif diff --git a/Frameworks/mpg123/mpg123/id3.c b/Frameworks/mpg123/mpg123/id3.c deleted file mode 100644 index ec88426a6..000000000 --- a/Frameworks/mpg123/mpg123/id3.c +++ /dev/null @@ -1,1124 +0,0 @@ -/* - id3: ID3v2.3 and ID3v2.4 parsing (a relevant subset) - - copyright 2006-2013 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Thomas Orgis -*/ - -#include "mpg123lib_intern.h" -#include "id3.h" -#include "debug.h" - -#ifndef NO_ID3V2 /* Only the main parsing routine will always be there. */ - -/* We know the usual text frames plus some specifics. */ -#define KNOWN_FRAMES 5 -static const char frame_type[KNOWN_FRAMES][5] = { "COMM", "TXXX", "RVA2", "USLT", "APIC" }; -enum frame_types { unknown = -2, text = -1, comment, extra, rva2, uslt, picture }; - -/* UTF support definitions */ - -typedef void (*text_converter)(mpg123_string *sb, const unsigned char* source, size_t len, const int noquiet); - -static void convert_latin1 (mpg123_string *sb, const unsigned char* source, size_t len, const int noquiet); -static void convert_utf16bom(mpg123_string *sb, const unsigned char* source, size_t len, const int noquiet); -static void convert_utf8 (mpg123_string *sb, const unsigned char* source, size_t len, const int noquiet); - -static const text_converter text_converters[4] = -{ - convert_latin1, - /* We always check for (multiple) BOM in 16bit unicode. Without BOM, UTF16 BE is the default. - Errors in encoding are detected anyway. */ - convert_utf16bom, - convert_utf16bom, - convert_utf8 -}; - -static const unsigned int encoding_widths[4] = { 1, 2, 2, 1 }; - -/* the code starts here... */ - -static void null_id3_links(mpg123_handle *fr) -{ - fr->id3v2.title = NULL; - fr->id3v2.artist = NULL; - fr->id3v2.album = NULL; - fr->id3v2.year = NULL; - fr->id3v2.genre = NULL; - fr->id3v2.comment = NULL; -} - -void init_id3(mpg123_handle *fr) -{ - fr->id3v2.version = 0; /* nothing there */ - null_id3_links(fr); - fr->id3v2.comments = 0; - fr->id3v2.comment_list = NULL; - fr->id3v2.texts = 0; - fr->id3v2.text = NULL; - fr->id3v2.extras = 0; - fr->id3v2.extra = NULL; - fr->id3v2.pictures = 0; - fr->id3v2.picture = NULL; -} - -/* Managing of the text, comment and extra lists. */ - -/* Initialize one element. */ -static void init_mpg123_text(mpg123_text *txt) -{ - mpg123_init_string(&txt->text); - mpg123_init_string(&txt->description); - txt->id[0] = 0; - txt->id[1] = 0; - txt->id[2] = 0; - txt->id[3] = 0; - txt->lang[0] = 0; - txt->lang[1] = 0; - txt->lang[2] = 0; -} - -static void init_mpg123_picture(mpg123_picture *pic) -{ - mpg123_init_string(&pic->mime_type); - mpg123_init_string(&pic->description); - pic->type = 0; - pic->size = 0; - pic->data = NULL; -} - -/* Free memory of one element. */ -static void free_mpg123_text(mpg123_text *txt) -{ - mpg123_free_string(&txt->text); - mpg123_free_string(&txt->description); -} - -static void free_mpg123_picture(mpg123_picture * pic) -{ - mpg123_free_string(&pic->mime_type); - mpg123_free_string(&pic->description); - if (pic->data != NULL) - free(pic->data); -} - -/* Free memory of whole list. */ -#define free_comment(mh) free_id3_text(&((mh)->id3v2.comment_list), &((mh)->id3v2.comments)) -#define free_text(mh) free_id3_text(&((mh)->id3v2.text), &((mh)->id3v2.texts)) -#define free_extra(mh) free_id3_text(&((mh)->id3v2.extra), &((mh)->id3v2.extras)) -#define free_picture(mh) free_id3_picture(&((mh)->id3v2.picture), &((mh)->id3v2.pictures)) -static void free_id3_text(mpg123_text **list, size_t *size) -{ - size_t i; - for(i=0; i<*size; ++i) free_mpg123_text(&((*list)[i])); - - free(*list); - *list = NULL; - *size = 0; -} -static void free_id3_picture(mpg123_picture **list, size_t *size) -{ - size_t i; - for(i=0; i<*size; ++i) free_mpg123_picture(&((*list)[i])); - - free(*list); - *list = NULL; - *size = 0; -} - -/* Add items to the list. */ -#define add_comment(mh) add_id3_text(&((mh)->id3v2.comment_list), &((mh)->id3v2.comments)) -#define add_text(mh) add_id3_text(&((mh)->id3v2.text), &((mh)->id3v2.texts)) -#define add_extra(mh) add_id3_text(&((mh)->id3v2.extra), &((mh)->id3v2.extras)) -#define add_picture(mh) add_id3_picture(&((mh)->id3v2.picture), &((mh)->id3v2.pictures)) -static mpg123_text *add_id3_text(mpg123_text **list, size_t *size) -{ - mpg123_text *x = safe_realloc(*list, sizeof(mpg123_text)*(*size+1)); - if(x == NULL) return NULL; /* bad */ - - *list = x; - *size += 1; - init_mpg123_text(&((*list)[*size-1])); - - return &((*list)[*size-1]); /* Return pointer to the added text. */ -} -static mpg123_picture *add_id3_picture(mpg123_picture **list, size_t *size) -{ - mpg123_picture *x = safe_realloc(*list, sizeof(mpg123_picture)*(*size+1)); - if(x == NULL) return NULL; /* bad */ - - *list = x; - *size += 1; - init_mpg123_picture(&((*list)[*size-1])); - - return &((*list)[*size-1]); /* Return pointer to the added picture. */ -} - - -/* Remove the last item. */ -#define pop_comment(mh) pop_id3_text(&((mh)->id3v2.comment_list), &((mh)->id3v2.comments)) -#define pop_text(mh) pop_id3_text(&((mh)->id3v2.text), &((mh)->id3v2.texts)) -#define pop_extra(mh) pop_id3_text(&((mh)->id3v2.extra), &((mh)->id3v2.extras)) -#define pop_picture(mh) pop_id3_picture(&((mh)->id3v2.picture), &((mh)->id3v2.pictures)) -static void pop_id3_text(mpg123_text **list, size_t *size) -{ - mpg123_text *x; - if(*size < 1) return; - - free_mpg123_text(&((*list)[*size-1])); - if(*size > 1) - { - x = safe_realloc(*list, sizeof(mpg123_text)*(*size-1)); - if(x != NULL){ *list = x; *size -= 1; } - } - else - { - free(*list); - *list = NULL; - *size = 0; - } -} -static void pop_id3_picture(mpg123_picture **list, size_t *size) -{ - mpg123_picture *x; - if(*size < 1) return; - - free_mpg123_picture(&((*list)[*size-1])); - if(*size > 1) - { - x = safe_realloc(*list, sizeof(mpg123_picture)*(*size-1)); - if(x != NULL){ *list = x; *size -= 1; } - } - else - { - free(*list); - *list = NULL; - *size = 0; - } -} - -/* OK, back to the higher level functions. */ - -void exit_id3(mpg123_handle *fr) -{ - free_picture(fr); - free_comment(fr); - free_extra(fr); - free_text(fr); -} - -void reset_id3(mpg123_handle *fr) -{ - exit_id3(fr); - init_id3(fr); -} - -/* Set the id3v2.artist id3v2.title ... links to elements of the array. */ -void id3_link(mpg123_handle *fr) -{ - size_t i; - mpg123_id3v2 *v2 = &fr->id3v2; - debug("linking ID3v2"); - null_id3_links(fr); - for(i=0; itexts; ++i) - { - mpg123_text *entry = &v2->text[i]; - if (!strncmp("TIT2", entry->id, 4)) v2->title = &entry->text; - else if(!strncmp("TALB", entry->id, 4)) v2->album = &entry->text; - else if(!strncmp("TPE1", entry->id, 4)) v2->artist = &entry->text; - else if(!strncmp("TYER", entry->id, 4)) v2->year = &entry->text; - else if(!strncmp("TCON", entry->id, 4)) v2->genre = &entry->text; - } - for(i=0; icomments; ++i) - { - mpg123_text *entry = &v2->comment_list[i]; - if(entry->description.fill == 0 || entry->description.p[0] == 0) - v2->comment = &entry->text; - } - /* When no generic comment found, use the last non-generic one. */ - if(v2->comment == NULL && v2->comments > 0) - v2->comment = &v2->comment_list[v2->comments-1].text; -} - -/* - Store ID3 text data in an mpg123_string; either verbatim copy or everything translated to UTF-8 encoding. - Preserve the zero string separator (I don't need strlen for the total size). - - ID3v2 standard says that there should be one text frame of specific type per tag, and subsequent tags overwrite old values. - So, I always replace the text that may be stored already (perhaps with a list of zero-separated strings, though). -*/ -static void store_id3_text(mpg123_string *sb, unsigned char *source, size_t source_size, const int noquiet, const int notranslate) -{ - if(!source_size) - { - debug("Empty id3 data!"); - return; - } - - /* We shall just copy the data. Client wants to decode itself. */ - if(notranslate) - { - /* Future: Add a path for ID3 errors. */ - if(!mpg123_resize_string(sb, source_size)) - { - if(noquiet) error("Cannot resize target string, out of memory?"); - return; - } - memcpy(sb->p, source, source_size); - sb->fill = source_size; - debug1("stored undecoded ID3 text of size %"SIZE_P, (size_p)source_size); - return; - } - - id3_to_utf8(sb, source[0], source+1, source_size-1, noquiet); - - if(sb->fill) debug1("UTF-8 string (the first one): %s", sb->p); - else if(noquiet) error("unable to convert string to UTF-8 (out of memory, junk input?)!"); -} - -/* On error, sb->size is 0. */ -void id3_to_utf8(mpg123_string *sb, unsigned char encoding, const unsigned char *source, size_t source_size, int noquiet) -{ - unsigned int bwidth; - debug1("encoding: %u", encoding); - /* A note: ID3v2.3 uses UCS-2 non-variable 16bit encoding, v2.4 uses UTF16. - UTF-16 uses a reserved/private range in UCS-2 to add the magic, so we just always treat it as UTF. */ - if(encoding > mpg123_id3_enc_max) - { - if(noquiet) error1("Unknown text encoding %u, I take no chances, sorry!", encoding); - - mpg123_free_string(sb); - return; - } - bwidth = encoding_widths[encoding]; - /* Hack! I've seen a stray zero byte before BOM. Is that supposed to happen? */ - if(encoding != mpg123_id3_utf16be) /* UTF16be _can_ beging with a null byte! */ - while(source_size > bwidth && source[0] == 0) - { - --source_size; - ++source; - debug("skipped leading zero"); - } - if(source_size % bwidth) - { - /* When we need two bytes for a character, it's strange to have an uneven bytestream length. */ - if(noquiet) warning2("Weird tag size %d for encoding %u - I will probably trim too early or something but I think the MP3 is broken.", (int)source_size, encoding); - source_size -= source_size % bwidth; - } - text_converters[encoding](sb, source, source_size, noquiet); -} - -static unsigned char *next_text(unsigned char* prev, unsigned char encoding, size_t limit) -{ - unsigned char *text = prev; - size_t width = encoding_widths[encoding]; - - /* So I go lengths to find zero or double zero... - Remember bug 2834636: Only check for aligned NULLs! */ - while(text-prev < (ssize_t)limit) - { - if(text[0] == 0) - { - if(width <= limit-(text-prev)) - { - size_t i = 1; - for(; i= limit) text = NULL; - - return text; -} - -static const char *enc_name(unsigned char enc) -{ - switch(enc) - { - case 0: return "Latin 1"; - case 1: return "UTF-16 BOM"; - case 2: return "UTF-16 BE"; - case 3: return "UTF-8"; - default: return "unknown!"; - } -} - -static void process_text(mpg123_handle *fr, unsigned char *realdata, size_t realsize, char *id) -{ - /* Text encoding $xx */ - /* The text (encoded) ... */ - mpg123_text *t = add_text(fr); - if(VERBOSE4) fprintf(stderr, "Note: Storing text from %s encoding\n", enc_name(realdata[0])); - if(t == NULL) - { - if(NOQUIET) error("Unable to attach new text!"); - return; - } - memcpy(t->id, id, 4); - store_id3_text(&t->text, realdata, realsize, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); - if(VERBOSE4) fprintf(stderr, "Note: ID3v2 %c%c%c%c text frame: %s\n", id[0], id[1], id[2], id[3], t->text.p); -} - -static void process_picture(mpg123_handle *fr, unsigned char *realdata, size_t realsize) -{ - unsigned char encoding = realdata[0]; - mpg123_picture *i = NULL; - unsigned char* workpoint; - if(realsize == 0) - { - debug("Empty id3 data!"); - return; - } - if(VERBOSE4) fprintf(stderr, "Note: Storing picture from APIC frame.\n"); - /* decompose realdata accordingly */ - i = add_picture(fr); - if(i == NULL) - { - if(NOQUIET) error("Unable to attach new picture!"); - return; - } - realdata++; realsize--; - /* get mime type (encoding is always latin-1) */ - workpoint = next_text(realdata, 0, realsize); - if (workpoint == NULL) { - pop_picture(fr); - if (NOQUIET) error("Unable to get mime type for picture; skipping picture."); - return; - } - id3_to_utf8(&i->mime_type, 0, realdata, workpoint - realdata, NOQUIET); - realsize -= workpoint - realdata; - realdata = workpoint; - /* get picture type */ - i->type = realdata[0]; - realdata++; realsize--; - /* get description (encoding is encoding) */ - workpoint = next_text(realdata, encoding, realsize); - if (workpoint == NULL) { - if (NOQUIET) error("Unable to get description for picture; skipping picture."); - pop_picture(fr); - return; - } - id3_to_utf8(&i->description, encoding, realdata, workpoint - realdata, NOQUIET); - realsize -= workpoint - realdata; - if (realsize == 0) { - if (NOQUIET) error("No picture data defined; skipping picture."); - pop_picture(fr); - return; - } - /* store_id3_picture(i, picture, realsize, NOQUIET)) */ - i->data = (unsigned char*)malloc(realsize); - if (i->data == NULL) { - if (NOQUIET) error("Unable to allocate memory for picture; skipping picture"); - pop_picture(fr); - return; - } - memcpy(i->data, workpoint, realsize); - i->size = realsize; - if(VERBOSE4) fprintf(stderr, "Note: ID3v2 APIC picture frame of type: %d\n", i->type); -} - -/* Store a new comment that perhaps is a RVA / RVA_ALBUM/AUDIOPHILE / RVA_MIX/RADIO one - Special gimmik: It also stores USLT to the texts. Stucture is the same as for comments. */ -static void process_comment(mpg123_handle *fr, enum frame_types tt, unsigned char *realdata, size_t realsize, int rva_level, char *id) -{ - /* Text encoding $xx */ - /* Language $xx xx xx */ - /* Short description (encoded!) $00 (00) */ - /* Then the comment text (encoded) ... */ - unsigned char encoding = realdata[0]; - unsigned char *lang = realdata+1; /* I'll only use the 3 bytes! */ - unsigned char *descr = realdata+4; - unsigned char *text = NULL; - mpg123_text *xcom = NULL; - mpg123_text localcom; /* UTF-8 variant for local processing. */ - - if(realsize < (size_t)(descr-realdata)) - { - if(NOQUIET) error1("Invalid frame size of %"SIZE_P" (too small for anything).", (size_p)realsize); - return; - } - xcom = (tt == uslt ? add_text(fr) : add_comment(fr)); - if(VERBOSE4) fprintf(stderr, "Note: Storing comment from %s encoding\n", enc_name(realdata[0])); - if(xcom == NULL) - { - if(NOQUIET) error("Unable to attach new comment!"); - return; - } - memcpy(xcom->lang, lang, 3); - memcpy(xcom->id, id, 4); - /* Now I can abuse a byte from lang for the encoding. */ - descr[-1] = encoding; - /* Be careful with finding the end of description, I have to honor encoding here. */ - text = next_text(descr, encoding, realsize-(descr-realdata)); - if(text == NULL) - { - if(NOQUIET) error("No comment text / valid description?"); - pop_comment(fr); - return; - } - - init_mpg123_text(&localcom); - /* Store the text, without translation to UTF-8, but for comments always a local copy in UTF-8. - Reminder: No bailing out from here on without freeing the local comment data! */ - store_id3_text(&xcom->description, descr-1, text-descr+1, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); - if(tt == comment) - store_id3_text(&localcom.description, descr-1, text-descr+1, NOQUIET, 0); - - text[-1] = encoding; /* Byte abusal for encoding... */ - store_id3_text(&xcom->text, text-1, realsize+1-(text-realdata), NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); - /* Remember: I will probably decode the above (again) for rva comment checking. So no messing around, please. */ - - if(VERBOSE4) /* Do _not_ print the verbatim text: The encoding might be funny! */ - { - fprintf(stderr, "Note: ID3 comm/uslt desc of length %"SIZE_P".\n", (size_p)xcom->description.fill); - fprintf(stderr, "Note: ID3 comm/uslt text of length %"SIZE_P".\n", (size_p)xcom->text.fill); - } - /* Look out for RVA info only when we really deal with a straight comment. */ - if(tt == comment && localcom.description.fill > 0) - { - int rva_mode = -1; /* mix / album */ - if( !strcasecmp(localcom.description.p, "rva") - || !strcasecmp(localcom.description.p, "rva_mix") - || !strcasecmp(localcom.description.p, "rva_track") - || !strcasecmp(localcom.description.p, "rva_radio") ) - rva_mode = 0; - else if( !strcasecmp(localcom.description.p, "rva_album") - || !strcasecmp(localcom.description.p, "rva_audiophile") - || !strcasecmp(localcom.description.p, "rva_user") ) - rva_mode = 1; - if((rva_mode > -1) && (fr->rva.level[rva_mode] <= rva_level)) - { - /* Only translate the contents in here where we really need them. */ - store_id3_text(&localcom.text, text-1, realsize+1-(text-realdata), NOQUIET, 0); - if(localcom.text.fill > 0) - { - fr->rva.gain[rva_mode] = (float) atof(localcom.text.p); - if(VERBOSE3) fprintf(stderr, "Note: RVA value %fdB\n", fr->rva.gain[rva_mode]); - fr->rva.peak[rva_mode] = 0; - fr->rva.level[rva_mode] = rva_level; - } - } - } - /* Make sure to free the local memory... */ - free_mpg123_text(&localcom); -} - -static void process_extra(mpg123_handle *fr, unsigned char* realdata, size_t realsize, int rva_level, char *id) -{ - /* Text encoding $xx */ - /* Description ... $00 (00) */ - /* Text ... */ - unsigned char encoding = realdata[0]; - unsigned char *descr = realdata+1; /* remember, the encoding is descr[-1] */ - unsigned char *text; - mpg123_text *xex; - mpg123_text localex; - - if((int)realsize < descr-realdata) - { - if(NOQUIET) error1("Invalid frame size of %lu (too small for anything).", (unsigned long)realsize); - return; - } - text = next_text(descr, encoding, realsize-(descr-realdata)); - if(VERBOSE4) fprintf(stderr, "Note: Storing extra from %s encoding\n", enc_name(realdata[0])); - if(text == NULL) - { - if(NOQUIET) error("No extra frame text / valid description?"); - return; - } - xex = add_extra(fr); - if(xex == NULL) - { - if(NOQUIET) error("Unable to attach new extra text!"); - return; - } - memcpy(xex->id, id, 4); - init_mpg123_text(&localex); /* For our local copy. */ - - /* The outside storage gets reencoded to UTF-8 only if not requested otherwise. - Remember that we really need the -1 here to hand in the encoding byte!*/ - store_id3_text(&xex->description, descr-1, text-descr+1, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); - /* Our local copy is always stored in UTF-8! */ - store_id3_text(&localex.description, descr-1, text-descr+1, NOQUIET, 0); - /* At first, only store the outside copy of the payload. We may not need the local copy. */ - text[-1] = encoding; - store_id3_text(&xex->text, text-1, realsize-(text-realdata)+1, NOQUIET, fr->p.flags & MPG123_PLAIN_ID3TEXT); - - /* Now check if we would like to interpret this extra info for RVA. */ - if(localex.description.fill > 0) - { - int is_peak = 0; - int rva_mode = -1; /* mix / album */ - - if(!strncasecmp(localex.description.p, "replaygain_track_",17)) - { - if(VERBOSE3) fprintf(stderr, "Note: RVA ReplayGain track gain/peak\n"); - - rva_mode = 0; - if(!strcasecmp(localex.description.p, "replaygain_track_peak")) is_peak = 1; - else if(strcasecmp(localex.description.p, "replaygain_track_gain")) rva_mode = -1; - } - else - if(!strncasecmp(localex.description.p, "replaygain_album_",17)) - { - if(VERBOSE3) fprintf(stderr, "Note: RVA ReplayGain album gain/peak\n"); - - rva_mode = 1; - if(!strcasecmp(localex.description.p, "replaygain_album_peak")) is_peak = 1; - else if(strcasecmp(localex.description.p, "replaygain_album_gain")) rva_mode = -1; - } - if((rva_mode > -1) && (fr->rva.level[rva_mode] <= rva_level)) - { - /* Now we need the translated copy of the data. */ - store_id3_text(&localex.text, text-1, realsize-(text-realdata)+1, NOQUIET, 0); - if(localex.text.fill > 0) - { - if(is_peak) - { - fr->rva.peak[rva_mode] = (float) atof(localex.text.p); - if(VERBOSE3) fprintf(stderr, "Note: RVA peak %f\n", fr->rva.peak[rva_mode]); - } - else - { - fr->rva.gain[rva_mode] = (float) atof(localex.text.p); - if(VERBOSE3) fprintf(stderr, "Note: RVA gain %fdB\n", fr->rva.gain[rva_mode]); - } - fr->rva.level[rva_mode] = rva_level; - } - } - } - - free_mpg123_text(&localex); -} - -/* Make a ID3v2.3+ 4-byte ID from a ID3v2.2 3-byte ID - Note that not all frames survived to 2.4; the mapping goes to 2.3 . - A notable miss is the old RVA frame, which is very unspecific anyway. - This function returns -1 when a not known 3 char ID was encountered, 0 otherwise. */ -static int promote_framename(mpg123_handle *fr, char *id) /* fr because of VERBOSE macros */ -{ - size_t i; - char *old[] = - { - "COM", "TAL", "TBP", "TCM", "TCO", "TCR", "TDA", "TDY", "TEN", "TFT", - "TIM", "TKE", "TLA", "TLE", "TMT", "TOA", "TOF", "TOL", "TOR", "TOT", - "TP1", "TP2", "TP3", "TP4", "TPA", "TPB", "TRC", "TDA", "TRK", "TSI", - "TSS", "TT1", "TT2", "TT3", "TXT", "TXX", "TYE" - }; - char *new[] = - { - "COMM", "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDAT", "TDLY", "TENC", "TFLT", - "TIME", "TKEY", "TLAN", "TLEN", "TMED", "TOPE", "TOFN", "TOLY", "TORY", "TOAL", - "TPE1", "TPE2", "TPE3", "TPE4", "TPOS", "TPUB", "TSRC", "TRDA", "TRCK", "TSIZ", - "TSSE", "TIT1", "TIT2", "TIT3", "TEXT", "TXXX", "TYER" - }; - for(i=0; ird->read_frame_body(fr, buf, 6)) < 0) /* read more header information */ - return ret2; - - if(buf[0] == 0xff) return 0; /* Revision, will never be 0xff. */ - - /* second new byte are some nice flags, if these are invalid skip the whole thing */ - flags = buf[1]; - debug1("ID3v2: flags 0x%08x", flags); - /* use 4 bytes from buf to construct 28bit uint value and return 1; return 0 if bytes are not synchsafe */ - #define synchsafe_to_long(buf,res) \ - ( \ - (((buf)[0]|(buf)[1]|(buf)[2]|(buf)[3]) & 0x80) ? 0 : \ - (res = (((unsigned long) (buf)[0]) << 21) \ - | (((unsigned long) (buf)[1]) << 14) \ - | (((unsigned long) (buf)[2]) << 7) \ - | ((unsigned long) (buf)[3]) \ - ,1) \ - ) - /* id3v2.3 does not store synchsafe frame sizes, but synchsafe tag size - doh! */ - #define bytes_to_long(buf,res) \ - ( \ - major == 3 ? \ - (res = (((unsigned long) (buf)[0]) << 24) \ - | (((unsigned long) (buf)[1]) << 16) \ - | (((unsigned long) (buf)[2]) << 8) \ - | ((unsigned long) (buf)[3]) \ - ,1) : synchsafe_to_long(buf,res) \ - ) - /* for id3v2.2 only */ - #define threebytes_to_long(buf,res) \ - ( \ - res = (((unsigned long) (buf)[0]) << 16) \ - | (((unsigned long) (buf)[1]) << 8) \ - | ((unsigned long) (buf)[2]) \ - ,1 \ - ) - - /* length-10 or length-20 (footer present); 4 synchsafe integers == 28 bit number */ - /* we have already read 10 bytes, so left are length or length+10 bytes belonging to tag */ - if(!synchsafe_to_long(buf+2,length)) - { - if(NOQUIET) error4("Bad tag length (not synchsafe): 0x%02x%02x%02x%02x; You got a bad ID3 tag here.", buf[2],buf[3],buf[4],buf[5]); - return 0; - } - debug1("ID3v2: tag data length %lu", length); -#ifndef NO_ID3V2 - if(VERBOSE2) fprintf(stderr,"Note: ID3v2.%i rev %i tag of %lu bytes\n", major, buf[0], length); - /* skip if unknown version/scary flags, parse otherwise */ - if(fr->p.flags & MPG123_SKIP_ID3V2 || ((flags & UNKNOWN_FLAGS) || (major > 4) || (major < 2))) - { - if(NOQUIET) - { - if(fr->p.flags & MPG123_SKIP_ID3V2) - { - if(VERBOSE3) fprintf(stderr, "Note: Skipping ID3v2 tag per user request.\n"); - } - else /* Must be because of scary Tag properties. */ - warning2("ID3v2: Won't parse the ID3v2 tag with major version %u and flags 0x%xu - some extra code may be needed", major, flags); - } -#endif - if((ret2 = fr->rd->skip_bytes(fr,length)) < 0) /* will not store data in backbuff! */ - ret = ret2; -#ifndef NO_ID3V2 - } - else - { - unsigned char* tagdata = NULL; - fr->id3v2.version = major; - /* try to interpret that beast */ - if((tagdata = (unsigned char*) malloc(length+1)) != NULL) - { - debug("ID3v2: analysing frames..."); - if((ret2 = fr->rd->read_frame_body(fr,tagdata,length)) > 0) - { - unsigned long tagpos = 0; - debug1("ID3v2: have read at all %lu bytes for the tag now", (unsigned long)length+6); - /* going to apply strlen for strings inside frames, make sure that it doesn't overflow! */ - tagdata[length] = 0; - if(flags & EXTHEAD_FLAG) - { - debug("ID3v2: skipping extended header"); - if(!bytes_to_long(tagdata, tagpos)) - { - ret = 0; - if(NOQUIET) error4("Bad (non-synchsafe) tag offset: 0x%02x%02x%02x%02x", tagdata[0], tagdata[1], tagdata[2], tagdata[3]); - } - } - if(ret > 0) - { - char id[5]; - unsigned long framesize; - unsigned long fflags; /* need 16 bits, actually */ - id[4] = 0; - /* pos now advanced after ext head, now a frame has to follow */ - while(tagpos < length-10) /* I want to read at least a full header */ - { - int i = 0; - unsigned long pos = tagpos; - int head_part = fr->id3v2.version == 2 ? 3 : 4; /* bytes of frame title and of framesize value */ - /* level 1,2,3 - 0 is info from lame/info tag! */ - /* rva tags with ascending significance, then general frames */ - enum frame_types tt = unknown; - /* we may have entered the padding zone or any other strangeness: check if we have valid frame id characters */ - for(i=0; i< head_part; ++i) - if( !( ((tagdata[tagpos+i] > 47) && (tagdata[tagpos+i] < 58)) - || ((tagdata[tagpos+i] > 64) && (tagdata[tagpos+i] < 91)) ) ) - { - debug5("ID3v2: real tag data apparently ended after %lu bytes with 0x%02x%02x%02x%02x", tagpos, tagdata[tagpos], tagdata[tagpos+1], tagdata[tagpos+2], tagdata[tagpos+3]); - /* This is no hard error... let's just hope that we got something meaningful already (ret==1 in that case). */ - goto tagparse_cleanup; /* Need to escape two loops here. */ - } - if(ret > 0) - { - /* 4 or 3 bytes id */ - strncpy(id, (char*) tagdata+pos, head_part); - id[head_part] = 0; /* terminate for 3 or 4 bytes */ - pos += head_part; - tagpos += head_part; - /* size as 32 bits or 28 bits */ - if(fr->id3v2.version == 2) threebytes_to_long(tagdata+pos, framesize); - else - if(!bytes_to_long(tagdata+pos, framesize)) - { - /* Just assume that up to now there was some good data. */ - if(NOQUIET) error1("ID3v2: non-syncsafe size of %s frame, skipping the remainder of tag", id); - break; - } - if(VERBOSE3) fprintf(stderr, "Note: ID3v2 %s frame of size %lu\n", id, framesize); - tagpos += head_part + framesize; /* the important advancement in whole tag */ - if(tagpos > length) - { - if(NOQUIET) error("Whoa! ID3v2 frame claims to be larger than the whole rest of the tag."); - break; - } - pos += head_part; - if(fr->id3v2.version > 2) - { - fflags = (((unsigned long) tagdata[pos]) << 8) | ((unsigned long) tagdata[pos+1]); - pos += 2; - tagpos += 2; - } - else fflags = 0; - /* for sanity, after full parsing tagpos should be == pos */ - /* debug4("ID3v2: found %s frame, size %lu (as bytes: 0x%08lx), flags 0x%016lx", id, framesize, framesize, fflags); */ - /* %0abc0000 %0h00kmnp */ - #define BAD_FFLAGS (unsigned long) 36784 - #define PRES_TAG_FFLAG 16384 - #define PRES_FILE_FFLAG 8192 - #define READ_ONLY_FFLAG 4096 - #define GROUP_FFLAG 64 - #define COMPR_FFLAG 8 - #define ENCR_FFLAG 4 - #define UNSYNC_FFLAG 2 - #define DATLEN_FFLAG 1 - if(head_part < 4 && promote_framename(fr, id) != 0) continue; - - /* shall not or want not handle these */ - if(fflags & (BAD_FFLAGS | COMPR_FFLAG | ENCR_FFLAG)) - { - if(NOQUIET) warning("ID3v2: skipping invalid/unsupported frame"); - continue; - } - - for(i = 0; i < KNOWN_FRAMES; ++i) - if(!strncmp(frame_type[i], id, 4)){ tt = i; break; } - - if(id[0] == 'T' && tt != extra) tt = text; - - if(tt != unknown) - { - int rva_mode = -1; /* mix / album */ - unsigned long realsize = framesize; - unsigned char* realdata = tagdata+pos; - if((flags & UNSYNC_FLAG) || (fflags & UNSYNC_FFLAG)) - { - unsigned long ipos = 0; - unsigned long opos = 0; - debug("Id3v2: going to de-unsync the frame data"); - /* de-unsync: FF00 -> FF; real FF00 is simply represented as FF0000 ... */ - /* damn, that means I have to delete bytes from withing the data block... thus need temporal storage */ - /* standard mandates that de-unsync should always be safe if flag is set */ - realdata = (unsigned char*) malloc(framesize); /* will need <= bytes */ - if(realdata == NULL) - { - if(NOQUIET) error("ID3v2: unable to allocate working buffer for de-unsync"); - continue; - } - /* now going byte per byte through the data... */ - realdata[0] = tagdata[pos]; - opos = 1; - for(ipos = pos+1; ipos < pos+framesize; ++ipos) - { - if(!((tagdata[ipos] == 0) && (tagdata[ipos-1] == 0xff))) - { - realdata[opos++] = tagdata[ipos]; - } - } - realsize = opos; - debug2("ID3v2: de-unsync made %lu out of %lu bytes", realsize, framesize); - } - pos = 0; /* now at the beginning again... */ - switch(tt) - { - case comment: - case uslt: - process_comment(fr, tt, realdata, realsize, comment+1, id); - break; - case extra: /* perhaps foobar2000's work */ - process_extra(fr, realdata, realsize, extra+1, id); - break; - case rva2: /* "the" RVA tag */ - { - /* starts with null-terminated identification */ - if(VERBOSE3) fprintf(stderr, "Note: RVA2 identification \"%s\"\n", realdata); - /* default: some individual value, mix mode */ - rva_mode = 0; - if( !strncasecmp((char*)realdata, "album", 5) - || !strncasecmp((char*)realdata, "audiophile", 10) - || !strncasecmp((char*)realdata, "user", 4)) - rva_mode = 1; - if(fr->rva.level[rva_mode] <= rva2+1) - { - pos += strlen((char*) realdata) + 1; - if(realdata[pos] == 1) - { - ++pos; - /* only handle master channel */ - debug("ID3v2: it is for the master channel"); - /* two bytes adjustment, one byte for bits representing peak - n bytes, eh bits, for peak */ - /* 16 bit signed integer = dB * 512 ... the double cast is needed to preserve the sign of negative values! */ - fr->rva.gain[rva_mode] = (float) ( (((short)((signed char)realdata[pos])) << 8) | realdata[pos+1] ) / 512; - pos += 2; - if(VERBOSE3) fprintf(stderr, "Note: RVA value %fdB\n", fr->rva.gain[rva_mode]); - /* heh, the peak value is represented by a number of bits - but in what manner? Skipping that part */ - fr->rva.peak[rva_mode] = 0; - fr->rva.level[rva_mode] = rva2+1; - } - } - } - break; - /* non-rva metainfo, simply store... */ - case text: - process_text(fr, realdata, realsize, id); - break; - case picture: - if (fr->p.flags & MPG123_PICTURE) - process_picture(fr, realdata, realsize); - - break; - default: if(NOQUIET) error1("ID3v2: unknown frame type %i", tt); - } - if((flags & UNSYNC_FLAG) || (fflags & UNSYNC_FFLAG)) free(realdata); - } - #undef BAD_FFLAGS - #undef PRES_TAG_FFLAG - #undef PRES_FILE_FFLAG - #undef READ_ONLY_FFLAG - #undef GROUP_FFLAG - #undef COMPR_FFLAG - #undef ENCR_FFLAG - #undef UNSYNC_FFLAG - #undef DATLEN_FFLAG - } - else break; - #undef KNOWN_FRAMES - } - } - } - else - { - /* There are tags with zero length. Strictly not an error, then. */ - if(length > 0 && NOQUIET && ret2 != MPG123_NEED_MORE) error("ID3v2: Duh, not able to read ID3v2 tag data."); - ret = ret2; - } -tagparse_cleanup: - free(tagdata); - } - else - { - if(NOQUIET) error1("ID3v2: Arrg! Unable to allocate %lu bytes for interpreting ID3v2 data - trying to skip instead.", length); - if((ret2 = fr->rd->skip_bytes(fr,length)) < 0) ret = ret2; /* will not store data in backbuff! */ - else ret = 0; - } - } -#endif /* NO_ID3V2 */ - /* skip footer if present */ - if((ret > 0) && (flags & FOOTER_FLAG) && ((ret2 = fr->rd->skip_bytes(fr,length)) < 0)) ret = ret2; - - return ret; - #undef UNSYNC_FLAG - #undef EXTHEAD_FLAG - #undef EXP_FLAG - #undef FOOTER_FLAG - #undef UNKOWN_FLAGS -} - -#ifndef NO_ID3V2 /* Disabling all the rest... */ - -static void convert_latin1(mpg123_string *sb, const unsigned char* s, size_t l, const int noquiet) -{ - size_t length = l; - size_t i; - unsigned char *p; - /* determine real length, a latin1 character can at most take 2 in UTF8 */ - for(i=0; i= 0x80) ++length; - - debug1("UTF-8 length: %lu", (unsigned long)length); - /* one extra zero byte for paranoia */ - if(!mpg123_resize_string(sb, length+1)){ mpg123_free_string(sb); return ; } - - p = (unsigned char*) sb->p; /* Signedness doesn't matter but it shows I thought about the non-issue */ - for(i=0; i>6); - *(p+1) = 0x80 | (s[i] & 0x3f); - p+=2; - } - - sb->p[length] = 0; - sb->fill = length+1; -} - -/* - Check if we have a byte oder mark(s) there, return: - -1: little endian - 0: no BOM - 1: big endian - - This modifies source and len to indicate the data _after_ the BOM(s). - Note on nasty data: The last encountered BOM determines the endianness. - I have seen data with multiple BOMS, namely from "the" id3v2 program. - Not nice, but what should I do? -*/ -static int check_bom(const unsigned char** source, size_t *len) -{ - int this_bom = 0; - int further_bom = 0; - - if(*len < 2) return 0; - - if((*source)[0] == 0xff && (*source)[1] == 0xfe) - this_bom = -1; - - if((*source)[0] == 0xfe && (*source)[1] == 0xff) - this_bom = 1; - - /* Skip the detected BOM. */ - if(this_bom != 0) - { - *source += 2; - *len -= 2; - /* Check for following BOMs. The last one wins! */ - further_bom = check_bom(source, len); - if(further_bom == 0) return this_bom; /* End of the recursion. */ - else return further_bom; - } - else return 0; -} - -#define FULLPOINT(f,s) ( (((f)&0x3ff)<<10) + ((s)&0x3ff) + 0x10000 ) -/* Remember: There's a limit at 0x1ffff. */ -#define UTF8LEN(x) ( (x)<0x80 ? 1 : ((x)<0x800 ? 2 : ((x)<0x10000 ? 3 : 4))) -static void convert_utf16bom(mpg123_string *sb, const unsigned char* s, size_t l, const int noquiet) -{ - size_t i; - size_t n; /* number bytes that make up full pairs */ - unsigned char *p; - size_t length = 0; /* the resulting UTF-8 length */ - /* Determine real length... extreme case can be more than utf-16 length. */ - size_t high = 0; - size_t low = 1; - int bom_endian; - - debug1("convert_utf16 with length %lu", (unsigned long)l); - - bom_endian = check_bom(&s, &l); - debug1("UTF16 endianness check: %i", bom_endian); - - if(bom_endian == -1) /* little-endian */ - { - high = 1; /* The second byte is the high byte. */ - low = 0; /* The first byte is the low byte. */ - } - - n = (l/2)*2; /* number bytes that make up full pairs */ - - /* first: get length, check for errors -- stop at first one */ - for(i=0; i < n; i+=2) - { - unsigned long point = ((unsigned long) s[i+high]<<8) + s[i+low]; - if((point & 0xd800) == 0xd800) /* lead surrogate */ - { - unsigned short second = (i+3 < l) ? (s[i+2+high]<<8) + s[i+2+low] : 0; - if((second & 0xdc00) == 0xdc00) /* good... */ - { - point = FULLPOINT(point,second); - length += UTF8LEN(point); /* possibly 4 bytes */ - i+=2; /* We overstepped one word. */ - } - else /* if no valid pair, break here */ - { - if(noquiet) error2("Invalid UTF16 surrogate pair at %li (0x%04lx).", (unsigned long)i, point); - n = i; /* Forget the half pair, END! */ - break; - } - } - else length += UTF8LEN(point); /* 1,2 or 3 bytes */ - } - - if(!mpg123_resize_string(sb, length+1)){ mpg123_free_string(sb); return ; } - - /* Now really convert, skip checks as these have been done just before. */ - p = (unsigned char*) sb->p; /* Signedness doesn't matter but it shows I thought about the non-issue */ - for(i=0; i < n; i+=2) - { - unsigned long codepoint = ((unsigned long) s[i+high]<<8) + s[i+low]; - if((codepoint & 0xd800) == 0xd800) /* lead surrogate */ - { - unsigned short second = (s[i+2+high]<<8) + s[i+2+low]; - codepoint = FULLPOINT(codepoint,second); - i+=2; /* We overstepped one word. */ - } - if(codepoint < 0x80) *p++ = (unsigned char) codepoint; - else if(codepoint < 0x800) - { - *p++ = (unsigned char) (0xc0 | (codepoint>>6)); - *p++ = (unsigned char) (0x80 | (codepoint & 0x3f)); - } - else if(codepoint < 0x10000) - { - *p++ = (unsigned char) (0xe0 | (codepoint>>12)); - *p++ = 0x80 | ((codepoint>>6) & 0x3f); - *p++ = 0x80 | (codepoint & 0x3f); - } - else if (codepoint < 0x200000) - { - *p++ = (unsigned char) (0xf0 | codepoint>>18); - *p++ = (unsigned char) (0x80 | ((codepoint>>12) & 0x3f)); - *p++ = (unsigned char) (0x80 | ((codepoint>>6) & 0x3f)); - *p++ = (unsigned char) (0x80 | (codepoint & 0x3f)); - } /* ignore bigger ones (that are not possible here anyway) */ - } - sb->p[sb->size-1] = 0; /* paranoia... */ - sb->fill = sb->size; -} -#undef UTF8LEN -#undef FULLPOINT - -static void convert_utf8(mpg123_string *sb, const unsigned char* source, size_t len, const int noquiet) -{ - if(mpg123_resize_string(sb, len+1)) - { - memcpy(sb->p, source, len); - sb->p[len] = 0; - sb->fill = len+1; - } - else mpg123_free_string(sb); -} - -#endif diff --git a/Frameworks/mpg123/mpg123/index.c b/Frameworks/mpg123/mpg123/index.c deleted file mode 100644 index bb5af3271..000000000 --- a/Frameworks/mpg123/mpg123/index.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - index: frame index data structure and functions - - copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Thomas Orgis -*/ - -#include "index.h" -#include "debug.h" - -/* The next expected frame offset, one step ahead. */ -static off_t fi_next(struct frame_index *fi) -{ - return (off_t)fi->fill*fi->step; -} - -/* Shrink down the used index to the half. - Be careful with size = 1 ... there's no shrinking possible there. */ -static void fi_shrink(struct frame_index *fi) -{ - if(fi->fill < 2) return; /* Won't shrink below 1. */ - else - { /* Double the step, half the fill. Should work as well for fill%2 = 1 */ - size_t c; - debug2("shrink index with fill %lu and step %lu", (unsigned long)fi->fill, (unsigned long)fi->step); - fi->step *= 2; - fi->fill /= 2; - /* Move the data down. */ - for(c = 0; c < fi->fill; ++c) - fi->data[c] = fi->data[2*c]; - } - - fi->next = fi_next(fi); -} - -void fi_init(struct frame_index *fi) -{ - fi->data = NULL; - fi->step = 1; - fi->fill = 0; - fi->size = 0; - fi->grow_size = 0; - fi->next = fi_next(fi); -} - -void fi_exit(struct frame_index *fi) -{ - debug2("fi_exit: %p and %lu", (void*)fi->data, (unsigned long)fi->size); - if(fi->size && fi->data != NULL) free(fi->data); - - fi_init(fi); /* Be prepared for further fun, still. */ -} - -int fi_resize(struct frame_index *fi, size_t newsize) -{ - off_t *newdata = NULL; - if(newsize == fi->size) return 0; - - if(newsize > 0 && newsize < fi->size) - { /* When we reduce buffer size a bit, shrink stuff. */ - while(fi->fill > newsize){ fi_shrink(fi); } - } - - newdata = safe_realloc(fi->data, newsize*sizeof(off_t)); - if(newsize == 0 || newdata != NULL) - { - fi->data = newdata; - fi->size = newsize; - if(fi->fill > fi->size) fi->fill = fi->size; - - fi->next = fi_next(fi); - debug2("new index of size %lu at %p", (unsigned long)fi->size, (void*)fi->data); - return 0; - } - else - { - error("failed to resize index!"); - return -1; - } -} - -void fi_add(struct frame_index *fi, off_t pos) -{ - debug3("wanting to add to fill %lu, step %lu, size %lu", (unsigned long)fi->fill, (unsigned long)fi->step, (unsigned long)fi->size); - if(fi->fill == fi->size) - { /* Index is full, we need to shrink... or grow. */ - /* Store the current frame number to check later if we still want it. */ - off_t framenum = fi->fill*fi->step; - /* If we want not / cannot grow, we shrink. */ - if( !(fi->grow_size && fi_resize(fi, fi->size+fi->grow_size)==0) ) - fi_shrink(fi); - - /* Now check if we still want to add this frame (could be that not, because of changed step). */ - if(fi->next != framenum) return; - } - /* When we are here, we want that frame. */ - if(fi->fill < fi->size) /* safeguard for size=1, or just generally */ - { - debug1("adding to index at %p", (void*)(fi->data+fi->fill)); - fi->data[fi->fill] = pos; - ++fi->fill; - fi->next = fi_next(fi); - debug3("added pos %li to index with fill %lu and step %lu", (long) pos, (unsigned long)fi->fill, (unsigned long)fi->step); - } -} - -int fi_set(struct frame_index *fi, off_t *offsets, off_t step, size_t fill) -{ - if(fi_resize(fi, fill) == -1) return -1; - fi->step = step; - if(offsets != NULL) - { - memcpy(fi->data, offsets, fill*sizeof(off_t)); - fi->fill = fill; - } - else - { - /* allocation only, no entries in index yet */ - fi->fill = 0; - } - fi->next = fi_next(fi); - debug3("set new index of fill %lu, size %lu at %p", - (unsigned long)fi->fill, (unsigned long)fi->size, (void*)fi->data); - return 0; -} - -void fi_reset(struct frame_index *fi) -{ - debug1("reset with size %"SIZE_P, (size_p)fi->size); - fi->fill = 0; - fi->step = 1; - fi->next = fi_next(fi); -} diff --git a/Frameworks/mpg123/mpg123/intsym.h b/Frameworks/mpg123/mpg123/intsym.h deleted file mode 100644 index ba2aba3eb..000000000 --- a/Frameworks/mpg123/mpg123/intsym.h +++ /dev/null @@ -1,271 +0,0 @@ -#ifndef MPG123_INTMAP_H -#define MPG123_INTMAP_H -/* Mapping of internal mpg123 symbols to something that is less likely to conflict in case of static linking. */ -#define COS9 INT123_COS9 -#define tfcos36 INT123_tfcos36 -#define pnts INT123_pnts -#define safe_realloc INT123_safe_realloc -#define compat_open INT123_compat_open -#define compat_close INT123_compat_close -#define win32_wide_utf8 INT123_win32_wide_utf8 -#define win32_utf8_wide INT123_win32_utf8_wide -#define ntom_set_ntom INT123_ntom_set_ntom -#define synth_1to1 INT123_synth_1to1 -#define synth_1to1_dither INT123_synth_1to1_dither -#define synth_1to1_i386 INT123_synth_1to1_i386 -#define synth_1to1_i586 INT123_synth_1to1_i586 -#define synth_1to1_i586_dither INT123_synth_1to1_i586_dither -#define synth_1to1_mmx INT123_synth_1to1_mmx -#define synth_1to1_3dnow INT123_synth_1to1_3dnow -#define synth_1to1_sse INT123_synth_1to1_sse -#define synth_1to1_stereo_sse INT123_synth_1to1_stereo_sse -#define synth_1to1_3dnowext INT123_synth_1to1_3dnowext -#define synth_1to1_altivec INT123_synth_1to1_altivec -#define synth_1to1_stereo_altivec INT123_synth_1to1_stereo_altivec -#define synth_1to1_x86_64 INT123_synth_1to1_x86_64 -#define synth_1to1_stereo_x86_64 INT123_synth_1to1_stereo_x86_64 -#define synth_1to1_avx INT123_synth_1to1_avx -#define synth_1to1_stereo_avx INT123_synth_1to1_stereo_avx -#define synth_1to1_arm INT123_synth_1to1_arm -#define synth_1to1_neon INT123_synth_1to1_neon -#define synth_1to1_stereo_neon INT123_synth_1to1_stereo_neon -#define absynth_1to1_i486 INT123_absynth_1to1_i486 -#define synth_1to1_mono INT123_synth_1to1_mono -#define synth_1to1_m2s INT123_synth_1to1_m2s -#define synth_2to1 INT123_synth_2to1 -#define synth_2to1_dither INT123_synth_2to1_dither -#define synth_2to1_i386 INT123_synth_2to1_i386 -#define synth_2to1_mono INT123_synth_2to1_mono -#define synth_2to1_m2s INT123_synth_2to1_m2s -#define synth_4to1 INT123_synth_4to1 -#define synth_4to1_dither INT123_synth_4to1_dither -#define synth_4to1_i386 INT123_synth_4to1_i386 -#define synth_4to1_mono INT123_synth_4to1_mono -#define synth_4to1_m2s INT123_synth_4to1_m2s -#define synth_ntom INT123_synth_ntom -#define synth_ntom_mono INT123_synth_ntom_mono -#define synth_ntom_m2s INT123_synth_ntom_m2s -#define synth_1to1_8bit INT123_synth_1to1_8bit -#define synth_1to1_8bit_i386 INT123_synth_1to1_8bit_i386 -#define synth_1to1_8bit_wrap INT123_synth_1to1_8bit_wrap -#define synth_1to1_8bit_mono INT123_synth_1to1_8bit_mono -#define synth_1to1_8bit_m2s INT123_synth_1to1_8bit_m2s -#define synth_1to1_8bit_wrap_mono INT123_synth_1to1_8bit_wrap_mono -#define synth_1to1_8bit_wrap_m2s INT123_synth_1to1_8bit_wrap_m2s -#define synth_2to1_8bit INT123_synth_2to1_8bit -#define synth_2to1_8bit_i386 INT123_synth_2to1_8bit_i386 -#define synth_2to1_8bit_mono INT123_synth_2to1_8bit_mono -#define synth_2to1_8bit_m2s INT123_synth_2to1_8bit_m2s -#define synth_4to1_8bit INT123_synth_4to1_8bit -#define synth_4to1_8bit_i386 INT123_synth_4to1_8bit_i386 -#define synth_4to1_8bit_mono INT123_synth_4to1_8bit_mono -#define synth_4to1_8bit_m2s INT123_synth_4to1_8bit_m2s -#define synth_ntom_8bit INT123_synth_ntom_8bit -#define synth_ntom_8bit_mono INT123_synth_ntom_8bit_mono -#define synth_ntom_8bit_m2s INT123_synth_ntom_8bit_m2s -#define synth_1to1_real INT123_synth_1to1_real -#define synth_1to1_real_i386 INT123_synth_1to1_real_i386 -#define synth_1to1_real_sse INT123_synth_1to1_real_sse -#define synth_1to1_real_stereo_sse INT123_synth_1to1_real_stereo_sse -#define synth_1to1_real_x86_64 INT123_synth_1to1_real_x86_64 -#define synth_1to1_real_stereo_x86_64 INT123_synth_1to1_real_stereo_x86_64 -#define synth_1to1_real_avx INT123_synth_1to1_real_avx -#define synth_1to1_real_stereo_avx INT123_synth_1to1_real_stereo_avx -#define synth_1to1_real_altivec INT123_synth_1to1_real_altivec -#define synth_1to1_real_stereo_altivec INT123_synth_1to1_real_stereo_altivec -#define synth_1to1_real_neon INT123_synth_1to1_real_neon -#define synth_1to1_real_stereo_neon INT123_synth_1to1_real_stereo_neon -#define synth_1to1_real_mono INT123_synth_1to1_real_mono -#define synth_1to1_real_m2s INT123_synth_1to1_real_m2s -#define synth_2to1_real INT123_synth_2to1_real -#define synth_2to1_real_i386 INT123_synth_2to1_real_i386 -#define synth_2to1_real_mono INT123_synth_2to1_real_mono -#define synth_2to1_real_m2s INT123_synth_2to1_real_m2s -#define synth_4to1_real INT123_synth_4to1_real -#define synth_4to1_real_i386 INT123_synth_4to1_real_i386 -#define synth_4to1_real_mono INT123_synth_4to1_real_mono -#define synth_4to1_real_m2s INT123_synth_4to1_real_m2s -#define synth_ntom_real INT123_synth_ntom_real -#define synth_ntom_real_mono INT123_synth_ntom_real_mono -#define synth_ntom_real_m2s INT123_synth_ntom_real_m2s -#define synth_1to1_s32 INT123_synth_1to1_s32 -#define synth_1to1_s32_i386 INT123_synth_1to1_s32_i386 -#define synth_1to1_s32_sse INT123_synth_1to1_s32_sse -#define synth_1to1_s32_stereo_sse INT123_synth_1to1_s32_stereo_sse -#define synth_1to1_s32_x86_64 INT123_synth_1to1_s32_x86_64 -#define synth_1to1_s32_stereo_x86_64 INT123_synth_1to1_s32_stereo_x86_64 -#define synth_1to1_s32_avx INT123_synth_1to1_s32_avx -#define synth_1to1_s32_stereo_avx INT123_synth_1to1_s32_stereo_avx -#define synth_1to1_s32_altivec INT123_synth_1to1_s32_altivec -#define synth_1to1_s32_stereo_altivec INT123_synth_1to1_s32_stereo_altivec -#define synth_1to1_s32_neon INT123_synth_1to1_s32_neon -#define synth_1to1_s32_stereo_neon INT123_synth_1to1_s32_stereo_neon -#define synth_1to1_s32_mono INT123_synth_1to1_s32_mono -#define synth_1to1_s32_m2s INT123_synth_1to1_s32_m2s -#define synth_2to1_s32 INT123_synth_2to1_s32 -#define synth_2to1_s32_i386 INT123_synth_2to1_s32_i386 -#define synth_2to1_s32_mono INT123_synth_2to1_s32_mono -#define synth_2to1_s32_m2s INT123_synth_2to1_s32_m2s -#define synth_4to1_s32 INT123_synth_4to1_s32 -#define synth_4to1_s32_i386 INT123_synth_4to1_s32_i386 -#define synth_4to1_s32_mono INT123_synth_4to1_s32_mono -#define synth_4to1_s32_m2s INT123_synth_4to1_s32_m2s -#define synth_ntom_s32 INT123_synth_ntom_s32 -#define synth_ntom_s32_mono INT123_synth_ntom_s32_mono -#define synth_ntom_s32_m2s INT123_synth_ntom_s32_m2s -#define dct64 INT123_dct64 -#define dct64_i386 INT123_dct64_i386 -#define dct64_altivec INT123_dct64_altivec -#define dct64_i486 INT123_dct64_i486 -#define dct36 INT123_dct36 -#define dct36_3dnow INT123_dct36_3dnow -#define dct36_3dnowext INT123_dct36_3dnowext -#define dct36_sse INT123_dct36_sse -#define dct36_x86_64 INT123_dct36_x86_64 -#define dct36_avx INT123_dct36_avx -#define synth_ntom_set_step INT123_synth_ntom_set_step -#define ntom_val INT123_ntom_val -#define ntom_frame_outsamples INT123_ntom_frame_outsamples -#define ntom_frmouts INT123_ntom_frmouts -#define ntom_ins2outs INT123_ntom_ins2outs -#define ntom_frameoff INT123_ntom_frameoff -#define init_layer3 INT123_init_layer3 -#define init_layer3_gainpow2 INT123_init_layer3_gainpow2 -#define init_layer3_stuff INT123_init_layer3_stuff -#define init_layer12 INT123_init_layer12 -#define init_layer12_table INT123_init_layer12_table -#define init_layer12_stuff INT123_init_layer12_stuff -#define prepare_decode_tables INT123_prepare_decode_tables -#define make_decode_tables INT123_make_decode_tables -#define make_decode_tables_mmx INT123_make_decode_tables_mmx -#define init_layer3_gainpow2_mmx INT123_init_layer3_gainpow2_mmx -#define init_layer12_table_mmx INT123_init_layer12_table_mmx -#define make_conv16to8_table INT123_make_conv16to8_table -#define do_layer3 INT123_do_layer3 -#define do_layer2 INT123_do_layer2 -#define do_layer1 INT123_do_layer1 -#define do_equalizer INT123_do_equalizer -#define dither_table_init INT123_dither_table_init -#define frame_dither_init INT123_frame_dither_init -#define invalidate_format INT123_invalidate_format -#define frame_init INT123_frame_init -#define frame_init_par INT123_frame_init_par -#define frame_outbuffer INT123_frame_outbuffer -#define frame_output_format INT123_frame_output_format -#define frame_buffers INT123_frame_buffers -#define frame_reset INT123_frame_reset -#define frame_buffers_reset INT123_frame_buffers_reset -#define frame_exit INT123_frame_exit -#define frame_index_find INT123_frame_index_find -#define frame_index_setup INT123_frame_index_setup -#define do_volume INT123_do_volume -#define do_rva INT123_do_rva -#define frame_gapless_init INT123_frame_gapless_init -#define frame_gapless_realinit INT123_frame_gapless_realinit -#define frame_gapless_update INT123_frame_gapless_update -#define frame_gapless_bytify INT123_frame_gapless_bytify -#define frame_gapless_ignore INT123_frame_gapless_ignore -#define frame_expect_outsamples INT123_frame_expect_outsamples -#define frame_skip INT123_frame_skip -#define frame_ins2outs INT123_frame_ins2outs -#define frame_outs INT123_frame_outs -#define frame_expect_outsampels INT123_frame_expect_outsampels -#define frame_offset INT123_frame_offset -#define frame_set_frameseek INT123_frame_set_frameseek -#define frame_set_seek INT123_frame_set_seek -#define frame_tell_seek INT123_frame_tell_seek -#define frame_fill_toc INT123_frame_fill_toc -#define getbits INT123_getbits -#define getcpuflags INT123_getcpuflags -#define icy2utf8 INT123_icy2utf8 -#define init_icy INT123_init_icy -#define clear_icy INT123_clear_icy -#define reset_icy INT123_reset_icy -#define init_id3 INT123_init_id3 -#define exit_id3 INT123_exit_id3 -#define reset_id3 INT123_reset_id3 -#define id3_link INT123_id3_link -#define parse_new_id3 INT123_parse_new_id3 -#define id3_to_utf8 INT123_id3_to_utf8 -#define fi_init INT123_fi_init -#define fi_exit INT123_fi_exit -#define fi_resize INT123_fi_resize -#define fi_add INT123_fi_add -#define fi_set INT123_fi_set -#define fi_reset INT123_fi_reset -#define double_to_long_rounded INT123_double_to_long_rounded -#define scale_rounded INT123_scale_rounded -#define decode_update INT123_decode_update -#define samples_to_bytes INT123_samples_to_bytes -#define bytes_to_samples INT123_bytes_to_samples -#define frame_cpu_opt INT123_frame_cpu_opt -#define set_synth_functions INT123_set_synth_functions -#define dectype INT123_dectype -#define defdec INT123_defdec -#define decclass INT123_decclass -#define check_decoders INT123_check_decoders -#define read_frame_init INT123_read_frame_init -#define frame_bitrate INT123_frame_bitrate -#define frame_freq INT123_frame_freq -#define read_frame_recover INT123_read_frame_recover -#define read_frame INT123_read_frame -#define set_pointer INT123_set_pointer -#define position_info INT123_position_info -#define compute_bpf INT123_compute_bpf -#define time_to_frame INT123_time_to_frame -#define get_songlen INT123_get_songlen -#define open_stream INT123_open_stream -#define open_stream_handle INT123_open_stream_handle -#define open_feed INT123_open_feed -#define feed_more INT123_feed_more -#define feed_forget INT123_feed_forget -#define feed_set_pos INT123_feed_set_pos -#define open_bad INT123_open_bad -#define dct64_3dnow INT123_dct64_3dnow -#define dct64_3dnowext INT123_dct64_3dnowext -#define dct64_mmx INT123_dct64_mmx -#define dct64_MMX INT123_dct64_MMX -#define dct64_sse INT123_dct64_sse -#define dct64_real_sse INT123_dct64_real_sse -#define dct64_x86_64 INT123_dct64_x86_64 -#define dct64_real_x86_64 INT123_dct64_real_x86_64 -#define dct64_avx INT123_dct64_avx -#define dct64_real_avx INT123_dct64_real_avx -#define dct64_neon INT123_dct64_neon -#define dct64_real_neon INT123_dct64_real_neon -#define do_equalizer_3dnow INT123_do_equalizer_3dnow -#define synth_1to1_3dnow_asm INT123_synth_1to1_3dnow_asm -#define synth_1to1_arm_asm INT123_synth_1to1_arm_asm -#define synth_1to1_arm_accurate_asm INT123_synth_1to1_arm_accurate_asm -#define synth_1to1_i586_asm INT123_synth_1to1_i586_asm -#define synth_1to1_i586_asm_dither INT123_synth_1to1_i586_asm_dither -#define synth_1to1_MMX INT123_synth_1to1_MMX -#define synth_1to1_sse_accurate_asm INT123_synth_1to1_sse_accurate_asm -#define synth_1to1_real_sse_asm INT123_synth_1to1_real_sse_asm -#define synth_1to1_s32_sse_asm INT123_synth_1to1_s32_sse_asm -#define synth_1to1_s_sse_accurate_asm INT123_synth_1to1_s_sse_accurate_asm -#define synth_1to1_real_s_sse_asm INT123_synth_1to1_real_s_sse_asm -#define synth_1to1_s32_s_sse_asm INT123_synth_1to1_s32_s_sse_asm -#define synth_1to1_s_x86_64_asm INT123_synth_1to1_s_x86_64_asm -#define synth_1to1_s_x86_64_accurate_asm INT123_synth_1to1_s_x86_64_accurate_asm -#define synth_1to1_real_s_x86_64_asm INT123_synth_1to1_real_s_x86_64_asm -#define synth_1to1_s32_s_x86_64_asm INT123_synth_1to1_s32_s_x86_64_asm -#define synth_1to1_x86_64_asm INT123_synth_1to1_x86_64_asm -#define synth_1to1_x86_64_accurate_asm INT123_synth_1to1_x86_64_accurate_asm -#define synth_1to1_real_x86_64_asm INT123_synth_1to1_real_x86_64_asm -#define synth_1to1_s32_x86_64_asm INT123_synth_1to1_s32_x86_64_asm -#define synth_1to1_s_avx_asm INT123_synth_1to1_s_avx_asm -#define synth_1to1_s_avx_accurate_asm INT123_synth_1to1_s_avx_accurate_asm -#define synth_1to1_real_s_avx_asm INT123_synth_1to1_real_s_avx_asm -#define synth_1to1_s32_s_avx_asm INT123_synth_1to1_s32_s_avx_asm -#define synth_1to1_neon_asm INT123_synth_1to1_neon_asm -#define synth_1to1_neon_accurate_asm INT123_synth_1to1_neon_accurate_asm -#define synth_1to1_real_neon_asm INT123_synth_1to1_real_neon_asm -#define synth_1to1_s32_neon_asm INT123_synth_1to1_s32_neon_asm -#define synth_1to1_s_neon_asm INT123_synth_1to1_s_neon_asm -#define synth_1to1_s_neon_accurate_asm INT123_synth_1to1_s_neon_accurate_asm -#define synth_1to1_real_s_neon_asm INT123_synth_1to1_real_s_neon_asm -#define synth_1to1_s32_s_neon_asm INT123_synth_1to1_s32_s_neon_asm -#define costab_mmxsse INT123_costab_mmxsse -#define make_decode_tables_mmx_asm INT123_make_decode_tables_mmx_asm -#endif diff --git a/Frameworks/mpg123/mpg123/l12_integer_tables.h b/Frameworks/mpg123/mpg123/l12_integer_tables.h deleted file mode 100644 index e306fa961..000000000 --- a/Frameworks/mpg123/mpg123/l12_integer_tables.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - l12_integer_tables.h: Layer1/2 Constant tables for integer decoders - - copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Taihei Monma -*/ - -#ifndef MPG123_L12_INTEGER_TABLES_H -#define MPG123_L12_INTEGER_TABLES_H - -static const real layer12_table[27][64] = -{ - { - }, - { - -1431655765,-1136305934,-901886617,-715827883,-568152967,-450943309,-357913941,-284076483, - -225471654,-178956971,-142038242,-112735827,-89478485,-71019121,-56367914,-44739243, - -35509560,-28183957,-22369621,-17754780,-14091978,-11184811,-8877390,-7045989, - -5592405,-4438695,-3522995,-2796203,-2219348,-1761497,-1398101,-1109674, - -880749,-699051,-554837,-440374,-349525,-277418,-220187,-174763, - -138709,-110094,-87381,-69355,-55047,-43691,-34677,-27523, - -21845,-17339,-13762,-10923,-8669,-6881,-5461,-4335, - -3440,-2731,-2167,-1720,-1365,-1084,-860,0 - }, - { - 1431655765,1136305934,901886617,715827883,568152967,450943309,357913941,284076483, - 225471654,178956971,142038242,112735827,89478485,71019121,56367914,44739243, - 35509560,28183957,22369621,17754780,14091978,11184811,8877390,7045989, - 5592405,4438695,3522995,2796203,2219348,1761497,1398101,1109674, - 880749,699051,554837,440374,349525,277418,220187,174763, - 138709,110094,87381,69355,55047,43691,34677,27523, - 21845,17339,13762,10923,8669,6881,5461,4335, - 3440,2731,2167,1720,1365,1084,860,0 - }, - { - 613566757,486988257,386522836,306783378,243494129,193261418,153391689,121747064, - 96630709,76695845,60873532,48315355,38347922,30436766,24157677,19173961, - 15218383,12078839,9586981,7609192,6039419,4793490,3804596,3019710, - 2396745,1902298,1509855,1198373,951149,754927,599186,475574, - 377464,299593,237787,188732,149797,118894,94366,74898, - 59447,47183,37449,29723,23591,18725,14862,11796, - 9362,7431,5898,4681,3715,2949,2341,1858, - 1474,1170,929,737,585,464,369,0 - }, - { - 286331153,227261187,180377323,143165577,113630593,90188662,71582788,56815297, - 45094331,35791394,28407648,22547165,17895697,14203824,11273583,8947849, - 7101912,5636791,4473924,3550956,2818396,2236962,1775478,1409198, - 1118481,887739,704599,559241,443870,352299,279620,221935, - 176150,139810,110967,88075,69905,55484,44037,34953, - 27742,22019,17476,13871,11009,8738,6935,5505, - 4369,3468,2752,2185,1734,1376,1092,867, - 688,546,433,344,273,217,172,0 - }, - { - 138547332,109965090,87279350,69273666,54982545,43639675,34636833,27491273, - 21819838,17318417,13745636,10909919,8659208,6872818,5454959,4329604, - 3436409,2727480,2164802,1718205,1363740,1082401,859102,681870, - 541201,429551,340935,270600,214776,170467,135300,107388, - 85234,67650,53694,42617,33825,26847,21308,16913, - 13423,10654,8456,6712,5327,4228,3356,2664, - 2114,1678,1332,1057,839,666,529,419, - 333,264,210,166,132,105,83,0 - }, - { - 68174084,54109806,42946982,34087042,27054903,21473491,17043521,13527452, - 10736745,8521761,6763726,5368373,4260880,3381863,2684186,2130440, - 1690931,1342093,1065220,845466,671047,532610,422733,335523, - 266305,211366,167762,133153,105683,83881,66576,52842, - 41940,33288,26421,20970,16644,13210,10485,8322, - 6605,5243,4161,3303,2621,2081,1651,1311, - 1040,826,655,520,413,328,260,206, - 164,130,103,82,65,52,41,0 - }, - { - 33818640,26841872,21304408,16909320,13420936,10652204,8454660,6710468, - 5326102,4227330,3355234,2663051,2113665,1677617,1331526,1056833, - 838809,665763,528416,419404,332881,264208,209702,166441, - 132104,104851,83220,66052,52426,41610,33026,26213, - 20805,16513,13106,10403,8257,6553,5201,4128, - 3277,2601,2064,1638,1300,1032,819,650, - 516,410,325,258,205,163,129,102, - 81,65,51,41,32,26,20,0 - }, - { - 16843009,13368305,10610431,8421505,6684153,5305215,4210752,3342076, - 2652608,2105376,1671038,1326304,1052688,835519,663152,526344, - 417760,331576,263172,208880,165788,131586,104440,82894, - 65793,52220,41447,32897,26110,20723,16448,13055, - 10362,8224,6527,5181,4112,3264,2590,2056, - 1632,1295,1028,816,648,514,408,324, - 257,204,162,129,102,81,64,51, - 40,32,25,20,16,13,10,0 - }, - { - 8405024,6671072,5294833,4202512,3335536,2647417,2101256,1667768, - 1323708,1050628,833884,661854,525314,416942,330927,262657, - 208471,165464,131329,104236,82732,65664,52118,41366, - 32832,26059,20683,16416,13029,10341,8208,6515, - 5171,4104,3257,2585,2052,1629,1293,1026, - 814,646,513,407,323,257,204,162, - 128,102,81,64,51,40,32,25, - 20,16,13,10,8,6,5,0 - }, - { - 4198404,3332275,2644829,2099202,1666138,1322414,1049601,833069, - 661207,524801,416534,330604,262400,208267,165302,131200, - 104134,82651,65600,52067,41325,32800,26033,20663, - 16400,13017,10331,8200,6508,5166,4100,3254, - 2583,2050,1627,1291,1025,814,646,513, - 407,323,256,203,161,128,102,81, - 64,51,40,32,25,20,16,13, - 10,8,6,5,4,3,3,0 - }, - { - 2098177,1665324,1321768,1049088,832662,660884,524544,416331, - 330442,262272,208165,165221,131136,104083,82611,65568, - 52041,41305,32784,26021,20653,16392,13010,10326, - 8196,6505,5163,4098,3253,2582,2049,1626, - 1291,1025,813,645,512,407,323,256, - 203,161,128,102,81,64,51,40, - 32,25,20,16,13,10,8,6, - 5,4,3,3,2,2,1,0 - }, - { - 1048832,832459,660723,524416,416229,330361,262208,208115, - 165181,131104,104057,82590,65552,52029,41295,32776, - 26014,20648,16388,13007,10324,8194,6504,5162, - 4097,3252,2581,2049,1626,1290,1024,813, - 645,512,406,323,256,203,161,128, - 102,81,64,51,40,32,25,20, - 16,13,10,8,6,5,4,3, - 3,2,2,1,1,1,1,0 - }, - { - 524352,416178,330321,262176,208089,165161,131088,104045, - 82580,65544,52022,41290,32772,26011,20645,16386, - 13006,10323,8193,6503,5161,4097,3251,2581, - 2048,1626,1290,1024,813,645,512,406, - 323,256,203,161,128,102,81,64, - 51,40,32,25,20,16,13,10, - 8,6,5,4,3,3,2,2, - 1,1,1,1,1,0,0,0 - }, - { - 262160,208077,165150,131080,104038,82575,65540,52019, - 41288,32770,26010,20644,16385,13005,10322,8193, - 6502,5161,4096,3251,2580,2048,1626,1290, - 1024,813,645,512,406,323,256,203, - 161,128,102,81,64,51,40,32, - 25,20,16,13,10,8,6,5, - 4,3,3,2,2,1,1,1, - 1,1,0,0,0,0,0,0 - }, - { - 131076,104035,82573,65538,52018,41286,32769,26009, - 20643,16385,13004,10322,8192,6502,5161,4096, - 3251,2580,2048,1626,1290,1024,813,645, - 512,406,323,256,203,161,128,102, - 81,64,51,40,32,25,20,16, - 13,10,8,6,5,4,3,3, - 2,2,1,1,1,1,1,0, - 0,0,0,0,0,0,0,0 - }, - { - 65537,52017,41286,32769,26008,20643,16384,13004, - 10321,8192,6502,5161,4096,3251,2580,2048, - 1626,1290,1024,813,645,512,406,323, - 256,203,161,128,102,81,64,51, - 40,32,25,20,16,13,10,8, - 6,5,4,3,3,2,2,1, - 1,1,1,1,0,0,0,0, - 0,0,0,0,0,0,0,0 - }, - { - -1717986918,-1363567121,-1082263941,-858993459,-681783560,-541131970,-429496730,-340891780, - -270565985,-214748365,-170445890,-135282993,-107374182,-85222945,-67641496,-53687091, - -42611473,-33820748,-26843546,-21305736,-16910374,-13421773,-10652868,-8455187, - -6710886,-5326434,-4227594,-3355443,-2663217,-2113797,-1677722,-1331609, - -1056898,-838861,-665804,-528449,-419430,-332902,-264225,-209715, - -166451,-132112,-104858,-83226,-66056,-52429,-41613,-33028, - -26214,-20806,-16514,-13107,-10403,-8257,-6554,-5202, - -4129,-3277,-2601,-2064,-1638,-1300,-1032,0 - }, - { - -858993459,-681783560,-541131970,-429496730,-340891780,-270565985,-214748365,-170445890, - -135282993,-107374182,-85222945,-67641496,-53687091,-42611473,-33820748,-26843546, - -21305736,-16910374,-13421773,-10652868,-8455187,-6710886,-5326434,-4227594, - -3355443,-2663217,-2113797,-1677722,-1331609,-1056898,-838861,-665804, - -528449,-419430,-332902,-264225,-209715,-166451,-132112,-104858, - -83226,-66056,-52429,-41613,-33028,-26214,-20806,-16514, - -13107,-10403,-8257,-6554,-5202,-4129,-3277,-2601, - -2064,-1638,-1300,-1032,-819,-650,-516,0 - }, - { - 858993459,681783560,541131970,429496730,340891780,270565985,214748365,170445890, - 135282993,107374182,85222945,67641496,53687091,42611473,33820748,26843546, - 21305736,16910374,13421773,10652868,8455187,6710886,5326434,4227594, - 3355443,2663217,2113797,1677722,1331609,1056898,838861,665804, - 528449,419430,332902,264225,209715,166451,132112,104858, - 83226,66056,52429,41613,33028,26214,20806,16514, - 13107,10403,8257,6554,5202,4129,3277,2601, - 2064,1638,1300,1032,819,650,516,0 - }, - { - 1717986918,1363567121,1082263941,858993459,681783560,541131970,429496730,340891780, - 270565985,214748365,170445890,135282993,107374182,85222945,67641496,53687091, - 42611473,33820748,26843546,21305736,16910374,13421773,10652868,8455187, - 6710886,5326434,4227594,3355443,2663217,2113797,1677722,1331609, - 1056898,838861,665804,528449,419430,332902,264225,209715, - 166451,132112,104858,83226,66056,52429,41613,33028, - 26214,20806,16514,13107,10403,8257,6554,5202, - 4129,3277,2601,2064,1638,1300,1032,0 - }, - { - -1908874354,-1515074579,-1202515490,-954437177,-757537289,-601257745,-477218588,-378768645, - -300628872,-238609294,-189384322,-150314436,-119304647,-94692161,-75157218,-59652324, - -47346081,-37578609,-29826162,-23673040,-18789305,-14913081,-11836520,-9394652, - -7456540,-5918260,-4697326,-3728270,-2959130,-2348663,-1864135,-1479565, - -1174332,-932068,-739783,-587166,-466034,-369891,-293583,-233017, - -184946,-146791,-116508,-92473,-73396,-58254,-46236,-36698, - -29127,-23118,-18349,-14564,-11559,-9174,-7282,-5780, - -4587,-3641,-2890,-2294,-1820,-1445,-1147,0 - }, - { - -954437177,-757537289,-601257745,-477218588,-378768645,-300628872,-238609294,-189384322, - -150314436,-119304647,-94692161,-75157218,-59652324,-47346081,-37578609,-29826162, - -23673040,-18789305,-14913081,-11836520,-9394652,-7456540,-5918260,-4697326, - -3728270,-2959130,-2348663,-1864135,-1479565,-1174332,-932068,-739783, - -587166,-466034,-369891,-293583,-233017,-184946,-146791,-116508, - -92473,-73396,-58254,-46236,-36698,-29127,-23118,-18349, - -14564,-11559,-9174,-7282,-5780,-4587,-3641,-2890, - -2294,-1820,-1445,-1147,-910,-722,-573,0 - }, - { - -477218588,-378768645,-300628872,-238609294,-189384322,-150314436,-119304647,-94692161, - -75157218,-59652324,-47346081,-37578609,-29826162,-23673040,-18789305,-14913081, - -11836520,-9394652,-7456540,-5918260,-4697326,-3728270,-2959130,-2348663, - -1864135,-1479565,-1174332,-932068,-739783,-587166,-466034,-369891, - -293583,-233017,-184946,-146791,-116508,-92473,-73396,-58254, - -46236,-36698,-29127,-23118,-18349,-14564,-11559,-9174, - -7282,-5780,-4587,-3641,-2890,-2294,-1820,-1445, - -1147,-910,-722,-573,-455,-361,-287,0 - }, - { - 477218588,378768645,300628872,238609294,189384322,150314436,119304647,94692161, - 75157218,59652324,47346081,37578609,29826162,23673040,18789305,14913081, - 11836520,9394652,7456540,5918260,4697326,3728270,2959130,2348663, - 1864135,1479565,1174332,932068,739783,587166,466034,369891, - 293583,233017,184946,146791,116508,92473,73396,58254, - 46236,36698,29127,23118,18349,14564,11559,9174, - 7282,5780,4587,3641,2890,2294,1820,1445, - 1147,910,722,573,455,361,287,0 - }, - { - 954437177,757537289,601257745,477218588,378768645,300628872,238609294,189384322, - 150314436,119304647,94692161,75157218,59652324,47346081,37578609,29826162, - 23673040,18789305,14913081,11836520,9394652,7456540,5918260,4697326, - 3728270,2959130,2348663,1864135,1479565,1174332,932068,739783, - 587166,466034,369891,293583,233017,184946,146791,116508, - 92473,73396,58254,46236,36698,29127,23118,18349, - 14564,11559,9174,7282,5780,4587,3641,2890, - 2294,1820,1445,1147,910,722,573,0 - }, - { - 1908874354,1515074579,1202515490,954437177,757537289,601257745,477218588,378768645, - 300628872,238609294,189384322,150314436,119304647,94692161,75157218,59652324, - 47346081,37578609,29826162,23673040,18789305,14913081,11836520,9394652, - 7456540,5918260,4697326,3728270,2959130,2348663,1864135,1479565, - 1174332,932068,739783,587166,466034,369891,293583,233017, - 184946,146791,116508,92473,73396,58254,46236,36698, - 29127,23118,18349,14564,11559,9174,7282,5780, - 4587,3641,2890,2294,1820,1445,1147,0 - }, -}; - -#endif diff --git a/Frameworks/mpg123/mpg123/l3_integer_tables.h b/Frameworks/mpg123/mpg123/l3_integer_tables.h deleted file mode 100644 index f600c3115..000000000 --- a/Frameworks/mpg123/mpg123/l3_integer_tables.h +++ /dev/null @@ -1,1002 +0,0 @@ -/* - l3_integer_tables.h: Layer3 Constant tables for integer decoders - - copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Taihei Monma -*/ - -#ifndef MPG123_L3_INTEGER_TABLES_H -#define MPG123_L3_INTEGER_TABLES_H - -#ifdef PRECALC_TABLES -static const real ispow[8207] = -{ - 0,8192,20643,35445,52016,70041,89315,109695,131072,153360, - 176491,200407,225060,250408,276414,303048,330281,358087,386444,415331, - 444730,474623,504995,535830,567116,598839,630988,663552,696521,729884, - 763633,797760,832255,867112,902323,937880,973778,1010010,1046569,1083451, - 1120650,1158160,1195976,1234093,1272507,1311213,1350207,1389485,1429042,1468875, - 1508979,1549352,1589990,1630889,1672046,1713458,1755122,1797035,1839193,1881594, - 1924236,1967115,2010229,2053576,2097152,2140956,2184985,2229238,2273710,2318402, - 2363310,2408432,2453767,2499312,2545065,2591025,2637190,2683558,2730126,2776895, - 2823861,2871023,2918379,2965929,3013670,3061600,3109719,3158025,3206517,3255192, - 3304050,3353089,3402309,3451707,3501282,3551033,3600960,3651060,3701332,3751776, - 3802390,3853172,3904123,3955241,4006524,4057972,4109583,4161357,4213293,4265389, - 4317644,4370058,4422630,4475359,4528243,4581282,4634476,4687822,4741320,4794970, - 4848770,4902720,4956819,5011066,5065460,5120000,5174686,5229517,5284492,5339610, - 5394871,5450274,5505818,5561502,5617327,5673290,5729391,5785631,5842007,5898519, - 5955168,6011951,6068869,6125920,6183105,6240422,6297871,6355451,6413162,6471004, - 6528974,6587074,6645302,6703658,6762141,6820751,6879487,6938349,6997336,7056447, - 7115683,7175042,7234524,7294129,7353855,7413703,7473672,7533762,7593972,7654301, - 7714750,7775317,7836002,7896805,7957725,8018762,8079916,8141185,8202570,8264070, - 8325685,8387413,8449256,8511212,8573281,8635462,8697756,8760161,8822678,8885305, - 8948043,9010892,9073850,9136917,9200094,9263379,9326772,9390274,9453882,9517598, - 9581421,9645351,9709386,9773527,9837774,9902125,9966582,10031143,10095807,10160576, - 10225448,10290423,10355500,10420681,10485963,10551347,10616832,10682419,10748106,10813894, - 10879782,10945770,11011857,11078044,11144330,11210715,11277198,11343779,11410458,11477234, - 11544108,11611079,11678147,11745311,11812571,11879927,11947378,12014925,12082567,12150304, - 12218135,12286061,12354081,12422194,12490401,12558701,12627094,12695580,12764158,12832829, - 12901592,12970446,13039392,13108429,13177557,13246776,13316085,13385485,13454975,13524554, - 13594224,13663982,13733830,13803767,13873792,13943906,14014108,14084398,14154776,14225242, - 14295794,14366435,14437162,14507975,14578876,14649862,14720935,14792093,14863337,14934667, - 15006082,15077582,15149167,15220837,15292591,15364429,15436351,15508358,15580448,15652621, - 15724878,15797217,15869640,15942146,16014734,16087404,16160156,16232991,16305907,16378905, - 16451984,16525145,16598386,16671709,16745112,16818596,16892160,16965804,17039528,17113332, - 17187216,17261179,17335222,17409343,17483544,17557824,17632182,17706618,17781133,17855726, - 17930397,18005146,18079973,18154877,18229858,18304917,18380052,18455265,18530554,18605920, - 18681362,18756880,18832475,18908145,18983891,19059713,19135610,19211583,19287630,19363753, - 19439951,19516223,19592571,19668992,19745488,19822058,19898702,19975420,20052211,20129076, - 20206015,20283027,20360112,20437270,20514501,20591805,20669181,20746630,20824151,20901745, - 20979410,21057148,21134957,21212838,21290791,21368815,21446910,21525076,21603314,21681622, - 21760001,21838451,21916971,21995561,22074222,22152953,22231754,22310625,22389566,22468576, - 22547656,22626806,22706024,22785312,22864669,22944094,23023589,23103152,23182783,23262484, - 23342252,23422089,23501993,23581966,23662007,23742115,23822291,23902534,23982845,24063223, - 24143669,24224181,24304761,24385407,24466120,24546899,24627745,24708658,24789637,24870682, - 24951793,25032970,25114213,25195521,25276895,25358335,25439841,25521411,25603047,25684748, - 25766514,25848345,25930241,26012201,26094226,26176316,26258469,26340688,26422970,26505317, - 26587727,26670202,26752740,26835342,26918008,27000737,27083530,27166386,27249305,27332287, - 27415332,27498440,27581611,27664845,27748142,27831501,27914922,27998406,28081952,28165561, - 28249231,28332963,28416758,28500614,28584532,28668511,28752552,28836655,28920819,29005044, - 29089330,29173677,29258086,29342555,29427085,29511676,29596328,29681040,29765813,29850646, - 29935539,30020493,30105507,30190581,30275714,30360908,30446162,30531475,30616848,30702280, - 30787772,30873323,30958934,31044604,31130332,31216120,31301967,31387873,31473838,31559862, - 31645944,31732084,31818284,31904541,31990857,32077231,32163664,32250154,32336703,32423309, - 32509974,32596696,32683476,32770313,32857208,32944161,33031171,33118238,33205363,33292544, - 33379783,33467079,33554432,33641842,33729308,33816832,33904412,33992048,34079741,34167491, - 34255297,34343159,34431078,34519052,34607083,34695170,34783312,34871511,34959765,35048075, - 35136441,35224862,35313339,35401872,35490459,35579102,35667801,35756554,35845363,35934226, - 36023145,36112118,36201147,36290230,36379367,36468560,36557807,36647108,36736464,36825875, - 36915339,37004858,37094431,37184058,37273739,37363474,37453263,37543106,37633003,37722953, - 37812957,37903015,37993126,38083291,38173509,38263780,38354105,38444483,38534914,38625398, - 38715935,38806525,38897168,38987864,39078612,39169414,39260268,39351174,39442133,39533145, - 39624209,39715325,39806494,39897714,39988987,40080312,40171690,40263119,40354600,40446133, - 40537718,40629354,40721042,40812782,40904574,40996417,41088311,41180257,41272254,41364303, - 41456402,41548553,41640755,41733008,41825313,41917668,42010074,42102530,42195038,42287596, - 42380205,42472865,42565575,42658336,42751147,42844009,42936921,43029883,43122895,43215958, - 43309070,43402233,43495446,43588709,43682022,43775384,43868797,43962259,44055771,44149332, - 44242943,44336604,44430314,44524073,44617882,44711741,44805648,44899605,44993611,45087666, - 45181770,45275923,45370126,45464377,45558677,45653025,45747423,45841869,45936364,46030908, - 46125500,46220141,46314830,46409567,46504353,46599187,46694070,46789001,46883980,46979007, - 47074082,47169205,47264376,47359595,47454862,47550177,47645540,47740950,47836408,47931914, - 48027467,48123068,48218716,48314412,48410155,48505945,48601783,48697668,48793601,48889580, - 48985607,49081681,49177802,49273969,49370184,49466446,49562754,49659109,49755511,49851960, - 49948456,50044998,50141586,50238222,50334903,50431631,50528406,50625227,50722094,50819007, - 50915967,51012973,51110025,51207123,51304267,51401457,51498694,51595976,51693304,51790677, - 51888097,51985562,52083073,52180630,52278232,52375880,52473573,52571312,52669097,52766926, - 52864801,52962722,53060688,53158699,53256755,53354856,53453002,53551194,53649430,53747712, - 53846038,53944410,54042826,54141287,54239793,54338344,54436939,54535579,54634263,54732993, - 54831766,54930585,55029447,55128354,55227306,55326302,55425342,55524426,55623555,55722728, - 55821945,55921206,56020511,56119860,56219253,56318690,56418171,56517696,56617265,56716877, - 56816534,56916234,57015977,57115764,57215595,57315470,57415388,57515349,57615354,57715403, - 57815494,57915629,58015808,58116029,58216294,58316602,58416954,58517348,58617785,58718266, - 58818789,58919356,59019965,59120617,59221312,59322050,59422831,59523654,59624521,59725429, - 59826381,59927375,60028412,60129491,60230613,60331777,60432983,60534232,60635524,60736857, - 60838233,60939651,61041112,61142614,61244159,61345746,61447375,61549046,61650759,61752513, - 61854310,61956149,62058030,62159952,62261916,62363922,62465970,62568059,62670191,62772363, - 62874578,62976833,63079131,63181470,63283850,63386272,63488735,63591239,63693785,63796372, - 63899001,64001670,64104381,64207133,64309926,64412760,64515636,64618552,64721509,64824507, - 64927546,65030627,65133747,65236909,65340112,65443355,65546639,65649964,65753329,65856735, - 65960182,66063669,66167197,66270765,66374374,66478023,66581713,66685443,66789213,66893024, - 66996875,67100766,67204698,67308669,67412681,67516733,67620825,67724957,67829130,67933342, - 68037594,68141886,68246218,68350590,68455002,68559454,68663945,68768476,68873047,68977658, - 69082308,69186998,69291728,69396497,69501306,69606154,69711042,69815969,69920936,70025942, - 70130987,70236072,70341196,70446360,70551562,70656804,70762085,70867406,70972765,71078164, - 71183601,71289078,71394594,71500149,71605742,71711375,71817046,71922757,72028506,72134294, - 72240121,72345987,72451891,72557835,72663817,72769837,72875896,72981994,73088130,73194305, - 73300519,73406770,73513061,73619389,73725757,73832162,73938606,74045088,74151609,74258168, - 74364765,74471400,74578073,74684785,74791535,74898323,75005149,75112012,75218914,75325854, - 75432832,75539848,75646902,75753994,75861123,75968291,76075496,76182739,76290020,76397338, - 76504694,76612088,76719520,76826989,76934495,77042040,77149622,77257241,77364898,77472592, - 77580324,77688093,77795899,77903743,78011625,78119543,78227499,78335492,78443522,78551590, - 78659695,78767836,78876015,78984232,79092485,79200775,79309102,79417467,79525868,79634306, - 79742781,79851293,79959842,80068428,80177050,80285710,80394406,80503139,80611908,80720715, - 80829558,80938438,81047354,81156307,81265296,81374322,81483385,81592484,81701620,81810792, - 81920000,82029245,82138526,82247844,82357198,82466588,82576014,82685477,82794976,82904512, - 83014083,83123691,83233334,83343014,83452730,83562482,83672271,83782095,83891955,84001851, - 84111783,84221751,84331755,84441795,84551870,84661982,84772129,84882312,84992531,85102786, - 85213076,85323402,85433764,85544161,85654594,85765063,85875567,85986107,86096682,86207293, - 86317939,86428621,86539338,86650091,86760879,86871702,86982561,87093455,87204384,87315349, - 87426349,87537384,87648455,87759560,87870701,87981877,88093088,88204334,88315616,88426932, - 88538283,88649670,88761091,88872548,88984039,89095565,89207126,89318723,89430353,89542019, - 89653720,89765455,89877226,89989030,90100870,90212745,90324654,90436598,90548576,90660589, - 90772637,90884719,90996836,91108987,91221173,91333394,91445648,91557938,91670262,91782620, - 91895012,92007439,92119901,92232396,92344926,92457491,92570089,92682722,92795389,92908090, - 93020826,93133595,93246399,93359237,93472109,93585015,93697955,93810929,93923937,94036980, - 94150056,94263166,94376310,94489488,94602700,94715946,94829225,94942539,95055886,95169267, - 95282682,95396131,95509613,95623129,95736679,95850263,95963880,96077530,96191215,96304933, - 96418684,96532470,96646288,96760140,96874026,96987945,97101898,97215884,97329904,97443956, - 97558043,97672162,97786315,97900502,98014721,98128974,98243260,98357580,98471933,98586318, - 98700737,98815190,98929675,99044194,99158745,99273330,99387948,99502598,99617282,99731999, - 99846749,99961532,100076348,100191197,100306078,100420993,100535940,100650921,100765934,100880980, - 100996059,101111170,101226315,101341492,101456702,101571944,101687220,101802528,101917868,102033241, - 102148647,102264086,102379557,102495061,102610597,102726166,102841767,102957401,103073067,103188765, - 103304497,103420260,103536056,103651884,103767745,103883638,103999563,104115521,104231511,104347533, - 104463588,104579675,104695794,104811945,104928128,105044344,105160592,105276871,105393183,105509527, - 105625904,105742312,105858752,105975224,106091729,106208265,106324833,106441433,106558066,106674730, - 106791426,106908154,107024913,107141705,107258528,107375384,107492271,107609190,107726140,107843123, - 107960137,108077182,108194260,108311369,108428510,108545683,108662887,108780122,108897390,109014689, - 109132019,109249381,109366775,109484200,109601656,109719144,109836664,109954215,110071797,110189411, - 110307056,110424733,110542441,110660180,110777950,110895752,111013585,111131450,111249346,111367273, - 111485231,111603220,111721241,111839292,111957375,112075489,112193635,112311811,112430018,112548257, - 112666526,112784827,112903159,113021521,113139915,113258339,113376795,113495282,113613799,113732347, - 113850927,113969537,114088178,114206850,114325552,114444286,114563050,114681845,114800671,114919528, - 115038415,115157333,115276282,115395262,115514272,115633313,115752384,115871486,115990619,116109783, - 116228976,116348201,116467456,116586742,116706058,116825404,116944781,117064189,117183627,117303095, - 117422594,117542124,117661683,117781273,117900894,118020545,118140226,118259937,118379679,118499451, - 118619253,118739086,118858948,118978842,119098765,119218718,119338702,119458716,119578759,119698834, - 119818938,119939072,120059236,120179431,120299655,120419910,120540194,120660509,120780854,120901228, - 121021633,121142067,121262532,121383026,121503550,121624105,121744689,121865303,121985946,122106620, - 122227323,122348057,122468820,122589613,122710435,122831287,122952170,123073081,123194023,123314994, - 123435995,123557025,123678085,123799175,123920295,124041444,124162622,124283830,124405068,124526335, - 124647632,124768959,124890314,125011700,125133114,125254559,125376032,125497536,125619068,125740630, - 125862221,125983842,126105492,126227171,126348880,126470618,126592386,126714182,126836008,126957863, - 127079748,127201661,127323604,127445576,127567578,127689608,127811668,127933756,128055874,128178021, - 128300197,128422403,128544637,128666900,128789193,128911514,129033865,129156244,129278652,129401090, - 129523556,129646052,129768576,129891129,130013711,130136323,130258963,130381631,130504329,130627056, - 130749811,130872595,130995408,131118250,131241120,131364020,131486948,131609905,131732890,131855904, - 131978947,132102019,132225119,132348248,132471406,132594592,132717807,132841050,132964323,133087623, - 133210952,133334310,133457696,133581111,133704554,133828026,133951527,134075055,134198613,134322198, - 134445812,134569455,134693126,134816825,134940553,135064309,135188094,135311906,135435747,135559617, - 135683515,135807441,135931395,136055378,136179388,136303427,136427495,136551590,136675714,136799866, - 136924046,137048254,137172490,137296755,137421048,137545368,137669717,137794094,137918499,138042932, - 138167393,138291882,138416400,138540945,138665518,138790119,138914748,139039405,139164090,139288803, - 139413544,139538313,139663110,139787934,139912787,140037667,140162575,140287511,140412475,140537467, - 140662486,140787533,140912608,141037711,141162842,141288000,141413186,141538399,141663641,141788910, - 141914207,142039531,142164883,142290263,142415670,142541105,142666567,142792057,142917575,143043120, - 143168693,143294294,143419921,143545577,143671260,143796970,143922708,144048473,144174266,144300086, - 144425934,144551809,144677712,144803641,144929599,145055583,145181595,145307635,145433701,145559795, - 145685917,145812065,145938241,146064445,146190675,146316933,146443218,146569530,146695869,146822236, - 146948630,147075051,147201499,147327974,147454477,147581007,147707563,147834147,147960758,148087396, - 148214061,148340754,148467473,148594219,148720993,148847793,148974620,149101475,149228356,149355264, - 149482200,149609162,149736151,149863167,149990210,150117280,150244377,150371501,150498652,150625829, - 150753033,150880265,151007523,151134807,151262119,151389457,151516823,151644215,151771633,151899079, - 152026551,152154050,152281576,152409128,152536707,152664313,152791945,152919604,153047290,153175002, - 153302741,153430507,153558299,153686118,153813963,153941835,154069734,154197659,154325610,154453588, - 154581593,154709624,154837682,154965766,155093876,155222013,155350177,155478367,155606583,155734826, - 155863095,155991391,156119713,156248061,156376436,156504837,156633264,156761718,156890198,157018704, - 157147237,157275796,157404381,157532993,157661630,157790294,157918985,158047701,158176444,158305212, - 158434008,158562829,158691676,158820550,158949449,159078375,159207327,159336305,159465310,159594340, - 159723396,159852479,159981587,160110722,160239882,160369069,160498282,160627520,160756785,160886076, - 161015392,161144735,161274103,161403498,161532918,161662365,161791837,161921335,162050859,162180409, - 162309985,162439587,162569215,162698868,162828547,162958252,163087983,163217740,163347523,163477331, - 163607165,163737025,163866910,163996822,164126759,164256722,164386710,164516724,164646764,164776830, - 164906921,165037038,165167181,165297349,165427543,165557762,165688007,165818278,165948574,166078896, - 166209243,166339616,166470015,166600439,166730888,166861363,166991864,167122390,167252942,167383519, - 167514122,167644750,167775403,167906082,168036786,168167516,168298271,168429052,168559858,168690689, - 168821546,168952428,169083335,169214268,169345226,169476210,169607219,169738253,169869312,170000397, - 170131507,170262642,170393802,170524988,170656199,170787435,170918696,171049983,171181295,171312632, - 171443994,171575381,171706793,171838231,171969694,172101182,172232695,172364233,172495796,172627384, - 172758997,172890636,173022299,173153988,173285702,173417440,173549204,173680993,173812806,173944645, - 174076509,174208397,174340311,174472249,174604213,174736201,174868215,175000253,175132316,175264404, - 175396517,175528655,175660818,175793005,175925218,176057455,176189717,176322004,176454316,176586653, - 176719014,176851400,176983811,177116247,177248708,177381193,177513703,177646237,177778797,177911381, - 178043990,178176624,178309282,178441965,178574672,178707405,178840162,178972943,179105749,179238580, - 179371435,179504316,179637220,179770149,179903103,180036082,180169084,180302112,180435164,180568240, - 180701342,180834467,180967617,181100792,181233991,181367214,181500462,181633735,181767032,181900353, - 182033699,182167069,182300464,182433883,182567326,182700794,182834286,182967803,183101344,183234909, - 183368499,183502113,183635751,183769414,183903101,184036812,184170548,184304307,184438092,184571900, - 184705732,184839589,184973470,185107376,185241305,185375259,185509237,185643239,185777266,185911316, - 186045391,186179490,186313613,186447760,186581931,186716126,186850346,186984590,187118857,187253149, - 187387465,187521805,187656169,187790557,187924969,188059405,188193866,188328350,188462858,188597390, - 188731946,188866527,189001131,189135759,189270411,189405087,189539787,189674511,189809259,189944031, - 190078827,190213646,190348490,190483357,190618249,190753164,190888103,191023066,191158052,191293063, - 191428097,191563155,191698237,191833343,191968473,192103626,192238803,192374004,192509229,192644477, - 192779749,192915045,193050365,193185708,193321075,193456466,193591881,193727319,193862781,193998266, - 194133775,194269308,194404864,194540444,194676048,194811675,194947326,195083001,195218699,195354421, - 195490166,195625935,195761727,195897543,196033383,196169246,196305132,196441042,196576976,196712933, - 196848914,196984918,197120945,197256996,197393071,197529169,197665290,197801435,197937603,198073795, - 198210010,198346249,198482510,198618796,198755104,198891437,199027792,199164171,199300573,199436998, - 199573447,199709919,199846415,199982934,200119476,200256041,200392630,200529242,200665877,200802535, - 200939217,201075922,201212650,201349402,201486176,201622974,201759795,201896639,202033507,202170398, - 202307311,202444248,202581209,202718192,202855198,202992228,203129281,203266357,203403456,203540578, - 203677723,203814891,203952082,204089297,204226534,204363795,204501078,204638385,204775715,204913067, - 205050443,205187842,205325264,205462708,205600176,205737667,205875180,206012717,206150277,206287859, - 206425465,206563093,206700745,206838419,206976116,207113836,207251579,207389345,207527134,207664946, - 207802780,207940638,208078518,208216421,208354347,208492295,208630267,208768261,208906279,209044319, - 209182381,209320467,209458575,209596706,209734860,209873037,210011236,210149458,210287703,210425971, - 210564261,210702574,210840910,210979268,211117649,211256053,211394480,211532929,211671400,211809895, - 211948412,212086952,212225514,212364099,212502706,212641337,212779989,212918665,213057363,213196083, - 213334826,213473592,213612380,213751191,213890024,214028880,214167758,214306659,214445582,214584528, - 214723497,214862488,215001501,215140537,215279595,215418676,215557779,215696904,215836053,215975223, - 216114416,216253631,216392869,216532129,216671412,216810717,216950044,217089394,217228766,217368160, - 217507577,217647016,217786477,217925961,218065467,218204996,218344546,218484119,218623715,218763332, - 218902972,219042634,219182319,219322026,219461754,219601506,219741279,219881075,220020893,220160733, - 220300595,220440479,220580386,220720315,220860266,221000239,221140235,221280252,221420292,221560354, - 221700438,221840544,221980672,222120823,222260995,222401190,222541406,222681645,222821906,222962189, - 223102494,223242821,223383170,223523541,223663934,223804350,223944787,224085246,224225728,224366231, - 224506756,224647303,224787873,224928464,225069077,225209712,225350370,225491049,225631750,225772473, - 225913218,226053985,226194773,226335584,226476417,226617271,226758148,226899046,227039966,227180908, - 227321872,227462858,227603865,227744895,227885946,228027019,228168114,228309231,228450369,228591529, - 228732712,228873916,229015141,229156389,229297658,229438949,229580262,229721596,229862953,230004331, - 230145730,230287152,230428595,230570060,230711546,230853055,230994585,231136136,231277709,231419304, - 231560921,231702559,231844219,231985901,232127604,232269329,232411076,232552844,232694633,232836445, - 232978278,233120132,233262008,233403906,233545825,233687766,233829728,233971712,234113717,234255744, - 234397793,234539863,234681954,234824068,234966202,235108358,235250536,235392735,235534955,235677197, - 235819461,235961746,236104052,236246380,236388729,236531100,236673492,236815905,236958340,237100797, - 237243274,237385774,237528294,237670836,237813399,237955984,238098590,238241217,238383866,238526536, - 238669228,238811940,238954674,239097430,239240207,239383005,239525824,239668664,239811526,239954409, - 240097314,240240240,240383187,240526155,240669144,240812155,240955187,241098240,241241314,241384410, - 241527527,241670665,241813824,241957005,242100206,242243429,242386673,242529938,242673224,242816532, - 242959860,243103210,243246581,243389973,243533386,243676820,243820276,243963752,244107249,244250768, - 244394308,244537869,244681450,244825053,244968677,245112322,245255989,245399676,245543384,245687113, - 245830863,245974635,246118427,246262240,246406074,246549930,246693806,246837703,246981621,247125560, - 247269521,247413502,247557504,247701527,247845571,247989635,248133721,248277828,248421956,248566104, - 248710273,248854464,248998675,249142907,249287160,249431434,249575729,249720044,249864381,250008738, - 250153116,250297515,250441935,250586375,250730837,250875319,251019822,251164346,251308890,251453456, - 251598042,251742649,251887277,252031925,252176594,252321284,252465995,252610727,252755479,252900252, - 253045045,253189860,253334695,253479551,253624427,253769324,253914242,254059181,254204140,254349120, - 254494121,254639142,254784184,254929246,255074329,255219433,255364558,255509703,255654868,255800054, - 255945261,256090489,256235737,256381006,256526295,256671605,256816935,256962286,257107657,257253049, - 257398462,257543895,257689349,257834823,257980318,258125833,258271369,258416925,258562502,258708099, - 258853717,258999355,259145014,259290693,259436392,259582112,259727853,259873614,260019395,260165197, - 260311019,260456862,260602725,260748609,260894513,261040437,261186382,261332347,261478333,261624339, - 261770365,261916411,262062478,262208566,262354674,262500802,262646950,262793119,262939308,263085517, - 263231747,263377997,263524267,263670558,263816869,263963200,264109551,264255923,264402315,264548728, - 264695160,264841613,264988086,265134579,265281093,265427627,265574181,265720755,265867349,266013964, - 266160599,266307254,266453929,266600625,266747340,266894076,267040832,267187608,267334404,267481221, - 267628057,267774914,267921791,268068688,268215605,268362542,268509500,268656477,268803475,268950493, - 269097530,269244588,269391666,269538764,269685882,269833021,269980179,270127357,270274555,270421774, - 270569012,270716271,270863549,271010848,271158166,271305505,271452863,271600242,271747640,271895059, - 272042497,272189956,272337434,272484933,272632451,272779990,272927548,273075126,273222724,273370342, - 273517981,273665639,273813316,273961014,274108732,274256470,274404227,274552005,274699802,274847619, - 274995456,275143313,275291190,275439087,275587003,275734940,275882896,276030872,276178868,276326884, - 276474919,276622975,276771050,276919145,277067260,277215394,277363549,277511723,277659917,277808130, - 277956364,278104617,278252890,278401183,278549496,278697828,278846180,278994552,279142943,279291354, - 279439785,279588236,279736706,279885196,280033706,280182236,280330785,280479353,280627942,280776550, - 280925178,281073825,281222493,281371179,281519886,281668612,281817358,281966123,282114908,282263713, - 282412537,282561381,282710244,282859127,283008030,283156952,283305894,283454855,283603836,283752836, - 283901856,284050896,284199955,284349034,284498132,284647250,284796387,284945544,285094721,285243917, - 285393132,285542367,285691621,285840895,285990189,286139502,286288834,286438186,286587557,286736948, - 286886358,287035788,287185237,287334706,287484194,287633701,287783228,287932774,288082340,288231925, - 288381530,288531154,288680797,288830460,288980142,289129844,289279565,289429305,289579065,289728844, - 289878642,290028460,290178297,290328153,290478029,290627924,290777839,290927773,291077726,291227698, - 291377690,291527701,291677731,291827781,291977850,292127938,292278045,292428172,292578318,292728484, - 292878668,293028872,293179095,293329337,293479599,293629880,293780180,293930499,294080837,294231195, - 294381572,294531968,294682383,294832818,294983272,295133744,295284237,295434748,295585278,295735828, - 295886396,296036984,296187591,296338218,296488863,296639527,296790211,296940914,297091636,297242377, - 297393137,297543916,297694714,297845532,297996368,298147224,298298098,298448992,298599905,298750837, - 298901788,299052758,299203747,299354755,299505782,299656829,299807894,299958978,300110081,300261204, - 300412345,300563505,300714685,300865883,301017101,301168337,301319592,301470867,301622160,301773472, - 301924804,302076154,302227523,302378911,302530318,302681744,302833189,302984653,303136136,303287638, - 303439159,303590698,303742257,303893834,304045431,304197046,304348680,304500333,304652005,304803696, - 304955405,305107134,305258881,305410648,305562433,305714237,305866060,306017901,306169762,306321641, - 306473539,306625456,306777392,306929347,307081320,307233312,307385323,307537353,307689402,307841469, - 307993555,308145660,308297784,308449927,308602088,308754268,308906467,309058684,309210921,309363176, - 309515449,309667742,309820053,309972383,310124732,310277099,310429485,310581890,310734313,310886755, - 311039216,311191696,311344194,311496711,311649247,311801801,311954374,312106965,312259575,312412204, - 312564852,312717518,312870203,313022906,313175628,313328369,313481128,313633906,313786703,313939518, - 314092351,314245204,314398074,314550964,314703872,314856799,315009744,315162708,315315690,315468691, - 315621710,315774748,315927805,316080880,316233973,316387086,316540216,316693365,316846533,316999719, - 317152924,317306147,317459389,317612649,317765928,317919225,318072541,318225875,318379228,318532599, - 318685988,318839396,318992823,319146268,319299731,319453213,319606713,319760232,319913769,320067324, - 320220898,320374491,320528101,320681731,320835378,320989044,321142729,321296431,321450153,321603892, - 321757650,321911426,322065221,322219034,322372865,322526715,322680583,322834470,322988374,323142297, - 323296239,323450199,323604177,323758173,323912188,324066221,324220272,324374342,324528430,324682536, - 324836660,324990803,325144964,325299144,325453341,325607557,325761791,325916044,326070314,326224603, - 326378910,326533236,326687579,326841941,326996321,327150720,327305136,327459571,327614024,327768495, - 327922984,328077492,328232018,328386562,328541124,328695704,328850302,329004919,329159554,329314207, - 329468878,329623567,329778275,329933000,330087744,330242506,330397286,330552084,330706900,330861735, - 331016587,331171458,331326347,331481254,331636178,331791121,331946083,332101062,332256059,332411074, - 332566108,332721159,332876229,333031317,333186422,333341546,333496688,333651848,333807026,333962221, - 334117435,334272667,334427917,334583185,334738471,334893776,335049098,335204438,335359796,335515172, - 335670566,335825978,335981408,336136856,336292322,336447806,336603308,336758828,336914365,337069921, - 337225495,337381087,337536696,337692324,337847969,338003633,338159314,338315013,338470730,338626465, - 338782218,338937989,339093778,339249585,339405409,339561252,339717112,339872990,340028886,340184800, - 340340732,340496682,340652650,340808635,340964638,341120659,341276698,341432755,341588830,341744922, - 341901032,342057161,342213306,342369470,342525652,342681851,342838068,342994303,343150556,343306826, - 343463115,343619421,343775745,343932086,344088446,344244823,344401218,344557631,344714061,344870509, - 345026975,345183459,345339960,345496480,345653016,345809571,345966143,346122733,346279341,346435967, - 346592610,346749271,346905949,347062646,347219359,347376091,347532840,347689607,347846392,348003194, - 348160014,348316852,348473707,348630580,348787471,348944379,349101305,349258249,349415210,349572189, - 349729185,349886199,350043231,350200280,350357347,350514432,350671534,350828653,350985791,351142946, - 351300118,351457308,351614516,351771741,351928984,352086244,352243522,352400817,352558130,352715461, - 352872809,353030175,353187558,353344959,353502377,353659813,353817266,353974737,354132225,354289731, - 354447254,354604795,354762354,354919929,355077523,355235134,355392762,355550408,355708071,355865752, - 356023450,356181166,356338899,356496649,356654418,356812203,356970006,357127826,357285664,357443520, - 357601392,357759282,357917190,358075115,358233057,358391017,358548994,358706989,358865001,359023030, - 359181077,359339141,359497223,359655322,359813438,359971572,360129723,360287891,360446077,360604280, - 360762501,360920738,361078994,361237266,361395556,361553863,361712188,361870530,362028889,362187265, - 362345659,362504070,362662499,362820944,362979407,363137888,363296385,363454900,363613432,363771982, - 363930549,364089133,364247734,364406353,364564988,364723642,364882312,365041000,365199704,365358426, - 365517166,365675922,365834696,365993487,366152296,366311121,366469964,366628824,366787701,366946595, - 367105507,367264435,367423381,367582344,367741325,367900322,368059337,368218369,368377418,368536484, - 368695567,368854668,369013785,369172920,369332072,369491241,369650428,369809631,369968852,370128089, - 370287344,370446616,370605905,370765211,370924535,371083875,371243232,371402607,371561999,371721408, - 371880833,372040276,372199737,372359214,372518708,372678219,372837748,372997293,373156856,373316435, - 373476032,373635645,373795276,373954924,374114589,374274270,374433969,374593685,374753418,374913168, - 375072935,375232719,375392520,375552338,375712173,375872025,376031894,376191780,376351683,376511603, - 376671540,376831494,376991465,377151453,377311458,377471479,377631518,377791574,377951647,378111736, - 378271843,378431966,378592107,378752264,378912439,379072630,379232838,379393063,379553305,379713564, - 379873840,380034133,380194443,380354769,380515113,380675473,380835850,380996244,381156655,381317083, - 381477528,381637990,381798468,381958964,382119476,382280005,382440551,382601114,382761694,382922290, - 383082903,383243534,383404181,383564844,383725525,383886223,384046937,384207668,384368416,384529181, - 384689962,384850761,385011576,385172408,385333256,385494122,385655004,385815903,385976819,386137752, - 386298701,386459667,386620650,386781650,386942667,387103700,387264750,387425816,387586900,387748000, - 387909117,388070251,388231401,388392568,388553752,388714952,388876170,389037404,389198654,389359922, - 389521206,389682507,389843824,390005158,390166509,390327877,390489261,390650662,390812079,390973513, - 391134964,391296432,391457916,391619417,391780934,391942469,392104019,392265587,392427171,392588772, - 392750389,392912023,393073674,393235341,393397025,393558725,393720442,393882176,394043926,394205693, - 394367477,394529277,394691093,394852927,395014776,395176643,395338526,395500425,395662342,395824274, - 395986224,396148189,396310172,396472171,396634186,396796218,396958267,397120332,397282414,397444512, - 397606627,397768758,397930906,398093070,398255251,398417448,398579662,398741892,398904139,399066402, - 399228682,399390979,399553291,399715621,399877966,400040329,400202707,400365103,400527514,400689943, - 400852387,401014848,401177326,401339820,401502330,401664857,401827400,401989960,402152536,402315129, - 402477738,402640363,402803005,402965664,403128338,403291030,403453737,403616461,403779201,403941958, - 404104731,404267521,404430327,404593149,404755988,404918843,405081715,405244602,405407507,405570427, - 405733364,405896317,406059287,406222273,406385275,406548294,406711329,406874381,407037448,407200532, - 407363633,407526750,407689883,407853032,408016198,408179380,408342578,408505793,408669024,408832271, - 408995534,409158814,409322110,409485423,409648751,409812096,409975457,410138835,410302229,410465639, - 410629065,410792508,410955967,411119442,411282933,411446441,411609964,411773505,411937061,412100633, - 412264222,412427827,412591449,412755086,412918740,413082410,413246096,413409798,413573517,413737251, - 413901002,414064769,414228553,414392352,414556168,414720000,414883848,415047712,415211593,415375489, - 415539402,415703331,415867276,416031238,416195215,416359209,416523218,416687244,416851286,417015344, - 417179419,417343509,417507616,417671738,417835877,418000032,418164203,418328390,418492594,418656813, - 418821048,418985300,419149568,419313852,419478151,419642467,419806800,419971148,420135512,420299892, - 420464289,420628701,420793130,420957574,421122035,421286511,421451004,421615513,421780038,421944579, - 422109136,422273709,422438298,422602903,422767524,422932161,423096814,423261483,423426168,423590870, - 423755587,423920320,424085069,424249834,424414616,424579413,424744226,424909055,425073900,425238762, - 425403639,425568532,425733441,425898366,426063307,426228264,426393237,426558226,426723231,426888252, - 427053288,427218341,427383410,427548494,427713595,427878711,428043844,428208992,428374156,428539337, - 428704533,428869745,429034973,429200217,429365476,429530752,429696043,429861351,430026674,430192013, - 430357369,430522740,430688126,430853529,431018948,431184382,431349833,431515299,431680781,431846279, - 432011793,432177323,432342868,432508430,432674007,432839600,433005209,433170834,433336474,433502131, - 433667803,433833491,433999195,434164914,434330650,434496401,434662168,434827951,434993750,435159565, - 435325395,435491241,435657103,435822981,435988874,436154784,436320709,436486650,436652606,436818579, - 436984567,437150571,437316590,437482626,437648677,437814744,437980827,438146925,438313039,438479169, - 438645315,438811476,438977653,439143846,439310055,439476279,439642519,439808775,439975046,440141333, - 440307636,440473955,440640289,440806639,440973005,441139386,441305783,441472196,441638624,441805068, - 441971528,442138004,442304495,442471002,442637524,442804062,442970616,443137185,443303770,443470371, - 443636988,443803620,443970267,444136931,444303610,444470304,444637014,444803740,444970482,445137239, - 445304012,445470800,445637604,445804423,445971259,446138109,446304976,446471858,446638755,446805668, - 446972597,447139542,447306501,447473477,447640468,447807475,447974497,448141535,448308588,448475657, - 448642742,448809842,448976957,449144088,449311235,449478397,449645575,449812768,449979977,450147202, - 450314442,450481697,450648968,450816255,450983557,451150874,451318207,451485556,451652920,451820300, - 451987695,452155105,452322531,452489973,452657430,452824903,452992391,453159894,453327413,453494948, - 453662498,453830063,453997644,454165240,454332852,454500480,454668122,454835781,455003454,455171143, - 455338848,455506568,455674303,455842054,456009821,456177602,456345399,456513212,456681040,456848884, - 457016742,457184617,457352506,457520411,457688332,457856268,458024219,458192186,458360168,458528165, - 458696178,458864207,459032250,459200309,459368384,459536474,459704579,459872699,460040835,460208986, - 460377153,460545335,460713532,460881745,461049973,461218216,461386475,461554749,461723039,461891343, - 462059663,462227999,462396350,462564716,462733097,462901494,463069906,463238333,463406776,463575234, - 463743707,463912196,464080699,464249219,464417753,464586303,464754868,464923448,465092044,465260655, - 465429281,465597922,465766579,465935251,466103938,466272641,466441358,466610091,466778840,466947603, - 467116382,467285176,467453985,467622810,467791650,467960505,468129375,468298260,468467161,468636077, - 468805008,468973954,469142916,469311893,469480885,469649892,469818914,469987952,470157005,470326073, - 470495156,470664254,470833368,471002497,471171641,471340800,471509974,471679164,471848368,472017588, - 472186823,472356073,472525339,472694619,472863915,473033226,473202552,473371893,473541249,473710620, - 473880007,474049409,474218825,474388257,474557704,474727167,474896644,475066136,475235644,475405167, - 475574704,475744257,475913825,476083408,476253007,476422620,476592248,476761892,476931550,477101224, - 477270913,477440617,477610336,477780070,477949819,478119583,478289362,478459157,478628966,478798790, - 478968630,479138484,479308354,479478239,479648138,479818053,479987983,480157928,480327888,480497863, - 480667853,480837858,481007878,481177913,481347963,481518028,481688108,481858203,482028313,482198438, - 482368578,482538734,482708904,482879089,483049289,483219504,483389734,483559979,483730240,483900515, - 484070805,484241110,484411430,484581765,484752115,484922480,485092860,485263254,485433664,485604089, - 485774529,485944983,486115453,486285938,486456437,486626952,486797481,486968025,487138585,487309159, - 487479748,487650352,487820971,487991605,488162254,488332917,488503596,488674290,488844998,489015721, - 489186460,489357213,489527981,489698764,489869562,490040374,490211202,490382044,490552902,490723774, - 490894661,491065563,491236480,491407412,491578358,491749320,491920296,492091287,492262294,492433314, - 492604350,492775401,492946466,493117547,493288642,493459752,493630876,493802016,493973171,494144340, - 494315524,494486723,494657937,494829165,495000409,495171667,495342940,495514228,495685530,495856848, - 496028180,496199527,496370889,496542265,496713657,496885063,497056484,497227919,497399370,497570835, - 497742315,497913810,498085320,498256844,498428383,498599937,498771506,498943089,499114687,499286300, - 499457928,499629570,499801227,499972899,500144586,500316287,500488003,500659734,500831480,501003240, - 501175015,501346805,501518609,501690428,501862262,502034111,502205974,502377852,502549745,502721652, - 502893574,503065511,503237462,503409429,503581409,503753405,503925415,504097440,504269480,504441534, - 504613603,504785686,504957785,505129897,505302025,505474167,505646324,505818496,505990682,506162883, - 506335098,506507328,506679573,506851833,507024107,507196395,507368699,507541017,507713349,507885697, - 508058058,508230435,508402826,508575232,508747652,508920087,509092536,509265000,509437479,509609972, - 509782480,509955003,510127540,510300092,510472658,510645239,510817834,510990444,511163069,511335708, - 511508362,511681030,511853713,512026411,512199123,512371849,512544590,512717346,512890116,513062901, - 513235701,513408514,513581343,513754186,513927043,514099916,514272802,514445703,514618619,514791549, - 514964494,515137453,515310427,515483415,515656418,515829435,516002467,516175513,516348574,516521649, - 516694739,516867844,517040962,517214096,517387243,517560406,517733582,517906774,518079979,518253200, - 518426434,518599683,518772947,518946225,519119518,519292825,519466146,519639482,519812833,519986197, - 520159577,520332970,520506379,520679801,520853238,521026690,521200156,521373636,521547131,521720640, - 521894164,522067702,522241255,522414822,522588403,522761999,522935609,523109234,523282873,523456526, - 523630194,523803876,523977573,524151284,524325009,524498749,524672503,524846272,525020055,525193852, - 525367664,525541490,525715330,525889185,526063054,526236938,526410836,526584748,526758675,526932616, - 527106571,527280541,527454525,527628524,527802536,527976563,528150605,528324661,528498731,528672815, - 528846914,529021027,529195155,529369297,529543453,529717623,529891808,530066007,530240220,530414448, - 530588690,530762946,530937217,531111502,531285801,531460115,531634442,531808785,531983141,532157512, - 532331897,532506296,532680709,532855137,533029579,533204036,533378506,533552991,533727490,533902004, - 534076531,534251073,534425630,534600200,534774785,534949384,535123997,535298624,535473266,535647922, - 535822592,535997276,536171975,536346688,536521415,536696156,536870912,537045682,537220466,537395264, - 537570076,537744903,537919744,538094599,538269468,538444352,538619249,538794161,538969087,539144028, - 539318982,539493951,539668934,539843931,540018942,540193967,540369007,540544060,540719128,540894210, - 541069307,541244417,541419542,541594680,541769833,541945000,542120182,542295377,542470587,542645810, - 542821048,542996300,543171566,543346846,543522141,543697449,543872772,544048109,544223460,544398825, - 544574204,544749597,544925004,545100426,545275862,545451311,545626775,545802253,545977745,546153251, - 546328772,546504306,546679854,546855417,547030994,547206584,547382189,547557808,547733441,547909088, - 548084749,548260425,548436114,548611817,548787535,548963266,549139012,549314771,549490545,549666333, - 549842135,550017950,550193780,550369624,550545482,550721354,550897241,551073141,551249055,551424983, - 551600925,551776882,551952852,552128836,552304835,552480847,552656873,552832914,553008968,553185037, - 553361119,553537215,553713326,553889450,554065589,554241741,554417908,554594088,554770283,554946491, - 555122714,555298950,555475201,555651465,555827743,556004036,556180342,556356662,556532997,556709345, - 556885707,557062083,557238473,557414877,557591295,557767727,557944173,558120633,558297107,558473595, - 558650097,558826612,559003142,559179686,559356243,559532814,559709400,559885999,560062612,560239240, - 560415881,560592536,560769205,560945887,561122584,561299295,561476019,561652758,561829510,562006276, - 562183057,562359851,562536659,562713480,562890316,563067166,563244029,563420907,563597798,563774703, - 563951622,564128555,564305502,564482463,564659437,564836426,565013428,565190444,565367474,565544518, - 565721576,565898647,566075733,566252832,566429945,566607072,566784213,566961368,567138536,567315719, - 567492915,567670125,567847349,568024586,568201838,568379103,568556382,568733675,568910982,569088303, - 569265637,569442985,569620347,569797723,569975113,570152516,570329933,570507365,570684809,570862268, - 571039740,571217227,571394727,571572240,571749768,571927309,572104865,572282433,572460016,572637613, - 572815223,572992847,573170485,573348136,573525802,573703481,573881173,574058880,574236600,574414334, - 574592082,574769844,574947619,575125408,575303211,575481028,575658858,575836702,576014560,576192431, - 576370316,576548215,576726128,576904054,577081994,577259948,577437916,577615897,577793892,577971901, - 578149923,578327959,578506009,578684072,578862149,579040240,579218345,579396463,579574595,579752741, - 579930900,580109073,580287260,580465460,580643674,580821902,581000143,581178399,581356667,581534950, - 581713246,581891555,582069879,582248216,582426567,582604931,582783309,582961701,583140106,583318525, - 583496958,583675404,583853864,584032337,584210825,584389325,584567840,584746368,584924910,585103465, - 585282034,585460616,585639213,585817822,585996446,586175083,586353733,586532398,586711076,586889767, - 587068472,587247191,587425923,587604669,587783428,587962201,588140988,588319788,588498602,588677429, - 588856270,589035125,589213993,589392875,589571770,589750679,589929601,590108537,590287487,590466450, - 590645427,590824417,591003421,591182438,591361469,591540513,591719571,591898643,592077728,592256827, - 592435939,592615065,592794204,592973357,593152523,593331703,593510896,593690103,593869324,594048558, - 594227805,594407066,594586341,594765629,594944930,595124245,595303574,595482916,595662271,595841640, - 596021023,596200419,596379829,596559252,596738688,596918138,597097602,597277079,597456569,597636073, - 597815591,597995122,598174666,598354224,598533795,598713380,598892979,599072590,599252216,599431854, - 599611506,599791172,599970851,600150544,600330250,600509969,600689702,600869448,601049208,601228981, - 601408768,601588568,601768381,601948208,602128049,602307902,602487770,602667650,602847544,603027452, - 603207373,603387307,603567255,603747216,603927191,604107179,604287180,604467195,604647223,604827265, - 605007320,605187388,605367470,605547565,605727674,605907796,606087931,606268080,606448242,606628417, - 606808606,606988808,607169024,607349253,607529496,607709751,607890020,608070303,608250599,608430908, - 608611231,608791566,608971916,609152278,609332654,609513044,609693446,609873862,610054292,610234735, - 610415191,610595660,610776143,610956639,611137148,611317671,611498207,611678756,611859319,612039895, - 612220484,612401087,612581703,612762332,612942975,613123631,613304300,613484983,613665679,613846388, - 614027110,614207846,614388595,614569357,614750133,614930922,615111724,615292540,615473368,615654210, - 615835066,616015934,616196816,616377712,616558620,616739542,616920477,617101425,617282386,617463361, - 617644349,617825351,618006365,618187393,618368434,618549488,618730556,618911637,619092731,619273838, - 619454959,619636093,619817240,619998400,620179573,620360760,620541960,620723173,620904400,621085639, - 621266892,621448158,621629438,621810730,621992036,622173355,622354687,622536032,622717391,622898763, - 623080148,623261546,623442957,623624382,623805820,623987271,624168735,624350212,624531703,624713207, - 624894724,625076254,625257797,625439354,625620923,625802506,625984102,626165711,626347334,626528969, - 626710618,626892280,627073955,627255643,627437344,627619058,627800786,627982527,628164281,628346048, - 628527828,628709621,628891428,629073248,629255080,629436926,629618785,629800658,629982543,630164441, - 630346353,630528278,630710215,630892166,631074130,631256108,631438098,631620101,631802118,631984147, - 632166190,632348246,632530315,632712397,632894492,633076600,633258722,633440856,633623004,633805164, - 633987338,634169525,634351725,634533938,634716164,634898403,635080655,635262921,635445199,635627490, - 635809795,635992113,636174443,636356787,636539144,636721514,636903896,637086292,637268701,637451123, - 637633559,637816007,637998468,638180942,638363430,638545930,638728443,638910970,639093509,639276062, - 639458627,639641206,639823797,640006402,640189020,640371650,640554294,640736951,640919621,641102303, - 641284999,641467708,641650430,641833165,642015912,642198673,642381447,642564234,642747034,642929846, - 643112672,643295511,643478363,643661228,643844105,644026996,644209900,644392817,644575746,644758689, - 644941645,645124613,645307595,645490590,645673597,645856618,646039651,646222698,646405757,646588830, - 646771915,646955013,647138125,647321249,647504386,647687536,647870699,648053875,648237064,648420266, - 648603481,648786709,648969949,649153203,649336470,649519749,649703042,649886347,650069665,650252997, - 650436341,650619698,650803068,650986451,651169847,651353255,651536677,651720112,651903559,652087020, - 652270493,652453979,652637478,652820990,653004515,653188053,653371604,653555167,653738744,653922333, - 654105935,654289550,654473178,654656819,654840473,655024140,655207819,655391512,655575217,655758935, - 655942666,656126410,656310167,656493936,656677719,656861514,657045322,657229143,657412977,657596824, - 657780683,657964556,658148441,658332339,658516250,658700174,658884111,659068060,659252023,659435998, - 659619986,659803987,659988000,660172027,660356066,660540118,660724183,660908261,661092351,661276455, - 661460571,661644700,661828842,662012997,662197164,662381344,662565538,662749743,662933962,663118194, - 663302438,663486695,663670965,663855247,664039543,664223851,664408172,664592506,664776853,664961212, - 665145584,665329969,665514367,665698777,665883200,666067636,666252085,666436547,666621021,666805508, - 666990008,667174521,667359046,667543584,667728135,667912699,668097275,668281864,668466466,668651081, - 668835708,669020348,669205001,669389667,669574345,669759036,669943740,670128456,670313185,670497927, - 670682682,670867450,671052230,671237023,671421828,671606647,671791478,671976321,672161178,672346047, - 672530929,672715823,672900731,673085651,673270583,673455529,673640487,673825458,674010441,674195437, - 674380446,674565468,674750502,674935549,675120609,675305681,675490766,675675863,675860974,676046097, - 676231232,676416381,676601542,676786716,676971902,677157101,677342313,677527537,677712774,677898024, - 678083286,678268561,678453849,678639149,678824462,679009787,679195126,679380477,679565840,679751216, - 679936605,680122006,680307421,680492847,680678287,680863739,681049203,681234680,681420170,681605673, - 681791188,681976716,682162256,682347809,682533374,682718953,682904543,683090147,683275763,683461391, - 683647033,683832687,684018353,684204032,684389724,684575428,684761145,684946874,685132616,685318371, - 685504138,685689918,685875710,686061515,686247332,686433163,686619005,686804861,686990728,687176609, - 687362502,687548407,687734325,687920256,688106199,688292155,688478123,688664104,688850098,689036104, - 689222122,689408154,689594197,689780254,689966322,690152404,690338498,690524604,690710723,690896854, - 691082998,691269155,691455324,691641506,691827700,692013907,692200126,692386358,692572602,692758859, - 692945128,693131410,693317704,693504011,693690330,693876662,694063007,694249364,694435733,694622115, - 694808509,694994916,695181336,695367768,695554212,695740669,695927138,696113620,696300115,696486621, - 696673141,696859673,697046217,697232774,697419343,697605925,697792519,697979126,698165745,698352377, - 698539021,698725677,698912347,699099028,699285722,699472429,699659147,699845879,700032623,700219379, - 700406148,700592929,700779723,700966529,701153347,701340178,701527022,701713878,701900746,702087627, - 702274520,702461425,702648343,702835274,703022217,703209172,703396140,703583120,703770113,703957118, - 704144135,704331165,704518208,704705262,704892329,705079409,705266501,705453605,705640722,705827851, - 706014993,706202147,706389313,706576492,706763683,706950887,707138103,707325331,707512572,707699825, - 707887090,708074368,708261659,708448961,708636276,708823604,709010944,709198296,709385660,709573037, - 709760427,709947828,710135242,710322669,710510107,710697559,710885022,711072498,711259986,711447487, - 711635000,711822525,712010063,712197613,712385175,712572750,712760337,712947936,713135548,713323172, - 713510808,713698457,713886118,714073791,714261477,714449175,714636885,714824608,715012343,715200090, - 715387850,715575622,715763406,715951203,716139012,716326833,716514667,716702513,716890371,717078242, - 717266124,717454019,717641927,717829847,718017779,718205723,718393680,718581648,718769630,718957623, - 719145629,719333647,719521677,719709720,719897775,720085842,720273922,720462013,720650117,720838234, - 721026362,721214503,721402656,721590822,721778999,721967189,722155392,722343606,722531833,722720072, - 722908323,723096587,723284862,723473150,723661451,723849763,724038088,724226425,724414774,724603136, - 724791509,724979895,725168294,725356704,725545127,725733562,725922009,726110468,726298940,726487424, - 726675920,726864428,727052949,727241481,727430026,727618583,727807153,727995734,728184328,728372934, - 728561553,728750183,728938826,729127480,729316148,729504827,729693518,729882222,730070938,730259666, - 730448406,730637159,730825923,731014700,731203489,731392290,731581104,731769929,731958767,732147617, - 732336479,732525353,732714240,732903139,733092049,733280972,733469908,733658855,733847814,734036786, - 734225770,734414766,734603774,734792794,734981827,735170871,735359928,735548997,735738078,735927171, - 736116277,736305394,736494524,736683666,736872820,737061986,737251164,737440354,737629557,737818771, - 738007998,738197237,738386488,738575751,738765026,738954314,739143613,739332925,739522249,739711585, - 739900933,740090293,740279665,740469049,740658446,740847854,741037275,741226708,741416152,741605609, - 741795078,741984560,742174053,742363558,742553076,742742605,742932147,743121701,743311266,743500844, - 743690434,743880036,744069651,744259277,744448915,744638566,744828228,745017903,745207589,745397288, - 745586999,745776721,745966456,746156203,746345962,746535733,746725517,746915312,747105119,747294938, - 747484770,747674613,747864469,748054336,748244216,748434107,748624011,748813927,749003855,749193794, - 749383746,749573710,749763686,749953674,750143674,750333686,750523710,750713746,750903794,751093854, - 751283926,751474011,751664107,751854215,752044335,752234467,752424612,752614768,752804936,752995117, - 753185309,753375513,753565729,753755958,753946198,754136450,754326715,754516991,754707279,754897580, - 755087892,755278216,755468553,755658901,755849261,756039633,756230018,756420414,756610822,756801242, - 756991675,757182119,757372575,757563043,757753523,757944015,758134519,758325035,758515563,758706103, - 758896655,759087219,759277794,759468382,759658982,759849593,760040217,760230853,760421500,760612160, - 760802831,760993514,761184210,761374917,761565636,761756367,761947110,762137866,762328632,762519411, - 762710202,762901005,763091820,763282646,763473485,763664335,763855198,764046072,764236958,764427856, - 764618767,764809689,765000622,765191568,765382526,765573496,765764477,765955471,766146476,766337493, - 766528523,766719564,766910617,767101682,767292758,767483847,767674948,767866060,768057185,768248321, - 768439469,768630629,768821801,769012985,769204180,769395388,769586607,769777839,769969082,770160337, - 770351604,770542883,770734174,770925476,771116791,771308117,771499455,771690805,771882167,772073541, - 772264926,772456324,772647733,772839155,773030588,773222032,773413489,773604958,773796438,773987931, - 774179435,774370951,774562479,774754018,774945570,775137133,775328708,775520295,775711894,775903505, - 776095127,776286762,776478408,776670066,776861736,777053417,777245111,777436816,777628533,777820262, - 778012003,778203755,778395520,778587296,778779084,778970884,779162695,779354519,779546354,779738201, - 779930060,780121930,780313813,780505707,780697613,780889531,781081460,781273402,781465355,781657320, - 781849297,782041285,782233285,782425297,782617321,782809357,783001404,783193464,783385535,783577617, - 783769712,783961818,784153936,784346066,784538208,784730361,784922526,785114703,785306892,785499092, - 785691304,785883528,786075764,786268012,786460271,786652542,786844824,787037119,787229425,787421743, - 787614073,787806414,787998767,788191132,788383509,788575897,788768297,788960709,789153133,789345568, - 789538015,789730474,789922944,790115426,790307920,790500426,790692943,790885472,791078013,791270566, - 791463130,791655706,791848294,792040893,792233504,792426127,792618762,792811408,793004066,793196735, - 793389417,793582110,793774814,793967531,794160259,794352999,794545750,794738513,794931288,795124075, - 795316873,795509683,795702505,795895338,796088183,796281039,796473908,796666788,796859680,797052583, - 797245498,797438425,797631363,797824313,798017275,798210248,798403233,798596230,798789238,798982258, - 799175290,799368333,799561388,799754455,799947533,800140623,800333725,800526838,800719963,800913099, - 801106248,801299407,801492579,801685762,801878957,802072163,802265381,802458611,802651852,802845105, - 803038370,803231646,803424934,803618233,803811544,804004867,804198201,804391547,804584905,804778274, - 804971654,805165047,805358451,805551866,805745294,805938733,806132183,806325645,806519119,806712604, - 806906101,807099609,807293129,807486661,807680204,807873759,808067326,808260904,808454493,808648094, - 808841707,809035332,809228968,809422615,809616274,809809945,810003627,810197321,810391027,810584744, - 810778472,810972213,811165964,811359728,811553503,811747289,811941087,812134897,812328718,812522551, - 812716395,812910251,813104118,813297997,813491888,813685790,813879703,814073628,814267565,814461513, - 814655473,814849445,815043427,815237422,815431428,815625445,815819475,816013515,816207567,816401631, - 816595706,816789793,816983891,817178001,817372122,817566255,817760400,817954555,818148723,818342902, - 818537092,818731294,818925508,819119733,819313969,819508217,819702477,819896748,820091031,820285325, - 820479630,820673947,820868276,821062616,821256968,821451331,821645705,821840091,822034489,822228898, - 822423319,822617751,822812194,823006649,823201116,823395594,823590083,823784584,823979097,824173621, - 824368156,824562703,824757261,824951831,825146413,825341005,825535610,825730225,825924853,826119491, - 826314141,826508803,826703476,826898160,827092856,827287564,827482283,827677013,827871755,828066508, - 828261273,828456049,828650837,828845636,829040446,829235268,829430102,829624946,829819803,830014670, - 830209550,830404440,830599342,830794256,830989181,831184117,831379065,831574024,831768994,831963976, - 832158970,832353975,832548991,832744019,832939058,833134109,833329170,833524244,833719329,833914425, - 834109533,834304652,834499782,834694924,834890077,835085242,835280418,835475605,835670804,835866015, - 836061236,836256469,836451714,836646970,836842237,837037516,837232806,837428107,837623420,837818744, - 838014080,838209427,838404785,838600155,838795536,838990928,839186332,839381747,839577174,839772612, - 839968061,840163522,840358994,840554478,840749972,840945479,841140996,841336525,841532065,841727617, - 841923180,842118754,842314340,842509937,842705546,842901165,843096797,843292439,843488093,843683758, - 843879435,844075122,844270822,844466532,844662254,844857987,845053732,845249488,845445255,845641034, - 845836823,846032625,846228437,846424261,846620096,846815943,847011801,847207670,847403550,847599442, - 847795345,847991260,848187186,848383123,848579071,848775031,848971002,849166984,849362978,849558983, - 849754999,849951027,850147065,850343116,850539177,850735250,850931334,851127429,851323536,851519654, - 851715783,851911924,852108076,852304239,852500413,852696599,852892796,853089004,853285224,853481454, - 853677697,853873950,854070215,854266491,854462778,854659076,854855386,855051707,855248039,855444383, - 855640738,855837104,856033481,856229870,856426270,856622681,856819103,857015537,857211982,857408438, - 857604905,857801384,857997874,858194375,858390888,858587411,858783946,858980492,859177050,859373619, - 859570198,859766790,859963392,860160006,860356630,860553267,860749914,860946572,861143242,861339923, - 861536615,861733319,861930034,862126760,862323497,862520245,862717005,862913775,863110557,863307351, - 863504155,863700971,863897798,864094636,864291485,864488346,864685217,864882100,865078994,865275900, - 865472816,865669744,865866683,866063633,866260595,866457567,866654551,866851546,867048552,867245569, - 867442598,867639637,867836688,868033750,868230823,868427908,868625004,868822110,869019228,869216357, - 869413498,869610649,869807812,870004986,870202171,870399367,870596574,870793793,870991023,871188264, - 871385516,871582779,871780053,871977339,872174635,872371943,872569262,872766592,872963934,873161286, - 873358650,873556024,873753410,873950807,874148216,874345635,874543065,874740507,874937960,875135424, - 875332899,875530385,875727882,875925391,876122910,876320441,876517983,876715536,876913100,877110675, - 877308262,877505859,877703468,877901088,878098719,878296361,878494014,878691678,878889353,879087040, - 879284737,879482446,879680166,879877897,880075639,880273392,880471156,880668932,880866718,881064516, - 881262324,881460144,881657975,881855817,882053670,882251534,882449409,882647296,882845193,883043102, - 883241021,883438952,883636894,883834847,884032811,884230786,884428772,884626769,884824777,885022797, - 885220827,885418869,885616921,885814985,886013060,886211145,886409242,886607350,886805469,887003599, - 887201741,887399893,887598056,887796230,887994416,888192612,888390820,888589038,888787268,888985509, - 889183760,889382023,889580297,889778582,889976878,890175185,890373503,890571832,890770172,890968523, - 891166885,891365258,891563643,891762038,891960444,892158862,892357290,892555729,892754180,892952641, - 893151114,893349597,893548092,893746597,893945114,894143642,894342180,894540730,894739291,894937862, - 895136445,895335039,895533644,895732259,895930886,896129524,896328173,896526833,896725503,896924185, - 897122878,897321582,897520297,897719022,897917759,898116507,898315266,898514036,898712816,898911608, - 899110411,899309225,899508050,899706885,899905732,900104590,900303458,900502338,900701229,900900130, - 901099043,901297967,901496901,901695847,901894803,902093771,902292749,902491739,902690739,902889750, - 903088773,903287806,903486850,903685906,903884972,904084049,904283137,904482236,904681346,904880467, - 905079599,905278742,905477896,905677061,905876237,906075423,906274621,906473829,906673049,906872279, - 907071521,907270773,907470037,907669311,907868596,908067892,908267199,908466517,908665846,908865186, - 909064537,909263899,909463271,909662655,909862049,910061455,910260871,910460298,910659737,910859186, - 911058646,911258117,911457599,911657091,911856595,912056110,912255635,912455172,912654719,912854277, - 913053846,913253426,913453017,913652619,913852232,914051856,914251490,914451136,914650792,914850459, - 915050138,915249827,915449527,915649237,915848959,916048692,916248435,916448190,916647955,916847731, - 917047518,917247316,917447125,917646945,917846775,918046617,918246469,918446332,918646206,918846091, - 919045987,919245894,919445811,919645740,919845679,920045629,920245590,920445562,920645545,920845538, - 921045543,921245558,921445584,921645621,921845669,922045728,922245797,922445878,922645969,922846071, - 923046184,923246308,923446443,923646588,923846745,924046912,924247090,924447279,924647479,924847689, - 925047911,925248143,925448386,925648640,925848904,926049180,926249466,926449764,926650072,926850391, - 927050720,927251061,927451412,927651774,927852147,928052531,928252926,928453331,928653747,928854174, - 929054612,929255061,929455521,929655991,929856472,930056964,930257467,930457980,930658504,930859040, - 931059586,931260142,931460710,931661288,931861877,932062477,932263088,932463709,932664342,932864985, - 933065639,933266303,933466979,933667665,933868362,934069070,934269789,934470518,934671258,934872009, - 935072771,935273543,935474326,935675120,935875925,936076741,936277567,936478404,936679252,936880111, - 937080980,937281861,937482751,937683653,937884566,938085489,938286423,938487368,938688323,938889289, - 939090266,939291254,939492253,939693262,939894282,940095313,940296354,940497407,940698470,940899543, - 941100628,941301723,941502829,941703946,941905073,942106212,942307361,942508520,942709691,942910872, - 943112064,943313266,943514480,943715704,943916938,944118184,944319440,944520707,944721985,944923273, - 945124572,945325882,945527203,945728534,945929876,946131229,946332592,946533966,946735351,946936747, - 947138153,947339570,947540998,947742436,947943885,948145345,948346815,948548297,948749789,948951291, - 949152804,949354328,949555863,949757409,949958965,950160531,950362109,950563697,950765296,950966905, - 951168526,951370156,951571798,951773450,951975113,952176787,952378471,952580166,952781872,952983588, - 953185315,953387053,953588801,953790560,953992330,954194110,954395901,954597703,954799515,955001338, - 955203172,955405016,955606871,955808737,956010613,956212500,956414398,956616306,956818225,957020155, - 957222095,957424046,957626008,957827980,958029963,958231956,958433960,958635975,958838001,959040037, - 959242083,959444141,959646209,959848287,960050377,960252477,960454587,960656708,960858840,961060983, - 961263136,961465299,961667474,961869659,962071854,962274060,962476277,962678505,962880743,963082991, - 963285251,963487521,963689801,963892092,964094394,964296707,964499030,964701363,964903707,965106062, - 965308428,965510804,965713190,965915588,966117995,966320414,966522843,966725283,966927733,967130194, - 967332665,967535147,967737640,967940143,968142657,968345181,968547716,968750262,968952818,969155385, - 969357962,969560550,969763149,969965758,970168378,970371008,970573649,970776300,970978962,971181635, - 971384318,971587011,971789716,971992431,972195156,972397892,972600639,972803396,973006163,973208942, - 973411731,973614530,973817340,974020160,974222991,974425833,974628685,974831548,975034421,975237305, - 975440200,975643105,975846020,976048946,976251883,976454830,976657788,976860756,977063735,977266724, - 977469724,977672734,977875755,978078787,978281829,978484881,978687944,978891018,979094102,979297197, - 979500302,979703418,979906544,980109681,980312828,980515986,980719154,980922333,981125523,981328723, - 981531933,981735154,981938386,982141628,982344880,982548143,982751417,982954701,983157995,983361300, - 983564616,983767942,983971279,984174626,984377983,984581352,984784730,984988119,985191519,985394929, - 985598350,985801781,986005222,986208675,986412137,986615610,986819094,987022588,987226092,987429608, - 987633133,987836669,988040216,988243773,988447340,988650918,988854506,989058105,989261715,989465335, - 989668965,989872606,990076257,990279919,990483591,990687274,990890967,991094671,991298385,991502109, - 991705844,991909590,992113346,992317112,992520889,992724677,992928475,993132283,993336102,993539931, - 993743770,993947620,994151481,994355352,994559234,994763125,994967028,995170941,995374864,995578798, - 995782742,995986696,996190661,996394637,996598623,996802619,997006626,997210643,997414671,997618709, - 997822757,998026816,998230886,998434965,998639056,998843156,999047267,999251389,999455521,999659663, - 999863816,1000067979,1000272153,1000476337,1000680531,1000884736,1001088952,1001293177,1001497413,1001701660, - 1001905917,1002110184,1002314462,1002518750,1002723049,1002927358,1003131677,1003336007,1003540347,1003744698, - 1003949059,1004153430,1004357812,1004562204,1004766607,1004971020,1005175443,1005379877,1005584321,1005788776, - 1005993241,1006197716,1006402202,1006606698,1006811205,1007015722,1007220249,1007424787,1007629335,1007833893, - 1008038462,1008243041,1008447631,1008652231,1008856841,1009061462,1009266093,1009470734,1009675386,1009880048, - 1010084721,1010289404,1010494097,1010698801,1010903515,1011108239,1011312974,1011517719,1011722475,1011927241, - 1012132017,1012336803,1012541600,1012746407,1012951225,1013156053,1013360891,1013565740,1013770599,1013975469, - 1014180348,1014385238,1014590139,1014795050,1014999971,1015204902,1015409844,1015614796,1015819759,1016024732, - 1016229715,1016434708,1016639712,1016844726,1017049751,1017254786,1017459831,1017664886,1017869952,1018075028, - 1018280115,1018485212,1018690319,1018895436,1019100564,1019305702,1019510851,1019716009,1019921179,1020126358, - 1020331548,1020536748,1020741958,1020947179,1021152410,1021357651,1021562903,1021768165,1021973437,1022178719, - 1022384012,1022589315,1022794629,1022999953,1023205287,1023410631,1023615986,1023821351,1024026726,1024232111, - 1024437507,1024642913,1024848330,1025053757,1025259194,1025464641,1025670099,1025875566,1026081045,1026286533, - 1026492032,1026697541,1026903060,1027108590,1027314130,1027519680,1027725240,1027930811,1028136392,1028341984, - 1028547585,1028753197,1028958819,1029164451,1029370094,1029575747,1029781410,1029987084,1030192768,1030398462, - 1030604166,1030809880,1031015605,1031221340,1031427086,1031632841,1031838607,1032044383,1032250170,1032455966, - 1032661773,1032867590,1033073418,1033279255,1033485103,1033690961,1033896830,1034102708,1034308597,1034514496, - 1034720406,1034926325,1035132255,1035338195,1035544146,1035750106,1035956077,1036162058,1036368050,1036574051, - 1036780063,1036986085,1037192117,1037398160,1037604212,1037810275,1038016348,1038222432,1038428526,1038634629, - 1038840743,1039046868,1039253002,1039459147,1039665302,1039871467,1040077643,1040283828,1040490024,1040696230, - 1040902446,1041108673,1041314910,1041521157,1041727414,1041933681,1042139959,1042346246,1042552544,1042758852, - 1042965171,1043171499,1043377838,1043584187,1043790546,1043996916,1044203295,1044409685,1044616085,1044822495, - 1045028916,1045235346,1045441787,1045648238,1045854699,1046061170,1046267652,1046474144,1046680645,1046887158, - 1047093680,1047300212,1047506755,1047713308,1047919871,1048126444,1048333027,1048539621,1048746224,1048952838, - 1049159462,1049366097,1049572741,1049779396,1049986060,1050192735,1050399420,1050606116,1050812821,1051019537, - 1051226262,1051432998,1051639744,1051846500,1052053267,1052260043,1052466830,1052673627,1052880434,1053087251, - 1053294079,1053500916,1053707764,1053914622,1054121489,1054328368,1054535256,1054742154,1054949063,1055155981, - 1055362910,1055569849,1055776798,1055983758,1056190727,1056397707,1056604696,1056811696,1057018706,1057225726, - 1057432756,1057639797,1057846847,1058053908,1058260979,1058468059,1058675150,1058882252,1059089363,1059296484, - 1059503616,1059710757,1059917909,1060125071,1060332243,1060539425,1060746617,1060953820,1061161032,1061368255, - 1061575488,1061782730,1061989983,1062197246,1062404520,1062611803,1062819096,1063026400,1063233713,1063441037, - 1063648371,1063855715,1064063069,1064270433,1064477807,1064685192,1064892586,1065099990,1065307405,1065514830, - 1065722265,1065929709,1066137164,1066344630,1066552105,1066759590,1066967085,1067174591,1067382106,1067589632, - 1067797168,1068004714,1068212269,1068419835,1068627411,1068834998,1069042594,1069250200,1069457816,1069665443, - 1069873079,1070080726,1070288383,1070496049,1070703726,1070911413,1071119110,1071326817,1071534534,1071742261, - 1071949998,1072157746,1072365503,1072573270,1072781048,1072988835,1073196633,1073404441,1073612258,1073820086, - 1074027924,1074235772,1074443630,1074651498,1074859376,1075067264,1075275162,1075483070,1075690988,1075898917, - 1076106855,1076314803,1076522762,1076730730,1076938709,1077146697,1077354696,1077562705,1077770723,1077978752, - 1078186791,1078394839,1078602898,1078810967,1079019046,1079227135,1079435234,1079643343,1079851462,1080059591, - 1080267730,1080475879,1080684038,1080892207,1081100386,1081308576,1081516775,1081724984,1081933203,1082141432, - 1082349672,1082557921,1082766180,1082974450,1083182729,1083391018,1083599318,1083807627,1084015947,1084224276, - 1084432615,1084640965,1084849324,1085057694,1085266073,1085474462,1085682862,1085891271,1086099691,1086308120, - 1086516560,1086725009,1086933468,1087141938,1087350417,1087558907,1087767406,1087975915,1088184435,1088392964, - 1088601503,1088810053,1089018612,1089227181,1089435761,1089644350,1089852949,1090061559,1090270178,1090478807, - 1090687446,1090896095,1091104754,1091313424,1091522103,1091730792,1091939491,1092148200,1092356919,1092565648, - 1092774387,1092983136,1093191894,1093400663,1093609442,1093818231,1094027030,1094235838,1094444657,1094653486, - 1094862324,1095071173,1095280031,1095488900,1095697778,1095906666,1096115565,1096324473,1096533391,1096742319, - 1096951257,1097160206,1097369164,1097578132,1097787109,1097996097,1098205095,1098414103,1098623121,1098832148, - 1099041186,1099250233,1099459291,1099668358,1099877435,1100086523,1100295620,1100504727,1100713844,1100922971, - 1101132108,1101341255,1101550412,1101759578,1101968755,1102177942,1102387138,1102596345,1102805561,1103014787, - 1103224023,1103433270,1103642526,1103851792,1104061067,1104270353,1104479649,1104688955,1104898270,1105107596, - 1105316931,1105526276,1105735631,1105944997,1106154372,1106363756,1106573151,1106782556,1106991971,1107201395, - 1107410830,1107620274,1107829728,1108039192,1108248667,1108458150,1108667644,1108877148,1109086662,1109296185, - 1109505719,1109715262,1109924815,1110134378,1110343951,1110553534,1110763127,1110972730,1111182342,1111391965, - 1111601597,1111811239,1112020891,1112230553,1112440225,1112649907,1112859598,1113069300,1113279011,1113488733, - 1113698464,1113908205,1114117956,1114327716,1114537487,1114747267,1114957058,1115166858,1115376668,1115586488, - 1115796318,1116006157,1116216007,1116425866,1116635736,1116845615,1117055504,1117265403,1117475311,1117685230, - 1117895158,1118105097,1118315045,1118525003,1118734971,1118944948,1119154936,1119364933,1119574941,1119784958, - 1119994985,1120205022,1120415068,1120625125,1120835191,1121045267,1121255353,1121465449,1121675555,1121885670, - 1122095796,1122305931,1122516076,1122726231,1122936396,1123146570,1123356755,1123566949,1123777153,1123987367, - 1124197590,1124407824,1124618067,1124828321,1125038584,1125248856,1125459139,1125669432,1125879734,1126090046, - 1126300368,1126510700,1126721041,1126931393,1127141754,1127352125,1127562506,1127772897,1127983297,1128193707, - 1128404127,1128614557,1128824997,1129035447,1129245906,1129456375,1129666854,1129877343,1130087841,1130298350, - 1130508868,1130719396,1130929934,1131140481,1131351039,1131561606,1131772183,1131982769,1132193366,1132403972, - 1132614588,1132825214,1133035850,1133246496,1133457151,1133667816,1133878491,1134089176,1134299870,1134510574, - 1134721288,1134932012,1135142746,1135353489,1135564242,1135775005,1135985778,1136196560,1136407352,1136618154, - 1136828966,1137039788,1137250619,1137461460,1137672311,1137883172,1138094042,1138304922,1138515812,1138726712, - 1138937622,1139148541,1139359470,1139570409,1139781357,1139992315,1140203284,1140414261,1140625249,1140836246, - 1141047253,1141258270,1141469297,1141680333,1141891379,1142102435,1142313501,1142524576,1142735661,1142946756, - 1143157861,1143368975,1143580099,1143791233,1144002377,1144213530,1144424693,1144635866,1144847048,1145058241, - 1145269443,1145480655,1145691876,1145903107,1146114348,1146325599,1146536859,1146748130,1146959410,1147170699, - 1147381999,1147593308,1147804626,1148015955,1148227293,1148438641,1148649999,1148861367,1149072744,1149284131, - 1149495527,1149706934,1149918350,1150129775,1150341211,1150552656,1150764111,1150975576,1151187050,1151398534, - 1151610028,1151821531,1152033044,1152244567,1152456100,1152667642,1152879194,1153090756,1153302327,1153513909, - 1153725499,1153937100,1154148710,1154360330,1154571960,1154783599,1154995248,1155206907,1155418575,1155630253, - 1155841941,1156053639,1156265346,1156477063,1156688789,1156900526,1157112272,1157324027,1157535793,1157747568, - 1157959352,1158171147,1158382951,1158594765,1158806588,1159018421,1159230264,1159442116,1159653979,1159865850, - 1160077732,1160289623,1160501524,1160713435,1160925355,1161137285,1161349224,1161561173,1161773132,1161985101, - 1162197079,1162409067,1162621064,1162833072,1163045089,1163257115,1163469151,1163681197,1163893253,1164105318, - 1164317393,1164529477,1164741571,1164953675,1165165789,1165377912,1165590045,1165802187,1166014339,1166226501, - 1166438672,1166650853,1166863044,1167075244,1167287454,1167499674,1167711903,1167924142,1168136390,1168348649, - 1168560916,1168773194,1168985481,1169197778,1169410084,1169622400,1169834726,1170047061,1170259406,1170471761, - 1170684125,1170896499,1171108882,1171321275,1171533678,1171746090,1171958512,1172170944,1172383385,1172595836, - 1172808296,1173020766,1173233246,1173445735,1173658234,1173870743,1174083261,1174295789,1174508326,1174720873, - 1174933430,1175145996,1175358572,1175571158,1175783753,1175996357,1176208972,1176421596,1176634229,1176846872, - 1177059525,1177272187,1177484859,1177697541,1177910232,1178122933,1178335643,1178548363,1178761093,1178973832, - 1179186581,1179399339,1179612107,1179824884,1180037672,1180250468,1180463275,1180676090,1180888916,1181101751, - 1181314596,1181527450,1181740314,1181953187,1182166070,1182378963,1182591865,1182804777,1183017698,1183230629, - 1183443570,1183656520,1183869480,1184082449,1184295428,1184508416,1184721414,1184934422,1185147439,1185360465, - 1185573502,1185786548,1185999603,1186212668,1186425743,1186638827,1186851920,1187065024,1187278136,1187491259, - 1187704391,1187917532,1188130683,1188343844,1188557014,1188770194,1188983383,1189196582,1189409790,1189623008, - 1189836236,1190049473,1190262720,1190475976,1190689242,1190902517,1191115802,1191329096,1191542400,1191755713, - 1191969036,1192182369,1192395711,1192609063,1192822424,1193035795,1193249175,1193462565,1193675964,1193889373, - 1194102791,1194316219,1194529657,1194743104,1194956561,1195170027,1195383502,1195596987,1195810482,1196023986, - 1196237500,1196451023,1196664556,1196878099,1197091650,1197305212,1197518783,1197732363,1197945953,1198159553, - 1198373162,1198586780,1198800408,1199014046,1199227693,1199441349,1199655015,1199868691,1200082376,1200296071, - 1200509775,1200723489,1200937212,1201150944,1201364687,1201578438,1201792200,1202005970,1202219750,1202433540, - 1202647339,1202861148,1203074966,1203288794,1203502631,1203716478,1203930334,1204144200,1204358075,1204571960, - 1204785854,1204999758,1205213671,1205427594,1205641526,1205855467,1206069419,1206283379,1206497349,1206711329, - 1206925318,1207139317,1207353325,1207567342,1207781369,1207995406,1208209452,1208423507,1208637572,1208851647, - 1209065731,1209279824,1209493927,1209708039,1209922161,1210136293,1210350433,1210564584,1210778743,1210992912, - 1211207091,1211421279,1211635477,1211849684,1212063900,1212278126,1212492362,1212706607,1212920861,1213135125, - 1213349398,1213563681,1213777973,1213992275,1214206586,1214420907,1214635237,1214849576,1215063925,1215278284, - 1215492652,1215707029,1215921416,1216135812,1216350218,1216564633,1216779057,1216993491,1217207935,1217422388, - 1217636850,1217851322,1218065803,1218280294,1218494794,1218709304,1218923823,1219138351,1219352889,1219567436, - 1219781993,1219996559,1220211135,1220425720,1220640314,1220854918,1221069532,1221284154,1221498787,1221713428, - 1221928079,1222142740,1222357410,1222572089,1222786778,1223001476,1223216184,1223430901,1223645627,1223860363, - 1224075109,1224289863,1224504627,1224719401,1224934184,1225148976,1225363778,1225578589,1225793410,1226008240, - 1226223080,1226437928,1226652787,1226867654,1227082531,1227297418,1227512314,1227727219,1227942134,1228157058, - 1228371992,1228586934,1228801887,1229016849,1229231820,1229446800,1229661790,1229876789,1230091798,1230306816, - 1230521844,1230736881,1230951927,1231166983,1231382048,1231597122,1231812206,1232027299,1232242402,1232457514, - 1232672636,1232887766,1233102907,1233318056,1233533215,1233748383,1233963561,1234178748,1234393945,1234609151, - 1234824366,1235039590,1235254824,1235470068,1235685321,1235900583,1236115854,1236331135,1236546425,1236761725, - 1236977034,1237192352,1237407680,1237623017,1237838364,1238053719,1238269085,1238484459,1238699843,1238915236, - 1239130639,1239346051,1239561472,1239776903,1239992343,1240207793,1240423251,1240638720,1240854197,1241069684, - 1241285180,1241500686,1241716201,1241931725,1242147259,1242362802,1242578354,1242793916,1243009487,1243225067, - 1243440657,1243656256,1243871864,1244087482,1244303109,1244518745,1244734391,1244950046,1245165711,1245381385, - 1245597068,1245812760,1246028462,1246244173,1246459894,1246675623,1246891363,1247107111,1247322869,1247538636, - 1247754413,1247970198,1248185993,1248401798,1248617612,1248833435,1249049267,1249265109,1249480960,1249696820, - 1249912690,1250128569,1250344458,1250560355,1250776262,1250992179,1251208104,1251424039,1251639983,1251855937, - 1252071900,1252287872,1252503854,1252719845,1252935845,1253151854,1253367873,1253583901,1253799938,1254015985, - 1254232041,1254448106,1254664181,1254880265,1255096358,1255312461,1255528572,1255744693,1255960824,1256176964, - 1256393113,1256609271,1256825438,1257041615,1257257802,1257473997,1257690202,1257906416,1258122639,1258338872, - 1258555114,1258771365,1258987626,1259203895,1259420174,1259636463,1259852760,1260069067,1260285384,1260501709, - 1260718044,1260934388,1261150741,1261367104,1261583476,1261799857,1262016248,1262232647,1262449056,1262665475, - 1262881902,1263098339,1263314785,1263531241,1263747705,1263964179,1264180662,1264397155,1264613657,1264830168, - 1265046688,1265263217,1265479756,1265696304,1265912861,1266129428,1266346004,1266562589,1266779183,1266995787, - 1267212400,1267429022,1267645653,1267862294,1268078944,1268295603,1268512271,1268728949,1268945636,1269162332, - 1269379038,1269595752,1269812476,1270029209,1270245952,1270462703,1270679464,1270896234,1271113014,1271329802, - 1271546600,1271763407,1271980224,1272197049,1272413884,1272630728,1272847582,1273064444,1273281316,1273498197, - 1273715087,1273931987,1274148895,1274365813,1274582740,1274799677,1275016622,1275233577,1275450541,1275667515, - 1275884497,1276101489,1276318490,1276535500,1276752520,1276969548,1277186586,1277403633,1277620690,1277837755, - 1278054830,1278271914,1278489007,1278706110,1278923221,1279140342,1279357472,1279574611,1279791760,1280008918, - 1280226085,1280443261,1280660446,1280877641,1281094844,1281312057,1281529279,1281746511,1281963751,1282181001, - 1282398260,1282615528,1282832806,1283050092,1283267388,1283484693,1283702007,1283919331,1284136663,1284354005, - 1284571356,1284788716,1285006085,1285223464,1285440852,1285658249,1285875655,1286093070,1286310494,1286527928, - 1286745371,1286962823,1287180284,1287397755,1287615234,1287832723,1288050221,1288267728,1288485245,1288702770, - 1288920305,1289137849,1289355402,1289572964,1289790535,1290008116,1290225706,1290443305,1290660913,1290878530, - 1291096157,1291313792,1291531437,1291749091,1291966754,1292184426,1292402108,1292619799,1292837498,1293055207, - 1293272925,1293490653,1293708389,1293926135,1294143890,1294361654,1294579427,1294797209,1295015000,1295232801, - 1295450611,1295668430,1295886258,1296104095,1296321941,1296539797,1296757661,1296975535,1297193418,1297411310, - 1297629211,1297847122,1298065041,1298282970,1298500908,1298718855,1298936811,1299154776,1299372751,1299590734, - 1299808727,1300026729,1300244740,1300462760,1300680789,1300898828,1301116875,1301334932,1301552998,1301771072, - 1301989157,1302207250,1302425352,1302643464,1302861584,1303079714,1303297853,1303516001,1303734158,1303952324, - 1304170499,1304388684,1304606878,1304825080,1305043292,1305261513,1305479743,1305697982,1305916231,1306134488, - 1306352755,1306571030,1306789315,1307007609,1307225912,1307444224,1307662546,1307880876,1308099216,1308317564, - 1308535922,1308754289,1308972665,1309191050,1309409444,1309627847,1309846259,1310064681,1310283112,1310501551, - 1310720000,1310938458,1311156925,1311375401,1311593886,1311812380,1312030884,1312249396,1312467918,1312686449, - 1312904988,1313123537,1313342095,1313560662,1313779238,1313997824,1314216418,1314435021,1314653634,1314872255, - 1315090886,1315309526,1315528175,1315746833,1315965500,1316184176,1316402861,1316621555,1316840259,1317058971, - 1317277693,1317496423,1317715163,1317933912,1318152669,1318371436,1318590212,1318808997,1319027792,1319246595, - 1319465407,1319684228,1319903059,1320121898,1320340747,1320559605,1320778471,1320997347,1321216232,1321435126, - 1321654029,1321872941,1322091862,1322310792,1322529731,1322748679,1322967637,1323186603,1323405579,1323624563, - 1323843557,1324062559,1324281571,1324500592,1324719622,1324938661,1325157708,1325376765,1325595831,1325814906, - 1326033991,1326253084,1326472186,1326691297,1326910418,1327129547,1327348685,1327567833,1327786989,1328006155, - 1328225329,1328444513,1328663706,1328882907,1329102118,1329321338,1329540567,1329759804,1329979051,1330198307, - 1330417572,1330636846,1330856129,1331075421,1331294722,1331514033,1331733352,1331952680,1332172017,1332391363, - 1332610719,1332830083,1333049456,1333268839,1333488230,1333707630,1333927040,1334146458,1334365886,1334585322, - 1334804768,1335024222,1335243686,1335463158,1335682640,1335902131,1336121630,1336341139,1336560657,1336780183, - 1336999719,1337219264,1337438817,1337658380,1337877952,1338097532,1338317122,1338536721,1338756329,1338975945, - 1339195571,1339415206,1339634850,1339854503,1340074164,1340293835,1340513515,1340733204,1340952901,1341172608, - 1341392324,1341612049,1341831783,1342051525,1342271277,1342491038,1342710808,1342930586,1343150374,1343370171, - 1343589977,1343809791,1344029615,1344249448,1344469289,1344689140,1344909000,1345128868,1345348746,1345568633, - 1345788528,1346008433,1346228346,1346448269,1346668200,1346888141,1347108090,1347328049,1347548016,1347767993, - 1347987978,1348207972,1348427976,1348647988,1348868009,1349088040,1349308079,1349528127,1349748184,1349968250, - 1350188326,1350408410,1350628503,1350848605,1351068716,1351288836,1351508965,1351729102,1351949249,1352169405, - 1352389570,1352609744,1352829926,1353050118,1353270318,1353490528,1353710747,1353930974,1354151210,1354371456, - 1354591710,1354811973,1355032246,1355252527,1355472817,1355693116,1355913424, -}; - -static real aa_cs[8] = -{ - 14386344,14793176,15932125,16497281,16702017,16763133,16775525,16777101 -}; - -static real aa_ca[8] = -{ - -8631806,-7914349,-5257601,-3051997,-1586692,-687288,-238212,-62075 -}; - -static real win[4][36] = -{ - { - 541609,1798624,3379171,5462936,8388608,12881122,20824265,39123649,129925287,-141788570,-50986933,-32687548, - -24744405,-20251891,-17326219,-15242454,-13661907,-12404893,-11366990,-10483150,-9710514,-9019459,-8388608,-7801881, - -7246655,-6712557,-6190623,-5672661,-5150726,-4616628,-4061402,-3474675,-2843824,-2152769,-1380133,-496293 - }, - { - 541609,1798624,3379171,5462936,8388608,12881122,20824265,39123649,129925287,-141788570,-50986933,-32687548, - -24744405,-20251891,-17326219,-15242454,-13661907,-12404893,-11377819,-10573609,-9946281,-9457165,-9079764,-8795700, - -8518771,-7816938,-6661470,-5111526,-3237882,-1121518, - }, - { - 1798624,8388608,39123649,-50986933,-20251891,-13661907,-10483150,-8388608,-6712557,-5150726,-3474675,-1380133, - }, - { - 0,0,0,0,0,0,5058839,24594154,117073194,-152572757,-59375541,-38425694, - -27896396,-21920489,-18167045,-15612533,-13779795,-12416710,-11366990,-10483150,-9710514,-9019459,-8388608,-7801881, - -7246655,-6712557,-6190623,-5672661,-5150726,-4616628,-4061402,-3474675,-2843824,-2152769,-1380133,-496293 - } -}; - -const real COS9[9] = -{ - 16777216,16522332,15765426,14529495,12852093,10784187,8388608,5738146,2913333 -}; - -static const real COS6_1 = 14529495; - -static const real COS6_2 = 8388608; - -const real tfcos36[9] = -{ - 8420651,8684526,9255805,10240599,11863283,14625092,19849138,32411092,96248483 -}; - -static const real tfcos12[3] = -{ - 8684526,11863283,32411092 -}; - -#ifdef NEW_DCT9 -static const real cos9[3] = -{ - 15765426,-2913333,-12852093 -}; - -static const real cos18[3] = -{ - 16522332,-5738146,-10784187 -}; -#endif - -static const real tan1_1[16] = -{ - 0,6925,11994,16384,20774,25843,32768,44762,77530,2147483647,-44762,-11994,0,6925,11994,16384 -}; - -static const real tan2_1[16] = -{ - 32768,25843,20774,16384,11994,6925,0,-11994,-44762,2147483647,77530,44762,32768,25843,20774,16384 -}; - -static const real tan1_2[16] = -{ - 0,9793,16962,23170,29379,36548,46341,63303,109644,2147483647,-63303,-16962,0,9793,16962,23170 -}; - -static real tan2_2[16] = -{ - 46341,36548,29379,23170,16962,9793,0,-16962,-63303,2147483647,109644,63303,46341,36548,29379,23170 -}; - -static const real pow1_1[2][16] = -{ - {32768,27554,32768,23170,32768,19484,32768,16384,32768,13777,32768,11585,32768,9742,32768,8192}, - {32768,23170,32768,16384,32768,11585,32768,8192,32768,5793,32768,4096,32768,2896,32768,2048} -}; - -static const real pow2_1[2][16] = -{ - {32768,32768,27554,32768,23170,32768,19484,32768,16384,32768,13777,32768,11585,32768,9742,32768}, - {32768,32768,23170,32768,16384,32768,11585,32768,8192,32768,5793,32768,4096,32768,2896,32768} -}; - -static const real pow1_2[2][16] = -{ - {46341,38968,46341,32768,46341,27554,46341,23170,46341,19484,46341,16384,46341,13777,46341,11585}, - {46341,32768,46341,23170,46341,16384,46341,11585,46341,8192,46341,5793,46341,4096,46341,2896} -}; - -static const real pow2_2[2][16] = -{ - {46341,46341,38968,46341,32768,46341,27554,46341,23170,46341,19484,46341,16384,46341,13777,46341}, - {46341,46341,32768,46341,23170,46341,16384,46341,11585,46341,8192,46341,5793,46341,4096,46341} -}; - -static const real gainpow2[256+118+4] = -{ - 1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417, - 1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301, - 1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417, - 1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301, - 1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417, - 1073741824,1805811301,1518500250,1276901417,1073741824,1805811301,1518500250,1276901417,1073741824,1805811301, - 1518500250,1276901417,1073741824,902905651,759250125,638450708,536870912,451452825,379625062,319225354, - 268435456,225726413,189812531,159612677,134217728,112863206,94906266,79806339,67108864,56431603, - 47453133,39903169,33554432,28215802,23726566,19951585,16777216,14107901,11863283,9975792, - 8388608,7053950,5931642,4987896,4194304,3526975,2965821,2493948,2097152,1763488, - 1482910,1246974,1048576,881744,741455,623487,524288,440872,370728,311744, - 262144,220436,185364,155872,131072,110218,92682,77936,65536,55109, - 46341,38968,32768,27554,23170,19484,16384,13777,11585,9742, - 8192,6889,5793,4871,4096,3444,2896,2435,2048,1722, - 1448,1218,1024,861,724,609,512,431,362,304, - 256,215,181,152,128,108,91,76,64,54, - 45,38,32,27,23,19,16,13,11,10, - 8,7,6,5,4,3,3,2,2,2, - 1,1,1,1,1,1,1, -}; - -#else -static real ispow[8207]; -static real aa_ca[8],aa_cs[8]; -static real win[4][36]; -static real win1[4][36]; -real COS9[9]; /* dct36_3dnow wants to use that */ -static real COS6_1,COS6_2; -real tfcos36[9]; /* dct36_3dnow wants to use that */ -static real tfcos12[3]; -#ifdef NEW_DCT9 -static real cos9[3],cos18[3]; -static real tan1_1[16],tan2_1[16],tan1_2[16],tan2_2[16]; -static real pow1_1[2][16],pow2_1[2][16],pow1_2[2][16],pow2_2[2][16]; -#endif -#endif - -static real win1[4][36]; - -static const char gainpow2_scale[256+118+4+1] = -{ - 19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,27, - 27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,33,33,34,34,34,34,34, - 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, - 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, - 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, - 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, - 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, - 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, - 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, - 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, - 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, - 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,0 -}; - -#endif diff --git a/Frameworks/mpg123/mpg123/layer1.c b/Frameworks/mpg123/mpg123/layer1.c deleted file mode 100644 index 4b3b4180b..000000000 --- a/Frameworks/mpg123/mpg123/layer1.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - layer1.c: the layer 1 decoder - - copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Michael Hipp - - may have a few bugs after last optimization ... -*/ - -#include "mpg123lib_intern.h" -#include "getbits.h" - -static void I_step_one(unsigned int balloc[], unsigned int scale_index[2][SBLIMIT],mpg123_handle *fr) -{ - unsigned int *ba=balloc; - unsigned int *sca = (unsigned int *) scale_index; - - if(fr->stereo == 2) - { - int i; - int jsbound = fr->jsbound; - for(i=0;istereo == 2) - { - int jsbound = fr->jsbound; - register real *f0 = fraction[0]; - register real *f1 = fraction[1]; - ba = balloc; - for(sample=smpb,i=0;imuls[n+1][*sca++]); - else *f0++ = DOUBLE_TO_REAL(0.0); - - if((n=*ba++)) - *f1++ = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15( ((-1)<muls[n+1][*sca++]); - else *f1++ = DOUBLE_TO_REAL(0.0); - } - for(i=jsbound;imuls[n+1][*sca++]); - *f1++ = REAL_MUL_SCALE_LAYER12(samp, fr->muls[n+1][*sca++]); - } - else *f0++ = *f1++ = DOUBLE_TO_REAL(0.0); - } - for(i=fr->down_sample_sblimit;i<32;i++) - fraction[0][i] = fraction[1][i] = 0.0; - } - else - { - register real *f0 = fraction[0]; - ba = balloc; - for(sample=smpb,i=0;imuls[n+1][*sca++]); - else *f0++ = DOUBLE_TO_REAL(0.0); - } - for(i=fr->down_sample_sblimit;i<32;i++) - fraction[0][i] = DOUBLE_TO_REAL(0.0); - } -} - -int do_layer1(mpg123_handle *fr) -{ - int clip=0; - int i,stereo = fr->stereo; - unsigned int balloc[2*SBLIMIT]; - unsigned int scale_index[2][SBLIMIT]; - real (*fraction)[SBLIMIT] = fr->layer1.fraction; /* fraction[2][SBLIMIT] */ - int single = fr->single; - - fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32; - - if(stereo == 1 || single == SINGLE_MIX) /* I don't see mixing handled here */ - single = SINGLE_LEFT; - - I_step_one(balloc,scale_index,fr); - - for(i=0;isynth_mono)(fraction[single], fr); - else - clip += (fr->synth_stereo)(fraction[0], fraction[1], fr); - } - - return clip; -} - - diff --git a/Frameworks/mpg123/mpg123/layer2.c b/Frameworks/mpg123/mpg123/layer2.c deleted file mode 100644 index 208817002..000000000 --- a/Frameworks/mpg123/mpg123/layer2.c +++ /dev/null @@ -1,371 +0,0 @@ -/* - layer2.c: the layer 2 decoder, root of mpg123 - - copyright 1994-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Michael Hipp - - mpg123 started as mp2 decoder a long time ago... - part of this file is required for layer 1, too. -*/ - - -#include "mpg123lib_intern.h" -#ifndef NO_LAYER2 -#include "l2tables.h" -#endif -#include "getbits.h" - -#ifndef NO_LAYER12 /* Stuff needed for layer I and II. */ - -static int grp_3tab[32 * 3] = { 0, }; /* used: 27 */ -static int grp_5tab[128 * 3] = { 0, }; /* used: 125 */ -static int grp_9tab[1024 * 3] = { 0, }; /* used: 729 */ - -#if defined(REAL_IS_FIXED) && defined(PRECALC_TABLES) -#include "l12_integer_tables.h" -#else -static const double mulmul[27] = -{ - 0.0 , -2.0/3.0 , 2.0/3.0 , - 2.0/7.0 , 2.0/15.0 , 2.0/31.0, 2.0/63.0 , 2.0/127.0 , 2.0/255.0 , - 2.0/511.0 , 2.0/1023.0 , 2.0/2047.0 , 2.0/4095.0 , 2.0/8191.0 , - 2.0/16383.0 , 2.0/32767.0 , 2.0/65535.0 , - -4.0/5.0 , -2.0/5.0 , 2.0/5.0, 4.0/5.0 , - -8.0/9.0 , -4.0/9.0 , -2.0/9.0 , 2.0/9.0 , 4.0/9.0 , 8.0/9.0 -}; -#endif - -void init_layer12(void) -{ - const int base[3][9] = - { - { 1 , 0, 2 , } , - { 17, 18, 0 , 19, 20 , } , - { 21, 1, 22, 23, 0, 24, 25, 2, 26 } - }; - int i,j,k,l,len; - const int tablen[3] = { 3 , 5 , 9 }; - int *itable; - int *tables[3] = { grp_3tab , grp_5tab , grp_9tab }; - - for(i=0;i<3;i++) - { - itable = tables[i]; - len = tablen[i]; - for(j=0;jmuls[k], k); - *table++ = 0.0; - } -} - -real* init_layer12_table(mpg123_handle *fr, real *table, int m) -{ -#if defined(REAL_IS_FIXED) && defined(PRECALC_TABLES) - int i; - for(i=0;i<63;i++) - *table++ = layer12_table[m][i]; -#else - int i,j; - for(j=3,i=0;i<63;i++,j--) - *table++ = DOUBLE_TO_REAL_SCALE_LAYER12(mulmul[m] * pow(2.0,(double) j / 3.0)); -#endif - - return table; -} - -#ifdef OPT_MMXORSSE -real* init_layer12_table_mmx(mpg123_handle *fr, real *table, int m) -{ - int i,j; - if(!fr->p.down_sample) - { - for(j=3,i=0;i<63;i++,j--) - *table++ = DOUBLE_TO_REAL(16384 * mulmul[m] * pow(2.0,(double) j / 3.0)); - } - else - { - for(j=3,i=0;i<63;i++,j--) - *table++ = DOUBLE_TO_REAL(mulmul[m] * pow(2.0,(double) j / 3.0)); - } - return table; -} -#endif - -#endif /* NO_LAYER12 */ - -/* The rest is the actual decoding of layer II data. */ - -#ifndef NO_LAYER2 - -static void II_step_one(unsigned int *bit_alloc,int *scale,mpg123_handle *fr) -{ - int stereo = fr->stereo-1; - int sblimit = fr->II_sblimit; - int jsbound = fr->jsbound; - int sblimit2 = fr->II_sblimit<alloc; - int i; - unsigned int scfsi_buf[64]; - unsigned int *scfsi,*bita; - int sc,step; - - bita = bit_alloc; - if(stereo) - { - for(i=jsbound;i;i--,alloc1+=(1<bits; - *bita++ = (char) getbits(fr, step); - *bita++ = (char) getbits(fr, step); - } - for(i=sblimit-jsbound;i;i--,alloc1+=(1<bits; - bita[0] = (char) getbits(fr, step); - bita[1] = bita[0]; - bita+=2; - } - bita = bit_alloc; - scfsi=scfsi_buf; - - for(i=sblimit2;i;i--) - if(*bita++) *scfsi++ = (char) getbits_fast(fr, 2); - } - else /* mono */ - { - for(i=sblimit;i;i--,alloc1+=(1<bits; - *bita++ = (char) getbits(fr, step); - } - bita = bit_alloc; - scfsi=scfsi_buf; - for(i=sblimit;i;i--) - if(*bita++) *scfsi++ = (char) getbits_fast(fr, 2); - } - - bita = bit_alloc; - scfsi=scfsi_buf; - for(i=sblimit2;i;i--) - if(*bita++) - switch(*scfsi++) - { - case 0: - *scale++ = (int) getbits_fast(fr, 6); - *scale++ = (int) getbits_fast(fr, 6); - *scale++ = (int) getbits_fast(fr, 6); - break; - case 1 : - *scale++ = sc = (int) getbits_fast(fr, 6); - *scale++ = sc; - *scale++ = (int) getbits_fast(fr, 6); - break; - case 2: - *scale++ = sc = (int) getbits_fast(fr, 6); - *scale++ = sc; - *scale++ = sc; - break; - default: /* case 3 */ - *scale++ = (int) getbits_fast(fr, 6); - *scale++ = sc = (int) getbits_fast(fr, 6); - *scale++ = sc; - break; - } -} - - -static void II_step_two(unsigned int *bit_alloc,real fraction[2][4][SBLIMIT],int *scale,mpg123_handle *fr,int x1) -{ - int i,j,k,ba; - int stereo = fr->stereo; - int sblimit = fr->II_sblimit; - int jsbound = fr->jsbound; - const struct al_table *alloc2,*alloc1 = fr->alloc; - unsigned int *bita=bit_alloc; - int d1,step; - - for(i=0;ibits; - for(j=0;jbits; - if( (d1=alloc2->d) < 0) - { - real cm=fr->muls[k][scale[x1]]; - fraction[j][0][i] = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1), cm); - fraction[j][1][i] = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1), cm); - fraction[j][2][i] = REAL_MUL_SCALE_LAYER12(DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1), cm); - } - else - { - const int *table[] = { 0,0,0,grp_3tab,0,grp_5tab,0,0,0,grp_9tab }; - unsigned int idx,*tab,m=scale[x1]; - idx = (unsigned int) getbits(fr, k); - tab = (unsigned int *) (table[d1] + idx + idx + idx); - fraction[j][0][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m]); - fraction[j][1][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m]); - fraction[j][2][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m]); - } - scale+=3; - } - else - fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = DOUBLE_TO_REAL(0.0); - } - } - - for(i=jsbound;ibits; - bita++; /* channel 1 and channel 2 bitalloc are the same */ - if( (ba=*bita++) ) - { - k=(alloc2 = alloc1+ba)->bits; - if( (d1=alloc2->d) < 0) - { - real cm; - cm=fr->muls[k][scale[x1+3]]; - fraction[0][0][i] = DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1); - fraction[0][1][i] = DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1); - fraction[0][2][i] = DOUBLE_TO_REAL_15((int)getbits(fr, k) + d1); - fraction[1][0][i] = REAL_MUL_SCALE_LAYER12(fraction[0][0][i], cm); - fraction[1][1][i] = REAL_MUL_SCALE_LAYER12(fraction[0][1][i], cm); - fraction[1][2][i] = REAL_MUL_SCALE_LAYER12(fraction[0][2][i], cm); - cm=fr->muls[k][scale[x1]]; - fraction[0][0][i] = REAL_MUL_SCALE_LAYER12(fraction[0][0][i], cm); - fraction[0][1][i] = REAL_MUL_SCALE_LAYER12(fraction[0][1][i], cm); - fraction[0][2][i] = REAL_MUL_SCALE_LAYER12(fraction[0][2][i], cm); - } - else - { - const int *table[] = { 0,0,0,grp_3tab,0,grp_5tab,0,0,0,grp_9tab }; - unsigned int idx,*tab,m1,m2; - m1 = scale[x1]; m2 = scale[x1+3]; - idx = (unsigned int) getbits(fr, k); - tab = (unsigned int *) (table[d1] + idx + idx + idx); - fraction[0][0][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m1]); fraction[1][0][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m2]); - fraction[0][1][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m1]); fraction[1][1][i] = REAL_SCALE_LAYER12(fr->muls[*tab++][m2]); - fraction[0][2][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m1]); fraction[1][2][i] = REAL_SCALE_LAYER12(fr->muls[*tab][m2]); - } - scale+=6; - } - else - { - fraction[0][0][i] = fraction[0][1][i] = fraction[0][2][i] = - fraction[1][0][i] = fraction[1][1][i] = fraction[1][2][i] = DOUBLE_TO_REAL(0.0); - } -/* - Historic comment... - should we use individual scalefac for channel 2 or - is the current way the right one , where we just copy channel 1 to - channel 2 ?? - The current 'strange' thing is, that we throw away the scalefac - values for the second channel ...!! - -> changed .. now we use the scalefac values of channel one !! -*/ - } - - if(sblimit > (fr->down_sample_sblimit) ) - sblimit = fr->down_sample_sblimit; - - for(i=sblimit;isampling_frequency >= 3) /* Or equivalent: (fr->lsf == 1) */ - table = 4; - else - table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index]; - - sblim = sblims[table]; - fr->alloc = tables[table]; - fr->II_sblimit = sblim; -} - - -int do_layer2(mpg123_handle *fr) -{ - int clip=0; - int i,j; - int stereo = fr->stereo; - /* pick_table clears unused subbands */ - /* replacement for real fraction[2][4][SBLIMIT], needs alignment. */ - real (*fraction)[4][SBLIMIT] = fr->layer2.fraction; - unsigned int bit_alloc[64]; - int scale[192]; - int single = fr->single; - - II_select_table(fr); - fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : fr->II_sblimit; - - if(fr->jsbound > fr->II_sblimit) - { - fprintf(stderr, "Truncating stereo boundary to sideband limit.\n"); - fr->jsbound=fr->II_sblimit; - } - - /* TODO: What happens with mono mixing, actually? */ - if(stereo == 1 || single == SINGLE_MIX) /* also, mix not really handled */ - single = SINGLE_LEFT; - - II_step_one(bit_alloc, scale, fr); - - for(i=0;i>2); - for(j=0;j<3;j++) - { - if(single != SINGLE_STEREO) - clip += (fr->synth_mono)(fraction[single][j], fr); - else - clip += (fr->synth_stereo)(fraction[0][j], fraction[1][j], fr); - } - } - - return clip; -} - -#endif /* NO_LAYER2 */ diff --git a/Frameworks/mpg123/mpg123/layer3.c b/Frameworks/mpg123/mpg123/layer3.c deleted file mode 100644 index a799ba245..000000000 --- a/Frameworks/mpg123/mpg123/layer3.c +++ /dev/null @@ -1,2085 +0,0 @@ -/* - layer3.c: the layer 3 decoder - - copyright 1995-2009 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Michael Hipp - - Dear visitor: - If you feel you don't understand fully the works of this file, your feeling might be correct. - - Optimize-TODO: put short bands into the band-field without the stride of 3 reals - Length-optimze: unify long and short band code where it is possible - - The int-vs-pointer situation has to be cleaned up. -*/ - -#include "mpg123lib_intern.h" -#ifdef USE_NEW_HUFFTABLE -#include "newhuffman.h" -#else -#include "huffman.h" -#endif -#include "getbits.h" -#include "debug.h" - - - -/* define CUT_SFB21 if you want to cut-off the frequency above 16kHz */ -#if 0 -#define CUT_SFB21 -#endif - -#ifdef REAL_IS_FIXED -#define NEW_DCT9 -#include "l3_integer_tables.h" -#else -/* static one-time calculated tables... or so */ -static real ispow[8207]; -static real aa_ca[8],aa_cs[8]; -static ALIGNED(16) real win[4][36]; -static ALIGNED(16) real win1[4][36]; -real COS9[9]; /* dct36_3dnow wants to use that */ -static real COS6_1,COS6_2; -real tfcos36[9]; /* dct36_3dnow wants to use that */ -static real tfcos12[3]; -#define NEW_DCT9 -#ifdef NEW_DCT9 -static real cos9[3],cos18[3]; -static real tan1_1[16],tan2_1[16],tan1_2[16],tan2_2[16]; -static real pow1_1[2][16],pow2_1[2][16],pow1_2[2][16],pow2_2[2][16]; -#endif -#endif - -/* Decoder state data, living on the stack of do_layer3. */ - -struct gr_info_s -{ - int scfsi; - unsigned part2_3_length; - unsigned big_values; - unsigned scalefac_compress; - unsigned block_type; - unsigned mixed_block_flag; - unsigned table_select[3]; - /* Making those two signed int as workaround for open64/pathscale/sun compilers, and also for consistency, since they're worked on together with other signed variables. */ - int maxband[3]; - int maxbandl; - unsigned maxb; - unsigned region1start; - unsigned region2start; - unsigned preflag; - unsigned scalefac_scale; - unsigned count1table_select; - real *full_gain[3]; - real *pow2gain; -}; - -struct III_sideinfo -{ - unsigned main_data_begin; - unsigned private_bits; - /* Hm, funny... struct inside struct... */ - struct { struct gr_info_s gr[2]; } ch[2]; -}; - -struct bandInfoStruct -{ - unsigned short longIdx[23]; - unsigned char longDiff[22]; - unsigned short shortIdx[14]; - unsigned char shortDiff[13]; -}; - -/* Techy details about our friendly MPEG data. Fairly constant over the years;-) */ -static const struct bandInfoStruct bandInfo[9] = -{ - { /* MPEG 1.0 */ - {0,4,8,12,16,20,24,30,36,44,52,62,74, 90,110,134,162,196,238,288,342,418,576}, - {4,4,4,4,4,4,6,6,8, 8,10,12,16,20,24,28,34,42,50,54, 76,158}, - {0,4*3,8*3,12*3,16*3,22*3,30*3,40*3,52*3,66*3, 84*3,106*3,136*3,192*3}, - {4,4,4,4,6,8,10,12,14,18,22,30,56} - }, - { - {0,4,8,12,16,20,24,30,36,42,50,60,72, 88,106,128,156,190,230,276,330,384,576}, - {4,4,4,4,4,4,6,6,6, 8,10,12,16,18,22,28,34,40,46,54, 54,192}, - {0,4*3,8*3,12*3,16*3,22*3,28*3,38*3,50*3,64*3, 80*3,100*3,126*3,192*3}, - {4,4,4,4,6,6,10,12,14,16,20,26,66} - }, - { - {0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576}, - {4,4,4,4,4,4,6,6,8,10,12,16,20,24,30,38,46,56,68,84,102, 26}, - {0,4*3,8*3,12*3,16*3,22*3,30*3,42*3,58*3,78*3,104*3,138*3,180*3,192*3}, - {4,4,4,4,6,8,12,16,20,26,34,42,12} - }, - { /* MPEG 2.0 */ - {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, - {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 } , - {0,4*3,8*3,12*3,18*3,24*3,32*3,42*3,56*3,74*3,100*3,132*3,174*3,192*3} , - {4,4,4,6,6,8,10,14,18,26,32,42,18 } - }, - { /* Twiddling 3 values here (not just 330->332!) fixed bug 1895025. */ - {0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,332,394,464,540,576}, - {6,6,6,6,6,6,8,10,12,14,16,18,22,26,32,38,46,54,62,70,76,36 }, - {0,4*3,8*3,12*3,18*3,26*3,36*3,48*3,62*3,80*3,104*3,136*3,180*3,192*3}, - {4,4,4,6,8,10,12,14,18,24,32,44,12 } - }, - { - {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, - {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54 }, - {0,4*3,8*3,12*3,18*3,26*3,36*3,48*3,62*3,80*3,104*3,134*3,174*3,192*3}, - {4,4,4,6,8,10,12,14,18,24,30,40,18 } - }, - { /* MPEG 2.5 */ - {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, - {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54}, - {0,12,24,36,54,78,108,144,186,240,312,402,522,576}, - {4,4,4,6,8,10,12,14,18,24,30,40,18} - }, - { - {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, - {6,6,6,6,6,6,8,10,12,14,16,20,24,28,32,38,46,52,60,68,58,54}, - {0,12,24,36,54,78,108,144,186,240,312,402,522,576}, - {4,4,4,6,8,10,12,14,18,24,30,40,18} - }, - { - {0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576}, - {12,12,12,12,12,12,16,20,24,28,32,40,48,56,64,76,90,2,2,2,2,2}, - {0, 24, 48, 72,108,156,216,288,372,480,486,492,498,576}, - {8,8,8,12,16,20,24,28,36,2,2,2,26} - } -}; - -static int mapbuf0[9][152]; -static int mapbuf1[9][156]; -static int mapbuf2[9][44]; -static int *map[9][3]; -static int *mapend[9][3]; - -static unsigned int n_slen2[512]; /* MPEG 2.0 slen for 'normal' mode */ -static unsigned int i_slen2[256]; /* MPEG 2.0 slen for intensity stereo */ - -/* Some helpers used in init_layer3 */ - -#ifdef OPT_MMXORSSE -real init_layer3_gainpow2_mmx(mpg123_handle *fr, int i) -{ - if(!fr->p.down_sample) return DOUBLE_TO_REAL(16384.0 * pow((double)2.0,-0.25 * (double) (i+210) )); - else return DOUBLE_TO_REAL(pow((double)2.0,-0.25 * (double) (i+210))); -} -#endif - -real init_layer3_gainpow2(mpg123_handle *fr, int i) -{ -#if defined(REAL_IS_FIXED) && defined(PRECALC_TABLES) - return gainpow2[i+256]; -#else - return DOUBLE_TO_REAL_SCALE_LAYER3(pow((double)2.0,-0.25 * (double) (i+210)),i+256); -#endif -} - - -/* init tables for layer-3 ... specific with the downsampling... */ -void init_layer3(void) -{ - int i,j,k,l; - -#if !defined(REAL_IS_FIXED) || !defined(PRECALC_TABLES) - for(i=0;i<8207;i++) - ispow[i] = DOUBLE_TO_REAL_POW43(pow((double)i,(double)4.0/3.0)); - - for(i=0;i<8;i++) - { - const double Ci[8] = {-0.6,-0.535,-0.33,-0.185,-0.095,-0.041,-0.0142,-0.0037}; - double sq = sqrt(1.0+Ci[i]*Ci[i]); - aa_cs[i] = DOUBLE_TO_REAL(1.0/sq); - aa_ca[i] = DOUBLE_TO_REAL(Ci[i]/sq); - } - - for(i=0;i<18;i++) - { - win[0][i] = win[1][i] = - DOUBLE_TO_REAL( 0.5*sin(M_PI/72.0 * (double)(2*(i+0) +1)) / cos(M_PI * (double)(2*(i+0) +19) / 72.0) ); - win[0][i+18] = win[3][i+18] = - DOUBLE_TO_REAL( 0.5*sin(M_PI/72.0 * (double)(2*(i+18)+1)) / cos(M_PI * (double)(2*(i+18)+19) / 72.0) ); - } - for(i=0;i<6;i++) - { - win[1][i+18] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 )); - win[3][i+12] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 )); - win[1][i+24] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+13) ) / cos ( M_PI * (double) (2*(i+24)+19) / 72.0 )); - win[1][i+30] = win[3][i] = DOUBLE_TO_REAL(0.0); - win[3][i+6 ] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+1 ) ) / cos ( M_PI * (double) (2*(i+6 )+19) / 72.0 )); - } - - for(i=0;i<9;i++) - COS9[i] = DOUBLE_TO_REAL(cos( M_PI / 18.0 * (double) i)); - - for(i=0;i<9;i++) - tfcos36[i] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 )); - - for(i=0;i<3;i++) - tfcos12[i] = DOUBLE_TO_REAL(0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 )); - - COS6_1 = DOUBLE_TO_REAL(cos( M_PI / 6.0 * (double) 1)); - COS6_2 = DOUBLE_TO_REAL(cos( M_PI / 6.0 * (double) 2)); - -#ifdef NEW_DCT9 - cos9[0] = DOUBLE_TO_REAL(cos(1.0*M_PI/9.0)); - cos9[1] = DOUBLE_TO_REAL(cos(5.0*M_PI/9.0)); - cos9[2] = DOUBLE_TO_REAL(cos(7.0*M_PI/9.0)); - cos18[0] = DOUBLE_TO_REAL(cos(1.0*M_PI/18.0)); - cos18[1] = DOUBLE_TO_REAL(cos(11.0*M_PI/18.0)); - cos18[2] = DOUBLE_TO_REAL(cos(13.0*M_PI/18.0)); -#endif - - for(i=0;i<12;i++) - { - win[2][i] = DOUBLE_TO_REAL(0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 )); - } - - for(i=0;i<16;i++) - { - double t = tan( (double) i * M_PI / 12.0 ); - tan1_1[i] = DOUBLE_TO_REAL_15(t / (1.0+t)); - tan2_1[i] = DOUBLE_TO_REAL_15(1.0 / (1.0 + t)); - tan1_2[i] = DOUBLE_TO_REAL_15(M_SQRT2 * t / (1.0+t)); - tan2_2[i] = DOUBLE_TO_REAL_15(M_SQRT2 / (1.0 + t)); - - for(j=0;j<2;j++) - { - double base = pow(2.0,-0.25*(j+1.0)); - double p1=1.0,p2=1.0; - if(i > 0) - { - if( i & 1 ) p1 = pow(base,(i+1.0)*0.5); - else p2 = pow(base,i*0.5); - } - pow1_1[j][i] = DOUBLE_TO_REAL_15(p1); - pow2_1[j][i] = DOUBLE_TO_REAL_15(p2); - pow1_2[j][i] = DOUBLE_TO_REAL_15(M_SQRT2 * p1); - pow2_2[j][i] = DOUBLE_TO_REAL_15(M_SQRT2 * p2); - } - } -#endif - - for(j=0;j<4;j++) - { - const int len[4] = { 36,36,12,36 }; - for(i=0;ilongDiff; - for(i=0,cb = 0; cb < 8 ; cb++,i+=*bdf++) - { - *mp++ = (*bdf) >> 1; - *mp++ = i; - *mp++ = 3; - *mp++ = cb; - } - bdf = bi->shortDiff+3; - for(cb=3;cb<13;cb++) - { - int l = (*bdf++) >> 1; - for(lwin=0;lwin<3;lwin++) - { - *mp++ = l; - *mp++ = i + lwin; - *mp++ = lwin; - *mp++ = cb; - } - i += 6*l; - } - mapend[j][0] = mp; - - mp = map[j][1] = mapbuf1[j]; - bdf = bi->shortDiff+0; - for(i=0,cb=0;cb<13;cb++) - { - int l = (*bdf++) >> 1; - for(lwin=0;lwin<3;lwin++) - { - *mp++ = l; - *mp++ = i + lwin; - *mp++ = lwin; - *mp++ = cb; - } - i += 6*l; - } - mapend[j][1] = mp; - - mp = map[j][2] = mapbuf2[j]; - bdf = bi->longDiff; - for(cb = 0; cb < 22 ; cb++) - { - *mp++ = (*bdf++) >> 1; - *mp++ = cb; - } - mapend[j][2] = mp; - } - - /* Now for some serious loopings! */ - for(i=0;i<5;i++) - for(j=0;j<6;j++) - for(k=0;k<6;k++) - { - int n = k + j * 6 + i * 36; - i_slen2[n] = i|(j<<3)|(k<<6)|(3<<12); - } - for(i=0;i<4;i++) - for(j=0;j<4;j++) - for(k=0;k<4;k++) - { - int n = k + j * 4 + i * 16; - i_slen2[n+180] = i|(j<<3)|(k<<6)|(4<<12); - } - for(i=0;i<4;i++) - for(j=0;j<3;j++) - { - int n = j + i * 3; - i_slen2[n+244] = i|(j<<3) | (5<<12); - n_slen2[n+500] = i|(j<<3) | (2<<12) | (1<<15); - } - for(i=0;i<5;i++) - for(j=0;j<5;j++) - for(k=0;k<4;k++) - for(l=0;l<4;l++) - { - int n = l + k * 4 + j * 16 + i * 80; - n_slen2[n] = i|(j<<3)|(k<<6)|(l<<9)|(0<<12); - } - for(i=0;i<5;i++) - for(j=0;j<5;j++) - for(k=0;k<4;k++) - { - int n = k + j * 4 + i * 20; - n_slen2[n+400] = i|(j<<3)|(k<<6)|(1<<12); - } -} - - -void init_layer3_stuff(mpg123_handle *fr, real (*gainpow2)(mpg123_handle *fr, int i)) -{ - int i,j; - - for(i=-256;i<118+4;i++) fr->gainpow2[i+256] = gainpow2(fr,i); - - for(j=0;j<9;j++) - { - for(i=0;i<23;i++) - { - fr->longLimit[j][i] = (bandInfo[j].longIdx[i] - 1 + 8) / 18 + 1; - if(fr->longLimit[j][i] > (fr->down_sample_sblimit) ) - fr->longLimit[j][i] = fr->down_sample_sblimit; - } - for(i=0;i<14;i++) - { - fr->shortLimit[j][i] = (bandInfo[j].shortIdx[i] - 1) / 18 + 1; - if(fr->shortLimit[j][i] > (fr->down_sample_sblimit) ) - fr->shortLimit[j][i] = fr->down_sample_sblimit; - } - } -} - -/* - Observe! - Now come the actualy decoding routines. -*/ - -/* read additional side information (for MPEG 1 and MPEG 2) */ -static int III_get_side_info(mpg123_handle *fr, struct III_sideinfo *si,int stereo, int ms_stereo,long sfreq,int single) -{ - int ch, gr; - int powdiff = (single == SINGLE_MIX) ? 4 : 0; - - const int tabs[2][5] = { { 2,9,5,3,4 } , { 1,8,1,2,9 } }; - const int *tab = tabs[fr->lsf]; - - si->main_data_begin = getbits(fr, tab[1]); - - if(si->main_data_begin > fr->bitreservoir) - { - if(!fr->to_ignore && VERBOSE2) fprintf(stderr, "Note: missing %d bytes in bit reservoir for frame %li\n", (int)(si->main_data_begin - fr->bitreservoir), (long)fr->num); - - /* overwrite main_data_begin for the really available bit reservoir */ - backbits(fr, tab[1]); - if(fr->lsf == 0) - { - fr->wordpointer[0] = (unsigned char) (fr->bitreservoir >> 1); - fr->wordpointer[1] = (unsigned char) ((fr->bitreservoir & 1) << 7); - } - else fr->wordpointer[0] = (unsigned char) fr->bitreservoir; - - /* zero "side-info" data for a silence-frame - without touching audio data used as bit reservoir for following frame */ - memset(fr->wordpointer+2, 0, fr->ssize-2); - - /* reread the new bit reservoir offset */ - si->main_data_begin = getbits(fr, tab[1]); - } - - /* Keep track of the available data bytes for the bit reservoir. - Think: Substract the 2 crc bytes in parser already? */ - fr->bitreservoir = fr->bitreservoir + fr->framesize - fr->ssize - (fr->error_protection ? 2 : 0); - /* Limit the reservoir to the max for MPEG 1.0 or 2.x . */ - if(fr->bitreservoir > (unsigned int) (fr->lsf == 0 ? 511 : 255)) - fr->bitreservoir = (fr->lsf == 0 ? 511 : 255); - - /* Now back into less commented territory. It's code. It works. */ - - if (stereo == 1) - si->private_bits = getbits_fast(fr, tab[2]); - else - si->private_bits = getbits_fast(fr, tab[3]); - - if(!fr->lsf) for(ch=0; chch[ch].gr[0].scfsi = -1; - si->ch[ch].gr[1].scfsi = getbits_fast(fr, 4); - } - - for (gr=0; grch[ch].gr[gr]); - - gr_info->part2_3_length = getbits(fr, 12); - gr_info->big_values = getbits(fr, 9); - if(gr_info->big_values > 288) - { - if(NOQUIET) error("big_values too large!"); - gr_info->big_values = 288; - } - gr_info->pow2gain = fr->gainpow2+256 - getbits_fast(fr, 8) + powdiff; - if(ms_stereo) gr_info->pow2gain += 2; - - gr_info->scalefac_compress = getbits(fr, tab[4]); - - if(get1bit(fr)) - { /* window switch flag */ - int i; - gr_info->block_type = getbits_fast(fr, 2); - gr_info->mixed_block_flag = get1bit(fr); - gr_info->table_select[0] = getbits_fast(fr, 5); - gr_info->table_select[1] = getbits_fast(fr, 5); - /* - table_select[2] not needed, because there is no region2, - but to satisfy some verification tools we set it either. - */ - gr_info->table_select[2] = 0; - for(i=0;i<3;i++) - gr_info->full_gain[i] = gr_info->pow2gain + (getbits_fast(fr, 3)<<3); - - if(gr_info->block_type == 0) - { - if(NOQUIET) error("Blocktype == 0 and window-switching == 1 not allowed."); - return 1; - } - - /* region_count/start parameters are implicit in this case. */ - if( (!fr->lsf || (gr_info->block_type == 2)) && !fr->mpeg25) - { - gr_info->region1start = 36>>1; - gr_info->region2start = 576>>1; - } - else - { - if(fr->mpeg25) - { - int r0c,r1c; - if((gr_info->block_type == 2) && (!gr_info->mixed_block_flag) ) r0c = 5; - else r0c = 7; - - /* r0c+1+r1c+1 == 22, always. */ - r1c = 20 - r0c; - gr_info->region1start = bandInfo[sfreq].longIdx[r0c+1] >> 1 ; - gr_info->region2start = bandInfo[sfreq].longIdx[r0c+1+r1c+1] >> 1; - } - else - { - gr_info->region1start = 54>>1; - gr_info->region2start = 576>>1; - } - } - } - else - { - int i,r0c,r1c; - for (i=0; i<3; i++) - gr_info->table_select[i] = getbits_fast(fr, 5); - - r0c = getbits_fast(fr, 4); /* 0 .. 15 */ - r1c = getbits_fast(fr, 3); /* 0 .. 7 */ - gr_info->region1start = bandInfo[sfreq].longIdx[r0c+1] >> 1 ; - - /* max(r0c+r1c+2) = 15+7+2 = 24 */ - if(r0c+1+r1c+1 > 22) gr_info->region2start = 576>>1; - else gr_info->region2start = bandInfo[sfreq].longIdx[r0c+1+r1c+1] >> 1; - - gr_info->block_type = 0; - gr_info->mixed_block_flag = 0; - } - if(!fr->lsf) gr_info->preflag = get1bit(fr); - - gr_info->scalefac_scale = get1bit(fr); - gr_info->count1table_select = get1bit(fr); - } - return 0; -} - - -/* read scalefactors */ -static int III_get_scale_factors_1(mpg123_handle *fr, int *scf,struct gr_info_s *gr_info,int ch,int gr) -{ - const unsigned char slen[2][16] = - { - {0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4}, - {0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3} - }; - int numbits; - int num0 = slen[0][gr_info->scalefac_compress]; - int num1 = slen[1][gr_info->scalefac_compress]; - - if(gr_info->block_type == 2) - { - int i=18; - numbits = (num0 + num1) * 18; - - if(gr_info->mixed_block_flag) - { - for (i=8;i;i--) - *scf++ = getbits_fast(fr, num0); - - i = 9; - numbits -= num0; /* num0 * 17 + num1 * 18 */ - } - - for(;i;i--) *scf++ = getbits_fast(fr, num0); - - for(i = 18; i; i--) *scf++ = getbits_fast(fr, num1); - - *scf++ = 0; *scf++ = 0; *scf++ = 0; /* short[13][0..2] = 0 */ - } - else - { - int i; - int scfsi = gr_info->scfsi; - - if(scfsi < 0) - { /* scfsi < 0 => granule == 0 */ - for(i=11;i;i--) *scf++ = getbits_fast(fr, num0); - - for(i=10;i;i--) *scf++ = getbits_fast(fr, num1); - - numbits = (num0 + num1) * 10 + num0; - *scf++ = 0; - } - else - { - numbits = 0; - if(!(scfsi & 0x8)) - { - for (i=0;i<6;i++) *scf++ = getbits_fast(fr, num0); - - numbits += num0 * 6; - } - else scf += 6; - - if(!(scfsi & 0x4)) - { - for (i=0;i<5;i++) *scf++ = getbits_fast(fr, num0); - - numbits += num0 * 5; - } - else scf += 5; - - if(!(scfsi & 0x2)) - { - for(i=0;i<5;i++) *scf++ = getbits_fast(fr, num1); - - numbits += num1 * 5; - } - else scf += 5; - - if(!(scfsi & 0x1)) - { - for (i=0;i<5;i++) *scf++ = getbits_fast(fr, num1); - - numbits += num1 * 5; - } - else scf += 5; - - *scf++ = 0; /* no l[21] in original sources */ - } - } - return numbits; -} - - -static int III_get_scale_factors_2(mpg123_handle *fr, int *scf,struct gr_info_s *gr_info,int i_stereo) -{ - const unsigned char *pnt; - int i,j,n=0,numbits=0; - unsigned int slen; - - const unsigned char stab[3][6][4] = - { - { - { 6, 5, 5,5 } , { 6, 5, 7,3 } , { 11,10,0,0}, - { 7, 7, 7,0 } , { 6, 6, 6,3 } , { 8, 8,5,0} - }, - { - { 9, 9, 9,9 } , { 9, 9,12,6 } , { 18,18,0,0}, - {12,12,12,0 } , {12, 9, 9,6 } , { 15,12,9,0} - }, - { - { 6, 9, 9,9 } , { 6, 9,12,6 } , { 15,18,0,0}, - { 6,15,12,0 } , { 6,12, 9,6 } , { 6,18,9,0} - } - }; - - if(i_stereo) /* i_stereo AND second channel -> do_layer3() checks this */ - slen = i_slen2[gr_info->scalefac_compress>>1]; - else - slen = n_slen2[gr_info->scalefac_compress]; - - gr_info->preflag = (slen>>15) & 0x1; - - n = 0; - if( gr_info->block_type == 2 ) - { - n++; - if(gr_info->mixed_block_flag) n++; - } - - pnt = stab[n][(slen>>12)&0x7]; - - for(i=0;i<4;i++) - { - int num = slen & 0x7; - slen >>= 3; - if(num) - { - for(j=0;j<(int)(pnt[i]);j++) *scf++ = getbits_fast(fr, num); - - numbits += pnt[i] * num; - } - else - for(j=0;j<(int)(pnt[i]);j++) *scf++ = 0; - } - - n = (n << 1) + 1; - for(i=0;iscalefac_scale; - real *xrpnt = (real *) xr; - int l[3],l3; - int part2remain = gr_info->part2_3_length - part2bits; - int *me; -#ifdef REAL_IS_FIXED - int gainpow2_scale_idx = 378; -#endif - - /* mhipp tree has this split up a bit... */ - int num=getbitoffset(fr); - long mask; - /* We must split this, because for num==0 the shift is undefined if you do it in one step. */ - mask = ((unsigned long) getbits(fr, num))<big_values; - int region1 = gr_info->region1start; - int region2 = gr_info->region2start; - l3 = ((576>>1)-bv)>>1; - - /* we may lose the 'odd' bit here !! check this later again */ - if(bv <= region1) - { - l[0] = bv; - l[1] = 0; - l[2] = 0; - } - else - { - l[0] = region1; - if(bv <= region2) - { - l[1] = bv - l[0]; - l[2] = 0; - } - else - { - l[1] = region2 - l[0]; - l[2] = bv - region2; - } - } - } - - if(gr_info->block_type == 2) - { - /* decoding with short or mixed mode BandIndex table */ - int i,max[4]; - int step=0,lwin=3,cb=0; - register real v = 0.0; - register int *m,mc; - - if(gr_info->mixed_block_flag) - { - max[3] = -1; - max[0] = max[1] = max[2] = 2; - m = map[sfreq][0]; - me = mapend[sfreq][0]; - } - else - { - max[0] = max[1] = max[2] = max[3] = -1; - /* max[3] not really needed in this case */ - m = map[sfreq][1]; - me = mapend[sfreq][1]; - } - - mc = 0; - for(i=0;i<2;i++) - { - int lp = l[i]; - const struct newhuff *h = ht+gr_info->table_select[i]; - for(;lp;lp--,mc--) - { - register long x,y; - if( (!mc) ) - { - mc = *m++; - xrpnt = ((real *) xr) + (*m++); - lwin = *m++; - cb = *m++; - if(lwin == 3) - { -#ifdef REAL_IS_FIXED - gainpow2_scale_idx = (int)(gr_info->pow2gain + (*scf << shift) - fr->gainpow2); -#endif - v = gr_info->pow2gain[(*scf++) << shift]; - step = 1; - } - else - { -#ifdef REAL_IS_FIXED - gainpow2_scale_idx = (int)(gr_info->full_gain[lwin] + (*scf << shift) - fr->gainpow2); -#endif - v = gr_info->full_gain[lwin][(*scf++) << shift]; - step = 3; - } - } - { - const short *val = h->table; - REFRESH_MASK; -#ifdef USE_NEW_HUFFTABLE - while((y=val[(unsigned long)mask>>(BITSHIFT+4)])<0) - { - val -= y; - num -= 4; - mask <<= 4; - } - num -= (y >> 8); - mask <<= (y >> 8); - x = (y >> 4) & 0xf; - y &= 0xf; -#else - while((y=*val++)<0) - { - if (mask < 0) val -= y; - - num--; - mask <<= 1; - } - x = y >> 4; - y &= 0xf; -#endif - } - if(x == 15 && h->linbits) - { - max[lwin] = cb; - REFRESH_MASK; - x += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits); - num -= h->linbits+1; - mask <<= h->linbits; - if(mask < 0) *xrpnt = REAL_MUL_SCALE_LAYER3(-ispow[x], v, gainpow2_scale_idx); - else *xrpnt = REAL_MUL_SCALE_LAYER3( ispow[x], v, gainpow2_scale_idx); - - mask <<= 1; - } - else if(x) - { - max[lwin] = cb; - if(mask < 0) *xrpnt = REAL_MUL_SCALE_LAYER3(-ispow[x], v, gainpow2_scale_idx); - else *xrpnt = REAL_MUL_SCALE_LAYER3( ispow[x], v, gainpow2_scale_idx); - - num--; - mask <<= 1; - } - else *xrpnt = DOUBLE_TO_REAL(0.0); - - xrpnt += step; - if(y == 15 && h->linbits) - { - max[lwin] = cb; - REFRESH_MASK; - y += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits); - num -= h->linbits+1; - mask <<= h->linbits; - if(mask < 0) *xrpnt = REAL_MUL_SCALE_LAYER3(-ispow[y], v, gainpow2_scale_idx); - else *xrpnt = REAL_MUL_SCALE_LAYER3( ispow[y], v, gainpow2_scale_idx); - - mask <<= 1; - } - else if(y) - { - max[lwin] = cb; - if(mask < 0) *xrpnt = REAL_MUL_SCALE_LAYER3(-ispow[y], v, gainpow2_scale_idx); - else *xrpnt = REAL_MUL_SCALE_LAYER3( ispow[y], v, gainpow2_scale_idx); - - num--; - mask <<= 1; - } - else *xrpnt = DOUBLE_TO_REAL(0.0); - - xrpnt += step; - } - } - - for(;l3 && (part2remain+num > 0);l3--) - { - const struct newhuff* h; - const short* val; - register short a; - /* - This is only a humble hack to prevent a special segfault. - More insight into the real workings is still needed. - Especially why there are (valid?) files that make xrpnt exceed the array with 4 bytes without segfaulting, more seems to be really bad, though. - */ - #ifdef DEBUG - if(!(xrpnt < &xr[SBLIMIT][0])) - { - if(VERBOSE) debug2("attempted soft xrpnt overflow (%p !< %p) ?", (void*) xrpnt, (void*) &xr[SBLIMIT][0]); - } - #endif - if(!(xrpnt < &xr[SBLIMIT][0]+5)) - { - if(NOQUIET) error2("attempted xrpnt overflow (%p !< %p)", (void*) xrpnt, (void*) &xr[SBLIMIT][0]); - return 2; - } - h = htc+gr_info->count1table_select; - val = h->table; - - REFRESH_MASK; - while((a=*val++)<0) - { - if(mask < 0) val -= a; - - num--; - mask <<= 1; - } - if(part2remain+num <= 0) - { - num -= part2remain+num; - break; - } - - for(i=0;i<4;i++) - { - if(!(i & 1)) - { - if(!mc) - { - mc = *m++; - xrpnt = ((real *) xr) + (*m++); - lwin = *m++; - cb = *m++; - if(lwin == 3) - { -#ifdef REAL_IS_FIXED - gainpow2_scale_idx = (int)(gr_info->pow2gain + (*scf << shift) - fr->gainpow2); -#endif - v = gr_info->pow2gain[(*scf++) << shift]; - step = 1; - } - else - { -#ifdef REAL_IS_FIXED - gainpow2_scale_idx = (int)(gr_info->full_gain[lwin] + (*scf << shift) - fr->gainpow2); -#endif - v = gr_info->full_gain[lwin][(*scf++) << shift]; - step = 3; - } - } - mc--; - } - if( (a & (0x8>>i)) ) - { - max[lwin] = cb; - if(part2remain+num <= 0) - break; - - if(mask < 0) *xrpnt = -REAL_SCALE_LAYER3(v, gainpow2_scale_idx); - else *xrpnt = REAL_SCALE_LAYER3(v, gainpow2_scale_idx); - - num--; - mask <<= 1; - } - else *xrpnt = DOUBLE_TO_REAL(0.0); - - xrpnt += step; - } - } - - if(lwin < 3) - { /* short band? */ - while(1) - { - for(;mc > 0;mc--) - { - *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += 3; /* short band -> step=3 */ - *xrpnt = DOUBLE_TO_REAL(0.0); xrpnt += 3; - } - if(m >= me) - break; - - mc = *m++; - xrpnt = ((real *) xr) + *m++; - if(*m++ == 0) - break; /* optimize: field will be set to zero at the end of the function */ - - m++; /* cb */ - } - } - - gr_info->maxband[0] = max[0]+1; - gr_info->maxband[1] = max[1]+1; - gr_info->maxband[2] = max[2]+1; - gr_info->maxbandl = max[3]+1; - - { - int rmax = max[0] > max[1] ? max[0] : max[1]; - rmax = (rmax > max[2] ? rmax : max[2]) + 1; - gr_info->maxb = rmax ? fr->shortLimit[sfreq][rmax] : fr->longLimit[sfreq][max[3]+1]; - } - - } - else - { - /* decoding with 'long' BandIndex table (block_type != 2) */ - const unsigned char *pretab = pretab_choice[gr_info->preflag]; - int i,max = -1; - int cb = 0; - int *m = map[sfreq][2]; - register real v = 0.0; - int mc = 0; - - /* long hash table values */ - for(i=0;i<3;i++) - { - int lp = l[i]; - const struct newhuff *h = ht+gr_info->table_select[i]; - - for(;lp;lp--,mc--) - { - long x,y; - if(!mc) - { - mc = *m++; - cb = *m++; -#ifdef CUT_SFB21 - if(cb == 21) - v = 0.0; - else -#endif - { -#ifdef REAL_IS_FIXED - gainpow2_scale_idx = (int)(gr_info->pow2gain + (*scf << shift) - fr->gainpow2); -#endif - v = gr_info->pow2gain[(*(scf++) + (*pretab++)) << shift]; - } - } - { - const short *val = h->table; - REFRESH_MASK; -#ifdef USE_NEW_HUFFTABLE - while((y=val[(unsigned long)mask>>(BITSHIFT+4)])<0) - { - val -= y; - num -= 4; - mask <<= 4; - } - num -= (y >> 8); - mask <<= (y >> 8); - x = (y >> 4) & 0xf; - y &= 0xf; -#else - while((y=*val++)<0) - { - if (mask < 0) val -= y; - - num--; - mask <<= 1; - } - x = y >> 4; - y &= 0xf; -#endif - } - - if(x == 15 && h->linbits) - { - max = cb; - REFRESH_MASK; - x += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits); - num -= h->linbits+1; - mask <<= h->linbits; - if(mask < 0) *xrpnt++ = REAL_MUL_SCALE_LAYER3(-ispow[x], v, gainpow2_scale_idx); - else *xrpnt++ = REAL_MUL_SCALE_LAYER3( ispow[x], v, gainpow2_scale_idx); - - mask <<= 1; - } - else if(x) - { - max = cb; - if(mask < 0) *xrpnt++ = REAL_MUL_SCALE_LAYER3(-ispow[x], v, gainpow2_scale_idx); - else *xrpnt++ = REAL_MUL_SCALE_LAYER3( ispow[x], v, gainpow2_scale_idx); - num--; - - mask <<= 1; - } - else *xrpnt++ = DOUBLE_TO_REAL(0.0); - - if(y == 15 && h->linbits) - { - max = cb; - REFRESH_MASK; - y += ((unsigned long) mask) >> (BITSHIFT+8-h->linbits); - num -= h->linbits+1; - mask <<= h->linbits; - if(mask < 0) *xrpnt++ = REAL_MUL_SCALE_LAYER3(-ispow[y], v, gainpow2_scale_idx); - else *xrpnt++ = REAL_MUL_SCALE_LAYER3( ispow[y], v, gainpow2_scale_idx); - - mask <<= 1; - } - else if(y) - { - max = cb; - if(mask < 0) *xrpnt++ = REAL_MUL_SCALE_LAYER3(-ispow[y], v, gainpow2_scale_idx); - else *xrpnt++ = REAL_MUL_SCALE_LAYER3( ispow[y], v, gainpow2_scale_idx); - - num--; - mask <<= 1; - } - else *xrpnt++ = DOUBLE_TO_REAL(0.0); - } - } - - /* short (count1table) values */ - for(;l3 && (part2remain+num > 0);l3--) - { - const struct newhuff *h = htc+gr_info->count1table_select; - const short *val = h->table; - register short a; - - REFRESH_MASK; - while((a=*val++)<0) - { - if (mask < 0) val -= a; - - num--; - mask <<= 1; - } - if(part2remain+num <= 0) - { - num -= part2remain+num; - break; - } - - for(i=0;i<4;i++) - { - if(!(i & 1)) - { - if(!mc) - { - mc = *m++; - cb = *m++; -#ifdef CUT_SFB21 - if(cb == 21) - v = 0.0; - else -#endif - { -#ifdef REAL_IS_FIXED - gainpow2_scale_idx = (int)(gr_info->pow2gain + (*scf << shift) - fr->gainpow2); -#endif - v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift]; - } - } - mc--; - } - if( (a & (0x8>>i)) ) - { - max = cb; - if(part2remain+num <= 0) - break; - - if(mask < 0) *xrpnt++ = -REAL_SCALE_LAYER3(v, gainpow2_scale_idx); - else *xrpnt++ = REAL_SCALE_LAYER3(v, gainpow2_scale_idx); - - num--; - mask <<= 1; - } - else *xrpnt++ = DOUBLE_TO_REAL(0.0); - } - } - - gr_info->maxbandl = max+1; - gr_info->maxb = fr->longLimit[sfreq][gr_info->maxbandl]; - } - - part2remain += num; - backbits(fr, num); - num = 0; - - while(xrpnt < &xr[SBLIMIT][0]) - *xrpnt++ = DOUBLE_TO_REAL(0.0); - - while( part2remain > 16 ) - { - skipbits(fr, 16); /* Dismiss stuffing Bits */ - part2remain -= 16; - } - if(part2remain > 0) skipbits(fr, part2remain); - else if(part2remain < 0) - { - debug1("Can't rewind stream by %d bits!",-part2remain); - return 1; /* -> error */ - } - return 0; -} - - -/* calculate real channel values for Joint-I-Stereo-mode */ -static void III_i_stereo(real xr_buf[2][SBLIMIT][SSLIMIT],int *scalefac, struct gr_info_s *gr_info,int sfreq,int ms_stereo,int lsf) -{ - real (*xr)[SBLIMIT*SSLIMIT] = (real (*)[SBLIMIT*SSLIMIT] ) xr_buf; - const struct bandInfoStruct *bi = &bandInfo[sfreq]; - - const real *tab1,*tab2; - -#if 1 - int tab; -/* TODO: optimize as static */ - const real *tabs[3][2][2] = - { - { { tan1_1,tan2_1 } , { tan1_2,tan2_2 } }, - { { pow1_1[0],pow2_1[0] } , { pow1_2[0],pow2_2[0] } }, - { { pow1_1[1],pow2_1[1] } , { pow1_2[1],pow2_2[1] } } - }; - - tab = lsf + (gr_info->scalefac_compress & lsf); - tab1 = tabs[tab][ms_stereo][0]; - tab2 = tabs[tab][ms_stereo][1]; -#else - if(lsf) - { - int p = gr_info->scalefac_compress & 0x1; - if(ms_stereo) - { - tab1 = pow1_2[p]; - tab2 = pow2_2[p]; - } - else - { - tab1 = pow1_1[p]; - tab2 = pow2_1[p]; - } - } - else - { - if(ms_stereo) - { - tab1 = tan1_2; - tab2 = tan2_2; - } - else - { - tab1 = tan1_1; - tab2 = tan2_1; - } - } -#endif - - if(gr_info->block_type == 2) - { - int lwin,do_l = 0; - if( gr_info->mixed_block_flag ) do_l = 1; - - for(lwin=0;lwin<3;lwin++) - { /* process each window */ - /* get first band with zero values */ - int is_p,sb,idx,sfb = gr_info->maxband[lwin]; /* sfb is minimal 3 for mixed mode */ - if(sfb > 3) do_l = 0; - - for(;sfb<12;sfb++) - { - is_p = scalefac[sfb*3+lwin-gr_info->mixed_block_flag]; /* scale: 0-15 */ - if(is_p != 7) - { - real t1,t2; - sb = bi->shortDiff[sfb]; - idx = bi->shortIdx[sfb] + lwin; - t1 = tab1[is_p]; t2 = tab2[is_p]; - for (; sb > 0; sb--,idx+=3) - { - real v = xr[0][idx]; - xr[0][idx] = REAL_MUL_15(v, t1); - xr[1][idx] = REAL_MUL_15(v, t2); - } - } - } - -#if 1 -/* in the original: copy 10 to 11 , here: copy 11 to 12 -maybe still wrong??? (copy 12 to 13?) */ - is_p = scalefac[11*3+lwin-gr_info->mixed_block_flag]; /* scale: 0-15 */ - sb = bi->shortDiff[12]; - idx = bi->shortIdx[12] + lwin; -#else - is_p = scalefac[10*3+lwin-gr_info->mixed_block_flag]; /* scale: 0-15 */ - sb = bi->shortDiff[11]; - idx = bi->shortIdx[11] + lwin; -#endif - if(is_p != 7) - { - real t1,t2; - t1 = tab1[is_p]; t2 = tab2[is_p]; - for( ; sb > 0; sb--,idx+=3 ) - { - real v = xr[0][idx]; - xr[0][idx] = REAL_MUL_15(v, t1); - xr[1][idx] = REAL_MUL_15(v, t2); - } - } - } /* end for(lwin; .. ; . ) */ - - /* also check l-part, if ALL bands in the three windows are 'empty' and mode = mixed_mode */ - if(do_l) - { - int sfb = gr_info->maxbandl; - int idx; - if(sfb > 21) return; /* similarity fix related to CVE-2006-1655 */ - - idx = bi->longIdx[sfb]; - for( ; sfb<8; sfb++ ) - { - int sb = bi->longDiff[sfb]; - int is_p = scalefac[sfb]; /* scale: 0-15 */ - if(is_p != 7) - { - real t1,t2; - t1 = tab1[is_p]; t2 = tab2[is_p]; - for( ; sb > 0; sb--,idx++) - { - real v = xr[0][idx]; - xr[0][idx] = REAL_MUL_15(v, t1); - xr[1][idx] = REAL_MUL_15(v, t2); - } - } - else idx += sb; - } - } - } - else - { /* ((gr_info->block_type != 2)) */ - int sfb = gr_info->maxbandl; - int is_p,idx; - if(sfb > 21) return; /* tightened fix for CVE-2006-1655 */ - - idx = bi->longIdx[sfb]; - for ( ; sfb<21; sfb++) - { - int sb = bi->longDiff[sfb]; - is_p = scalefac[sfb]; /* scale: 0-15 */ - if(is_p != 7) - { - real t1,t2; - t1 = tab1[is_p]; t2 = tab2[is_p]; - for( ; sb > 0; sb--,idx++) - { - real v = xr[0][idx]; - xr[0][idx] = REAL_MUL_15(v, t1); - xr[1][idx] = REAL_MUL_15(v, t2); - } - } - else idx += sb; - } - - is_p = scalefac[20]; - if(is_p != 7) - { /* copy l-band 20 to l-band 21 */ - int sb; - real t1 = tab1[is_p],t2 = tab2[is_p]; - - for( sb = bi->longDiff[21]; sb > 0; sb--,idx++ ) - { - real v = xr[0][idx]; - xr[0][idx] = REAL_MUL_15(v, t1); - xr[1][idx] = REAL_MUL_15(v, t2); - } - } - } -} - - -static void III_antialias(real xr[SBLIMIT][SSLIMIT],struct gr_info_s *gr_info) -{ - int sblim; - - if(gr_info->block_type == 2) - { - if(!gr_info->mixed_block_flag) return; - - sblim = 1; - } - else sblim = gr_info->maxb-1; - - /* 31 alias-reduction operations between each pair of sub-bands */ - /* with 8 butterflies between each pair */ - - { - int sb; - real *xr1=(real *) xr[1]; - - for(sb=sblim; sb; sb--,xr1+=10) - { - int ss; - real *cs=aa_cs,*ca=aa_ca; - real *xr2 = xr1; - - for(ss=7;ss>=0;ss--) - { /* upper and lower butterfly inputs */ - register real bu = *--xr2,bd = *xr1; - *xr2 = REAL_MUL(bu, *cs) - REAL_MUL(bd, *ca); - *xr1++ = REAL_MUL(bd, *cs++) + REAL_MUL(bu, *ca++); - } - } - } -} - -/* - This is an optimized DCT from Jeff Tsay's maplay 1.2+ package. - Saved one multiplication by doing the 'twiddle factor' stuff - together with the window mul. (MH) - - This uses Byeong Gi Lee's Fast Cosine Transform algorithm, but the - 9 point IDCT needs to be reduced further. Unfortunately, I don't - know how to do that, because 9 is not an even number. - Jeff. - - Original Message: - - 9 Point Inverse Discrete Cosine Transform - - This piece of code is Copyright 1997 Mikko Tommila and is freely usable - by anybody. The algorithm itself is of course in the public domain. - - Again derived heuristically from the 9-point WFTA. - - The algorithm is optimized (?) for speed, not for small rounding errors or - good readability. - - 36 additions, 11 multiplications - - Again this is very likely sub-optimal. - - The code is optimized to use a minimum number of temporary variables, - so it should compile quite well even on 8-register Intel x86 processors. - This makes the code quite obfuscated and very difficult to understand. - - References: - [1] S. Winograd: "On Computing the Discrete Fourier Transform", - Mathematics of Computation, Volume 32, Number 141, January 1978, - Pages 175-199 -*/ - -/* Calculation of the inverse MDCT - used to be static without 3dnow - does that really matter? */ -void dct36(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf) -{ -#ifdef NEW_DCT9 - real tmp[18]; -#endif - - { - register real *in = inbuf; - - in[17]+=in[16]; in[16]+=in[15]; in[15]+=in[14]; - in[14]+=in[13]; in[13]+=in[12]; in[12]+=in[11]; - in[11]+=in[10]; in[10]+=in[9]; in[9] +=in[8]; - in[8] +=in[7]; in[7] +=in[6]; in[6] +=in[5]; - in[5] +=in[4]; in[4] +=in[3]; in[3] +=in[2]; - in[2] +=in[1]; in[1] +=in[0]; - - in[17]+=in[15]; in[15]+=in[13]; in[13]+=in[11]; in[11]+=in[9]; - in[9] +=in[7]; in[7] +=in[5]; in[5] +=in[3]; in[3] +=in[1]; - - -#ifdef NEW_DCT9 -#if 1 - { - real t3; - { - real t0, t1, t2; - - t0 = REAL_MUL(COS6_2, (in[8] + in[16] - in[4])); - t1 = REAL_MUL(COS6_2, in[12]); - - t3 = in[0]; - t2 = t3 - t1 - t1; - tmp[1] = tmp[7] = t2 - t0; - tmp[4] = t2 + t0 + t0; - t3 += t1; - - t2 = REAL_MUL(COS6_1, (in[10] + in[14] - in[2])); - tmp[1] -= t2; - tmp[7] += t2; - } - { - real t0, t1, t2; - - t0 = REAL_MUL(cos9[0], (in[4] + in[8] )); - t1 = REAL_MUL(cos9[1], (in[8] - in[16])); - t2 = REAL_MUL(cos9[2], (in[4] + in[16])); - - tmp[2] = tmp[6] = t3 - t0 - t2; - tmp[0] = tmp[8] = t3 + t0 + t1; - tmp[3] = tmp[5] = t3 - t1 + t2; - } - } - { - real t1, t2, t3; - - t1 = REAL_MUL(cos18[0], (in[2] + in[10])); - t2 = REAL_MUL(cos18[1], (in[10] - in[14])); - t3 = REAL_MUL(COS6_1, in[6]); - - { - real t0 = t1 + t2 + t3; - tmp[0] += t0; - tmp[8] -= t0; - } - - t2 -= t3; - t1 -= t3; - - t3 = REAL_MUL(cos18[2], (in[2] + in[14])); - - t1 += t3; - tmp[3] += t1; - tmp[5] -= t1; - - t2 -= t3; - tmp[2] += t2; - tmp[6] -= t2; - } - -#else - { - real t0, t1, t2, t3, t4, t5, t6, t7; - - t1 = REAL_MUL(COS6_2, in[12]); - t2 = REAL_MUL(COS6_2, (in[8] + in[16] - in[4])); - - t3 = in[0] + t1; - t4 = in[0] - t1 - t1; - t5 = t4 - t2; - tmp[4] = t4 + t2 + t2; - - t0 = REAL_MUL(cos9[0], (in[4] + in[8])); - t1 = REAL_MUL(cos9[1], (in[8] - in[16])); - - t2 = REAL_MUL(cos9[2], (in[4] + in[16])); - - t6 = t3 - t0 - t2; - t0 += t3 + t1; - t3 += t2 - t1; - - t2 = REAL_MUL(cos18[0], (in[2] + in[10])); - t4 = REAL_MUL(cos18[1], (in[10] - in[14])); - t7 = REAL_MUL(COS6_1, in[6]); - - t1 = t2 + t4 + t7; - tmp[0] = t0 + t1; - tmp[8] = t0 - t1; - t1 = REAL_MUL(cos18[2], (in[2] + in[14])); - t2 += t1 - t7; - - tmp[3] = t3 + t2; - t0 = REAL_MUL(COS6_1, (in[10] + in[14] - in[2])); - tmp[5] = t3 - t2; - - t4 -= t1 + t7; - - tmp[1] = t5 - t0; - tmp[7] = t5 + t0; - tmp[2] = t6 + t4; - tmp[6] = t6 - t4; - } -#endif - - { - real t0, t1, t2, t3, t4, t5, t6, t7; - - t1 = REAL_MUL(COS6_2, in[13]); - t2 = REAL_MUL(COS6_2, (in[9] + in[17] - in[5])); - - t3 = in[1] + t1; - t4 = in[1] - t1 - t1; - t5 = t4 - t2; - - t0 = REAL_MUL(cos9[0], (in[5] + in[9])); - t1 = REAL_MUL(cos9[1], (in[9] - in[17])); - - tmp[13] = REAL_MUL((t4 + t2 + t2), tfcos36[17-13]); - t2 = REAL_MUL(cos9[2], (in[5] + in[17])); - - t6 = t3 - t0 - t2; - t0 += t3 + t1; - t3 += t2 - t1; - - t2 = REAL_MUL(cos18[0], (in[3] + in[11])); - t4 = REAL_MUL(cos18[1], (in[11] - in[15])); - t7 = REAL_MUL(COS6_1, in[7]); - - t1 = t2 + t4 + t7; - tmp[17] = REAL_MUL((t0 + t1), tfcos36[17-17]); - tmp[9] = REAL_MUL((t0 - t1), tfcos36[17-9]); - t1 = REAL_MUL(cos18[2], (in[3] + in[15])); - t2 += t1 - t7; - - tmp[14] = REAL_MUL((t3 + t2), tfcos36[17-14]); - t0 = REAL_MUL(COS6_1, (in[11] + in[15] - in[3])); - tmp[12] = REAL_MUL((t3 - t2), tfcos36[17-12]); - - t4 -= t1 + t7; - - tmp[16] = REAL_MUL((t5 - t0), tfcos36[17-16]); - tmp[10] = REAL_MUL((t5 + t0), tfcos36[17-10]); - tmp[15] = REAL_MUL((t6 + t4), tfcos36[17-15]); - tmp[11] = REAL_MUL((t6 - t4), tfcos36[17-11]); - } - -#define MACRO(v) { \ - real tmpval; \ - tmpval = tmp[(v)] + tmp[17-(v)]; \ - out2[9+(v)] = REAL_MUL(tmpval, w[27+(v)]); \ - out2[8-(v)] = REAL_MUL(tmpval, w[26-(v)]); \ - tmpval = tmp[(v)] - tmp[17-(v)]; \ - ts[SBLIMIT*(8-(v))] = out1[8-(v)] + REAL_MUL(tmpval, w[8-(v)]); \ - ts[SBLIMIT*(9+(v))] = out1[9+(v)] + REAL_MUL(tmpval, w[9+(v)]); } - - { - register real *out2 = o2; - register real *w = wintab; - register real *out1 = o1; - register real *ts = tsbuf; - - MACRO(0); - MACRO(1); - MACRO(2); - MACRO(3); - MACRO(4); - MACRO(5); - MACRO(6); - MACRO(7); - MACRO(8); - } - -#else - - { - -#define MACRO0(v) { \ - real tmp; \ - out2[9+(v)] = REAL_MUL((tmp = sum0 + sum1), w[27+(v)]); \ - out2[8-(v)] = REAL_MUL(tmp, w[26-(v)]); } \ - sum0 -= sum1; \ - ts[SBLIMIT*(8-(v))] = out1[8-(v)] + REAL_MUL(sum0, w[8-(v)]); \ - ts[SBLIMIT*(9+(v))] = out1[9+(v)] + REAL_MUL(sum0, w[9+(v)]); -#define MACRO1(v) { \ - real sum0,sum1; \ - sum0 = tmp1a + tmp2a; \ - sum1 = REAL_MUL((tmp1b + tmp2b), tfcos36[(v)]); \ - MACRO0(v); } -#define MACRO2(v) { \ - real sum0,sum1; \ - sum0 = tmp2a - tmp1a; \ - sum1 = REAL_MUL((tmp2b - tmp1b), tfcos36[(v)]); \ - MACRO0(v); } - - register const real *c = COS9; - register real *out2 = o2; - register real *w = wintab; - register real *out1 = o1; - register real *ts = tsbuf; - - real ta33,ta66,tb33,tb66; - - ta33 = REAL_MUL(in[2*3+0], c[3]); - ta66 = REAL_MUL(in[2*6+0], c[6]); - tb33 = REAL_MUL(in[2*3+1], c[3]); - tb66 = REAL_MUL(in[2*6+1], c[6]); - - { - real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = REAL_MUL(in[2*1+0], c[1]) + ta33 + REAL_MUL(in[2*5+0], c[5]) + REAL_MUL(in[2*7+0], c[7]); - tmp1b = REAL_MUL(in[2*1+1], c[1]) + tb33 + REAL_MUL(in[2*5+1], c[5]) + REAL_MUL(in[2*7+1], c[7]); - tmp2a = REAL_MUL(in[2*2+0], c[2]) + REAL_MUL(in[2*4+0], c[4]) + ta66 + REAL_MUL(in[2*8+0], c[8]); - tmp2b = REAL_MUL(in[2*2+1], c[2]) + REAL_MUL(in[2*4+1], c[4]) + tb66 + REAL_MUL(in[2*8+1], c[8]); - - MACRO1(0); - MACRO2(8); - } - - { - real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = REAL_MUL(( in[2*1+0] - in[2*5+0] - in[2*7+0] ), c[3]); - tmp1b = REAL_MUL(( in[2*1+1] - in[2*5+1] - in[2*7+1] ), c[3]); - tmp2a = REAL_MUL(( in[2*2+0] - in[2*4+0] - in[2*8+0] ), c[6]) - in[2*6+0] + in[2*0+0]; - tmp2b = REAL_MUL(( in[2*2+1] - in[2*4+1] - in[2*8+1] ), c[6]) - in[2*6+1] + in[2*0+1]; - - MACRO1(1); - MACRO2(7); - } - - { - real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = REAL_MUL(in[2*1+0], c[5]) - ta33 - REAL_MUL(in[2*5+0], c[7]) + REAL_MUL(in[2*7+0], c[1]); - tmp1b = REAL_MUL(in[2*1+1], c[5]) - tb33 - REAL_MUL(in[2*5+1], c[7]) + REAL_MUL(in[2*7+1], c[1]); - tmp2a = - REAL_MUL(in[2*2+0], c[8]) - REAL_MUL(in[2*4+0], c[2]) + ta66 + REAL_MUL(in[2*8+0], c[4]); - tmp2b = - REAL_MUL(in[2*2+1], c[8]) - REAL_MUL(in[2*4+1], c[2]) + tb66 + REAL_MUL(in[2*8+1], c[4]); - - MACRO1(2); - MACRO2(6); - } - - { - real tmp1a,tmp2a,tmp1b,tmp2b; - tmp1a = REAL_MUL(in[2*1+0], c[7]) - ta33 + REAL_MUL(in[2*5+0], c[1]) - REAL_MUL(in[2*7+0], c[5]); - tmp1b = REAL_MUL(in[2*1+1], c[7]) - tb33 + REAL_MUL(in[2*5+1], c[1]) - REAL_MUL(in[2*7+1], c[5]); - tmp2a = - REAL_MUL(in[2*2+0], c[4]) + REAL_MUL(in[2*4+0], c[8]) + ta66 - REAL_MUL(in[2*8+0], c[2]); - tmp2b = - REAL_MUL(in[2*2+1], c[4]) + REAL_MUL(in[2*4+1], c[8]) + tb66 - REAL_MUL(in[2*8+1], c[2]); - - MACRO1(3); - MACRO2(5); - } - - { - real sum0,sum1; - sum0 = in[2*0+0] - in[2*2+0] + in[2*4+0] - in[2*6+0] + in[2*8+0]; - sum1 = REAL_MUL((in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ), tfcos36[4]); - MACRO0(4); - } - } -#endif - - } -} - - -/* new DCT12 */ -static void dct12(real *in,real *rawout1,real *rawout2,register real *wi,register real *ts) -{ -#define DCT12_PART1 \ - in5 = in[5*3]; \ - in5 += (in4 = in[4*3]); \ - in4 += (in3 = in[3*3]); \ - in3 += (in2 = in[2*3]); \ - in2 += (in1 = in[1*3]); \ - in1 += (in0 = in[0*3]); \ - \ - in5 += in3; in3 += in1; \ - \ - in2 = REAL_MUL(in2, COS6_1); \ - in3 = REAL_MUL(in3, COS6_1); - -#define DCT12_PART2 \ - in0 += REAL_MUL(in4, COS6_2); \ - \ - in4 = in0 + in2; \ - in0 -= in2; \ - \ - in1 += REAL_MUL(in5, COS6_2); \ - \ - in5 = REAL_MUL((in1 + in3), tfcos12[0]); \ - in1 = REAL_MUL((in1 - in3), tfcos12[2]); \ - \ - in3 = in4 + in5; \ - in4 -= in5; \ - \ - in2 = in0 + in1; \ - in0 -= in1; - - { - real in0,in1,in2,in3,in4,in5; - register real *out1 = rawout1; - ts[SBLIMIT*0] = out1[0]; ts[SBLIMIT*1] = out1[1]; ts[SBLIMIT*2] = out1[2]; - ts[SBLIMIT*3] = out1[3]; ts[SBLIMIT*4] = out1[4]; ts[SBLIMIT*5] = out1[5]; - - DCT12_PART1 - - { - real tmp0,tmp1 = (in0 - in4); - { - real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); - tmp0 = tmp1 + tmp2; - tmp1 -= tmp2; - } - ts[(17-1)*SBLIMIT] = out1[17-1] + REAL_MUL(tmp0, wi[11-1]); - ts[(12+1)*SBLIMIT] = out1[12+1] + REAL_MUL(tmp0, wi[6+1]); - ts[(6 +1)*SBLIMIT] = out1[6 +1] + REAL_MUL(tmp1, wi[1]); - ts[(11-1)*SBLIMIT] = out1[11-1] + REAL_MUL(tmp1, wi[5-1]); - } - - DCT12_PART2 - - ts[(17-0)*SBLIMIT] = out1[17-0] + REAL_MUL(in2, wi[11-0]); - ts[(12+0)*SBLIMIT] = out1[12+0] + REAL_MUL(in2, wi[6+0]); - ts[(12+2)*SBLIMIT] = out1[12+2] + REAL_MUL(in3, wi[6+2]); - ts[(17-2)*SBLIMIT] = out1[17-2] + REAL_MUL(in3, wi[11-2]); - - ts[(6 +0)*SBLIMIT] = out1[6+0] + REAL_MUL(in0, wi[0]); - ts[(11-0)*SBLIMIT] = out1[11-0] + REAL_MUL(in0, wi[5-0]); - ts[(6 +2)*SBLIMIT] = out1[6+2] + REAL_MUL(in4, wi[2]); - ts[(11-2)*SBLIMIT] = out1[11-2] + REAL_MUL(in4, wi[5-2]); - } - - in++; - - { - real in0,in1,in2,in3,in4,in5; - register real *out2 = rawout2; - - DCT12_PART1 - - { - real tmp0,tmp1 = (in0 - in4); - { - real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); - tmp0 = tmp1 + tmp2; - tmp1 -= tmp2; - } - out2[5-1] = REAL_MUL(tmp0, wi[11-1]); - out2[0+1] = REAL_MUL(tmp0, wi[6+1]); - ts[(12+1)*SBLIMIT] += REAL_MUL(tmp1, wi[1]); - ts[(17-1)*SBLIMIT] += REAL_MUL(tmp1, wi[5-1]); - } - - DCT12_PART2 - - out2[5-0] = REAL_MUL(in2, wi[11-0]); - out2[0+0] = REAL_MUL(in2, wi[6+0]); - out2[0+2] = REAL_MUL(in3, wi[6+2]); - out2[5-2] = REAL_MUL(in3, wi[11-2]); - - ts[(12+0)*SBLIMIT] += REAL_MUL(in0, wi[0]); - ts[(17-0)*SBLIMIT] += REAL_MUL(in0, wi[5-0]); - ts[(12+2)*SBLIMIT] += REAL_MUL(in4, wi[2]); - ts[(17-2)*SBLIMIT] += REAL_MUL(in4, wi[5-2]); - } - - in++; - - { - real in0,in1,in2,in3,in4,in5; - register real *out2 = rawout2; - out2[12]=out2[13]=out2[14]=out2[15]=out2[16]=out2[17]=0.0; - - DCT12_PART1 - - { - real tmp0,tmp1 = (in0 - in4); - { - real tmp2 = REAL_MUL((in1 - in5), tfcos12[1]); - tmp0 = tmp1 + tmp2; - tmp1 -= tmp2; - } - out2[11-1] = REAL_MUL(tmp0, wi[11-1]); - out2[6 +1] = REAL_MUL(tmp0, wi[6+1]); - out2[0+1] += REAL_MUL(tmp1, wi[1]); - out2[5-1] += REAL_MUL(tmp1, wi[5-1]); - } - - DCT12_PART2 - - out2[11-0] = REAL_MUL(in2, wi[11-0]); - out2[6 +0] = REAL_MUL(in2, wi[6+0]); - out2[6 +2] = REAL_MUL(in3, wi[6+2]); - out2[11-2] = REAL_MUL(in3, wi[11-2]); - - out2[0+0] += REAL_MUL(in0, wi[0]); - out2[5-0] += REAL_MUL(in0, wi[5-0]); - out2[0+2] += REAL_MUL(in4, wi[2]); - out2[5-2] += REAL_MUL(in4, wi[5-2]); - } -} - - -static void III_hybrid(real fsIn[SBLIMIT][SSLIMIT], real tsOut[SSLIMIT][SBLIMIT], int ch,struct gr_info_s *gr_info, mpg123_handle *fr) -{ - real (*block)[2][SBLIMIT*SSLIMIT] = fr->hybrid_block; - int *blc = fr->hybrid_blc; - - real *tspnt = (real *) tsOut; - real *rawout1,*rawout2; - int bt = 0; - size_t sb = 0; - - { - int b = blc[ch]; - rawout1=block[b][ch]; - b=-b+1; - rawout2=block[b][ch]; - blc[ch] = b; - } - - if(gr_info->mixed_block_flag) - { - sb = 2; - opt_dct36(fr)(fsIn[0],rawout1,rawout2,win[0],tspnt); - opt_dct36(fr)(fsIn[1],rawout1+18,rawout2+18,win1[0],tspnt+1); - rawout1 += 36; rawout2 += 36; tspnt += 2; - } - - bt = gr_info->block_type; - if(bt == 2) - { - for(; sbmaxb; sb+=2,tspnt+=2,rawout1+=36,rawout2+=36) - { - dct12(fsIn[sb] ,rawout1 ,rawout2 ,win[2] ,tspnt); - dct12(fsIn[sb+1],rawout1+18,rawout2+18,win1[2],tspnt+1); - } - } - else - { - for(; sbmaxb; sb+=2,tspnt+=2,rawout1+=36,rawout2+=36) - { - opt_dct36(fr)(fsIn[sb],rawout1,rawout2,win[bt],tspnt); - opt_dct36(fr)(fsIn[sb+1],rawout1+18,rawout2+18,win1[bt],tspnt+1); - } - } - - for(;sbstereo; - int single = fr->single; - int ms_stereo,i_stereo; - int sfreq = fr->sampling_frequency; - int stereo1,granules; - - if(stereo == 1) - { /* stream is mono */ - stereo1 = 1; - single = SINGLE_LEFT; - } - else if(single != SINGLE_STEREO) /* stream is stereo, but force to mono */ - stereo1 = 1; - else - stereo1 = 2; - - if(fr->mode == MPG_MD_JOINT_STEREO) - { - ms_stereo = (fr->mode_ext & 0x2)>>1; - i_stereo = fr->mode_ext & 0x1; - } - else ms_stereo = i_stereo = 0; - - granules = fr->lsf ? 1 : 2; - - /* quick hack to keep the music playing */ - /* after having seen this nasty test file... */ - if(III_get_side_info(fr, &sideinfo,stereo,ms_stereo,sfreq,single)) - { - if(NOQUIET) error("bad frame - unable to get valid sideinfo"); - return clip; - } - - set_pointer(fr,sideinfo.main_data_begin); - - for(gr=0;grlayer3.hybrid_in; - /* hybridOut[2][SSLIMIT][SBLIMIT] */ - real (*hybridOut)[SSLIMIT][SBLIMIT] = fr->layer3.hybrid_out; - - { - struct gr_info_s *gr_info = &(sideinfo.ch[0].gr[gr]); - long part2bits; - if(fr->lsf) - part2bits = III_get_scale_factors_2(fr, scalefacs[0],gr_info,0); - else - part2bits = III_get_scale_factors_1(fr, scalefacs[0],gr_info,0,gr); - - if(III_dequantize_sample(fr, hybridIn[0], scalefacs[0],gr_info,sfreq,part2bits)) - { - if(VERBOSE2) error("dequantization failed!"); - return clip; - } - } - - if(stereo == 2) - { - struct gr_info_s *gr_info = &(sideinfo.ch[1].gr[gr]); - long part2bits; - if(fr->lsf) - part2bits = III_get_scale_factors_2(fr, scalefacs[1],gr_info,i_stereo); - else - part2bits = III_get_scale_factors_1(fr, scalefacs[1],gr_info,1,gr); - - if(III_dequantize_sample(fr, hybridIn[1],scalefacs[1],gr_info,sfreq,part2bits)) - { - if(VERBOSE2) error("dequantization failed!"); - return clip; - } - - if(ms_stereo) - { - int i; - unsigned int maxb = sideinfo.ch[0].gr[gr].maxb; - if(sideinfo.ch[1].gr[gr].maxb > maxb) maxb = sideinfo.ch[1].gr[gr].maxb; - - for(i=0;ilsf); - - if(ms_stereo || i_stereo || (single == SINGLE_MIX) ) - { - if(gr_info->maxb > sideinfo.ch[0].gr[gr].maxb) - sideinfo.ch[0].gr[gr].maxb = gr_info->maxb; - else - gr_info->maxb = sideinfo.ch[0].gr[gr].maxb; - } - - switch(single) - { - case SINGLE_MIX: - { - register int i; - register real *in0 = (real *) hybridIn[0],*in1 = (real *) hybridIn[1]; - for(i=0;imaxb;i++,in0++) - *in0 = (*in0 + *in1++); /* *0.5 done by pow-scale */ - } - break; - case SINGLE_RIGHT: - { - register int i; - register real *in0 = (real *) hybridIn[0],*in1 = (real *) hybridIn[1]; - for(i=0;imaxb;i++) - *in0++ = *in1++; - } - break; - } - } - - for(ch=0;chaf.encoding != MPG123_ENC_SIGNED_16 || fr->down_sample != 0) - { -#endif - for(ss=0;sssynth_mono)(hybridOut[0][ss], fr); - else - clip += (fr->synth_stereo)(hybridOut[0][ss], hybridOut[1][ss], fr); - - } -#ifdef OPT_I486 - } else - { - /* Only stereo, 16 bits benefit from the 486 optimization. */ - ss=0; - while(ss < SSLIMIT) - { - int n; - n=(fr->buffer.size - fr->buffer.fill) / (2*2*32); - if(n > (SSLIMIT-ss)) n=SSLIMIT-ss; - - /* Clip counting makes no sense with this function. */ - absynth_1to1_i486(hybridOut[0][ss], 0, fr, n); - absynth_1to1_i486(hybridOut[1][ss], 1, fr, n); - ss+=n; - fr->buffer.fill+=(2*2*32)*n; - } - } -#endif - } - - return clip; -} diff --git a/Frameworks/mpg123/mpg123/lfs_alias.c b/Frameworks/mpg123/mpg123/lfs_alias.c deleted file mode 100644 index 864b4fbbd..000000000 --- a/Frameworks/mpg123/mpg123/lfs_alias.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - lfs_alias: Aliases to the small/native API functions with the size of long int as suffix. - - copyright 2010-2013 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - initially written by Thomas Orgis - - Use case: Client code on Linux/x86-64 that defines _FILE_OFFSET_BITS to 64, - which is the only choice on that platform anyway. It should be no-op, but - prompts the platform-agnostic header of mpg123 to define API calls with the - corresponding suffix. This file provides the names for this case. It's cruft, - but glibc does it, too -- so people rely on it. - Oh, and it also caters for the lunatics that define _FILE_OFFSET_BITS=32 on - 32 bit platforms. In addition, it's needed for platforms that always have - off_t /= long, and clients still insisting on defining _FILE_OFFSET_BITS. - - Depending on use case, the aliases map to 32 (small) or 64 bit (large) offset - functions, to the ones from libmpg123 or the ones from lfs_wrap. - - So, two basic cases: - 1. mpg123_bla_32 alias for mpg123_bla (native) - 2. mpg123_bla alias for mpg123_bla_32 (wrapper) - Same for 64 bits. Confusing, I know. It sucks. - - Note that the mpg123 header is _not_ used here to avoid definition with whacky off_t. - The aliases are always about arguments of native alias_t type. This can be off_t, but - on Linux/x86, this is long int. The off_t declarations in mpg123.h confuse things, - so reproduce definitions for the wrapper functions in that case. The definitions are - pulled by an inline Perl script in any case ... no need to copy anything manually! - As a benefit, one can skip undefining possible largefile namings. -*/ - -#include "config.h" - -/* Hack for Solaris: Some system headers included from compat.h might force _FILE_OFFSET_BITS. Need to follow that here. - Also, want it around to have types defined. */ -#include "compat.h" - -#ifndef LFS_ALIAS_BITS -#error "I need the count of alias bits here." -#endif - -#define MACROCAT_REALLY(a, b) a ## b -#define MACROCAT(a, b) MACROCAT_REALLY(a, b) - -/* This is wicked switchery: Decide which way the aliases are facing. */ - -#if _FILE_OFFSET_BITS+0 == LFS_ALIAS_BITS - -/* The native functions have suffix, the aliases not. */ -#define NATIVE_SUFFIX MACROCAT(_, _FILE_OFFSET_BITS) -#define NATIVE_NAME(func) MACROCAT(func, NATIVE_SUFFIX) -#define ALIAS_NAME(func) func - -#else - -/* The alias functions have suffix, the native ones not. */ -#define ALIAS_SUFFIX MACROCAT(_, LFS_ALIAS_BITS) -#define ALIAS_NAME(func) MACROCAT(func, ALIAS_SUFFIX) -#define NATIVE_NAME(func) func - -#endif - -/* Copy of necessary definitions, actually just forward declarations. */ -struct mpg123_handle_struct; -typedef struct mpg123_handle_struct mpg123_handle; - - -/* Get attribute_align_arg, to stay safe. */ -#include "abi_align.h" - -/* - Extract the list of functions we need wrappers for, pregenerating the wrappers for simple cases (inline script for nedit): -perl -ne ' -if(/^\s*EXPORT\s+(\S+)\s+(mpg123_\S+)\((.*)\);\s*$/) -{ - my $type = $1; - my $name = $2; - my $args = $3; - next unless ($type =~ /off_t/ or $args =~ /off_t/ or ($name =~ /open/ and $name ne mpg123_open_feed)); - $type =~ s/off_t/lfs_alias_t/g; - my @nargs = (); - $args =~ s/off_t/lfs_alias_t/g; - foreach my $a (split(/,/, $args)) - { - $a =~ s/^.*\s\**([a-z_]+)$/$1/; - push(@nargs, $a); - } - my $nargs = join(", ", @nargs); - $nargs = "Human: figure me out." if($nargs =~ /\(/); - print < -#include -#include -#include "compat.h" -#include "debug.h" - -/* - Now, start off easy... translate simple API calls. - I need to deal with these here: -perl -ne ' -if(/^\s*EXPORT\s+(\S+)\s+(mpg123_\S+)\((.*)\);\s*$/) -{ - $type = $1; - $name = $2; - $args = $3; - next unless ($type =~ /off_t/ or $args =~ /off_t/); - print "$name\n" unless grep {$_ eq $name} - ("mpg123_open", "mpg123_open_fd", "mpg123_open_handle", "mpg123_replace_reader", "mpg123_replace_reader_handle"); -}' < mpg123.h.in - -mpg123_decode_frame -mpg123_framebyframe_decode -mpg123_framepos -mpg123_tell -mpg123_tellframe -mpg123_tell_stream -mpg123_seek -mpg123_feedseek -mpg123_seek_frame -mpg123_timeframe -mpg123_index -mpg123_set_index -mpg123_position -mpg123_length -mpg123_set_filesize -mpg123_decode_raw ... that's experimental. - -Let's work on them in that order. -*/ - -/* I see that I will need custom data storage. Main use is for the replaced I/O later, but the seek table for small file offsets needs extra storage, too. */ - -/* The wrapper handle for descriptor and handle I/O. */ - -/* The handle is used for nothing (0), or one of these two modes of operation: */ -#define IO_FD 1 /* Wrapping over callbacks operation on integer file descriptor. */ -#define IO_HANDLE 2 /* Wrapping over custom handle callbacks. */ - -struct wrap_data -{ - /* Storage for small offset index table. */ - long *indextable; - /* I/O handle stuff */ - int iotype; /* IO_FD or IO_HANDLE */ - /* Data for IO_FD. */ - int fd; - int my_fd; /* A descriptor that the wrapper code opened itself. */ - /* The actual callbacks from the outside. */ - ssize_t (*r_read) (int, void *, size_t); - long (*r_lseek)(int, long, int); - /* Data for IO_HANDLE. */ - void* handle; - ssize_t (*r_h_read)(void *, void *, size_t); - long (*r_h_lseek)(void*, long, int); - void (*h_cleanup)(void*); -}; - - -/* Cleanup I/O part of the handle handle... but not deleting the wrapper handle itself. - That is stored in the frame and only deleted on mpg123_delete(). */ -static void wrap_io_cleanup(void *handle) -{ - struct wrap_data *ioh = handle; - if(ioh->iotype == IO_HANDLE) - { - if(ioh->h_cleanup != NULL && ioh->handle != NULL) - ioh->h_cleanup(ioh->handle); - - ioh->handle = NULL; - } - if(ioh->my_fd >= 0) - { - close(ioh->my_fd); - ioh->my_fd = -1; - } -} - -/* Really finish off the handle... freeing all memory. */ -static void wrap_destroy(void *handle) -{ - struct wrap_data *wh = handle; - wrap_io_cleanup(handle); - if(wh->indextable != NULL) - free(wh->indextable); - - free(wh); -} - -/* More helper code... extract the special wrapper handle, possible allocate and initialize it. */ -static struct wrap_data* wrap_get(mpg123_handle *mh) -{ - struct wrap_data* whd; - if(mh == NULL) return NULL; - - /* Access the private storage inside the mpg123 handle. - The real callback functions and handles are stored there. */ - if(mh->wrapperdata == NULL) - { - /* Create a new one. */ - mh->wrapperdata = malloc(sizeof(struct wrap_data)); - if(mh->wrapperdata == NULL) - { - mh->err = MPG123_OUT_OF_MEM; - return NULL; - } - /* When we have wrapper data present, the callback for its proper cleanup is needed. */ - mh->wrapperclean = wrap_destroy; - - whd = mh->wrapperdata; - whd->indextable = NULL; - whd->iotype = 0; - whd->fd = -1; - whd->my_fd = -1; - whd->r_read = NULL; - whd->r_lseek = NULL; - whd->handle = NULL; - whd->r_h_read = NULL; - whd->r_h_lseek = NULL; - whd->h_cleanup = NULL; - } - else whd = mh->wrapperdata; - - return whd; -} - -/* After settling the data... start with some simple wrappers. */ - -#undef mpg123_decode_frame -/* int mpg123_decode_frame(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes) */ -int attribute_align_arg mpg123_decode_frame(mpg123_handle *mh, long *num, unsigned char **audio, size_t *bytes) -{ - off_t largenum; - int err; - - err = MPG123_LARGENAME(mpg123_decode_frame)(mh, &largenum, audio, bytes); - if(err == MPG123_OK && num != NULL) - { - *num = largenum; - if(*num != largenum) - { - mh->err = MPG123_LFS_OVERFLOW; - err = MPG123_ERR; - } - } - return err; -} - -#undef mpg123_framebyframe_decode -/* int mpg123_framebyframe_decode(mpg123_handle *mh, off_t *num, unsigned char **audio, size_t *bytes); */ -int attribute_align_arg mpg123_framebyframe_decode(mpg123_handle *mh, long *num, unsigned char **audio, size_t *bytes) -{ - off_t largenum; - int err; - - err = MPG123_LARGENAME(mpg123_framebyframe_decode)(mh, &largenum, audio, bytes); - if(err == MPG123_OK && num != NULL) - { - *num = largenum; - if(*num != largenum) - { - mh->err = MPG123_LFS_OVERFLOW; - err = MPG123_ERR; - } - } - return err; -} - -#undef mpg123_framepos -/* off_t mpg123_framepos(mpg123_handle *mh); */ -long attribute_align_arg mpg123_framepos(mpg123_handle *mh) -{ - long val; - off_t largeval; - - largeval = MPG123_LARGENAME(mpg123_framepos)(mh); - val = largeval; - if(val != largeval) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - return val; -} - -#undef mpg123_tell -/* off_t mpg123_tell(mpg123_handle *mh); */ -long attribute_align_arg mpg123_tell(mpg123_handle *mh) -{ - long val; - off_t largeval; - - largeval = MPG123_LARGENAME(mpg123_tell)(mh); - val = largeval; - if(val != largeval) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - return val; -} - -#undef mpg123_tellframe -/* off_t mpg123_tellframe(mpg123_handle *mh); */ -long attribute_align_arg mpg123_tellframe(mpg123_handle *mh) -{ - long val; - off_t largeval; - - largeval = MPG123_LARGENAME(mpg123_tellframe)(mh); - val = largeval; - if(val != largeval) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - return val; -} - -#undef mpg123_tell_stream -/* off_t mpg123_tell_stream(mpg123_handle *mh); */ -long attribute_align_arg mpg123_tell_stream(mpg123_handle *mh) -{ - long val; - off_t largeval; - - largeval = MPG123_LARGENAME(mpg123_tell_stream)(mh); - val = largeval; - if(val != largeval) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - return val; -} - -#undef mpg123_seek -/* off_t mpg123_seek(mpg123_handle *mh, off_t sampleoff, int whence); */ -long attribute_align_arg mpg123_seek(mpg123_handle *mh, long sampleoff, int whence) -{ - long val; - off_t largeval; - - largeval = MPG123_LARGENAME(mpg123_seek)(mh, sampleoff, whence); - val = largeval; - if(val != largeval) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - return val; -} - -#undef mpg123_feedseek -/* off_t mpg123_feedseek(mpg123_handle *mh, off_t sampleoff, int whence, off_t *input_offset); */ -long attribute_align_arg mpg123_feedseek(mpg123_handle *mh, long sampleoff, int whence, long *input_offset) -{ - long val; - off_t largeioff; - off_t largeval; - - largeval = MPG123_LARGENAME(mpg123_feedseek)(mh, sampleoff, whence, &largeioff); - /* Error/message codes are small... */ - if(largeval < 0) return (long)largeval; - - val = largeval; - *input_offset = largeioff; - if(val != largeval || *input_offset != largeioff) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - return val; -} - -#undef mpg123_seek_frame -/* off_t mpg123_seek_frame(mpg123_handle *mh, off_t frameoff, int whence); */ -long attribute_align_arg mpg123_seek_frame(mpg123_handle *mh, long frameoff, int whence) -{ - long val; - off_t largeval; - - largeval = MPG123_LARGENAME(mpg123_seek_frame)(mh, frameoff, whence); - val = largeval; - if(val != largeval) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - return val; -} - -#undef mpg123_timeframe -/* off_t mpg123_timeframe(mpg123_handle *mh, double sec); */ -long attribute_align_arg mpg123_timeframe(mpg123_handle *mh, double sec) -{ - long val; - off_t largeval; - - largeval = MPG123_LARGENAME(mpg123_timeframe)(mh, sec); - val = largeval; - if(val != largeval) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - return val; -} - -/* Now something less simple: Index retrieval and manipulation. - The index is an _array_ of off_t, which means that I need to construct a copy with translated long values. */ -#undef mpg123_index -/* int mpg123_index(mpg123_handle *mh, off_t **offsets, off_t *step, size_t *fill) */ -int attribute_align_arg mpg123_index(mpg123_handle *mh, long **offsets, long *step, size_t *fill) -{ - int err; - size_t i; - long smallstep; - size_t thefill; - off_t largestep; - off_t *largeoffsets; - struct wrap_data *whd; - - whd = wrap_get(mh); - if(whd == NULL) return MPG123_ERR; - - err = MPG123_LARGENAME(mpg123_index)(mh, &largeoffsets, &largestep, &thefill); - if(err != MPG123_OK) return err; - - /* For a _very_ large file, even the step could overflow. */ - smallstep = largestep; - if(smallstep != largestep) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - if(step != NULL) *step = smallstep; - - /* When there are no values stored, there is no table content to take care of. - Table pointer does not matter. Mission completed. */ - if(thefill == 0) return MPG123_OK; - - if(fill != NULL) *fill = thefill; - - /* Construct a copy of the index to hand over to the small-minded client. */ - *offsets = safe_realloc(whd->indextable, (*fill)*sizeof(long)); - if(*offsets == NULL) - { - mh->err = MPG123_OUT_OF_MEM; - return MPG123_ERR; - } - whd->indextable = *offsets; - /* Elaborate conversion of each index value, with overflow check. */ - for(i=0; i<*fill; ++i) - { - whd->indextable[i] = largeoffsets[i]; - if(whd->indextable[i] != largeoffsets[i]) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - } - /* If we came that far... there should be a valid copy of the table now. */ - return MPG123_OK; -} - -/* The writing does basically the same than the above, just the opposite. - Oh, and the overflow checks are not needed -- off_t is bigger than long. */ -#undef mpg123_set_index -/* int mpg123_set_index(mpg123_handle *mh, off_t *offsets, off_t step, size_t fill); */ -int attribute_align_arg mpg123_set_index(mpg123_handle *mh, long *offsets, long step, size_t fill) -{ - int err; - size_t i; - struct wrap_data *whd; - off_t *indextmp; - - whd = wrap_get(mh); - if(whd == NULL) return MPG123_ERR; - - /* Expensive temporary storage... for staying outside at the API layer. */ - indextmp = malloc(fill*sizeof(off_t)); - if(indextmp == NULL) - { - mh->err = MPG123_OUT_OF_MEM; - return MPG123_ERR; - } - - if(fill > 0 && offsets == NULL) - { - mh->err = MPG123_BAD_INDEX_PAR; - err = MPG123_ERR; - } - else - { - /* Fill the large-file copy of the provided index, then feed it to mpg123. */ - for(i=0; ierr = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - - if(current_frame != NULL) *current_frame = small_curframe; - - if(frames_left != NULL) *frames_left = small_frameleft; - - - return MPG123_OK; -} - -#undef mpg123_length -/* off_t mpg123_length(mpg123_handle *mh); */ -long attribute_align_arg mpg123_length(mpg123_handle *mh) -{ - long val; - off_t largeval; - - largeval = MPG123_LARGENAME(mpg123_length)(mh); - val = largeval; - if(val != largeval) - { - mh->err = MPG123_LFS_OVERFLOW; - return MPG123_ERR; - } - return val; -} - -/* The simplest wrapper of all... */ -#undef mpg123_set_filesize -/* int mpg123_set_filesize(mpg123_handle *mh, off_t size); */ -int attribute_align_arg mpg123_set_filesize(mpg123_handle *mh, long size) -{ - return MPG123_LARGENAME(mpg123_set_filesize)(mh, size); -} - - -/* ========================================= - THE BOUNDARY OF SANITY - Behold, stranger! - ========================================= */ - - -/* - The messy part: Replacement of I/O core (actally, this is only due to lseek()). - Both descriptor and handle replaced I/O are mapped to replaced handle I/O, the handle wrapping over the actual callbacks and the actual handle/descriptor. - You got multiple levels of handles and callbacks to think about. Have fun reading and comprehending. -*/ - -/* Could go into compat.h ... Windows needs that flag. */ -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -/* Read callback needs nothing special. */ -ssize_t wrap_read(void* handle, void *buf, size_t count) -{ - struct wrap_data *ioh = handle; - switch(ioh->iotype) - { - case IO_FD: return ioh->r_read(ioh->fd, buf, count); - case IO_HANDLE: return ioh->r_h_read(ioh->handle, buf, count); - } - error("Serious breakage - bad IO type in LFS wrapper!"); - return -1; -} - -/* Seek callback needs protection from too big offsets. */ -off_t wrap_lseek(void *handle, off_t offset, int whence) -{ - struct wrap_data *ioh = handle; - long smalloff = offset; - if(smalloff == offset) - { - switch(ioh->iotype) - { - case IO_FD: return ioh->r_lseek(ioh->fd, smalloff, whence); - case IO_HANDLE: return ioh->r_h_lseek(ioh->handle, smalloff, whence); - } - error("Serious breakage - bad IO type in LFS wrapper!"); - return -1; - } - else - { - errno = EOVERFLOW; - return -1; - } -} - - -/* - Now, let's replace the API dealing with replacement I/O. - Start with undefining the renames... -*/ - -#undef mpg123_replace_reader -#undef mpg123_replace_reader_handle -#undef mpg123_open -#undef mpg123_open_fd -#undef mpg123_open_handle - - -/* Normal reader replacement needs fallback implementations. */ -static ssize_t fallback_read(int fd, void *buf, size_t count) -{ - return read(fd, buf, count); -} - -static long fallback_lseek(int fd, long offset, int whence) -{ - /* Since the offset is long int already, the returned value really should fit into a long... but whatever. */ - long newpos_long; - off_t newpos; - newpos = lseek(fd, offset, whence); - newpos_long = newpos; - if(newpos_long == newpos) - return newpos_long; - else - { - errno = EOVERFLOW; - return -1; - } -} - -/* Reader replacement prepares the hidden handle storage for next mpg123_open_fd() or plain mpg123_open(). */ -int attribute_align_arg mpg123_replace_reader(mpg123_handle *mh, ssize_t (*r_read) (int, void *, size_t), long (*r_lseek)(int, long, int) ) -{ - struct wrap_data* ioh; - - if(mh == NULL) return MPG123_ERR; - - mpg123_close(mh); - ioh = wrap_get(mh); - if(ioh == NULL) return MPG123_ERR; - - /* If both callbacks are NULL, switch totally to internal I/O, else just use fallback for at most half of them. */ - if(r_read == NULL && r_lseek == NULL) - { - /* Only the type is actually important to disable the code. */ - ioh->iotype = 0; - ioh->fd = -1; - ioh->r_read = NULL; - ioh->r_lseek = NULL; - } - else - { - ioh->iotype = IO_FD; - ioh->fd = -1; /* On next mpg123_open_fd(), this gets a value. */ - ioh->r_read = r_read != NULL ? r_read : fallback_read; - ioh->r_lseek = r_lseek != NULL ? r_lseek : fallback_lseek; - } - - /* The real reader replacement will happen while opening. */ - return MPG123_OK; -} - -int attribute_align_arg mpg123_replace_reader_handle(mpg123_handle *mh, ssize_t (*r_read) (void*, void *, size_t), long (*r_lseek)(void*, long, int), void (*cleanup)(void*)) -{ - struct wrap_data* ioh; - - if(mh == NULL) return MPG123_ERR; - - mpg123_close(mh); - ioh = wrap_get(mh); - if(ioh == NULL) return MPG123_ERR; - - ioh->iotype = IO_HANDLE; - ioh->handle = NULL; - ioh->r_h_read = r_read; - ioh->r_h_lseek = r_lseek; - ioh->h_cleanup = cleanup; - - /* The real reader replacement will happen while opening. */ - return MPG123_OK; -} - -/* - The open routines always need to watch out for a prepared wrapper handle to use replaced normal I/O. - Two cases to consider: - 1. Plain normal open using internal I/O. - 2. Client called mpg123_replace_reader() before. - The second case needs hackery to activate the client I/O callbacks. For that, we create a custom I/O handle and use the guts of mpg123_open_fd() on it. -*/ -int attribute_align_arg mpg123_open(mpg123_handle *mh, const char *path) -{ - struct wrap_data* ioh; - - if(mh == NULL) return MPG123_ERR; - - ioh = mh->wrapperdata; - /* Mimic the use of mpg123_replace_reader() functions by lower levels... - IO_HANDLE is not valid here, though. Only IO_FD. */ - if(ioh != NULL && ioh->iotype == IO_FD) - { - int err; - err = MPG123_LARGENAME(mpg123_replace_reader_handle)(mh, wrap_read, wrap_lseek, wrap_io_cleanup); - if(err != MPG123_OK) return MPG123_ERR; - - /* The above call implied mpg123_close() already */ - /* - I really need to open the file here... to be able to use the replacer handle I/O ... - my_fd is used to indicate closing of the descriptor on cleanup. - */ - ioh->my_fd = compat_open(path, O_RDONLY|O_BINARY); - if(ioh->my_fd < 0) - { - if(!(mh->p.flags & MPG123_QUIET)) error2("Cannot open file %s: %s", path, strerror(errno)); - - mh->err = MPG123_BAD_FILE; - return MPG123_ERR; - } - /* Store a copy of the descriptor where it is actually used. */ - ioh->fd = ioh->my_fd; - /* Initiate I/O operating on my handle now. */ - err = open_stream_handle(mh, ioh); - if(err != MPG123_OK) - { - wrap_io_cleanup(ioh); - return MPG123_ERR; - } - /* All fine... */ - return MPG123_OK; - } - else return MPG123_LARGENAME(mpg123_open)(mh, path); -} - -/* - This is in fact very similar to the above: - The open routines always need to watch out for a prepared wrapper handle to use replaced normal I/O. - Two cases to consider: - 1. Plain normal open_fd using internal I/O. - 2. Client called mpg123_replace_reader() before. - The second case needs hackery to activate the client I/O callbacks. For that, we create a custom I/O handle and use the guts of mpg123_open_fd() on it. -*/ - -int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd) -{ - struct wrap_data* ioh; - - if(mh == NULL) return MPG123_ERR; - - mpg123_close(mh); - ioh = mh->wrapperdata; - if(ioh != NULL && ioh->iotype == IO_FD) - { - int err; - err = MPG123_LARGENAME(mpg123_replace_reader_handle)(mh, wrap_read, wrap_lseek, wrap_io_cleanup); - if(err != MPG123_OK) return MPG123_ERR; - - /* The above call implied mpg123_close() already */ - - /* Store the real file descriptor inside the handle. */ - ioh->fd = fd; - /* Initiate I/O operating on my handle now. */ - err = open_stream_handle(mh, ioh); - if(err != MPG123_OK) - { - wrap_io_cleanup(ioh); - return MPG123_ERR; - } - /* All fine... */ - return MPG123_OK; - } - else return MPG123_LARGENAME(mpg123_open_fd)(mh, fd); -} - -int attribute_align_arg mpg123_open_handle(mpg123_handle *mh, void *handle) -{ - struct wrap_data* ioh; - - if(mh == NULL) return MPG123_ERR; - - mpg123_close(mh); - ioh = mh->wrapperdata; - if(ioh != NULL && ioh->iotype == IO_HANDLE && ioh->r_h_read != NULL) - { - /* Wrap the custom handle into my handle. */ - int err; - err = MPG123_LARGENAME(mpg123_replace_reader_handle)(mh, wrap_read, wrap_lseek, wrap_io_cleanup); - if(err != MPG123_OK) return MPG123_ERR; - - ioh->handle = handle; - /* No extra error handling, keep behaviour of the original open_handle. */ - return open_stream_handle(mh, ioh); - } - else - { - /* This is an error ... you need to prepare the I/O before using it. */ - mh->err = MPG123_BAD_CUSTOM_IO; - return MPG123_ERR; - } -} - diff --git a/Frameworks/mpg123/mpg123/libmpg123.c b/Frameworks/mpg123/mpg123/libmpg123.c deleted file mode 100644 index 8cb219c7a..000000000 --- a/Frameworks/mpg123/mpg123/libmpg123.c +++ /dev/null @@ -1,1606 +0,0 @@ -/* - libmpg123: MPEG Audio Decoder library - - copyright 1995-2012 by the mpg123 project - free software under the terms of the LGPL 2.1 - see COPYING and AUTHORS files in distribution or http://mpg123.org - -*/ - -#include "mpg123lib_intern.h" -#include "icy2utf8.h" -#include "debug.h" - -#include "gapless.h" - -#define SEEKFRAME(mh) ((mh)->ignoreframe < 0 ? 0 : (mh)->ignoreframe) - -static int initialized = 0; - -int attribute_align_arg mpg123_init(void) -{ - if((sizeof(short) != 2) || (sizeof(long) < 4)) return MPG123_BAD_TYPES; - - if(initialized) return MPG123_OK; /* no need to initialize twice */ - -#ifndef NO_LAYER12 - init_layer12(); /* inits also shared tables with layer1 */ -#endif -#ifndef NO_LAYER3 - init_layer3(); -#endif - prepare_decode_tables(); - check_decoders(); - initialized = 1; - return MPG123_OK; -} - -void attribute_align_arg mpg123_exit(void) -{ - /* nothing yet, but something later perhaps */ -} - -/* create a new handle with specified decoder, decoder can be "", "auto" or NULL for auto-detection */ -mpg123_handle attribute_align_arg *mpg123_new(const char* decoder, int *error) -{ - return mpg123_parnew(NULL, decoder, error); -} - -/* ...the full routine with optional initial parameters to override defaults. */ -mpg123_handle attribute_align_arg *mpg123_parnew(mpg123_pars *mp, const char* decoder, int *error) -{ - mpg123_handle *fr = NULL; - int err = MPG123_OK; - - if(initialized) fr = (mpg123_handle*) malloc(sizeof(mpg123_handle)); - else err = MPG123_NOT_INITIALIZED; - if(fr != NULL) - { - frame_init_par(fr, mp); - debug("cpu opt setting"); - if(frame_cpu_opt(fr, decoder) != 1) - { - err = MPG123_BAD_DECODER; - frame_exit(fr); - free(fr); - fr = NULL; - } - } - if(fr != NULL) - { - fr->decoder_change = 1; - } - else if(err == MPG123_OK) err = MPG123_OUT_OF_MEM; - - if(error != NULL) *error = err; - return fr; -} - -int attribute_align_arg mpg123_decoder(mpg123_handle *mh, const char* decoder) -{ - enum optdec dt = dectype(decoder); - - if(mh == NULL) return MPG123_ERR; - - if(dt == nodec) - { - mh->err = MPG123_BAD_DECODER; - return MPG123_ERR; - } - if(dt == mh->cpu_opts.type) return MPG123_OK; - - /* Now really change. */ - /* frame_exit(mh); - frame_init(mh); */ - debug("cpu opt setting"); - if(frame_cpu_opt(mh, decoder) != 1) - { - mh->err = MPG123_BAD_DECODER; - frame_exit(mh); - return MPG123_ERR; - } - /* New buffers for decoder are created in frame_buffers() */ - if((frame_outbuffer(mh) != 0)) - { - mh->err = MPG123_NO_BUFFERS; - frame_exit(mh); - return MPG123_ERR; - } - /* Do _not_ call decode_update here! That is only allowed after a first MPEG frame has been met. */ - mh->decoder_change = 1; - return MPG123_OK; -} - -int attribute_align_arg mpg123_param(mpg123_handle *mh, enum mpg123_parms key, long val, double fval) -{ - int r; - - if(mh == NULL) return MPG123_ERR; - r = mpg123_par(&mh->p, key, val, fval); - if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; } - else - { /* Special treatment for some settings. */ -#ifdef FRAME_INDEX - if(key == MPG123_INDEX_SIZE) - { /* Apply frame index size and grow property on the fly. */ - r = frame_index_setup(mh); - if(r != MPG123_OK) mh->err = MPG123_INDEX_FAIL; - } -#endif -#ifndef NO_FEEDER - /* Feeder pool size is applied right away, reader will react to that. */ - if(key == MPG123_FEEDPOOL || key == MPG123_FEEDBUFFER) - bc_poolsize(&mh->rdat.buffer, mh->p.feedpool, mh->p.feedbuffer); -#endif - } - return r; -} - -int attribute_align_arg mpg123_par(mpg123_pars *mp, enum mpg123_parms key, long val, double fval) -{ - int ret = MPG123_OK; - - if(mp == NULL) return MPG123_BAD_PARS; - switch(key) - { - case MPG123_VERBOSE: - mp->verbose = val; - break; - case MPG123_FLAGS: -#ifndef GAPLESS - if(val & MPG123_GAPLESS) ret = MPG123_NO_GAPLESS; -#endif - if(ret == MPG123_OK) mp->flags = val; - debug1("set flags to 0x%lx", (unsigned long) mp->flags); - break; - case MPG123_ADD_FLAGS: -#ifndef GAPLESS - /* Enabling of gapless mode doesn't work when it's not there, but disabling (below) is no problem. */ - if(val & MPG123_GAPLESS) ret = MPG123_NO_GAPLESS; - else -#endif - mp->flags |= val; - debug1("set flags to 0x%lx", (unsigned long) mp->flags); - break; - case MPG123_REMOVE_FLAGS: - mp->flags &= ~val; - debug1("set flags to 0x%lx", (unsigned long) mp->flags); - break; - case MPG123_FORCE_RATE: /* should this trigger something? */ -#ifdef NO_NTOM - if(val > 0) - ret = MPG123_BAD_RATE; -#else - if(val > 96000) ret = MPG123_BAD_RATE; - else mp->force_rate = val < 0 ? 0 : val; /* >0 means enable, 0 disable */ -#endif - break; - case MPG123_DOWN_SAMPLE: -#ifdef NO_DOWNSAMPLE - if(val != 0) ret = MPG123_BAD_RATE; -#else - if(val < 0 || val > 2) ret = MPG123_BAD_RATE; - else mp->down_sample = (int)val; -#endif - break; - case MPG123_RVA: - if(val < 0 || val > MPG123_RVA_MAX) ret = MPG123_BAD_RVA; - else mp->rva = (int)val; - break; - case MPG123_DOWNSPEED: - mp->halfspeed = val < 0 ? 0 : val; - break; - case MPG123_UPSPEED: - mp->doublespeed = val < 0 ? 0 : val; - break; - case MPG123_ICY_INTERVAL: -#ifndef NO_ICY - mp->icy_interval = val > 0 ? val : 0; -#else - if(val > 0) ret = MPG123_BAD_PARAM; -#endif - break; - case MPG123_OUTSCALE: - /* Choose the value that is non-zero, if any. - Downscaling integers to 1.0 . */ - mp->outscale = val == 0 ? fval : (double)val/SHORT_SCALE; - break; - case MPG123_TIMEOUT: -#ifdef TIMEOUT_READ - mp->timeout = val >= 0 ? val : 0; -#else - if(val > 0) ret = MPG123_NO_TIMEOUT; -#endif - break; - case MPG123_RESYNC_LIMIT: - mp->resync_limit = val; - break; - case MPG123_INDEX_SIZE: -#ifdef FRAME_INDEX - mp->index_size = val; -#else - ret = MPG123_NO_INDEX; -#endif - break; - case MPG123_PREFRAMES: - if(val >= 0) mp->preframes = val; - else ret = MPG123_BAD_VALUE; - break; - case MPG123_FEEDPOOL: -#ifndef NO_FEEDER - if(val >= 0) mp->feedpool = val; - else ret = MPG123_BAD_VALUE; -#else - ret = MPG123_MISSING_FEATURE; -#endif - break; - case MPG123_FEEDBUFFER: -#ifndef NO_FEEDER - if(val > 0) mp->feedbuffer = val; - else ret = MPG123_BAD_VALUE; -#else - ret = MPG123_MISSING_FEATURE; -#endif - break; - default: - ret = MPG123_BAD_PARAM; - } - return ret; -} - -int attribute_align_arg mpg123_getparam(mpg123_handle *mh, enum mpg123_parms key, long *val, double *fval) -{ - int r; - - if(mh == NULL) return MPG123_ERR; - r = mpg123_getpar(&mh->p, key, val, fval); - if(r != MPG123_OK){ mh->err = r; r = MPG123_ERR; } - return r; -} - -int attribute_align_arg mpg123_getpar(mpg123_pars *mp, enum mpg123_parms key, long *val, double *fval) -{ - int ret = 0; - - if(mp == NULL) return MPG123_BAD_PARS; - switch(key) - { - case MPG123_VERBOSE: - if(val) *val = mp->verbose; - break; - case MPG123_FLAGS: - case MPG123_ADD_FLAGS: - if(val) *val = mp->flags; - break; - case MPG123_FORCE_RATE: - if(val) -#ifdef NO_NTOM - *val = 0; -#else - *val = mp->force_rate; -#endif - break; - case MPG123_DOWN_SAMPLE: - if(val) *val = mp->down_sample; - break; - case MPG123_RVA: - if(val) *val = mp->rva; - break; - case MPG123_DOWNSPEED: - if(val) *val = mp->halfspeed; - break; - case MPG123_UPSPEED: - if(val) *val = mp->doublespeed; - break; - case MPG123_ICY_INTERVAL: -#ifndef NO_ICY - if(val) *val = (long)mp->icy_interval; -#else - if(val) *val = 0; -#endif - break; - case MPG123_OUTSCALE: - if(fval) *fval = mp->outscale; - if(val) *val = (long)(mp->outscale*SHORT_SCALE); - break; - case MPG123_RESYNC_LIMIT: - if(val) *val = mp->resync_limit; - break; - case MPG123_INDEX_SIZE: - if(val) -#ifdef FRAME_INDEX - *val = mp->index_size; -#else - *val = 0; /* graceful fallback: no index is index of zero size */ -#endif - break; - case MPG123_PREFRAMES: - *val = mp->preframes; - break; - case MPG123_FEEDPOOL: -#ifndef NO_FEEDER - *val = mp->feedpool; -#else - ret = MPG123_MISSING_FEATURE; -#endif - break; - case MPG123_FEEDBUFFER: -#ifndef NO_FEEDER - *val = mp->feedbuffer; -#else - ret = MPG123_MISSING_FEATURE; -#endif - break; - default: - ret = MPG123_BAD_PARAM; - } - return ret; -} - -int attribute_align_arg mpg123_getstate(mpg123_handle *mh, enum mpg123_state key, long *val, double *fval) -{ - int ret = MPG123_OK; - long theval = 0; - double thefval = 0.; - - if(mh == NULL) return MPG123_ERR; - - switch(key) - { - case MPG123_ACCURATE: - theval = mh->state_flags & FRAME_ACCURATE; - break; - case MPG123_FRANKENSTEIN: - theval = mh->state_flags & FRAME_FRANKENSTEIN; - break; - case MPG123_BUFFERFILL: -#ifndef NO_FEEDER - { - size_t sval = bc_fill(&mh->rdat.buffer); - theval = (long)sval; - if((size_t)theval != sval) - { - mh->err = MPG123_INT_OVERFLOW; - ret = MPG123_ERR; - } - } -#else - mh->err = MPG123_MISSING_FEATURE; - ret = MPG123_ERR; -#endif - break; - default: - mh->err = MPG123_BAD_KEY; - ret = MPG123_ERR; - } - - if(val != NULL) *val = theval; - if(fval != NULL) *fval = thefval; - - return ret; -} - -int attribute_align_arg mpg123_eq(mpg123_handle *mh, enum mpg123_channels channel, int band, double val) -{ - if(mh == NULL) return MPG123_ERR; - if(band < 0 || band > 31){ mh->err = MPG123_BAD_BAND; return MPG123_ERR; } - switch(channel) - { - case MPG123_LEFT|MPG123_RIGHT: - mh->equalizer[0][band] = mh->equalizer[1][band] = DOUBLE_TO_REAL(val); - break; - case MPG123_LEFT: mh->equalizer[0][band] = DOUBLE_TO_REAL(val); break; - case MPG123_RIGHT: mh->equalizer[1][band] = DOUBLE_TO_REAL(val); break; - default: - mh->err=MPG123_BAD_CHANNEL; - return MPG123_ERR; - } - mh->have_eq_settings = TRUE; - return MPG123_OK; -} - -double attribute_align_arg mpg123_geteq(mpg123_handle *mh, enum mpg123_channels channel, int band) -{ - double ret = 0.; - - if(mh == NULL) return MPG123_ERR; - - /* Handle this gracefully. When there is no band, it has no volume. */ - if(band > -1 && band < 32) - switch(channel) - { - case MPG123_LEFT|MPG123_RIGHT: - ret = 0.5*(REAL_TO_DOUBLE(mh->equalizer[0][band])+REAL_TO_DOUBLE(mh->equalizer[1][band])); - break; - case MPG123_LEFT: ret = REAL_TO_DOUBLE(mh->equalizer[0][band]); break; - case MPG123_RIGHT: ret = REAL_TO_DOUBLE(mh->equalizer[1][band]); break; - /* Default case is already handled: ret = 0 */ - } - - return ret; -} - - -/* plain file access, no http! */ -int attribute_align_arg mpg123_open(mpg123_handle *mh, const char *path) -{ - if(mh == NULL) return MPG123_ERR; - - mpg123_close(mh); - return open_stream(mh, path, -1); -} - -int attribute_align_arg mpg123_open_fd(mpg123_handle *mh, int fd) -{ - if(mh == NULL) return MPG123_ERR; - - mpg123_close(mh); - return open_stream(mh, NULL, fd); -} - -int attribute_align_arg mpg123_open_handle(mpg123_handle *mh, void *iohandle) -{ - if(mh == NULL) return MPG123_ERR; - - mpg123_close(mh); - if(mh->rdat.r_read_handle == NULL) - { - mh->err = MPG123_BAD_CUSTOM_IO; - return MPG123_ERR; - } - return open_stream_handle(mh, iohandle); -} - -int attribute_align_arg mpg123_open_feed(mpg123_handle *mh) -{ - if(mh == NULL) return MPG123_ERR; - - mpg123_close(mh); - return open_feed(mh); -} - -int attribute_align_arg mpg123_replace_reader( mpg123_handle *mh, - ssize_t (*r_read) (int, void *, size_t), - off_t (*r_lseek)(int, off_t, int) ) -{ - if(mh == NULL) return MPG123_ERR; - - mpg123_close(mh); - mh->rdat.r_read = r_read; - mh->rdat.r_lseek = r_lseek; - return MPG123_OK; -} - -int attribute_align_arg mpg123_replace_reader_handle( mpg123_handle *mh, - ssize_t (*r_read) (void*, void *, size_t), - off_t (*r_lseek)(void*, off_t, int), - void (*cleanup)(void*) ) -{ - if(mh == NULL) return MPG123_ERR; - - mpg123_close(mh); - mh->rdat.r_read_handle = r_read; - mh->rdat.r_lseek_handle = r_lseek; - mh->rdat.cleanup_handle = cleanup; - return MPG123_OK; -} - -/* Update decoding engine for - a) a new choice of decoder - b) a changed native format of the MPEG stream - ... calls are only valid after parsing some MPEG frame! */ -int decode_update(mpg123_handle *mh) -{ - long native_rate; - int b; - - if(mh->num < 0) - { - if(!(mh->p.flags & MPG123_QUIET)) error("decode_update() has been called before reading the first MPEG frame! Internal programming error."); - - mh->err = MPG123_BAD_DECODER_SETUP; - return MPG123_ERR; - } - - native_rate = frame_freq(mh); - - b = frame_output_format(mh); /* Select the new output format based on given constraints. */ - if(b < 0) return MPG123_ERR; - - if(b == 1) mh->new_format = 1; /* Store for later... */ - - debug3("updating decoder structure with native rate %li and af.rate %li (new format: %i)", native_rate, mh->af.rate, mh->new_format); - if(mh->af.rate == native_rate) mh->down_sample = 0; - else if(mh->af.rate == native_rate>>1) mh->down_sample = 1; - else if(mh->af.rate == native_rate>>2) mh->down_sample = 2; - else mh->down_sample = 3; /* flexible (fixed) rate */ - switch(mh->down_sample) - { - case 0: - case 1: - case 2: - mh->down_sample_sblimit = SBLIMIT>>(mh->down_sample); - /* With downsampling I get less samples per frame */ - mh->outblock = samples_to_storage(mh, (spf(mh)>>mh->down_sample)); - break; -#ifndef NO_NTOM - case 3: - { - if(synth_ntom_set_step(mh) != 0) return -1; - if(frame_freq(mh) > mh->af.rate) - { - mh->down_sample_sblimit = SBLIMIT * mh->af.rate; - mh->down_sample_sblimit /= frame_freq(mh); - } - else mh->down_sample_sblimit = SBLIMIT; - mh->outblock = samples_to_storage(mh, - ( ( NTOM_MUL-1+spf(mh) - * (((size_t)NTOM_MUL*mh->af.rate)/frame_freq(mh)) - )/NTOM_MUL )); - } - break; -#endif - } - - if(!(mh->p.flags & MPG123_FORCE_MONO)) - { - if(mh->af.channels == 1) mh->single = SINGLE_MIX; - else mh->single = SINGLE_STEREO; - } - else mh->single = (mh->p.flags & MPG123_FORCE_MONO)-1; - if(set_synth_functions(mh) != 0) return -1;; - - /* The needed size of output buffer may have changed. */ - if(frame_outbuffer(mh) != MPG123_OK) return -1; - - do_rva(mh); - debug3("done updating decoder structure with native rate %li and af.rate %li and down_sample %i", frame_freq(mh), mh->af.rate, mh->down_sample); - - return 0; -} - -size_t attribute_align_arg mpg123_safe_buffer(void) -{ - /* real is the largest possible output (it's 32bit float, 32bit int or 64bit double). */ - return sizeof(real)*2*1152*NTOM_MAX; -} - -size_t attribute_align_arg mpg123_outblock(mpg123_handle *mh) -{ - /* Try to be helpful and never return zero output block size. */ - if(mh != NULL && mh->outblock > 0) return mh->outblock; - else return mpg123_safe_buffer(); -} - -/* Read in the next frame we actually want for decoding. - This includes skipping/ignoring frames, in additon to skipping junk in the parser. */ -static int get_next_frame(mpg123_handle *mh) -{ - /* We have some decoder ready, if the desired decoder has changed, - it is OK to use the old one for ignoring frames and activating - the new one for real (decode_update()) after getting the frame. */ - int change = mh->decoder_change; - do - { - int b; - /* Decode & discard some frame(s) before beginning. */ - if(mh->to_ignore && mh->num < mh->firstframe && mh->num >= mh->ignoreframe) - { - debug1("ignoring frame %li", (long)mh->num); - /* Decoder structure must be current! decode_update has been called before... */ - (mh->do_layer)(mh); mh->buffer.fill = 0; -#ifndef NO_NTOM - /* The ignored decoding may have failed. Make sure ntom stays consistent. */ - if(mh->down_sample == 3) ntom_set_ntom(mh, mh->num+1); -#endif - mh->to_ignore = mh->to_decode = FALSE; - } - /* Read new frame data; possibly breaking out here for MPG123_NEED_MORE. */ - debug("read frame"); - mh->to_decode = FALSE; - b = read_frame(mh); /* That sets to_decode only if a full frame was read. */ - debug4("read of frame %li returned %i (to_decode=%i) at sample %li", (long)mh->num, b, mh->to_decode, (long)mpg123_tell(mh)); - if(b == MPG123_NEED_MORE) return MPG123_NEED_MORE; /* need another call with data */ - else if(b <= 0) - { - /* More sophisticated error control? */ - if(b==0 || (mh->rdat.filelen >= 0 && mh->rdat.filepos == mh->rdat.filelen)) - { /* We simply reached the end. */ - mh->track_frames = mh->num + 1; - debug("What about updating/checking gapless sample count here?"); - return MPG123_DONE; - } - else return MPG123_ERR; /* Some real error. */ - } - /* Now, there should be new data to decode ... and also possibly new stream properties */ - if(mh->header_change > 1) - { - debug("big header change"); - change = 1; - } - /* Now some accounting: Look at the numbers and decide if we want this frame. */ - ++mh->playnum; - /* Plain skipping without decoding, only when frame is not ignored on next cycle. */ - if(mh->num < mh->firstframe || (mh->p.doublespeed && (mh->playnum % mh->p.doublespeed))) - { - if(!(mh->to_ignore && mh->num < mh->firstframe && mh->num >= mh->ignoreframe)) - { - frame_skip(mh); - /* Should one fix NtoM here or not? - It is not work the trouble for doublespeed, but what with leading frames? */ - } - } - /* Or, we are finally done and have a new frame. */ - else break; - } while(1); - - /* If we reach this point, we got a new frame ready to be decoded. - All other situations resulted in returns from the loop. */ - if(change) - { - if(decode_update(mh) < 0) /* dito... */ - return MPG123_ERR; - -debug1("new format: %i", mh->new_format); - - mh->decoder_change = 0; - if(mh->fresh) - { -#ifdef GAPLESS - int b=0; - /* Prepare offsets for gapless decoding. */ - debug1("preparing gapless stuff with native rate %li", frame_freq(mh)); - frame_gapless_realinit(mh); - frame_set_frameseek(mh, mh->num); -#endif - mh->fresh = 0; -#ifdef GAPLESS - /* Could this possibly happen? With a real big gapless offset... */ - if(mh->num < mh->firstframe) b = get_next_frame(mh); - if(b < 0) return b; /* Could be error, need for more, new format... */ -#endif - } - } - return MPG123_OK; -} - -/* Assumption: A buffer full of zero samples can be constructed by repetition of this byte. - Oh, and it handles some format conversion. - Only to be used by decode_the_frame() ... */ -static int zero_byte(mpg123_handle *fr) -{ -#ifndef NO_8BIT - return fr->af.encoding & MPG123_ENC_8 ? fr->conv16to8[0] : 0; -#else - return 0; /* All normal signed formats have the zero here (even in byte form -- that may be an assumption for your funny machine...). */ -#endif -} - -/* - Not part of the api. This just decodes the frame and fills missing bits with zeroes. - There can be frames that are broken and thus make do_layer() fail. -*/ -static void decode_the_frame(mpg123_handle *fr) -{ - size_t needed_bytes = samples_to_storage(fr, frame_expect_outsamples(fr)); - fr->clip += (fr->do_layer)(fr); - /*fprintf(stderr, "frame %"OFF_P": got %"SIZE_P" / %"SIZE_P"\n", fr->num,(size_p)fr->buffer.fill, (size_p)needed_bytes);*/ - /* There could be less data than promised. - Also, then debugging, we look out for coding errors that could result in _more_ data than expected. */ -#ifdef DEBUG - if(fr->buffer.fill != needed_bytes) - { -#endif - if(fr->buffer.fill < needed_bytes) - { - if(VERBOSE2) - fprintf(stderr, "Note: broken frame %li, filling up with %"SIZE_P" zeroes, from %"SIZE_P"\n", (long)fr->num, (size_p)(needed_bytes-fr->buffer.fill), (size_p)fr->buffer.fill); - - /* - One could do a loop with individual samples instead... but zero is zero - Actually, that is wrong: zero is mostly a series of null bytes, - but we have funny 8bit formats that have a different opinion on zero... - Unsigned 16 or 32 bit formats are handled later. - */ - memset( fr->buffer.data + fr->buffer.fill, zero_byte(fr), needed_bytes - fr->buffer.fill ); - - fr->buffer.fill = needed_bytes; -#ifndef NO_NTOM - /* ntom_val will be wrong when the decoding wasn't carried out completely */ - ntom_set_ntom(fr, fr->num+1); -#endif - } -#ifdef DEBUG - else - { - if(NOQUIET) - error2("I got _more_ bytes than expected (%"SIZE_P" / %"SIZE_P"), that should not be possible!", (size_p)fr->buffer.fill, (size_p)needed_bytes); - } - } -#endif - postprocess_buffer(fr); -} - -/* - Decode the current frame into the frame structure's buffer, accessible at the location stored in